blob: f853057b446ecb8191c04a1e237ab32abfb8aecd [file] [log] [blame]
Harald Weltef6543322017-07-16 07:35:10 +02001/* Data Types / Encoding / Decoding for OsmocomBB L1CTL interface */
2/* (C) 2017 by Harald Welte <laforge@gnumonks.org>, derived from l1ctl_proto.h
3 * (C) 2010 by Harald Welte + Holger Hans Peter Freyther */
4module L1CTL_Types {
5
6 import from General_Types all;
7 import from GSM_Types all;
Harald Welte9419c8a2017-07-30 04:07:05 +02008 import from GSM_RR_Types all;
Harald Weltef6543322017-07-16 07:35:10 +02009 import from Osmocom_Types all;
10
11 type enumerated L1ctlMsgType {
12 L1CTL_NONE,
13 L1CTL_FBSB_REQ,
14 L1CTL_FBSB_CONF,
15 L1CTL_DATA_IND,
16 L1CTL_RACH_REQ,
17 L1CTL_DM_EST_REQ,
18 L1CTL_DATA_REQ,
19 L1CTL_RESET_IND,
20 L1CTL_PM_REQ, /* power measurement */
21 L1CTL_PM_CONF, /* power measurement */
22 L1CTL_ECHO_REQ,
23 L1CTL_ECHO_CONF,
24 L1CTL_RACH_CONF,
25 L1CTL_RESET_REQ,
26 L1CTL_RESET_CONF,
27 L1CTL_DATA_CONF,
28 L1CTL_CCCH_MODE_REQ,
29 L1CTL_CCCH_MODE_CONF,
30 L1CTL_DM_REL_REQ,
31 L1CTL_PARAM_REQ,
32 L1CTL_DM_FREQ_REQ,
33 L1CTL_CRYPTO_REQ,
34 L1CTL_SIM_REQ,
35 L1CTL_SIM_CONF,
36 L1CTL_TCH_MODE_REQ,
37 L1CTL_TCH_MODE_CONF,
38 L1CTL_NEIGH_PM_REQ,
39 L1CTL_NEIGH_PM_IND,
40 L1CTL_TRAFFIC_REQ,
41 L1CTL_TRAFFIC_CONF,
Harald Welte00d4dac2017-07-30 00:50:32 +020042 L1CTL_TRAFFIC_IND,
43 L1CTL_TBF_CFG_REQ,
Harald Welteb3c226e2017-07-30 17:18:01 +020044 L1CTL_TBF_CFG_CONF,
45 L1CTL_DATA_TBF_REQ,
Harald Welte3a40ec72018-03-02 20:45:04 +010046 L1CTL_DATA_TBF_CONF,
47 L1CTL_DATA_ABS_REQ
Harald Weltef6543322017-07-16 07:35:10 +020048 } with { variant "FIELDLENGTH(8)" };
49
50 type enumerated L1ctlCcchMode {
51 CCCH_MODE_NONE (0),
52 CCCH_MODE_NON_COMBINED,
53 CCCH_MODE_COMBINED
54 } with { variant "FIELDLENGTH(8)" };
55
56 type enumerated L1ctlNeighMode {
57 NEIGH_MODE_NONE (0),
58 NEIGH_MODE_PM,
59 NEIGH_MODE_SB
60 } with { variant "FIELDLENGTH(8)" };
61
Harald Welte1dcc3712017-08-01 00:05:52 +020062 type enumerated L1ctlGprsCs {
63 L1CTL_CS1 (1),
64 L1CTL_CS2,
65 L1CTL_CS3,
66 L1CTL_CS4,
67 L1CTL_MCS1,
68 L1CTL_MCS2,
69 L1CTL_MCS3,
70 L1CTL_MCS4,
71 L1CTL_MCS5,
72 L1CTL_MCS6,
73 L1CTL_MCS7,
74 L1CTL_MCS8,
75 L1CTL_MCS9
76 } with { variant "FIELDLENGTH(8)" };
77
Harald Weltef6543322017-07-16 07:35:10 +020078 type enumerated L1ctlResetType {
79 L1CTL_RES_T_BOOT (0),
80 L1CTL_RES_T_FULL,
81 L1CTL_RES_T_SCHED
82 } with { variant "FIELDLENGTH(8)" };
83
84 const integer TRAFFIC_DATA_LEN := 40;
85
86 type record L1ctlHdrFlags {
87 BIT7 padding,
88 boolean f_done
89 } with { variant "" };
90
91 type record L1ctlHeader {
92 L1ctlMsgType msg_type,
93 L1ctlHdrFlags flags,
94 OCT2 padding
95 } with { variant "" };
96
Harald Welte52c713c2017-07-16 15:44:44 +020097 template L1ctlHeader t_L1ctlHeader(template L1ctlMsgType msg_type) := {
98 msg_type := msg_type,
99 flags := { padding := '0000000'B, f_done := false },
100 padding := '0000'O
101 };
102
Harald Weltef6543322017-07-16 07:35:10 +0200103 type record L1ctlDlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200104 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200105 RslLinkId link_id,
106 Arfcn arfcn,
Harald Welte5f0d5c82017-07-16 18:56:01 +0200107 uint32_t frame_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200108 GsmRxLev rx_level,
109 uint8_t snr,
110 uint8_t num_biterr,
111 uint8_t fire_crc
112 } with { variant "" };
113
114 type record L1ctlFbsbConf {
115 int16_t initial_freq_err,
116 uint8_t result,
117 uint8_t bsic
118 } with { variant "" };
119
120 type record L1ctlCcchModeConf {
121 L1ctlCcchMode ccch_mode,
122 OCT3 padding
123 } with { variant "" };
124
125 /* gsm48_chan_mode */
126 type uint8_t L1ctlTchMode;
127
128 type record L1ctlAudioMode {
129 BIT4 padding,
130 boolean tx_microphone,
131 boolean tx_traffic_req,
132 boolean rx_speaker,
133 boolean rx_traffic_ind
134 } with { variant "" };
135
Harald Welte66110f02017-07-16 21:05:18 +0200136 template L1ctlAudioMode t_L1CTL_AudioModeNone := { '0000'B, false, false, false, false };
137
Harald Weltef6543322017-07-16 07:35:10 +0200138 type record L1ctlTchModeConf {
139 L1ctlTchMode tch_mode,
140 L1ctlAudioMode audio_mode,
141 OCT2 padding
142 } with { variant "" };
143
144 type record L1ctlDataInd {
145 octetstring payload length(23)
146 } with { variant "" };
147
148 type union L1ctlDlPayload {
149 L1ctlFbsbConf fbsb_conf,
150 L1ctlCcchModeConf ccch_mode_conf,
151 L1ctlTchModeConf tch_mode_conf,
152 L1ctlDataInd data_ind,
153 L1ctlTrafficReq traffic_ind,
Harald Welte00d4dac2017-07-30 00:50:32 +0200154 L1ctlTbfCfgReq tbf_cfg_conf,
Harald Weltef6543322017-07-16 07:35:10 +0200155 octetstring other
156 } with { variant "" };
157
158 type record L1ctlDlMessage {
159 L1ctlHeader header,
160 L1ctlDlInfo dl_info optional,
161 L1ctlDlPayload payload
162 } with { variant (dl_info) "PRESENCE(header.msg_type = L1CTL_FBSB_CONF,
163 header.msg_type = L1CTL_RACH_CONF,
164 header.msg_type = L1CTL_DATA_IND,
165 header.msg_type = L1CTL_DATA_CONF,
166 header.msg_type = L1CTL_TRAFFIC_IND)"
167 variant (payload) "CROSSTAG(fbsb_conf, header.msg_type = L1CTL_FBSB_CONF;
168 ccch_mode_conf, header.msg_type = L1CTL_CCCH_MODE_CONF;
169 tch_mode_conf, header.msg_type = L1CTL_TCH_MODE_CONF;
170 data_ind, header.msg_type = L1CTL_DATA_IND;
171 traffic_ind, header.msg_type = L1CTL_TRAFFIC_IND;
Harald Welte00d4dac2017-07-30 00:50:32 +0200172 tbf_cfg_conf, header.msg_type = L1CTL_TBF_CFG_CONF;
Harald Weltef6543322017-07-16 07:35:10 +0200173 other, OTHERWISE;
174 )" };
175
176 external function enc_L1ctlDlMessage(in L1ctlDlMessage msg) return octetstring
177 with { extension "prototype(convert) encode(RAW)" };
178 external function dec_L1ctlDlMessage(in octetstring stream) return L1ctlDlMessage
179 with { extension "prototype(convert) decode(RAW)" };
180
181
182 type record L1ctlUlInfo {
Harald Welte8e4db2c2017-07-16 18:54:55 +0200183 RslChannelNr chan_nr,
Harald Weltef6543322017-07-16 07:35:10 +0200184 RslLinkId link_id,
185 OCT2 padding
186 } with { variant "" };
187
Harald Welteb3c226e2017-07-30 17:18:01 +0200188 type record L1ctlUlTbfInfo {
189 uint8_t tbf_nr,
Harald Welte1dcc3712017-08-01 00:05:52 +0200190 L1ctlGprsCs cs,
191 OCT2 padding
Harald Welteb3c226e2017-07-30 17:18:01 +0200192 } with { variant "" };
193
Harald Welte3a40ec72018-03-02 20:45:04 +0100194 type record L1ctlUlAbsInfo {
195 uint8_t tbf_nr,
196 L1ctlGprsCs cs,
197 uint8_t ts_nr,
198 OCT1 padding,
199 uint32_t fn,
200 Arfcn arfcn,
201 OCT2 padding2
202 } with { variant "" };
203
Harald Weltef6543322017-07-16 07:35:10 +0200204 type record L1ctlFbsbFlags {
205 BIT5 padding,
206 boolean sb,
207 boolean fb1,
208 boolean fb0
209 } with { variant "" };
210
Harald Welte66110f02017-07-16 21:05:18 +0200211 template L1ctlFbsbFlags t_L1CTL_FBSB_F_ALL := {
212 padding := '00000'B,
213 sb := true,
214 fb1 := true,
215 fb0 := true
216 };
217
Harald Weltef6543322017-07-16 07:35:10 +0200218 type record L1ctlFbsbReq {
219 Arfcn arfcn,
220 uint16_t timeout_tdma_frames,
221 uint16_t freq_err_thresh1,
222 uint16_t freq_err_thresh2,
223 uint8_t num_freqerr_avg,
224 L1ctlFbsbFlags flags,
225 uint8_t sync_info_idx,
226 L1ctlCcchMode ccch_mode,
227 GsmRxLev rxlev_exp
228 } with { variant "" };
229
230 type record L1ctlCcchModeReq {
231 L1ctlTchMode tch_mode,
232 L1ctlAudioMode audio_mode,
233 OCT2 padding
234 } with { variant "" };
235
236 type record L1ctlTchModeReq {
237 L1ctlTchMode tch_mode,
238 L1ctlAudioMode audio_mode,
239 OCT2 padding
240 } with { variant "" };
241
242 type record L1ctlRachReq {
243 uint8_t ra,
244 uint8_t combined,
245 uint16_t offset
246 } with { variant "" };
247
248 type record L1ctlParReq {
249 int8_t ta,
250 uint8_t tx_power,
251 OCT2 padding
252 } with { variant "" };
253
254 type record L1ctlH1 {
255 uint8_t hsn,
256 uint8_t maio,
257 uint8_t n,
258 OCT1 padding,
259 bitstring ma length(64)
260 } with { variant "" };
261
262 type record L1ctlDmEstReq {
263 GsmTsc tsc,
264 uint8_t h,
265 Arfcn arfcn optional,
266 L1ctlH1 hopping optional,
267 L1ctlTchMode tch_mode,
268 L1ctlAudioMode audio_mode
269 } with { variant (arfcn) "PRESENCE(h = 0)"
270 variant (hopping) "PRESENCE(h = 1)" };
271
272 type record L1ctlReset {
273 L1ctlResetType reset_type,
274 OCT3 padding
275 } with { variant "" };
276
277
278 type record L1ctlTrafficReq {
279 octetstring data length(TRAFFIC_DATA_LEN)
280 } with { variant "" };
281
Harald Welte00d4dac2017-07-30 00:50:32 +0200282 type record length(8) of uint8_t TfiUsfArr;
283
284 type record L1ctlTbfCfgReq {
285 uint8_t tbf_nr,
286 boolean is_uplink,
287 OCT2 padding,
288 TfiUsfArr tfi_usf
289 } with { variant (is_uplink) "FIELDLENGTH(8)" };
290
Harald Weltef6543322017-07-16 07:35:10 +0200291 type union L1ctlUlPayload {
292 L1ctlFbsbReq fbsb_req,
293 L1ctlCcchModeReq ccch_mode_req,
294 L1ctlTchModeReq tch_mode_req,
295 L1ctlRachReq rach_req,
296 L1ctlParReq par_req,
297 L1ctlDmEstReq dm_est_req,
298 L1ctlReset reset_req,
299 //L1ctlNeighPmReq neigh_pm_req,
300 L1ctlTrafficReq traffic_req,
Harald Welte00d4dac2017-07-30 00:50:32 +0200301 L1ctlTbfCfgReq tbf_cfg_req,
Harald Weltef6543322017-07-16 07:35:10 +0200302 octetstring other
303 } with { variant "" };
304
305 type record L1ctlUlMessage {
306 L1ctlHeader header,
307 L1ctlUlInfo ul_info optional,
Harald Welteb3c226e2017-07-30 17:18:01 +0200308 L1ctlUlTbfInfo ul_info_tbf optional,
Harald Welte3a40ec72018-03-02 20:45:04 +0100309 L1ctlUlAbsInfo ul_info_abs optional,
Harald Weltef6543322017-07-16 07:35:10 +0200310 L1ctlUlPayload payload
311 } with { variant (ul_info) "PRESENCE(header.msg_type = L1CTL_RACH_REQ,
312 header.msg_type = L1CTL_PARAM_REQ,
313 header.msg_type = L1CTL_CRYPTO_REQ,
314 header.msg_type = L1CTL_DATA_REQ,
315 header.msg_type = L1CTL_DM_EST_REQ,
316 header.msg_type = L1CTL_DM_FREQ_REQ,
317 header.msg_type = L1CTL_DM_REL_REQ,
318 header.msg_type = L1CTL_TRAFFIC_REQ)"
Harald Welteb3c226e2017-07-30 17:18:01 +0200319 variant (ul_info_tbf) "PRESENCE(header.msg_type = L1CTL_DATA_TBF_REQ)"
Harald Welte3a40ec72018-03-02 20:45:04 +0100320 variant (ul_info_abs) "PRESENCE(header.msg_type = L1CTL_DATA_ABS_REQ)"
Harald Weltef6543322017-07-16 07:35:10 +0200321 variant (payload) "CROSSTAG(fbsb_req, header.msg_type = L1CTL_FBSB_REQ;
322 ccch_mode_req, header.msg_type = L1CTL_CCCH_MODE_REQ;
323 tch_mode_req, header.msg_type = L1CTL_TCH_MODE_REQ;
324 rach_req, header.msg_type = L1CTL_RACH_REQ;
325 par_req, header.msg_type = L1CTL_PARAM_REQ;
326 dm_est_req, header.msg_type = L1CTL_DM_EST_REQ;
327 reset_req, header.msg_type = L1CTL_RESET_REQ;
328 traffic_req, header.msg_type = L1CTL_TRAFFIC_REQ;
Harald Welte00d4dac2017-07-30 00:50:32 +0200329 tbf_cfg_req, header.msg_type = L1CTL_TBF_CFG_REQ;
Harald Weltef6543322017-07-16 07:35:10 +0200330 other, OTHERWISE;
331 )" };
332
333 external function enc_L1ctlUlMessage(in L1ctlUlMessage msg) return octetstring
334 with { extension "prototype(convert) encode(RAW)" };
335 external function dec_L1ctlUlMessage(in octetstring stream) return L1ctlUlMessage
336 with { extension "prototype(convert) decode(RAW)" };
337
Harald Welte52c713c2017-07-16 15:44:44 +0200338 type record L1ctlUlMessageLV {
339 uint16_t len,
340 L1ctlUlMessage msg
341 } with { variant (len) "LENGTHTO(msg)" };
342
343 external function enc_L1ctlUlMessageLV(in L1ctlUlMessageLV msg) return octetstring
344 with { extension "prototype(convert) encode(RAW)" };
345 external function dec_L1ctlUlMessageLV(in octetstring stream) return L1ctlUlMessageLV
346 with { extension "prototype(convert) decode(RAW)" };
347
348 type record L1ctlDlMessageLV {
349 uint16_t len,
350 L1ctlDlMessage msg
351 } with { variant (len) "LENGTHTO(msg)" };
352
353 external function enc_L1ctlDlMessageLV(in L1ctlDlMessageLV msg) return octetstring
354 with { extension "prototype(convert) encode(RAW)" };
355 external function dec_L1ctlDlMessageLV(in octetstring stream) return L1ctlDlMessageLV
356 with { extension "prototype(convert) decode(RAW)" };
357
358
Harald Welte9e4725d2017-07-16 23:18:09 +0200359
360
361 /* for generating RESET_REQ */
362 template L1ctlUlMessage t_L1ctlResetReq(template L1ctlResetType rst_type) := {
363 header := t_L1ctlHeader(L1CTL_RESET_REQ),
364 ul_info := omit,
Harald Welteb3c226e2017-07-30 17:18:01 +0200365 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100366 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200367 payload := {
368 reset_req := {
369 reset_type := rst_type,
370 padding := '000000'O
371 }
372 }
373 };
374
375 /* for generating FBSB_REQ */
376 template L1ctlUlMessage t_L1CTL_FBSB_REQ(template Arfcn arfcn, template L1ctlFbsbFlags flags, uint8_t sync_info_idx, L1ctlCcchMode ccch_mode, GsmRxLev rxlev_exp) := {
377 header := t_L1ctlHeader(L1CTL_FBSB_REQ),
378 ul_info := omit,
Harald Welteb3c226e2017-07-30 17:18:01 +0200379 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100380 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200381 payload := {
382 fbsb_req := {
383 arfcn := arfcn,
Harald Weltea82f7e62018-02-22 18:51:33 +0100384 timeout_tdma_frames := 250, /* about 1s */
Harald Welte9e4725d2017-07-16 23:18:09 +0200385 freq_err_thresh1 := 10000,
386 freq_err_thresh2 := 800,
387 num_freqerr_avg := 3,
388 flags := flags,
389 sync_info_idx := sync_info_idx,
390 ccch_mode := ccch_mode,
391 rxlev_exp := rxlev_exp
392 }
393 }
394 };
395
396 /* for matching against incoming FBSB_CONF */
397 template L1ctlDlMessage t_L1CTL_FBSB_CONF(template uint8_t result) := {
398 header := t_L1ctlHeader(L1CTL_FBSB_CONF),
399 dl_info := ?,
400 payload := {
401 fbsb_conf := {
402 initial_freq_err := ?,
403 result := result,
404 bsic := ?
405 }
406 }
407 };
408
409 template L1ctlUlMessage t_L1CTL_RACH_REQ(uint8_t ra, uint8_t combined, uint16_t offset) := {
410 header := t_L1ctlHeader(L1CTL_RACH_REQ),
411 ul_info := {
412 chan_nr := t_RslChanNr_RACH(0),
413 link_id := ts_RslLinkID_DCCH(0),
414 padding := '0000'O
415 },
Harald Welteb3c226e2017-07-30 17:18:01 +0200416 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100417 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200418 payload := {
419 rach_req := {
420 ra := ra,
421 combined := combined,
422 offset := offset
423 }
424 }
425 }
426
427 template L1ctlUlMessage t_L1CTL_DM_EST_REQ(Arfcn arfcn, RslChannelNr chan_nr, GsmTsc tsc) := {
428 header := t_L1ctlHeader(L1CTL_DM_EST_REQ),
429 ul_info := {
430 chan_nr := chan_nr,
431 link_id := ts_RslLinkID_DCCH(0),
432 padding := '0000'O
433 },
Harald Welteb3c226e2017-07-30 17:18:01 +0200434 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100435 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200436 payload := {
437 dm_est_req := {
438 tsc := tsc,
439 h := 0,
440 arfcn := arfcn,
441 hopping := omit,
442 tch_mode := 0,
443 audio_mode := t_L1CTL_AudioModeNone
444 }
445 }
446 }
447
448 template L1ctlUlMessage t_L1CTL_DM_REL_REQ(RslChannelNr chan_nr) := {
Harald Welte143edbd2017-07-17 20:55:42 +0200449 header := t_L1ctlHeader(L1CTL_DM_REL_REQ),
Harald Welte9e4725d2017-07-16 23:18:09 +0200450 ul_info := {
451 chan_nr := chan_nr,
452 link_id := ts_RslLinkID_DCCH(0),
453 padding := '0000'O
454 },
Harald Welteb3c226e2017-07-30 17:18:01 +0200455 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100456 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200457 payload := {
458 other := ''O
459 }
460 }
461
462 template L1ctlUlMessage t_L1CTL_DATA_REQ(template RslChannelNr chan_nr, template RslLinkId link_id, octetstring l2_data) := {
463 header := t_L1ctlHeader(L1CTL_DATA_REQ),
464 ul_info := {
465 chan_nr := chan_nr,
466 link_id := link_id,
467 padding := '0000'O
468 },
Harald Welteb3c226e2017-07-30 17:18:01 +0200469 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100470 ul_info_abs := omit,
Harald Welte9e4725d2017-07-16 23:18:09 +0200471 payload := {
472 other := l2_data
473 }
474 }
475
Harald Welte00d4dac2017-07-30 00:50:32 +0200476 template L1ctlUlMessage t_L1CTL_TBF_CFG_REQ(boolean is_uplink, TfiUsfArr tfi_usf) := {
477 header := t_L1ctlHeader(L1CTL_TBF_CFG_REQ),
478 ul_info := omit,
Harald Welteb3c226e2017-07-30 17:18:01 +0200479 ul_info_tbf := omit,
Harald Welte3a40ec72018-03-02 20:45:04 +0100480 ul_info_abs := omit,
Harald Welte00d4dac2017-07-30 00:50:32 +0200481 payload := {
482 tbf_cfg_req := {
483 tbf_nr := 0,
484 is_uplink := is_uplink,
485 padding := '0000'O,
486 tfi_usf := tfi_usf
487 }
488 }
489 };
490
491 template L1ctlDlMessage t_L1CTL_TBF_CFG_CONF(template boolean is_uplink) := {
492 header := t_L1ctlHeader(L1CTL_TBF_CFG_CONF),
493 dl_info := omit,
494 payload := {
495 tbf_cfg_conf := {
496 tbf_nr := 0,
497 is_uplink := is_uplink,
498 padding := ?,
499 tfi_usf := ?
500 }
501 }
502 };
503
Harald Welte1dcc3712017-08-01 00:05:52 +0200504 template L1ctlUlMessage t_L1CTL_DATA_TBF_REQ(octetstring l2_data, L1ctlGprsCs cs := L1CTL_CS1, uint8_t tbf_nr := 0) := {
Harald Welteb3c226e2017-07-30 17:18:01 +0200505 header := t_L1ctlHeader(L1CTL_DATA_TBF_REQ),
506 ul_info := omit,
507 ul_info_tbf := {
508 tbf_nr := tbf_nr,
Harald Welte1dcc3712017-08-01 00:05:52 +0200509 cs := cs,
510 padding := '0000'O
Harald Welteb3c226e2017-07-30 17:18:01 +0200511 },
Harald Welte3a40ec72018-03-02 20:45:04 +0100512 ul_info_abs := omit,
Harald Welteb3c226e2017-07-30 17:18:01 +0200513 payload := {
514 other := l2_data
515 }
516 }
517
Harald Welte3a40ec72018-03-02 20:45:04 +0100518 template L1ctlUlMessage t_L1CTL_DATA_ABS_REQ(octetstring l2_data, Arfcn arfcn,
519 uint8_t ts, GsmFrameNumber fn,
520 L1ctlGprsCs cs := L1CTL_CS1,
521 uint8_t tbf_nr := 0) := {
522 header := t_L1ctlHeader(L1CTL_DATA_ABS_REQ),
523 ul_info := omit,
524 ul_info_tbf := omit,
525 ul_info_abs := {
526 tbf_nr := tbf_nr,
527 cs := cs,
528 ts_nr := ts,
529 padding := '00'O,
530 fn := fn,
531 arfcn := arfcn,
532 padding2 := '0000'O
533 },
534 payload := {
535 other := l2_data
536 }
537 }
538
539
Harald Welte9e4725d2017-07-16 23:18:09 +0200540 /* for matching against incoming RACH_CONF */
541 template L1ctlDlMessage t_L1CTL_RACH_CONF := {
542 header := t_L1ctlHeader(L1CTL_RACH_CONF),
543 dl_info := ?,
544 payload := ?
545 };
546
Harald Weltece6dc442018-02-21 22:00:21 +0100547 /* for matching against incoming DATA_IND */
548 template L1ctlDlMessage t_L1CTL_DATA_IND(template RslChannelNr chan_nr,
Harald Welte68e495b2018-02-25 00:05:57 +0100549 template RslLinkId link_id := ?,
550 template octetstring l2_data := ?) := {
Harald Welte9e4725d2017-07-16 23:18:09 +0200551 header := t_L1ctlHeader(L1CTL_DATA_IND),
552 dl_info := {
553 chan_nr := chan_nr,
Harald Weltece6dc442018-02-21 22:00:21 +0100554 link_id := link_id,
Harald Welte9e4725d2017-07-16 23:18:09 +0200555 arfcn := ?,
556 frame_nr := ?,
557 rx_level := ?,
558 snr := ?,
559 num_biterr := ?,
560 fire_crc := ?
561 },
562 payload := {
Harald Welte68e495b2018-02-25 00:05:57 +0100563 data_ind := {
564 payload := l2_data
565 }
Harald Welte9e4725d2017-07-16 23:18:09 +0200566 }
567 };
568
Harald Welte88849c62017-07-30 17:19:41 +0200569 template ImmediateAssignment t_IMM_ASS(uint8_t ra, GsmFrameNumber fn) := {
570 ded_or_tbf := ?,
571 page_mode := ?,
572 chan_desc := *,
573 pkt_chan_desc := *,
574 req_ref := f_compute_ReqRef(ra, fn),
575 timing_advance := ?,
576 mobile_allocation := ?,
577 rest_octets:= ?
578 };
579
580 template GsmRrMessage t_RR_IMM_ASS(uint8_t ra, GsmFrameNumber fn) := {
Harald Welte9e4725d2017-07-16 23:18:09 +0200581 header := t_RrHeader(IMMEDIATE_ASSIGNMENT, ?),
582 payload := {
Harald Welte88849c62017-07-30 17:19:41 +0200583 imm_ass := t_IMM_ASS(ra, fn)
Harald Welte9e4725d2017-07-16 23:18:09 +0200584 }
585 };
586
Harald Welte68e495b2018-02-25 00:05:57 +0100587 const octetstring c_DummyUI := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O;
588
Harald Weltef6543322017-07-16 07:35:10 +0200589} with { encode "RAW" };