From 16e523d2d07e463da80d3e18e1117c4353dcad0c Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Mon, 10 Jan 2011 23:38:58 +0100 Subject: [PATCH] add IE definitions for most MM/CC IEs --- osmo_codegen.g | 65 ++++++++++---- proto_desc/gsm_l3/cc_ie.dsl | 150 ++++++++++++++++++++++++++++++++ proto_desc/gsm_l3/common_ie.dsl | 58 ++++++++++++ proto_desc/gsm_l3/mm_ie.dsl | 38 ++++++++ 4 files changed, 294 insertions(+), 17 deletions(-) create mode 100644 proto_desc/gsm_l3/cc_ie.dsl create mode 100644 proto_desc/gsm_l3/common_ie.dsl create mode 100644 proto_desc/gsm_l3/mm_ie.dsl diff --git a/osmo_codegen.g b/osmo_codegen.g index c23d99c..7560400 100644 --- a/osmo_codegen.g +++ b/osmo_codegen.g @@ -4,16 +4,45 @@ grammar osmo_codegen; //language = Python; //} root : - pdu_spec* + (pdu_spec | ie_spec | ie_alias)* ; +ie_alias: 'ie_alias' ie_name ie_name; + +ie_name : ID; + +ie_spec : 'ie_spec' ID + ie_field_def* + 'end_ie_spec' + ; + +ie_field_def + : ie_field_name ie_field_len ie_field_type ie_field_opts + ; + +ie_field_name + : ID; +ie_field_len + : (NUMERIC | '*'); +ie_field_type + : ('byte' | 'bytes' | 'bit' | 'bits' | 'bcd'); +ie_field_opts + : field_val? ie_field_cond? ie_field_endian?; +ie_field_cond + : 'if (' ie_field_name COMP_OP NUMERIC ')'; +ie_field_endian + : ('big' | 'little'); + + +/* PDU */ + pdu_spec - : 'pdu_spec' ID - field_def* - 'end_pdu_spec' + : 'pdu_spec' ID + pdu_field_def* + 'end_pdu_spec' ; -field_mode +pdu_field_mode : 'mand' | 'opt' | 'cond'; field_val @@ -22,27 +51,27 @@ field_val field_tag : 'tag' NUMERIC; -field_size +pdu_field_size : NUMERIC ('-' NUMERIC)? ; -field_opts +pdu_field_opts : ('uplink_only' | 'downlink_only') ; -field_type +pdu_field_type : ( - ('V4u' field_val?) - | ('V4l' field_val?) - | ('V' field_size field_val?) - | ('TLV' field_size? field_val? field_tag) - | ('LV' field_size field_val?) - | ('TV' field_size field_val? field_tag) + ('V4u' field_val?) + | ('V4l' field_val?) + | ('V' pdu_field_size field_val?) + | ('TLV' pdu_field_size? field_val? field_tag) + | ('LV' pdu_field_size field_val?) + | ('TV' pdu_field_size field_val? field_tag) | ('T' field_val? field_tag) | ('TV4' field_val? field_tag) - ) field_opts*; + ) pdu_field_opts*; -field_def - : ID field_mode field_type; +pdu_field_def + : ID pdu_field_mode pdu_field_type; /* LEXER RULES */ @@ -72,6 +101,8 @@ STRING : '"' ( ESC_SEQ | ~('\\'|'"') )* '"' ; +COMP_OP : '==' | '<' | '>' | '>=' | '<=' | '!='; + fragment HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; diff --git a/proto_desc/gsm_l3/cc_ie.dsl b/proto_desc/gsm_l3/cc_ie.dsl new file mode 100644 index 0000000..916c3b3 --- /dev/null +++ b/proto_desc/gsm_l3/cc_ie.dsl @@ -0,0 +1,150 @@ + +# 10.5.4.4 Auxiliary states +ie_spec cc_auxiliary_states + content_len 1 byte + mpty_aux_state 2 bits + hold_aux_state 2 bits + spare 3 bits val 0 + ext 1 bit val 1 +end_ie_spec + +# 10.5.4.4a backup bearer capability: too complex +# 10.5.4.5 bearer capability: too complex + +# 10.5.4.5a CC capabilities +ie_spec cc_capabilities + content_len 1 byte + dtmf 1 bit + pcp 1 bit + enicm 1 bit + spare 1 bit val 0 + max_supp_bearers 4 bit + max_speech_bearers 4 bit + spare2 4 bit val 0 +end_ie_spec + +# 10.5.4.6 Call state +ie_spec cc_call_state + call_state 6 bit + coding_standard 2 bit +end_ie_spec + +# 10.5.4.7 Called party BCD number +ie_spec cc_called_party_bcd_number + content_len 1 byte + numbering_plan_id 4 bit + type_of_number 3 bit + ext 1 bit val 1 + digits * bcd +end_ie_spec + +# 10.5.4.8 Called party subaddress +ie_spec cc_called_party_subaddr + content_len 1 byte + spare 3 bit val 0 + odd_even_ind 1 bit + type_of_subaddr 3 bit + ext 1 bit val 1 + subaddr_info * byte +end_ie_spec + +# 10.5.4.9 Calling party BCD number +ie_spec cc_calling_party_bcd_number + content_len 1 byte + numbering_plan_id 4 bit + type_of_number 3 bit + ext1 1 bit + screening_ind 2 bit if (ext1 == 0) + spare 3 bit val 0 if (ext1 == 0) + presentation_ind 2 bit if (ext1 == 0) + ext2 1 bit val 1 if (ext1 == 0) + digits * bcd +end_ie_spec + +# 10.5.4.10 Calling party subaddress +ie_alias cc_calling_party_subaddr cc_called_party_subaddr + +# 10.5.4.11 Cause +ie_spec cc_cause + content_len 1 byte + location 4 bit + spare 1 bit val 0 + coding_standard 2 bit + ext1 1 bit + recommendation 7 bit if (ext1 == 0) + ext2 1 bit val 1 if (ext1 == 0) + cause 7 bit + ext3 1 bit val 1 + diagnostics * byte +end_ie_spec + +# 10.5.4.11a CLIR suppression: no need +# 10.5.4.11b CLIR invocation: no need +# 10.5.4.12 Congestion level: no need + +# 10.5.4.13 Connected number +ie_alias cc_connected_party_bcd_number cc_calling_party_bcd_number + +# 10.5.4.14 Connected subaddress +ie_alias cc_connected_party_subaddr cc_called_party_subaddr + +# 10.5.4.15 Facility: no need + +# 10.5.4.16 Higher layer compatibility +ie_spec cc_high_layer_compat + content_len 1 byte + pres_method 2 bit + interpretation 3 bit + ext1 1 bit val 1 + hl_charact_id 7 bit + ext2 1 bit + ext_hl_charact_id 7 bit if (ext1 == 0) + ext3 1 bit val 1 +end_ie_spec + +# 10.5.4.17 Keypad facility: no need +# 10.5.4.18 Low layer compatibility: no need +# 10.5.4.19 More data: no need +# 10.5.4.20 Notification ind: no need + +# 10.5.4.21 Progress ind +ie_spec cc_progress_ind + content_len 1 byte + location 3 bit + spare 1 bit val 0 + coding_standard 2 bit + ext1 1 bit val 1 + progress_descr 7 bit + ext2 1 bit val 1 +end_ie_spec + +# 10.5.4.21b Redirecting party BCD number +ie_alias cc_redir_party_bcd_number cc_calling_party_bcd_number + +# 10.5.4.21c Redirecting party subaddr +ie_alias cc_redir_party_subaddr cc_calling_party_subaddr + +# 10.5.4.22 Repeat indicator: no need (TV4) +# 10.5.4.22a Reverse call setup direction: no need +# 10.5.4.22b SETUP container: no need +# 10.5.4.23 Signal: no need +# 10.5.4.24 SS Version ind: no need +# 10.5.4.25 User-user +ie_spec cc_user_user + content_len 1 byte + pdisc 1 byte + info * byte +end_ie_spec + +# 10.5.4.26 Alerting Pattern: no need + +# 10.5.4.27 Allowed actions: no need + +# 10.5.4.28 Stream identifier: no need +# 10.5.4.29 Network call control capabilities: no need +# 10.5.4.30 Cause of no CLI: no need +# 10.5.4.31 Void +# 10.5.4.32 Supported codec list: too complex +# 10.5.4.33 Service category: no need +# 10.5.4.34 Redial: no need +# 10.5.4.35: Network-initiated service upgrade indicator: no need diff --git a/proto_desc/gsm_l3/common_ie.dsl b/proto_desc/gsm_l3/common_ie.dsl new file mode 100644 index 0000000..ac3cdfa --- /dev/null +++ b/proto_desc/gsm_l3/common_ie.dsl @@ -0,0 +1,58 @@ +# TODO: we always code bitfields from LSB to MSB, the parser needs to know that! + +ie_spec cell_identity + cell_identity 16 bit big +end_ie_spec + +# 10.5.1.3 Location Area ID +ie_spec la_id + mcc 3 bcd + mnc 3 bcd + lac 16 bit big +end_ie_spec + +# 10.5.1.4 Mobile ID +ie_spec mobile_id + content_len 8 bit + type 3 bit + odd_even_ind 1 bit + identity_digit * bcd +end_ie_spec + +# 10.5.1.5 MS Classmark 1 +ie_spec ms_classmark1 + rf_pwr_capa 3 bit + a51 1 bit + es_ind 1 bit + rev_level 2 bit + spare 1 bit +end_ie_spec + +# 10.5.1.6 MS Classmark 2 +ie_spec ms_classmark2 + content_len 8 bit + rf_pwr_capa 3 bit + a51 1 bit + es_ind 1 bit + rev_level 2 bit + spare 1 bit + fc 1 bit + vgcs 1 bit + vbs 1 bit + sm_capa 1 bit + ss_screen_ind 2 bit + ps_capa 1 bit + spare2 1 bit + a52 1 bit + a53 1 bit + cmsp 1 bit + solsa 1 bit + ucs2 1 bit + lcsva_capa 1 bit + spare3 1 bit + cm3 1 bit +end_ie_spec + +# 10.5.1.7 MS Classmark 3: too complex + +# 10.5.1.11 Priority level: TV4, no need diff --git a/proto_desc/gsm_l3/mm_ie.dsl b/proto_desc/gsm_l3/mm_ie.dsl new file mode 100644 index 0000000..1bc62af --- /dev/null +++ b/proto_desc/gsm_l3/mm_ie.dsl @@ -0,0 +1,38 @@ + +# 10.5.3.1 Auth parameter RAND: no need +# 10.5.3.1.1 Auth parameter AUTN: no need +# 10.5.3.2 Auth response parameter: no need +# 10.5.3.2.1 Auth resp extension: no need +# 10.5.3.2.2 Auth failure parameter: no need +# 10.5.3.3 CM service type: no need (TV4) +# 10.5.3.4 Identity type: no need (TV4) +# 10.5.3.5 Location updating type: no need (TV4) + +# 10.5.3.5a Network Name +ie_spec network_name + num_spare_bits 3 bit + add_ci 1 bit + coding_scheme 3 bit + ext 1 bit + text * byte +end_ie_spec + +# 10.5.3.6 Reject cause: no need, single byte +# 10.5.3.7 Follow on proceed: no need (single byte) +# 10.5.3.8 Time Zone: no need (single byte) +# 10.6.3.9 Time Zone and Time +ie_spec nitz + year 2 bcd + month 2 bcd + day 2 bcd + hour 2 bcd + minute 2 bcd + second 2 bcd + time_zone 2 bcd +end_ie_spec + +# 10.6.3.10 CTS permission: no need (single byte) + +# 10.5.3.11 LSA identifier: no need + +# 10.5.3.13 Emergency Number list (too complex)