diff options
Diffstat (limited to 'library/GSM_RestOctets.ttcn')
-rw-r--r-- | library/GSM_RestOctets.ttcn | 613 |
1 files changed, 613 insertions, 0 deletions
diff --git a/library/GSM_RestOctets.ttcn b/library/GSM_RestOctets.ttcn index d47e510f..eff95469 100644 --- a/library/GSM_RestOctets.ttcn +++ b/library/GSM_RestOctets.ttcn @@ -15,6 +15,408 @@ module GSM_RestOctets { import from General_Types all; import from Osmocom_Types all; +import from RLCMAC_CSN1_Types all; +import from GSM_Types all; + +/* 10.5.2.16 IA (Immediate Assignment) Rest Octets */ +type record IaRestOctets { + BIT2 presence, + IaRestOctLL ll optional, + IaRestOctLH lh optional, + IaRestOctHL hl optional, + IaRestOctHH hh optional +} with { + variant (presence) "CSN.1 L/H" + variant (ll) "PRESENCE(presence = '00'B)" + variant (lh) "PRESENCE(presence = '01'B)" + variant (hl) "PRESENCE(presence = '10'B)" + variant (hh) "PRESENCE(presence = '11'B)" + + /* The TITAN's RAW encoder generates an octet-aligned octetstring, + * so we should make sure that unused bits contain proper padding. */ + variant "PADDING(yes), PADDING_PATTERN('00101011'B)" +}; + +type record IaRestOctLL { + BIT1 compressed_irat_ho_info_ind +} with { + variant (compressed_irat_ho_info_ind) "CSN.1 L/H" +}; + +type record IaRestOctLH { + BIT2 presence, + EgprsUlAss egprs_ul optional, + octetstring multiblock_dl_ass optional /* TODO */ +} with { + variant (egprs_ul) "PRESENCE(presence = '00'B)" + variant (multiblock_dl_ass) "PRESENCE(presence = '01'B)" +}; + +/* EGPRS Packet Uplink Assignment */ +type record EgprsUlAss { + BIT5 ext_ra, + BIT1 ats_present, + AccessTechnologiesRequestRepetition ats optional, + BIT1 presence, + EgprsUlAssignDyn dynamic optional, + EgprsUlAssignMultiblock multiblock optional +} with { + variant (ats) "PRESENCE(ats_present = '1'B)" + variant (dynamic) "PRESENCE(presence = '1'B)" + variant (multiblock) "PRESENCE(presence = '0'B)" + /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ + variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first +}; + +type record EgprsUlAssignDyn { + uint5_t tfi_assignment, + BIT1 polling, + BIT1 spare ('0'B), + uint3_t usf, + BIT1 usf_granularity, + BIT1 p0_present, + uint4_t p0 optional, + BIT1 pr_mode optional, + EgprsChCodingCommand egprs_ch_coding_cmd, + BIT1 tlli_block_chan_coding, + BIT1 bep_period2_present, + BIT4 bep_period2 optional, + BIT1 resegment, + EgprsWindowSize egprs_window_size, + BIT1 alpha_present, + uint4_t alpha optional, + uint5_t gamma, + BIT1 ta_index_present, + uint4_t ta_index optional, + BIT1 tbf_starting_time_present, + TbfStartingTime tbf_starting_time optional + /* TODO: Additions for Rel-7 */ +} with { + variant (p0) "PRESENCE(p0_present = '1'B)" + variant (pr_mode) "PRESENCE(p0_present = '1'B)" + variant (bep_period2) "PRESENCE(bep_period2_present = '1'B)" + variant (alpha) "PRESENCE(alpha_present = '1'B)" + variant (ta_index) "PRESENCE(ta_index_present = '1'B)" + variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" +}; + +type record EgprsUlAssignMultiblock { + BIT1 alpha_present, + uint4_t alpha optional, + uint5_t gamma, + TbfStartingTime tbf_starting_time, + BIT2 nr_radio_blocks_allocated, + BIT1 p0_present, + uint4_t p0 optional, + BIT1 spare ('0'B) optional, + BIT1 pr_mode optional + /* TDO: Additions for Rel-6 */ +} with { + variant (alpha) "PRESENCE(alpha_present = '1'B)" + variant (p0) "PRESENCE(p0_present = '1'B)" + variant (spare) "PRESENCE(p0_present = '1'B)" + variant (pr_mode) "PRESENCE(p0_present = '1'B)" +}; + +type record IaRestOctHL { + uint6_t freq_par_len, + BIT2 padding ('00'B) optional, + uint6_t maio optional, + octetstring mobile_allocation optional +} with { + variant (freq_par_len) "LENGTHTO(mobile_allocation,maio,padding)" +/* + variant (padding) "PRESENCE(freq_par_len != 0)" + variant (maio) "PRESENCE(freq_par_len != 0)" + variant (mobile_allocation) "PRESENCE(freq_par_len != 0)" +*/ +}; + +type record IaRestOctHH { + /* Packet Assignment discriminator: + * Packet Uplink / Downlink Assignment (0) + * Second Part Packet Assignment (1) */ + BIT1 pa_disc, + PacketAssignUnion pa +} with { + variant (pa) "CROSSTAG(spa, pa_disc = '1'B; uldl, pa_disc = '0'B)" +}; + +type union PacketAssignUnion { + SecondPartAssign spa, + PacketUlDlAssign uldl +}; + +type record SecondPartAssign { + BIT1 r99, /* L / H */ + BIT1 presence optional, + BIT5 ext_ra optional +} with { + variant (r99) "CSN.1 L/H" + variant (presence) "PRESENCE(r99 = '1'B)" /* H */ + variant (ext_ra) "PRESENCE(presence = '1'B)" + /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ + variant (ext_ra) "BYTEORDER(last)" // FIXME: should be first +}; + +type record PacketUlDlAssign { + BIT1 ass_disc, + PacketUlDlAssignUnion ass +} with { + variant (ass) "CROSSTAG(dl, ass_disc = '1'B; ul, ass_disc = '0'B)" +}; + +type union PacketUlDlAssignUnion { + PacketUlAssign ul, + PacketDlAssign dl +}; + +type record PacketUlAssign { + BIT1 presence, + PacketUlAssignDyn dynamic optional, + PacketUlAssignSgl single optional + /* TODO: Estended RA, PFI */ +} with { + variant (dynamic) "PRESENCE(presence = '1'B)" + variant (single) "PRESENCE(presence = '0'B)" +}; + +type record PacketUlAssignDyn { + uint5_t tfi_assignment, + BIT1 polling, + BIT1 spare ('0'B), + uint3_t usf, + BIT1 usf_granularity, + BIT1 p0_present, + uint4_t p0 optional, + BIT1 pr_mode optional, + ChCodingCommand ch_coding_cmd, + BIT1 tlli_block_chan_coding, + BIT1 alpha_present, + uint4_t alpha optional, + uint5_t gamma, + BIT1 ta_index_present, + uint4_t ta_index optional, + BIT1 tbf_starting_time_present, + TbfStartingTime tbf_starting_time optional +} with { + variant (p0) "PRESENCE(p0_present = '1'B)" + variant (pr_mode) "PRESENCE(p0_present = '1'B)" + variant (alpha) "PRESENCE(alpha_present = '1'B)" + variant (ta_index) "PRESENCE(ta_index_present = '1'B)" + variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" +}; + +type record PacketUlAssignSgl { + BIT1 alpha_present, + uint4_t alpha optional, + uint5_t gamma, + BIT2 padding ('01'B), + TbfStartingTime tbf_starting_time + /* TODO: P0 / PR_MODE */ +} with { + variant (alpha) "PRESENCE(alpha_present = '1'B)" +}; + +type record PacketDlAssign { + GprsTlli tlli, + BIT1 group1_present, + PacketDlAssG1 group1 optional, + BIT1 ta_index_present, + uint4_t ta_index optional, + BIT1 tbf_starting_time_present, + TbfStartingTime tbf_starting_time optional, + BIT1 p0_present, + uint4_t p0 optional, + BIT1 pr_mode optional + /* TODO: EGPRS window size, etc. */ +} with { + variant (group1) "PRESENCE(group1_present = '1'B)" + variant (ta_index) "PRESENCE(ta_index_present = '1'B)" + variant (tbf_starting_time) "PRESENCE(tbf_starting_time_present = '1'B)" + variant (p0) "PRESENCE(p0_present = '1'B)" + variant (pr_mode) "PRESENCE(p0_present = '1'B)" +}; + +type record PacketDlAssG1 { + uint5_t tfi_assignment, + BIT1 rlc_mode, + BIT1 alpha_present, + uint4_t alpha optional, + uint5_t gamma, + BIT1 polling, + BIT1 ta_valid +} with { variant "" }; + +type record TbfStartingTime { + uint5_t t1, + uint6_t t3, + uint5_t t2 +}; + +/* 10.5.2.17 IAR (Immediate Assignment Reject) Rest Octets */ +type record IARRestOctets { + ExtRAList ext_ra_list, + BIT1 rel13_ind, // L/H + uint3_t rcc optional + /* Addition in Rel-15: PEO IMM Cell Group Details struct */ +} with { + variant (rel13_ind) "CSN.1 L/H" + variant (rcc) "PRESENCE(rel13_ind = '1'B)" + + /* The TITAN's RAW encoder generates an octet-aligned octetstring, + * so we should make sure that unused bits contain proper padding. */ + variant "PADDING(yes), PADDING_PATTERN('00101011'B)" +}; + +/* Optional extended RA: 0 | 1 < Extended RA 1 : bit (5) > */ +type record length(4) of ExtRAOpt ExtRAList; +type record ExtRAOpt { + BIT1 presence, // L/H + BIT5 ext_ra optional +} with { + variant (presence) "CSN.1 L/H" + variant (ext_ra) "PRESENCE(presence = '1'B)" + /* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=562488 */ + variant (ext_ra) "BYTEORDER(last)" +}; + +template PacketDlAssign tr_PacketDlAssign(template GprsTlli tlli) := { + tlli := tlli, + group1_present := ?, + group1 := *, + ta_index_present := ?, + ta_index := *, + tbf_starting_time_present := ?, + tbf_starting_time := *, + p0_present := ?, + p0 := *, + pr_mode := * +}; + +template IaRestOctets tr_IaRestOctets_DLAss(template PacketDlAssign dl_ass) := { + presence := '11'B, /* HH */ + ll := omit, lh := omit, hl := omit, + hh := { + pa_disc := '0'B, /* Packet Assignment (0) */ + pa := { + uldl := { + ass_disc := '1'B, /* Downlink Assignment (1) */ + ass := { dl := dl_ass } + } + } + } +}; + +template PacketUlAssign tr_PacketUlDynAssign(template uint5_t tfi := ?, + template BIT1 polling := ?, + template uint3_t usf := ?, + template BIT1 usf_granularity := ?, + template ChCodingCommand cs := ?) := { + presence := '1'B, /* Dynamic Block Allocation */ + dynamic := { + tfi_assignment := tfi, + polling := polling, + spare := '0'B, /* Dynamic Block Allocation (mandatory after Rel-4) */ + usf := usf, + usf_granularity := usf_granularity, + p0_present := ?, + p0 := *, + pr_mode := *, + ch_coding_cmd := cs, + tlli_block_chan_coding := ?, + alpha_present := ?, + alpha := *, + gamma := ?, + /* TODO: add to parameters */ + ta_index_present := ?, + ta_index := *, + tbf_starting_time_present := ?, + tbf_starting_time := * + }, + single := omit +}; + +template PacketUlAssign tr_PacketUlSglAssign := { + presence := '0'B, /* Single Block Allocation */ + dynamic := omit, + single := { + alpha_present := ?, + alpha := *, + gamma := ?, + padding := '01'B, + tbf_starting_time := ? + } +}; + +template IaRestOctets tr_IaRestOctets_ULAss(template PacketUlAssign ul_ass) := { + presence := '11'B, /* HH */ + ll := omit, lh := omit, hl := omit, + hh := { + pa_disc := '0'B, /* Packet Assignment (0) */ + pa := { + uldl := { + ass_disc := '0'B, /* Uplink Assignment (0) */ + ass := { ul := ul_ass } + } + } + } +}; + +template EgprsUlAss tr_EgprsUlAssDynamic(template (present) BIT5 ext_ra := ?, + template EgprsUlAssignDyn dyn_ass := ?) := { + ext_ra := ext_ra, + ats_present := ?, + ats := *, + presence := '1'B, + dynamic := dyn_ass, + multiblock := omit +}; +template EgprsUlAss tr_EgprsUlAssMultiblock(template (present) BIT5 ext_ra := ?, + template EgprsUlAssignMultiblock mb_ass := ?) := { + ext_ra := ext_ra, + ats_present := ?, + ats := *, + presence := '0'B, + dynamic := omit, + multiblock := mb_ass +}; + +template IaRestOctets tr_IaRestOctets_EGPRSULAss(template EgprsUlAss ul_ass) := { + presence := '01'B, /* LH */ + ll := omit, + lh := { + presence := '00'B, + egprs_ul := ul_ass, + multiblock_dl_ass := omit + }, + hl := omit, + hh := omit +}; + +template IARRestOctets tr_IARRestOctets(template ExtRAList ext_ra_list := ?, + template uint3_t rcc := ?) := { + ext_ra_list := ext_ra_list, + rel13_ind := ?, + rcc := rcc ifpresent +}; + +template ExtRAOpt tr_ExtRAOpt(template BIT5 ext_ra := ?) := { + presence := '1'B, // L/H + ext_ra := ext_ra +}; + + +external function enc_IaRestOctets(in IaRestOctets ro) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_IaRestOctets(in octetstring stream) return IaRestOctets + with { extension "prototype(convert) decode(RAW)" }; + +external function enc_IARRestOctets(in IARRestOctets ro) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_IARRestOctets(in octetstring stream) return IARRestOctets + with { extension "prototype(convert) decode(RAW)" }; + /* 10.5.2.33b SI 2quater Rest Octets */ type record SI2quaterRestOctets { @@ -692,6 +1094,83 @@ type record SI4RestOctets { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" }; +/* 10.5.2.35a SI 6 Rest Octets */ +type record SI6RestOctets { + PchAndNchInfoOpt pch_nch_info, + VbsVgcsOptionsOpt vbs_vgcs_options, + BIT1 dtm_support, // L/H + uint8_t rac optional, + uint3_t max_lapdm optional, + BIT1 band_ind // L/H (DCS/PCS) + /* TODO: add more fields */ +} with { + variant (dtm_support) "CSN.1 L/H" + variant (rac) "PRESENCE(dtm_support = '1'B)" + variant (max_lapdm) "PRESENCE(dtm_support = '1'B)" + variant (band_ind) "CSN.1 L/H" + + /* The TITAN's RAW encoder generates an octet-aligned octetstring, + * so we should make sure that unused bits contain proper padding. */ + variant "PADDING(yes), PADDING_PATTERN('00101011'B)" +}; + +/* Optional PCH and NCH info: L | H < PCH and NCH info > */ +type record PchAndNchInfoOpt { + BIT1 presence, // L/H + PchAndNchInfo info optional +} with { + variant (presence) "CSN.1 L/H" + variant (info) "PRESENCE(presence = '1'B)" +}; + +/* PCH and NCH info */ +type record PchAndNchInfo { + BIT1 pag_chan_restruct, + uint2_t nln_sacch, + BIT1 call_prio_presence, + uint3_t call_prio optional, + BIT1 nln_status_sacch +} with { + variant (call_prio) "PRESENCE(call_prio_presence = '1'B)" +}; + +/* Optional VBS/VGCS options: L | H < VBS/VGCS options > */ +type record VbsVgcsOptionsOpt { + BIT1 presence, // L/H + BIT2 options optional +} with { + variant (presence) "CSN.1 L/H" + variant (options) "PRESENCE(presence = '1'B)" +}; + +/* 10.5.2.37b SI 13 Rest Octets (O & S) */ +type record SI13RestOctets { + BIT1 presence, // L/H + uint3_t bcch_change_mark, + BIT4 si_change_field, + BIT1 presence2, + BIT2 si13_change_mark optional, + GprsMobileAllocation gprs_ma optional, + BIT1 zero ('0'B), /* PBCCH not present in cell */ + uint8_t rac, + BIT1 spgc_ccch_sup, + BIT3 priority_access_thr, + BIT2 network_control_order, + GprsCellOptions gprs_cell_opts, + GprsPowerControlParameters gprs_pwr_ctrl_params + /* TODO: Additions in release 99 */ +} with { + + variant (presence) "CSN.1 L/H" + /* TODO: for all fields after presencte: variant (<field>) "PRESENCE(presence = '1'B)" */ + variant (si13_change_mark) "PRESENCE(presence2 = '1'B)" + variant (gprs_ma) "PRESENCE(presence2 = '1'B)" + + /* The TITAN's RAW encoder generates an octet-aligned octetstring, + * so we should make sure that unused bits contain proper padding. */ + variant "PADDING(yes), PADDING_PATTERN('00101011'B)" +}; + /* Selection Parameters */ type record SelectionParams { boolean cbq, @@ -762,6 +1241,125 @@ type record SI21IndicatorOpt { }; +/* 10.5.2.44 SI10 rest octets (ASCI) */ +type record SI10RestOctets { + BIT1 ba_ind, + BIT1 neigh_info_presence, // L/H + SI10NeighInfo neigh_info optional +} with { + variant (neigh_info_presence) "CSN.1 L/H" + variant (neigh_info) "PRESENCE(neigh_info_presence = '1'B)" + + /* The TITAN's RAW encoder generates an octet-aligned octetstring, + * so we should make sure that unused bits contain proper padding. */ + variant "PADDING(yes), PADDING_PATTERN('00101011'B)" +}; + +private type record SI10NeighInfo { + uint5_t first_freq, + SI10CellInfo cell_info, + SI10InfoFieldList info_field optional, + BIT1 info_field_term ('0'B) // L/H +} with { + variant (info_field_term) "CSN.1 L/H" +}; + +private type record SI10CellInfo { + uint6_t bsic, + BIT1 cell_params_presence, // L/H + SI10CellParams cell_params optional +} with { + variant (cell_params_presence) "CSN.1 L/H" + variant (cell_params) "PRESENCE(cell_params_presence = '1'B)" +}; + +private type record SI10CellParams { + BIT1 cell_barred, // L/H + SI10FurtherCellInfo further_cell_info optional +} with { + variant (cell_barred) "CSN.1 L/H" + variant (further_cell_info) "PRESENCE(cell_barred = '0'B)" +}; + +private type record SI10FurtherCellInfo { + BIT1 la_different, // L/H + uint3_t cell_resel_hyst optional, + uint5_t ms_txpwr_max_cch, + uint6_t rxlev_access_min, + uint6_t cell_resel_offset, + uint3_t temp_offset, + uint5_t penalty_time +} with { + variant (la_different) "CSN.1 L/H" + variant (cell_resel_hyst) "PRESENCE(la_different = '1'B)" +}; + +private type record of SI10InfoField SI10InfoFieldList; +private type record SI10InfoField { + BIT1 item_ind ('1'B), + SI10NextFreqList next_freq optional, + BIT1 next_freq_term ('0'B), // L/H + SI10DiffCellInfo diff_cell_info +} with { + variant (item_ind) "CSN.1 L/H" + variant "PRESENCE(item_ind = '1'B)" + variant (next_freq_term) "CSN.1 L/H" +}; + +private type record of SI10NextFreq SI10NextFreqList; +private type BIT1 SI10NextFreq with { variant "CSN.1 L/H" }; + +private type record SI10DiffCellInfo { + BIT1 bcc_or_bsic, // L/H + uint3_t bcc optional, + uint6_t bsic optional, + BIT1 diff_cell_params_presence, // L/H + SI10DiffCellParams diff_cell_params optional +} with { + variant (bcc_or_bsic) "CSN.1 L/H" + variant (bcc) "PRESENCE(bcc_or_bsic = '1'B)" + variant (bsic) "PRESENCE(bcc_or_bsic = '0'B)" + variant (diff_cell_params_presence) "CSN.1 L/H" + variant (diff_cell_params) "PRESENCE(diff_cell_params_presence = '1'B)" +}; + +private type record SI10DiffCellParams { + BIT1 cell_barred, // L/H + SI10FurtherDiffCellInfo further_diff_cell_info optional +} with { + variant (cell_barred) "CSN.1 L/H" + variant (further_diff_cell_info) "PRESENCE(cell_barred = '0'B)" +}; + +private type record SI10FurtherDiffCellInfo { + BIT1 la_different, // L/H + uint3_t cell_resel_hyst optional, + BIT1 ms_txpwr_max_cch_presence, // L/H + uint5_t ms_txpwr_max_cch optional, + BIT1 rxlev_access_min_presence, // L/H + uint6_t rxlev_access_min optional, + BIT1 cell_resel_offset_presence, // L/H + uint6_t cell_resel_offset optional, + BIT1 temp_offset_presence, // L/H + uint3_t temp_offset optional, + BIT1 penalty_time_presence, // L/H + uint5_t penalty_time optional +} with { + variant (la_different) "CSN.1 L/H" + variant (cell_resel_hyst) "PRESENCE(la_different = '1'B)" + variant (ms_txpwr_max_cch_presence) "CSN.1 L/H" + variant (ms_txpwr_max_cch) "PRESENCE(ms_txpwr_max_cch_presence = '1'B)" + variant (rxlev_access_min_presence) "CSN.1 L/H" + variant (rxlev_access_min) "PRESENCE(rxlev_access_min_presence = '1'B)" + variant (cell_resel_offset_presence) "CSN.1 L/H" + variant (cell_resel_offset) "PRESENCE(cell_resel_offset_presence = '1'B)" + variant (temp_offset_presence) "CSN.1 L/H" + variant (temp_offset) "PRESENCE(temp_offset_presence = '1'B)" + variant (penalty_time_presence) "CSN.1 L/H" + variant (penalty_time) "PRESENCE(penalty_time_presence = '1'B)" +}; + + external function enc_SI2quaterRestOctets(in SI2quaterRestOctets ro) return octetstring with { extension "prototype(convert) encode(RAW)" }; external function dec_SI2quaterRestOctets(in octetstring stream) return SI2quaterRestOctets @@ -777,6 +1375,21 @@ external function enc_SI4RestOctets(in SI4RestOctets ro) return octetstring external function dec_SI4RestOctets(in octetstring stream) return SI4RestOctets with { extension "prototype(convert) decode(RAW)" }; +external function enc_SI6RestOctets(in SI4RestOctets ro) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_SI6RestOctets(in octetstring stream) return SI6RestOctets + with { extension "prototype(convert) decode(RAW)" }; + +external function enc_SI13RestOctets(in SI13RestOctets ro) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_SI13RestOctets(in octetstring stream) return SI13RestOctets + with { extension "prototype(convert) decode(RAW)" }; + +external function enc_SI10RestOctets(in SI10RestOctets ro) return octetstring + with { extension "prototype(convert) encode(RAW)" }; +external function dec_SI10RestOctets(in octetstring stream) return SI10RestOctets + with { extension "prototype(convert) decode(RAW)" }; + /* Basic templates to be extended in place */ template (value) SI3RestOctets ts_SI3RestOctets := { |