From 3b8bdd63580a10b74c7556bd8fb6e2629e6b5734 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 19 Jul 2017 19:57:26 +0200 Subject: Introduce 'library' directory for modules shared by multiple test cases --- library/GSMTAP_PortType.ttcn | 76 +++++ library/GSMTAP_Types.ttcn | 77 +++++ library/GSM_SystemInformation.ttcn | 209 +++++++++++++ library/GSM_Types.ttcn | 587 ++++++++++++++++++++++++++++++++++++ library/General_Types.ttcn | 321 ++++++++++++++++++++ library/IPL4_GSMTAP_CtrlFunct.ttcn | 44 +++ library/IPL4_GSMTAP_CtrlFunctDef.cc | 56 ++++ library/Osmocom_Types.ttcn | 29 ++ 8 files changed, 1399 insertions(+) create mode 100644 library/GSMTAP_PortType.ttcn create mode 100644 library/GSMTAP_Types.ttcn create mode 100644 library/GSM_SystemInformation.ttcn create mode 100644 library/GSM_Types.ttcn create mode 100644 library/General_Types.ttcn create mode 100644 library/IPL4_GSMTAP_CtrlFunct.ttcn create mode 100644 library/IPL4_GSMTAP_CtrlFunctDef.cc create mode 100644 library/Osmocom_Types.ttcn (limited to 'library') diff --git a/library/GSMTAP_PortType.ttcn b/library/GSMTAP_PortType.ttcn new file mode 100644 index 00000000..69074df5 --- /dev/null +++ b/library/GSMTAP_PortType.ttcn @@ -0,0 +1,76 @@ +/* dual-faced port that wraps an IPL4asp port and encodes/decodes GSMTAP */ +module GSMTAP_PortType { + import from GSMTAP_Types all; + import from IPL4asp_PortType all; + import from IPL4asp_Types all; + + /* just like ASP_ReacFrom but with decoded GsmtapMessage */ + type record GSMTAP_RecvFrom { + ConnectionId connId, + HostName remName, + PortNumber remPort, + HostName locName, + PortNumber locPort, + ProtoTuple proto, + UserData userData, + GsmtapMessage msg + } + + /* just like ASP_Send but with decoded GsmtapMessage */ + type record GSMTAP_Send { + ConnectionId connId, + ProtoTuple proto, + GsmtapMessage msg + } + + /* just like ASP_SendTo but with decoded GsmtapMessage */ + type record GSMTAP_SendTo { + ConnectionId connId, + HostName remName, + PortNumber remPort, + ProtoTuple proto, + GsmtapMessage msg + } + + /* Convert RecvFrom from ASP to GSMTAP decoded */ + private function IPL4_to_GSMTAP(in ASP_RecvFrom pin, out GSMTAP_RecvFrom pout) { + pout.connId := pin.connId; + pout.remName := pin.remName; + pout.remPort := pin.remPort; + pout.locName := pin.locName; + pout.locPort := pin.locPort; + pout.proto := pin.proto; + pout.userData := pin.userData; + pout.msg := dec_GsmtapMessage(pin.msg); + } with { extension "prototype(fast)" } + + /* Convert SendTo from GSMTAP to ASP */ + private function GSMTAP_to_IPL4_SendTo(in GSMTAP_SendTo pin, out ASP_SendTo pout) { + pout.connId := pin.connId; + pout.remName := pin.remName; + pout.remPort := pin.remPort; + pout.proto := pin.proto; + pout.msg := enc_GsmtapMessage(pin.msg); + } with { extension "prototype(fast)" } + + /* Convert SendTo from GSMTAP to ASP */ + private function GSMTAP_to_IPL4_Send(in GSMTAP_Send pin, out ASP_Send pout) { + pout.connId := pin.connId; + pout.proto := pin.proto; + pout.msg := enc_GsmtapMessage(pin.msg); + } with { extension "prototype(fast)" } + + /* dual-faced port that converts from octetstring to decoded + * GSMTAP and vice-versa */ + type port GSMTAP_PT message { + out GSMTAP_Send + out GSMTAP_SendTo + in GSMTAP_RecvFrom + in ASP_Event + } with { extension "user IPL4asp_PT + out(GSMTAP_Send -> ASP_Send: function(GSMTAP_to_IPL4_Send); + GSMTAP_SendTo -> ASP_SendTo: function(GSMTAP_to_IPL4_SendTo)) + in(ASP_RecvFrom -> GSMTAP_RecvFrom: function(IPL4_to_GSMTAP); + ASP_Event -> ASP_Event: simple)" } + +} diff --git a/library/GSMTAP_Types.ttcn b/library/GSMTAP_Types.ttcn new file mode 100644 index 00000000..32882844 --- /dev/null +++ b/library/GSMTAP_Types.ttcn @@ -0,0 +1,77 @@ +module GSMTAP_Types { + import from Osmocom_Types all; + + const uint8_t GSMTAP_VERSION := 2; + + const uint16_t GSMTAP_PORT := 4729; + + type enumerated GsmtapMsgType { + GSMTAP_TYPE_UM (1), + GSMTAP_TYPE_ABIS (2), + GSMTAP_TYPE_UM_BURST (3), + GSMTAP_TYPE_SIM (4), + GSMTAP_TYPE_TETRA_I1 (5), + GSMTAP_TYPE_TETRA_I1_BURST (6), + GSMTAP_TYPE_WMX_BURST (7), + GSMTAP_TYPE_GB_LLC (8), + GSMTAP_TYPE_GB_SNDCP (9), + GSMTAP_TYPE_GMR1_UM (10), + GSMTAP_TYPE_UMTS_RLC_MAC (11), + GSMTAP_TYPE_UMTS_RRC (12), + GSMTAP_TYPE_LTE_RRC (13), + GSMTAP_TYPE_LTE_MAC (14), + GSMTAP_TYPE_LTE_MAC_FRAMED (15), + GSMTAP_TYPE_OSMOCORE_LOG (16), + GSMTAP_TYPE_QC_DIAG (17) + } with { variant "FIELDLENGTH(8)" }; + + type enumerated GsmtapChannel { + GSMTAP_CHANNEL_UNKNOWN (0), + GSMTAP_CHANNEL_BCCH (1), + GSMTAP_CHANNEL_CCCH (2), + GSMTAP_CHANNEL_RACH (3), + GSMTAP_CHANNEL_AGCH (4), + GSMTAP_CHANNEL_PCH (5), + GSMTAP_CHANNEL_SDCCH (6), + GSMTAP_CHANNEL_SDCCH4 (7), + GSMTAP_CHANNEL_SDCCH8 (8), + GSMTAP_CHANNEL_TCH_F (9), + GSMTAP_CHANNEL_TCH_H (10), + GSMTAP_CHANNEL_PACCH (11), + GSMTAP_CHANNEL_CBCH52 (12), + GSMTAP_CHANNEL_PDCH (13), + GSMTAP_CHANNEL_PTCCH (14), + GSMTAP_CHANNEL_CBCH51 (15) + } with { variant "FIELDLENGTH(8)" }; + + type record GsmtapHeader { + uint8_t version, + uint8_t hdr_len, + GsmtapMsgType msg_type, + uint8_t timeslot, + Arfcn arfcn, + int8_t signal_dbm, + int8_t snr_db, + uint32_t frame_number, + GsmtapChannel sub_type, + uint8_t antenna_nr, + uint8_t sub_slot, + uint8_t res + } with { variant (hdr_len) "LENGTHTO(version, hdr_len, msg_type, timeslot, arfcn, signal_dbm, snr_db, frame_number, sub_type, antenna_nr, sub_slot, res), UNIT(dword32)" } + + external function enc_GsmtapHeader(in GsmtapHeader si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_GsmtapHeader(in octetstring stream) return GsmtapHeader + with { extension "prototype(convert) decode(RAW)" }; + + type record GsmtapMessage { + GsmtapHeader header, + octetstring payload optional + } with { variant "" }; + + external function enc_GsmtapMessage(in GsmtapMessage si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_GsmtapMessage(in octetstring stream) return GsmtapMessage + with { extension "prototype(convert) decode(RAW)" }; + +} with { encode "RAW" }; diff --git a/library/GSM_SystemInformation.ttcn b/library/GSM_SystemInformation.ttcn new file mode 100644 index 00000000..74852d43 --- /dev/null +++ b/library/GSM_SystemInformation.ttcn @@ -0,0 +1,209 @@ +/* Encoding/Decoding routines for GSM System Information messages + * according to 3GPP TS 44.018 Version 12.3.0 Release 12 */ + +/* (C) 2017 by Harald Welte */ + +module GSM_SystemInformation { + + import from General_Types all; + import from GSM_Types all; + import from Osmocom_Types all; + + type union ArfcnOrMaio { + uint12_t arfcn, + MaioHsn maio_hsn + } with { variant "" }; + + /* 24.008 10.5.1.1 */ + type uint16_t CellIdentity; + + /* 44.018 10.5.2.1b */ + type octetstring CellChannelDescription with { variant "FIELDLENGTH(16)" }; + + /* 44.018 10.5.2.3 */ + type record CellOptions { + boolean dn_ind, + boolean pwrc, + BIT2 dtx, + BIT4 radio_link_timeout + } with { variant "" }; + + /* 44.018 10.5.2.3a */ + type record CellOptionsSacch { + BIT1 dtx_ext, + boolean pwrc, + BIT2 dtx, + BIT4 radio_link_timeout + } with { variant "" }; + + /* 44.018 10.5.2.4 */ + type record CellSelectionParameters { + uint3_t cell_resel_hyst, + uint5_t ms_txpwr_max_cch, + boolean acs, + boolean neci, + uint6_t rxlev_access_min + } with { variant "" }; + + /* 44.018 10.5.2.11 */ + type record ControlChannelDescription { + boolean mscrr, + boolean att, + uint3_t bs_ag_blks_res, + uint3_t ccch_conf, + boolean si22ind, + uint2_t cbq3, + BIT2 spare, + uint3_t bs_pa_mfrms, + uint8_t t3212 + } with { variant "" }; + + template ControlChannelDescription t_ControlChannelDescription := { ?, ?, ?, ?, ?, ?, '00'B, ?, ? }; + + /* 44.018 10.5.2.21 */ + type record MobileAllocationT { + OCT1 iei, + uint8_t len, + bitstring ma + } with { variant "" }; + + /* 44.018 10.5.2.22 */ + type octetstring NeighbourCellDescription with { variant "FIELDLENGTH(16)" }; + + /* 44.018 10.5.2.22a */ + type octetstring NeighbourCellDescription2 with { variant "FIELDLENGTH(16)" }; + + type bitstring AccessControlClass with { variant "FIELDLENGTH(16), BYTEORDER(last)" }; + + /* 44.018 10.5.2.29 */ + type record RachControlParameters { + BIT2 max_retrans, + BIT4 tx_integer, + boolean cell_barr_access, + boolean re, + AccessControlClass ac + } with { variant (ac) "FIELDLENGTH(16)" }; + + /* 44.018 10.5.2.32 */ + type RestOctets Si1RestOctets with { variant "FIELDLENGTH(1)" }; + type RestOctets Si3RestOctets with { variant "FIELDLENGTH(4)" }; + + /* 44.018 9.1.31 */ + type record SystemInformationType1 { + CellChannelDescription cell_chan_desc, + RachControlParameters rach_control, + Si1RestOctets rest_octets + } with { variant "" }; + + /* 44.018 9.1.32 */ + type record SystemInformationType2 { + NeighbourCellDescription bcch_freq_list, + BIT8 ncc_permitted, + RachControlParameters rach_control + } with { variant "" }; + + /* 44.018 9.1.33 */ + type record SystemInformationType2bis { + NeighbourCellDescription extd_bcch_freq_list, + RachControlParameters rach_control, + OCT1 rest_octets + } with { variant "" }; + + /* 44.018 9.1.34 */ + type record SystemInformationType2ter { + NeighbourCellDescription2 extd_bcch_freq_list, + OCT4 rest_octets + } with { variant "" }; + + /* 44.018 9.1.35 */ + type record SystemInformationType3 { + CellIdentity cell_id, + LocationAreaIdentification lai, + ControlChannelDescription ctrl_chan_desc, + CellOptions cell_options, + CellSelectionParameters cell_sel_par, + RachControlParameters rach_control, + Si3RestOctets rest_octets + } with { variant "" }; + + template SystemInformationType3 t_SI3 := { + cell_id := ?, + lai := ?, + ctrl_chan_desc := t_ControlChannelDescription, + cell_options := ?, + cell_sel_par := ?, + rach_control := ?, + rest_octets := ? + }; + + + /* 44.018 9.1.36 */ + type record SystemInformationType4 { + LocationAreaIdentification lai, + CellSelectionParameters cell_sel_par, + RachControlParameters rach_control, + ChannelDescriptionTV cbch_chan_desc optional, + MobileAllocationT cbch_mobile_alloc optional, + RestOctets rest_octets + } with { variant "TAG(cbch_chan_desc, iei = '64'O; cbch_mobile_alloc, iei = '72'O)" }; + + /* 44.018 9.1.37 */ + type record SystemInformationType5 { + NeighbourCellDescription bcch_freq_list + } with { variant "" }; + + /* 44.018 9.1.38 */ + type record SystemInformationType5bis { + NeighbourCellDescription extd_bcch_freq_list + } with { variant "" }; + + /* 44.018 9.1.39 */ + type record SystemInformationType5ter { + NeighbourCellDescription2 extd_bcch_freq_list + } with { variant "" }; + + /* 44.018 9.1.40 */ + type record SystemInformationType6 { + CellIdentity cell_id, + LocationAreaIdentification lai, + CellOptionsSacch cell_options, + BIT8 ncc_permitted, + OCT7 rest_octets + } with { variant "" }; + + type union SystemInformationUnion { + SystemInformationType1 si1, + SystemInformationType2 si2, + SystemInformationType2bis si2bis, + SystemInformationType2ter si2ter, + SystemInformationType3 si3, + SystemInformationType4 si4, + SystemInformationType5 si5, + SystemInformationType5bis si5bis, + SystemInformationType5ter si5ter, + SystemInformationType6 si6, + octetstring other + } with { variant "" }; + + type record SystemInformation { + RrHeader header, + SystemInformationUnion payload + } with { variant (payload) "CROSSTAG(si1, header.message_type = SYSTEM_INFORMATION_TYPE_1; + si2, header.message_type = SYSTEM_INFORMATION_TYPE_2; + si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis; + si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter; + si3, header.message_type = SYSTEM_INFORMATION_TYPE_3; + si4, header.message_type = SYSTEM_INFORMATION_TYPE_4; + si5, header.message_type = SYSTEM_INFORMATION_TYPE_5; + si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis; + si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter; + si6, header.message_type = SYSTEM_INFORMATION_TYPE_6; + other, OTHERWISE; + )" }; + + external function enc_SystemInformation(in SystemInformation si) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_SystemInformation(in octetstring stream) return SystemInformation + with { extension "prototype(convert) decode(RAW)" }; + +} with { encode "RAW"; variant "FIELDORDER(msb)" } diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn new file mode 100644 index 00000000..c2051403 --- /dev/null +++ b/library/GSM_Types.ttcn @@ -0,0 +1,587 @@ +/* Encoding/Decoding routines for GSM System Information messages + * according to 3GPP TS 44.018 Version 12.3.0 Release 12 */ + +/* (C) 2017 by Harald Welte */ + +module GSM_Types { + + import from General_Types all; + import from Osmocom_Types all; + + type integer GsmArfcn (0..1023); + type integer UmtsArfcn (0..16383); + type integer UmtsScramblingCode (0..511); + const integer GsmMaxFrameNumber := 26*51*2048; + type integer GsmFrameNumber (0..GsmMaxFrameNumber); + type integer GsmRxLev (0..63); + type integer GsmTsc (0..7) with { variant "FIELDLENGTH(8)" }; + type uint32_t GsmTmsi; + + /* Table 10.4.1 of Section 10.4 / 3GPP TS 44.018 */ + type enumerated RrMessageType { + ADDITIONAL_ASSIGNMENT ('00111011'B), + IMMEDIATE_ASSIGNMENT ('00111111'B), + IMMEDIATE_ASSIGNMENT_EXTENDED ('00111001'B), + IMMEDIATE_ASSIGNMENT_REJECT ('00111010'B), + IMMEDIATE_PACKET_ASSIGNMENT ('01101001'B), + + CIPHERING_MODE_COMMAND ('00110101'B), + CIPHERING_MODE_COMPLETE ('00110010'B), + + CONFIGURATION_CHANGE_COMMAND ('00110000'B), + CONFIGURATION_CHANGE_ACK ('00110001'B), + CONFIGURATION_CHANGE_REJECT ('00110011'B), + + ASSIGNMENT_COMMAND ('00101110'B), + ASSIGNMENT_COMPLETE ('00101001'B), + ASSIGNMENT_FAILURE ('00101111'B), + HANDOVER_COMMAND ('00101011'B), + HANDOVER_COMPLETE ('00101100'B), + HANDOVER_FAILURE ('00101000'B), + PHYSICAL_INFORMATION ('00101101'B), + + CHANNEL_RELEASE ('00001101'B), + PARTIAL_RELEASE ('00001010'B), + PARTIAL_RELEASE_COMPLETE ('00001111'B), + + PAGING_REQUEST_TYPE_1 ('00100001'B), + PAGING_REQUEST_TYPE_2 ('00100010'B), + PAGING_REQUEST_TYPE_3 ('00100100'B), + PAGING_RESPONSE ('00100111'B), + NOTIFICATION_NCH ('00100000'B), + NOTIFICATION_RESPOSNE ('00100110'B), + + SYSTEM_INFORMATION_TYPE_8 ('00011000'B), + SYSTEM_INFORMATION_TYPE_1 ('00011001'B), + SYSTEM_INFORMATION_TYPE_2 ('00011010'B), + SYSTEM_INFORMATION_TYPE_3 ('00011011'B), + SYSTEM_INFORMATION_TYPE_4 ('00011100'B), + SYSTEM_INFORMATION_TYPE_5 ('00011101'B), + SYSTEM_INFORMATION_TYPE_6 ('00011110'B), + SYSTEM_INFORMATION_TYPE_7 ('00011111'B), + SYSTEM_INFORMATION_TYPE_2bis ('00000010'B), + SYSTEM_INFORMATION_TYPE_2ter ('00000011'B), + SYSTEM_INFORMATION_TYPE_2quater ('00000111'B), + SYSTEM_INFORMATION_TYPE_5bis ('00000101'B), + SYSTEM_INFORMATION_TYPE_5ter ('00000110'B), + SYSTEM_INFORMATION_TYPE_9 ('00000100'B), + SYSTEM_INFORMATION_TYPE_13 ('00000000'B), + + SYSTEM_INFORMATION_TYPE_16 ('00111101'B), + SYSTEM_INFORMATION_TYPE_17 ('00111110'B), + + CHANNEL_MODE_MODIFY ('00010000'B), + RR_STATUS ('00010010'B), + CHANNEL_MODE_MODIFY_ACKNOWLEDGE ('00010111'B), + FREQUENCY_REDEFINITION ('00010100'B), + MEASUREMENT_REPORT ('00010101'B), + CLASSMARK_CHANGE ('00010110'B), + CLASSMARK_ENQUIRY ('00010011'B), + EXTENDED_MEASUREMENT_REPORT ('00110110'B), + EXTENDED_MEASUREMENT_ORDER ('00110111'B), + GPRS_SUSPENSION_REQUEST ('00110100'B), + //MBMS_ANNOUNCEMENT ('00010110'B), duplicate? + //SERVICE_INFORMATION ('00110110'B), duplicate? + + APPLICATION_INFORMATION ('00111000'B), + + SYSTEM_INFORMATION_TYPE_14 ('00000001'B), + SYSTEM_INFORMATION_TYPE_15 ('01000011'B), + SYSTEM_INFORMATION_TYPE_18 ('01000000'B), + SYSTEM_INFORMATION_TYPE_19 ('01000001'B), + SYSTEM_INFORMATION_TYPE_20 ('01000010'B), + SYSTEM_INFORMATION_TYPE_13alt ('01000100'B), + SYSTEM_INFORMATION_TYPE_2n ('01000101'B), + SYSTEM_INFORMATION_TYPE_21 ('01000110'B), + SYSTEM_INFORMATION_TYPE_22 ('01000111'B), + SYSTEM_INFORMATION_TYPE_23 ('01001111'B), + + DTM_ASSIGNMENT_FAILURE ('01001000'B), + DTM_REJECT ('01001001'B), + DTM_REQUEST ('01001010'B), + PACKET_ASSIGNMENT ('01001011'B), + DTM_ASSIGNMENT_COMMAND ('01001100'B), + DTM_INFORMATION ('01001101'B), + PACKET_INFORMATION ('01001110'B), + + UTRAN_CLASSMARK_CHANGE ('01100000'B), + CDMA2000_CLASSMARK_CHANGE ('01100010'B), + INTERSYS_TO_UTRAN_HO_CMD ('01100011'B), + INTERSYS_TO_CDMA2000_HO_CMD ('01100100'B), + GERAN_IU_MODE_CLASSMARK_CHG ('01100101'B), + INTERSYS_TO_EUTRAN_HO_CMD ('01100110'B) + } with { variant "FIELDLENGTH(8)" }; + + type octetstring RestOctets with { variant "PADDING(yes), PADDING_PATTERN('00101011'B)" }; + type hexstring GsmBcdString with { variant "HEXORDER(low)" }; + type GsmBcdString BcdMccMnc with { variant "FIELDLENGTH(6)" }; + + type record L2PseudoLength { + uint6_t l2_plen, + BIT2 zero_one + } with { variant "" }; + + template L2PseudoLength t_L2Pseudolength(template uint6_t len) := { + l2_plen := len, + zero_one := '01'B + }; + + type record RrHeader { + L2PseudoLength l2_plen, + uint4_t skip_indicator, + uint4_t rr_protocol_discriminator, + RrMessageType message_type + } with { variant "" }; + + template RrHeader t_RrHeader(RrMessageType msg_type, template uint6_t len) := { + l2_plen := t_L2Pseudolength(len), + skip_indicator := 0, + rr_protocol_discriminator := 6, + message_type := msg_type + }; + + type record RrL3Header { + uint4_t skip_indicator, + uint4_t rr_protocol_discriminator, + RrMessageType message_type + } with { variant "" }; + + type record MaioHsn { + } with { variant "" }; + + /* TS 24.008 10.5.1.2 */ + type uint4_t CipheringKeySeqNr (0..7); + + /* 24.008 10.5.1.3 */ + type record LocationAreaIdentification { + BcdMccMnc mcc_mnc, + uint16_t lac + } with { variant "" }; + + /* TS 24.008 10.5.1.4 */ + type enumerated MobileIdentityType { + MI_TYPE_NONE (0), + MI_TYPE_IMSI, + MI_TYPE_IMEI, + MI_TYPE_IMEISV, + MI_TYPE_TMSI, + MI_TYPE_TMGI + } with { variant "FIELDLENGTH(3)" }; + + type record MobileIdentityBCD { + MobileIdentityType mi_type (MI_TYPE_IMSI, MI_TYPE_IMEI, MI_TYPE_IMEISV), + boolean odd, + hexstring digits + } with { variant "" }; + + type record MobileIdentityTMSI { + BIT4 pad ('1111'B), + boolean odd (false), + MobileIdentityType mi_type (MI_TYPE_TMSI), + GsmTmsi tmsi + } with { variant "" }; + + type record MobileIdentityNone { + BIT4 pad ('1111'B), + boolean odd (false), + MobileIdentityType mi_type (MI_TYPE_NONE) + } with { variant "" }; + + type union MobileIdentity { + MobileIdentityBCD bcd, + MobileIdentityTMSI tmsi, + MobileIdentityNone unused + } with { variant "TAG(bcd, mi_type = MI_TYPE_IMSI; + bcd, mi_type = MI_TYPE_IMEI; + bcd, mi_type = MI_TYPE_IMEISV; + tmsi, mi_type = MI_TYPE_TMSI; + unused, mi_type = MI_TYPE_NONE)" }; + + type record MobileIdentityLV { + uint8_t len, + MobileIdentity mi + } with { variant (len) "LENGTHTO(mi)" }; + + type record MobileIdentityTLV { + uint8_t tag, + uint8_t len, + MobileIdentity mi + } with { variant (len) "LENGTHTO(mi)" }; + + /* TS 24.008 10.5.1.5 */ + type record MsClassmark1 { + BIT1 spare, + uint2_t rev_level, + boolean es_ind, + boolean a51, + uint3_t rf_pwr_cap + } with { variant "" }; + + /* TS 24.008 10.5.1.6 */ + type record MsClassmark2 { + BIT1 spare, + uint2_t rev_level, + boolean es_ind, + boolean a51, + uint3_t rf_pwr_cap, + BIT1 spare1, + boolean ps_cap, + uint2_t ss_screen_ind, + boolean sm_cap, + boolean vbs, + boolean vgcs, + boolean fc, + boolean cm3, + BIT1 spare2, + boolean lcsva_cap, + boolean ucs2, + boolean solsa, + boolean cmsp, + boolean a53, + boolean a52 + } with { variant "" }; + type record MsClassmark2LV { + uint8_t len, + MsClassmark2 cm2 + } with { variant (len) "LENGTHTO(cm2)" }; + + + /* 44.018 10.5.2.5 */ + type record ChannelDescription { + RslChannelNr chan_nr, + uint3_t tsc, + boolean h, + uint12_t arfcn optional, + MaioHsn maio_hsn optional + } with { variant (arfcn) "PRESENCE(h = false)" + variant (maio_hsn) "PRESENCE(h = true)" }; + + type record ChannelDescriptionTV { + OCT1 iei, + ChannelDescription v + } with { variant "" }; + + /* 10.5.2.8 */ + type enumerated ChannelNeeded { + CHAN_NEED_ANY (0), + CHAN_NEED_SDCCH (1), + CHAN_NEED_TCH_F (2), + CHAN_NEED_TCH_H (3) + } with { variant "FIELDLENGTH(2)" }; + type record ChannelNeeded12 { + ChannelNeeded second, + ChannelNeeded first + } with { variant "" }; + + /* 10.5.2.21 */ + type record MobileAllocation { + uint8_t len, + bitstring ma + } with { variant (len) "LENGTHTO(ma)" }; + + /* 10.5.2.25a */ + type OCT3 PacketChannelDescription; + + /* 10.5.2.25b */ + type record DedicatedModeOrTbf { + BIT1 spare, + boolean tma, + boolean downlink, + boolean tbf + } with { variant "" }; + + /* 10.5.2.26 */ + type enumerated PageMode { + PAGE_MODE_NORMAL, + PAGE_MODE_EXTENDED, + PAGE_MODE_REORGANIZATION, + PAGE_MODE_SAME_AS_BEFORE + } with { variant "FIELDLENGTH(4)" }; + + /* 10.5.2.30 */ + type record RequestReference { + bitstring ra length(8), + uint5_t t1p, + uint6_t t3, + uint5_t t2 + } with { variant "" }; + + template RequestReference t_RequestReference(template bitstring ra, template uint5_t t1p, template uint6_t t3, template uint5_t t2) := { + ra := ra, + t1p := t1p, + t3 := t3, + t2 := t2 + } + + /* compute the expected request reference for given RA + FN */ + function f_compute_ReqRef(uint8_t ra, GsmFrameNumber fn) return RequestReference { + var RequestReference req_ref := { ra := int2bit(ra, 8) }; + req_ref.t1p := (fn / 1326) mod 32; + req_ref.t2 := fn mod 26; + req_ref.t3 := fn mod 51; + return req_ref + } + + /* 10.5.2.40 */ + type integer TimingAdvance (0..219); + + /* 10.5.2.43 */ + type uint8_t WaitIndication; + + /* 10.5.2.76 */ + type record FeatureIndicator { + BIT2 spare, + boolean cs_ir, + boolean ps_ir + } with { variant "" }; + + + /* 9.1.18 */ + type record ImmediateAssignment { + DedicatedModeOrTbf ded_or_tbf, + PageMode page_mode, + ChannelDescription chan_desc optional, + PacketChannelDescription pkt_chan_desc optional, + RequestReference req_ref, + TimingAdvance timing_advance, + MobileAllocation mobile_allocation + } with { variant (chan_desc) "PRESENCE(ded_or_tbf.tbf = false)" + variant (pkt_chan_desc) "PRESENCE(ded_or_tbf.tbf = true)" }; + + /* 9.1.20 */ + type record ReqRefWaitInd { + RequestReference req_ref, + WaitIndication wait_ind + } with { variant "" }; + type record length(4) of ReqRefWaitInd ReqRefWaitInd4; + type record ImmediateAssignmentReject { + FeatureIndicator feature_ind, + PageMode page_mode, + ReqRefWaitInd4 payload + } with { variant "" }; + + /* 9.1.22 */ + type record PagingRequestType1 { + ChannelNeeded12 chan_needed, + PageMode page_mode, + MobileIdentityLV mi1, + MobileIdentityTLV mi2 optional, + RestOctets rest_octets + } with { variant "TAG(mi2, tag = 23)" }; + + /* 9.1.23 */ + type record PagingRequestType2 { + ChannelNeeded12 chan_needed, + PageMode page_mode, + GsmTmsi mi1, + GsmTmsi mi2, + MobileIdentityTLV mi3 optional, + RestOctets rest_octets + } with { variant "TAG(mi3, tag = 23)" }; + + /* 9.1.24 */ + type record length(4) of GsmTmsi GsmTmsi4; + type record PagingRequestType3 { + ChannelNeeded12 chan_needed, + PageMode page_mode, + GsmTmsi4 mi, + RestOctets rest_octets + } with { variant "" }; + + + type union RrUnion { +/* + SystemInformationType1 si1, + SystemInformationType2 si2, + SystemInformationType2bis si2bis, + SystemInformationType2ter si2ter, + SystemInformationType3 si3, + SystemInformationType4 si4, + SystemInformationType5 si5, + SystemInformationType5bis si5bis, + SystemInformationType5ter si5ter, + SystemInformationType6 si6, +*/ + ImmediateAssignment imm_ass, + ImmediateAssignmentReject imm_ass_rej, + PagingRequestType1 pag_req_1, + PagingRequestType2 pag_req_2, + PagingRequestType3 pag_req_3, + octetstring other + } with { variant "" }; + + /* Special RR Message on BCCH / CCCH Dowlink */ + + type record GsmRrMessage { + RrHeader header, + RrUnion payload + } with { variant (payload) "CROSSTAG( +/* + si1, header.message_type = SYSTEM_INFORMATION_TYPE_1; + si2, header.message_type = SYSTEM_INFORMATION_TYPE_2; + si2bis, header.message_type = SYSTEM_INFORMATION_TYPE_2bis; + si2ter, header.message_type = SYSTEM_INFORMATION_TYPE_2ter; + si3, header.message_type = SYSTEM_INFORMATION_TYPE_3; + si4, header.message_type = SYSTEM_INFORMATION_TYPE_4; + si5, header.message_type = SYSTEM_INFORMATION_TYPE_5; + si5bis, header.message_type = SYSTEM_INFORMATION_TYPE_5bis; + si5ter, header.message_type = SYSTEM_INFORMATION_TYPE_5ter; + si6, header.message_type = SYSTEM_INFORMATION_TYPE_6; +*/ + imm_ass, header.message_type = IMMEDIATE_ASSIGNMENT; + imm_ass_rej, header.message_type = IMMEDIATE_ASSIGNMENT_REJECT; + pag_req_1, header.message_type = PAGING_REQUEST_TYPE_1; + pag_req_2, header.message_type = PAGING_REQUEST_TYPE_2; + pag_req_3, header.message_type = PAGING_REQUEST_TYPE_3; + other, OTHERWISE; + )" }; + + external function enc_GsmRrMessage(in GsmRrMessage msg) return octetstring + with { extension "prototype(convert) encode(RAW)" }; + external function dec_GsmRrMessage(in octetstring stream) return GsmRrMessage + with { extension "prototype(convert) decode(RAW)" }; + + /* Normal L3 Message on Dedicated Channel */ + + /* 9.1.25 Paging Response */ + type record PagingResponse { + uint4_t spare_half_octet, + CipheringKeySeqNr cksn, + MsClassmark2LV cm2, + MobileIdentityLV mi, + uint8_t addl_upd_par optional + } with { variant "" }; + + type union RrL3Union { + PagingResponse paging_response, + octetstring other + }; + + type record GsmRrL3Message { + RrL3Header header, + RrL3Union payload + } with { variant (payload) "CROSSTAG( + paging_response, header.message_type = PAGING_RESPONSE; + + other, OTHERWISE; + )" } + + /* TS 48.058 9.3.1 Channel Number IE */ + type enumerated RslChanNr0 { + RSL_CHAN_NR_INVALID ('00'H), + RSL_CHAN_NR_Bm_ACCH ('01'H), + RSL_CHAN_NR_BCCH ('10'H), + RSL_CHAN_NR_RACH ('11'H), + RSL_CHAN_NR_PCH_AGCH ('12'H) + } with { variant "FIELDLENGTH(5)" }; + + type record RslChanNr2 { + BIT4 tag ('0001'B), + uint1_t sub_chan + } with { variant "FIELDLENGTH(5)" }; + + type record RslChanNr4 { + BIT3 tag ('001'B), + uint2_t sub_chan + } with { variant "FIELDLENGTH(5)" }; + + type record RslChanNr8 { + BIT2 tag ('01'B), + uint3_t sub_chan + } with { variant "FIELDLENGTH(5)" }; + + type union RslChanNrU { + RslChanNr0 ch0, + RslChanNr2 lm, + RslChanNr4 sdcch4, + RslChanNr8 sdcch8 + } with { + variant "TAG(lm, tag = '0001'B; + sdcch4, tag = '001'B; + sdcch8, tag = '01'B; + ch0, OTHERWISE)" + variant "FIELDLENGTH(5)" + }; + + type record RslChannelNr { + RslChanNrU u, + uint3_t tn + } with { variant "FIELDLENGTH(8)" }; + + template RslChannelNr t_RslChanNr0(template uint3_t tn, template RslChanNr0 cht) := { + u := { ch0 := cht }, + tn := tn + } + + template RslChannelNr t_RslChanNr_RACH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_RACH); + template RslChannelNr t_RslChanNr_BCCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_BCCH); + template RslChannelNr t_RslChanNr_PCH_AGCH(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_PCH_AGCH); + template RslChannelNr t_RslChanNr_Bm(template uint3_t tn) := t_RslChanNr0(tn, RSL_CHAN_NR_Bm_ACCH); + template RslChannelNr t_RslChanNr_Lm(template uint3_t tn, uint1_t sub_slot) := { + u := { lm := { tag := '0001'B, sub_chan := sub_slot } }, + tn := tn + } + template RslChannelNr t_RslChanNr_SDCCH4(template uint3_t tn, template uint2_t sub_slot) := { + u := { sdcch4 := { tag := '001'B, sub_chan := sub_slot } }, + tn := tn + } + template RslChannelNr t_RslChanNr_SDCCH8(template uint3_t tn, template uint3_t sub_slot) := { + u := { sdcch8 := { tag := '01'B, sub_chan := sub_slot } }, + tn := tn + } + + /* TS 48.058 9.3.2 Link ID */ + type enumerated RslLinkIdC { + FACCH_SDCCH (0), + SACCH (1) + } with { variant "FIELDLENGTH(2)" }; + + type enumerated RslSapi0Prio { + SAPI0_PRIO_NORMAL (0), + SAPI0_PRIO_HIGH (1), + SAPI0_PRIO_LOW (2) + } with { variant "FIELDLENGTH(2)" }; + + type uint3_t GsmSapi; + + type record RslLinkId { + RslLinkIdC c, + boolean na, + RslSapi0Prio prio, + GsmSapi sapi + } with { variant "" }; + + template RslLinkId tr_RslLinkId := { + c := ?, + na := ?, + prio := ?, + sapi := ? + }; + + template RslLinkId tr_RslLinkID_DCCH(template GsmSapi sapi) modifies tr_RslLinkId := { + c := FACCH_SDCCH, + na := false, + sapi := sapi + }; + + template RslLinkId tr_RslLinkID_SACCH(template GsmSapi sapi) modifies tr_RslLinkId := { + c := SACCH, + na := false, + sapi := sapi + }; + + template RslLinkId ts_RslLinkID_DCCH(GsmSapi sapi) := { + c := FACCH_SDCCH, + na := false, + prio := SAPI0_PRIO_NORMAL, + sapi := sapi + }; + + template RslLinkId ts_RslLinkID_SACCH(GsmSapi sapi) := { + c := SACCH, + na := false, + prio := SAPI0_PRIO_NORMAL, + sapi := sapi + }; + +} with { encode "RAW"; variant "FIELDORDER(msb)" } diff --git a/library/General_Types.ttcn b/library/General_Types.ttcn new file mode 100644 index 00000000..bdf85853 --- /dev/null +++ b/library/General_Types.ttcn @@ -0,0 +1,321 @@ +/****************************************************************************** + * Copyright (c) 2000-2017 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Balasko, Jeno + * Baranyi, Botond + * + ******************************************************************************/ +// +// File: General_Types.ttcn +// Rev: +// Prodnr: CNL 113 368 +// Updated: 2012-11-06 +// Contact: http://ttcn.ericsson.se +// Reference: + + +module General_Types +{ + +group SimpleNativeTypes { + + //**************************************************** + // Bitstrings + //**************************************************** + + //bitstring with fixed length + type bitstring BIT1n length(1) with { variant "" }; + type bitstring BIT2n length(2) with { variant "" }; + type bitstring BIT3n length(3) with { variant "" }; + type bitstring BIT4n length(4) with { variant "" }; + type bitstring BIT5n length(5) with { variant "" }; + type bitstring BIT6n length(6) with { variant "" }; + type bitstring BIT7n length(7) with { variant "" }; + type bitstring BIT8n length(8) with { variant "" }; + type bitstring BIT9n length(9) with { variant "" }; + type bitstring BIT12n length(12) with { variant "" }; + type bitstring BIT14n length(14) with { variant "" }; + type bitstring BIT15n length(15) with { variant "" }; + type bitstring BIT16n length(16) with { variant "" }; + type bitstring BIT56n length(56) with { variant "" }; + + //bitstring with length interval + type bitstring BIT14_24n length(14..24) with { variant "" }; + + //bitstring to be padded with fixed length + type bitstring BIT1np length(1) with { variant "" }; + type bitstring BIT2np length(2) with { variant "" }; + type bitstring BIT3np length(3) with { variant "" }; + type bitstring BIT4np length(4) with { variant "" }; + type bitstring BIT5np length(5) with { variant "" }; + type bitstring BIT6np length(6) with { variant "" }; + type bitstring BIT7np length(7) with { variant "" }; + type bitstring BIT15np length(15) with { variant "" }; + + //bitstring with fixed length + type bitstring BIT1 length(1) with { variant "FIELDLENGTH(1)" }; + type bitstring BIT2 length(2) with { variant "FIELDLENGTH(2)" }; + type bitstring BIT3 length(3) with { variant "FIELDLENGTH(3)" }; + type bitstring BIT4 length(4) with { variant "FIELDLENGTH(4)" }; + type bitstring BIT5 length(5) with { variant "FIELDLENGTH(5)" }; + type bitstring BIT6 length(6) with { variant "FIELDLENGTH(6)" }; + type bitstring BIT7 length(7) with { variant "FIELDLENGTH(7)" }; + type bitstring BIT8 length(8) with { variant "FIELDLENGTH(8)" }; + type bitstring BIT9 length(9) with { variant "FIELDLENGTH(9)" }; + type bitstring BIT10 length(10) with { variant "FIELDLENGTH(10)" }; + type bitstring BIT11 length(11) with { variant "FIELDLENGTH(11)" }; + type bitstring BIT12 length(12) with { variant "FIELDLENGTH(12)" }; + type bitstring BIT14 length(14) with { variant "FIELDLENGTH(14)" }; + type bitstring BIT15 length(15) with { variant "FIELDLENGTH(15)" }; + type bitstring BIT16 length(16) with { variant "FIELDLENGTH(16)" }; + type bitstring BIT24 length(24) with { variant "FIELDLENGTH(24)" }; + type bitstring BIT31 length(31) with { variant "FIELDLENGTH(31)" }; + type bitstring BIT56 length(56) with { variant "FIELDLENGTH(56)" }; + + //**************************************************** + // Octetstrings + //**************************************************** + + //octetstring with fixed length + type octetstring OCT0n length(0) with { variant "" }; + type octetstring OCT1n length(1) with { variant "" }; + type octetstring OCT2n length(2) with { variant "" }; + type octetstring OCT3n length(3) with { variant "" }; + type octetstring OCT4n length(4) with { variant "" }; + type octetstring OCT5n length(5) with { variant "" }; + type octetstring OCT6n length(6) with { variant "" }; + type octetstring OCT7n length(7) with { variant "" }; + type octetstring OCT8n length(8) with { variant "" }; + type octetstring OCT9n length(9) with { variant "" }; + type octetstring OCT10n length(10) with { variant "" }; + type octetstring OCT11n length(11) with { variant "" }; + type octetstring OCT12n length(12) with { variant "" }; + type octetstring OCT13n length(13) with { variant "" }; + type octetstring OCT14n length(14) with { variant "" }; + type octetstring OCT15n length(15) with { variant "" }; + type octetstring OCT16n length(16) with { variant "" }; + type octetstring OCT17n length(17) with { variant "" }; + type octetstring OCT18n length(18) with { variant "" }; + type octetstring OCT19n length(19) with { variant "" }; + type octetstring OCT20n length(20) with { variant "" }; + type octetstring OCT28n length(28) with { variant "" }; + type octetstring OCT32n length(32) with { variant "" }; + type octetstring OCT34n length(34) with { variant "" }; + type octetstring OCT46n length(46) with { variant "" }; + type octetstring OCT50n length(50) with { variant "" }; + type octetstring OCT69n length(69) with { variant "" }; + type octetstring OCT100n length(100) with { variant "" }; + type octetstring OCT128n length(128) with { variant "" }; + type octetstring OCT500n length(500) with { variant "" }; + type octetstring OCTNn with { variant "" }; + + //octetstring with length interval + type octetstring OCT1_3n length(1..3) with { variant "" }; + type octetstring OCT1_4n length(1..4) with { variant "" }; + type octetstring OCT1_5n length(1..5) with { variant "" }; + type octetstring OCT1_6n length(1..6) with { variant "" }; + type octetstring OCT1_7n length(1..7) with { variant "" }; + type octetstring OCT1_8n length(1..8) with { variant "" }; + type octetstring OCT1_12n length(1..12) with { variant "" }; + type octetstring OCT1_15n length(1..15) with { variant "" }; + type octetstring OCT1_16n length(1..16) with { variant "" }; + type octetstring OCT1_18n length(1..18) with { variant "" }; + type octetstring OCT1_20n length(1..20) with { variant "" }; + type octetstring OCT1_24n length(1..24) with { variant "" }; + type octetstring OCT1_32n length(1..32) with { variant "" }; + type octetstring OCT1_34n length(1..34) with { variant "" }; + type octetstring OCT1_46n length(1..46) with { variant "" }; + type octetstring OCT1_50n length(1..50) with { variant "" }; + type octetstring OCT1_112n length(1..112) with { variant "" }; + type octetstring OCT1_127n length(1..127) with { variant "" }; + type octetstring OCT1_128n length(1..128) with { variant "" }; + type octetstring OCT1_172n length(1..172) with { variant "" }; + type octetstring OCT3_5n length(3..5) with { variant "" }; + type octetstring OCT3_7n length(3..7) with { variant "" }; + type octetstring OCT3_8n length(3..8) with { variant "" }; + type octetstring OCT3_14n length(3..14) with { variant "" }; + type octetstring OCT3_17n length(3..17) with { variant "" }; + type octetstring OCT4_8n length(4..8) with { variant "" }; + + + //**************************************************** + // Charstrings + //**************************************************** + + //charstring with fixed length + type charstring CHAR4 length (4); + + //**************************************************** + // Hexstrings + //**************************************************** + + //hexstring with fixed length + type hexstring HEX4n length(4) with { variant "" }; + type hexstring HEX6n length(6) with { variant "" }; + type hexstring HEX8n length(8) with { variant "" }; + type hexstring HEX15n length(15) with { variant "" }; + type hexstring HEX16n length(16) with { variant "" }; + type hexstring HEX24n length(24) with { variant "" }; + + //hexstring with length interval + type hexstring HEX0_18n length(0..18) with { variant "" }; + type hexstring HEX1_20n length(1..20) with { variant "" }; + type hexstring HEX1_34n length(1..34) with { variant "" }; + + //**************************************************** + // Integers + //**************************************************** + + //integer with fixed bit number + type integer INT3nb (0..7) with { variant "" }; + type integer INT4nb (0..15) with { variant "" }; + type integer INT5nb (0..31) with { variant "" }; + type integer INT8nb (0..255) with { variant "" }; + + //integer with fixed bit number and with padding + type integer INT2nbp (0..3) with { variant "" }; + type integer INT1nbp (0..1) with { variant "" }; + type integer INT3nbp (0..7) with { variant "" }; + type integer INT5nbp (0..31) with { variant "" }; + type integer INT9nbp (0..511) with { variant "" }; + type integer INT13nbp (0..8191) with { variant "" }; + type integer INT15nbp (0..32767) with { variant "" }; + +} // end group NativeTypes + +//**************************************************** +//**************************************************** +// RAW Encoded Types +//**************************************************** +//**************************************************** + +group SimpleRAWEncodedTypes { + + //**************************************************** + // Bitstrings + //**************************************************** + + //bitstring with fixed length + type bitstring BIT6_BO_LAST length (6) with {variant "BYTEORDER(last)"}; + type bitstring BIT16_BO_LAST length (16) with {variant "BYTEORDER(last)"}; + type bitstring BIT32_BO_LAST length (32) with {variant "BYTEORDER(last)"}; + + //**************************************************** + // Octetstrings + //**************************************************** + //octetstring with fixed length + type octetstring Dummy length(0) with { variant "FIELDLENGTH(0)" }; + type octetstring OCT0 length(0) with { variant "FIELDLENGTH(0)" }; + type octetstring OCT1 length(1) with { variant "FIELDLENGTH(1)" }; + type octetstring OCT2 length(2) with { variant "FIELDLENGTH(2)" }; + type octetstring OCT3 length(3) with { variant "FIELDLENGTH(3)" }; + type octetstring OCT4 length(4) with { variant "FIELDLENGTH(4)" }; + type octetstring OCT5 length(5) with { variant "FIELDLENGTH(5)" }; + type octetstring OCT6 length(6) with { variant "FIELDLENGTH(6)" }; + type octetstring OCT7 length(7) with { variant "FIELDLENGTH(7)" }; + type octetstring OCT8 length(8) with { variant "FIELDLENGTH(8)" }; + type octetstring OCT9 length(9) with { variant "FIELDLENGTH(9)" }; + type octetstring OCT10 length(10) with { variant "FIELDLENGTH(10)" }; + type octetstring OCT11 length(11) with { variant "FIELDLENGTH(11)" }; + type octetstring OCT12 length(12) with { variant "FIELDLENGTH(12)" }; + type octetstring OCT13 length(13) with { variant "FIELDLENGTH(13)" }; + type octetstring OCT14 length(14) with { variant "FIELDLENGTH(14)" }; + type octetstring OCT15 length(15) with { variant "FIELDLENGTH(15)" }; + type octetstring OCT16 length(16) with { variant "FIELDLENGTH(16)" }; + type octetstring OCT17 length(17) with { variant "FIELDLENGTH(17)" }; + type octetstring OCT18 length(18) with { variant "FIELDLENGTH(18)" }; + type octetstring OCT19 length(19) with { variant "FIELDLENGTH(19)" }; + type octetstring OCT20 length(20) with { variant "FIELDLENGTH(20)" }; + type octetstring OCT32 length(32) with { variant "FIELDLENGTH(32)" }; + type octetstring OCT34 length(34) with { variant "FIELDLENGTH(34)" }; + type octetstring OCT46 length(46) with { variant "FIELDLENGTH(46)" }; + + //octetstring with length interval + type octetstring OCT1_260 length(1..260) with { variant "" }; + type octetstring OCT1_8 length(1..8) with { variant "" }; + type octetstring OCT1_12 length(1..12) with { variant "" }; + type octetstring OCT1_32 length(1..32) with { variant "" }; + type octetstring OCT1_50 length(1..50) with { variant "" }; + type octetstring OCT3_8 length(3..8) with { variant "" }; + + type octetstring OCTN with { variant "" }; + + //**************************************************** + // Hexstrings + //**************************************************** + + //hexstring with fixed length + type hexstring HEX1 length(1) with {variant "FIELDLENGTH(1)"}; + + //hexstring with length interval + type hexstring HEX0_16 length(0..16) with { variant "" }; + type hexstring HEX5_16 length(5..16) with { variant "" }; + type hexstring HEX1_32 length(1..32) with { variant "" }; + + + //**************************************************** + // Integers + //**************************************************** + + //integer with fixed octet number + type integer INT1 (0..255) with { variant "FIELDLENGTH(8)" }; + type integer LIN1 (0..255) with { variant "FIELDLENGTH(8)" }; + type integer LIN2 (0..65535) with { variant "FIELDLENGTH(16)" }; + type integer LIN2_BO_LAST (0..65535) with { variant "FIELDLENGTH(16), COMP(nosign), BYTEORDER(last)" }; + type integer LIN3_BO_LAST (0..16777215) with { variant "FIELDLENGTH(24), COMP(nosign), BYTEORDER(last)" }; + type integer LIN4_BO_LAST (0..4294967295) with { variant "FIELDLENGTH(32), COMP(nosign), BYTEORDER(last)" }; + + //integer with fixed bit number + type integer INT1b (0..1) with { variant "FIELDLENGTH(1)" }; + type integer INT2b (0..3) with { variant "FIELDLENGTH(2)" }; + type integer INT3b (0..7) with { variant "FIELDLENGTH(3)" }; + type integer INT4b (0..15) with { variant "FIELDLENGTH(4)" }; + type integer INT5b (0..31) with { variant "FIELDLENGTH(5)" }; + type integer INT6b (0..63) with { variant "FIELDLENGTH(6)" }; + type integer INT7b (0..127) with { variant "FIELDLENGTH(7)" }; + type integer INT11b_BO_LAST ( 0 .. 2047 ) with { variant "FIELDLENGTH(11), COMP(nosign), BYTEORDER(last)" }; + type integer INT12b_BO_LAST ( 0 .. 4095 ) with { variant "FIELDLENGTH(12), COMP(nosign), BYTEORDER(last)" }; + type integer INT13b_BO_LAST ( 0 .. 8191 ) with { variant "FIELDLENGTH(13), COMP(nosign), BYTEORDER(last)" }; + type integer INT14b_BO_LAST ( 0 .. 16383 ) with { variant "FIELDLENGTH(14), COMP(nosign), BYTEORDER(last)" }; + type integer INT20b_BO_LAST ( 0 .. 1048575 ) with { variant "FIELDLENGTH(20), COMP(nosign), BYTEORDER(last)" }; + type integer INT31b_BO_LAST ( 0 .. 2147483647 ) with { variant "FIELDLENGTH(31), COMP(nosign), BYTEORDER(last)" }; + + //**************************************************** + // Structures + //**************************************************** + + //integer record + type record of integer Integers with { variant "" }; + type record of Integers Integer_array with { variant "" }; + +} // end group SimpleRAWEncodedTypes + +group ComponentTypes { + type component Dummy_comptype {} + type component Dummy_CT {} +} // end group ComponentTypes + +group CompositeTypes { + type enumerated Protocols + { mtp3, sccp, isup, bicc, qaal2, gcp, bssap, bssmap, ranap, dtap } + + type record of OCT1 OCT1List with { variant "" }; + type record of OCT2 OCT2List with { variant "" }; + type record of OCT3 OCT3List with { variant "" }; + type record of OCT4 OCT4List with { variant "" }; + type record of OCT5 OCT5List with { variant "" }; + type record of OCT6 OCT6List with { variant "" }; + type record of OCT7 OCT7List with { variant "" }; + + type record of Dummy_comptype ListOfDummy_comptype with { variant "" }; + type record of Dummy_CT ListOfDummy_CT with { variant "" }; + type record of Protocols ProtocolList with { variant "" }; +} // end group CompositeTypes + +} with { encode "JSON" } /* End of module General_Types */ + diff --git a/library/IPL4_GSMTAP_CtrlFunct.ttcn b/library/IPL4_GSMTAP_CtrlFunct.ttcn new file mode 100644 index 00000000..8bdb5921 --- /dev/null +++ b/library/IPL4_GSMTAP_CtrlFunct.ttcn @@ -0,0 +1,44 @@ +module IPL4_GSMTAP_CtrlFunct { + + import from GSMTAP_PortType all; + import from IPL4asp_Types all; + + external function f_IPL4_listen( + inout GSMTAP_PT portRef, + in HostName locName, + in PortNumber locPort, + in ProtoTuple proto, + in OptionList options := {} + ) return Result; + + external function f_IPL4_connect( + inout GSMTAP_PT portRef, + in HostName remName, + in PortNumber remPort, + in HostName locName, + in PortNumber locPort, + in ConnectionId connId, + in ProtoTuple proto, + in OptionList options := {} + ) return Result; + + external function f_IPL4_close( + inout GSMTAP_PT portRef, + in ConnectionId id, + in ProtoTuple proto := { unspecified := {} } + ) return Result; + + external function f_IPL4_setUserData( + inout GSMTAP_PT portRef, + in ConnectionId id, + in UserData userData + ) return Result; + + external function f_IPL4_getUserData( + inout GSMTAP_PT portRef, + in ConnectionId id, + out UserData userData + ) return Result; + +} + diff --git a/library/IPL4_GSMTAP_CtrlFunctDef.cc b/library/IPL4_GSMTAP_CtrlFunctDef.cc new file mode 100644 index 00000000..4c05fe8a --- /dev/null +++ b/library/IPL4_GSMTAP_CtrlFunctDef.cc @@ -0,0 +1,56 @@ +#include "IPL4asp_PortType.hh" +#include "GSMTAP_PortType.hh" +#include "IPL4asp_PT.hh" + +namespace IPL4__GSMTAP__CtrlFunct { + + IPL4asp__Types::Result f__IPL4__listen( + GSMTAP__PortType::GSMTAP__PT& portRef, + const IPL4asp__Types::HostName& locName, + const IPL4asp__Types::PortNumber& locPort, + const IPL4asp__Types::ProtoTuple& proto, + const IPL4asp__Types::OptionList& options) + { + return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options); + } + + IPL4asp__Types::Result f__IPL4__connect( + GSMTAP__PortType::GSMTAP__PT& portRef, + const IPL4asp__Types::HostName& remName, + const IPL4asp__Types::PortNumber& remPort, + const IPL4asp__Types::HostName& locName, + const IPL4asp__Types::PortNumber& locPort, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::ProtoTuple& proto, + const IPL4asp__Types::OptionList& options) + { + return f__IPL4__PROVIDER__connect(portRef, remName, remPort, + locName, locPort, connId, proto, options); + } + + IPL4asp__Types::Result f__IPL4__close( + GSMTAP__PortType::GSMTAP__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::ProtoTuple& proto) + { + return f__IPL4__PROVIDER__close(portRef, connId, proto); + } + + IPL4asp__Types::Result f__IPL4__setUserData( + GSMTAP__PortType::GSMTAP__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::UserData& userData) + { + return f__IPL4__PROVIDER__setUserData(portRef, connId, userData); + } + + IPL4asp__Types::Result f__IPL4__getUserData( + GSMTAP__PortType::GSMTAP__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + IPL4asp__Types::UserData& userData) + { + return f__IPL4__PROVIDER__getUserData(portRef, connId, userData); + } + +} + diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn new file mode 100644 index 00000000..0c26f02a --- /dev/null +++ b/library/Osmocom_Types.ttcn @@ -0,0 +1,29 @@ +module Osmocom_Types { + type integer uint8_t (0..255) with { variant "unsigned 8 bit" }; + type integer uint16_t (0..65535) with { variant "unsigned 16 bit" }; + type integer uint32_t (0..4294967295) with { variant "unsigned 32 bit" }; + + type integer int8_t (-128..127) with { variant "8 bit" }; + type integer int16_t (-32768..32767) with { variant "16 bit" }; + + type integer uint1_t (0..1) with { variant "unsigned 1 bit" }; + type integer uint2_t (0..3) with { variant "unsigned 2 bit" }; + type integer uint3_t (0..7) with { variant "unsigned 3 bit" }; + type integer uint4_t (0..15) with { variant "unsigned 4 bit" }; + type integer uint5_t (0..31) with { variant "unsigned 5 bit" }; + type integer uint6_t (0..63) with { variant "unsigned 6 bit" }; + type integer uint7_t (0..127) with { variant "unsigned 7 bit" }; + type integer uint9_t (0..511) with { variant "unsigned 9 bit" }; + type integer uint10_t (0..1023) with { variant "unsigned 10 bit" }; + type integer uint11_t (0..2047) with { variant "unsigned 11 bit" }; + type integer uint12_t (0..4095) with { variant "unsigned 12 bit" }; + type integer uint13_t (0..8191) with { variant "unsigned 13 bit" }; + type integer uint14_t (0..16383) with { variant "unsigned 14 bit" }; + type integer uint15_t (0..32767) with { variant "unsigned 15 bit" }; + + type record Arfcn { + boolean pcs, + uint15_t arfcn + } with { variant "" }; + +} with { encode "RAW"; variant "FIELDORDER(msb)" } -- cgit v1.2.3