From 2954a69d7d5627bf330eb9bb05eb5a1274e01f3a Mon Sep 17 00:00:00 2001 From: Vasil Velichkov Date: Thu, 22 Jun 2017 03:53:26 +0300 Subject: sbc-ap: Dissect several IEs Add dissection of the following IEs: - Serial-Number - Warning-Type - Data-Coding-Scheme - Warning-Message-Contents - Message-Identifier Reuse the code from S1AP wherever possible Change-Id: Icaf78b21532cf91fc2cd225d687a6a11813a20d8 Reviewed-on: https://code.wireshark.org/review/22352 Petri-Dish: Pascal Quantin Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/asn1/s1ap/packet-s1ap-template.c | 12 +- epan/dissectors/asn1/s1ap/packet-s1ap-template.h | 4 + epan/dissectors/asn1/s1ap/s1ap.cnf | 2 +- .../asn1/sbc-ap/packet-sbc-ap-template.c | 84 +++++++++- epan/dissectors/asn1/sbc-ap/sbc-ap.cnf | 71 +++++++++ epan/dissectors/packet-s1ap.c | 14 +- epan/dissectors/packet-s1ap.h | 6 +- epan/dissectors/packet-sbc-ap.c | 170 ++++++++++++++++++--- 8 files changed, 324 insertions(+), 39 deletions(-) diff --git a/epan/dissectors/asn1/s1ap/packet-s1ap-template.c b/epan/dissectors/asn1/s1ap/packet-s1ap-template.c index 9d4e36f4df..3fc39d3dea 100644 --- a/epan/dissectors/asn1/s1ap/packet-s1ap-template.c +++ b/epan/dissectors/asn1/s1ap/packet-s1ap-template.c @@ -248,7 +248,7 @@ s1ap_Time_UE_StayedInCell_EnhancedGranularity_fmt(gchar *s, guint32 v) g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fs", ((float)v)/10); } -static const value_string s1ap_serialNumber_gs_vals[] = { +const value_string s1ap_serialNumber_gs_vals[] = { { 0, "Display mode immediate, cell wide"}, { 1, "Display mode normal, PLMN wide"}, { 2, "Display mode normal, tracking area wide"}, @@ -256,7 +256,7 @@ static const value_string s1ap_serialNumber_gs_vals[] = { { 0, NULL}, }; -static const value_string s1ap_warningType_vals[] = { +const value_string s1ap_warningType_vals[] = { { 0, "Earthquake"}, { 1, "Tsunami"}, { 2, "Earthquake and Tsunami"}, @@ -265,8 +265,8 @@ static const value_string s1ap_warningType_vals[] = { { 0, NULL}, }; -static void -dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs) +void +dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs, int hf_nb_pages, int hf_decoded_page) { guint32 offset; guint8 nb_of_pages, length, *str; @@ -275,7 +275,7 @@ dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, int i; nb_of_pages = tvb_get_guint8(warning_msg_tvb, 0); - ti = proto_tree_add_uint(tree, hf_s1ap_WarningMessageContents_nb_pages, warning_msg_tvb, 0, 1, nb_of_pages); + ti = proto_tree_add_uint(tree, hf_nb_pages, warning_msg_tvb, 0, 1, nb_of_pages); if (nb_of_pages > 15) { expert_add_info_format(pinfo, ti, &ei_s1ap_number_pages_le15, "Number of pages should be <=15 (found %u)", nb_of_pages); @@ -287,7 +287,7 @@ dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, cb_data_tvb = dissect_cbs_data(dcs, cb_data_page_tvb, tree, pinfo, 0); if (cb_data_tvb) { str = tvb_get_string_enc(wmem_packet_scope(), cb_data_tvb, 0, tvb_reported_length(cb_data_tvb), ENC_UTF_8|ENC_NA); - proto_tree_add_string_format(tree, hf_s1ap_WarningMessageContents_decoded_page, warning_msg_tvb, offset, 83, + proto_tree_add_string_format(tree, hf_decoded_page, warning_msg_tvb, offset, 83, str, "Decoded Page %u: %s", i+1, str); } offset += 83; diff --git a/epan/dissectors/asn1/s1ap/packet-s1ap-template.h b/epan/dissectors/asn1/s1ap/packet-s1ap-template.h index 51be20e70e..45348f1bd7 100644 --- a/epan/dissectors/asn1/s1ap/packet-s1ap-template.h +++ b/epan/dissectors/asn1/s1ap/packet-s1ap-template.h @@ -30,6 +30,10 @@ typedef struct _s1ap_ctx_t { guint32 ProtocolExtensionID; } s1ap_ctx_t; +extern const value_string s1ap_warningType_vals[]; +extern const value_string s1ap_serialNumber_gs_vals[]; + +void dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs, int hf_nb_pages, int hf_decoded_page); #include "packet-s1ap-exp.h" diff --git a/epan/dissectors/asn1/s1ap/s1ap.cnf b/epan/dissectors/asn1/s1ap/s1ap.cnf index 000b3bd8f3..7a031802cb 100644 --- a/epan/dissectors/asn1/s1ap/s1ap.cnf +++ b/epan/dissectors/asn1/s1ap/s1ap.cnf @@ -886,7 +886,7 @@ RepetitionPeriod DISPLAY=BASE_DEC|BASE_UNIT_STRING STRINGS=&units_seconds if (parameter_tvb) { struct s1ap_private_data *s1ap_data = s1ap_get_private_data(actx->pinfo); proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_s1ap_WarningMessageContents); - dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, s1ap_data->data_coding_scheme); + dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, s1ap_data->data_coding_scheme, hf_s1ap_WarningMessageContents_nb_pages, hf_s1ap_WarningMessageContents_decoded_page); } #.FN_BODY MSClassmark2 VAL_PTR = ¶meter_tvb diff --git a/epan/dissectors/asn1/sbc-ap/packet-sbc-ap-template.c b/epan/dissectors/asn1/sbc-ap/packet-sbc-ap-template.c index 3a012d404b..c1aeac53c6 100644 --- a/epan/dissectors/asn1/sbc-ap/packet-sbc-ap-template.c +++ b/epan/dissectors/asn1/sbc-ap/packet-sbc-ap-template.c @@ -28,10 +28,14 @@ #include #include #include +#include #include "packet-ber.h" #include "packet-per.h" #include "packet-e212.h" +#include "packet-gsm_map.h" +#include "packet-s1ap.h" +#include "packet-lte-rrc.h" #define PNAME "SBc Application Part" #define PSNAME "SBCAP" @@ -52,10 +56,22 @@ static dissector_handle_t sbc_ap_handle=NULL; /* Initialize the protocol and registered fields */ static int proto_sbc_ap = -1; +static int hf_sbc_ap_Serial_Number_gs = -1; +static int hf_sbc_ap_Serial_Number_msg_code = -1; +static int hf_sbc_ap_Serial_Number_upd_nb = -1; +static int hf_sbc_ap_Warning_Type_value = -1; +static int hf_sbc_ap_Warning_Type_emergency_user_alert = -1; +static int hf_sbc_ap_Warning_Type_popup = -1; +static int hf_sbc_ap_Warning_Message_Contents_nb_pages = -1; +static int hf_sbc_ap_Warning_Message_Contents_decoded_page = -1; #include "packet-sbc-ap-hf.c" /* Initialize the subtree pointers */ static int ett_sbc_ap = -1; +static int ett_sbc_ap_Serial_Number = -1; +static int ett_sbc_ap_Warning_Type = -1; +static int ett_sbc_ap_Data_Coding_Scheme = -1; +static int ett_sbc_ap_Warning_Message_Contents = -1; #include "packet-sbc-ap-ett.c" @@ -65,6 +81,10 @@ enum{ UNSUCCESSFUL_OUTCOME }; +struct sbc_ap_private_data { + guint8 data_coding_scheme; +}; + /* Global variables */ static guint32 ProcedureCode; static guint32 ProtocolIE_ID; @@ -84,6 +104,18 @@ static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); + +static struct sbc_ap_private_data* +sbc_ap_get_private_data(packet_info *pinfo) +{ + struct sbc_ap_private_data *sbc_ap_data = (struct sbc_ap_private_data*)p_get_proto_data(pinfo->pool, pinfo, proto_sbc_ap, 0); + if (!sbc_ap_data) { + sbc_ap_data = wmem_new0(pinfo->pool, struct sbc_ap_private_data); + p_add_proto_data(pinfo->pool, pinfo, proto_sbc_ap, 0, sbc_ap_data); + } + return sbc_ap_data; +} + #include "packet-sbc-ap-fn.c" static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) @@ -146,13 +178,48 @@ void proto_register_sbc_ap(void) { /* List of fields */ static hf_register_info hf[] = { - + { &hf_sbc_ap_Serial_Number_gs, + { "Geographical Scope", "sbc_ap.SerialNumber.gs", + FT_UINT16, BASE_DEC, VALS(s1ap_serialNumber_gs_vals), 0xc000, + NULL, HFILL }}, + { &hf_sbc_ap_Serial_Number_msg_code, + { "Message Code", "sbc_ap.SerialNumber.msg_code", + FT_UINT16, BASE_DEC, NULL, 0x3ff0, + NULL, HFILL }}, + { &hf_sbc_ap_Serial_Number_upd_nb, + { "Update Number", "sbc_ap.SerialNumber.upd_nb", + FT_UINT16, BASE_DEC, NULL, 0x000f, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_value, + { "Warning Type Value", "sbc-ap.WarningType.value", + FT_UINT16, BASE_DEC, VALS(s1ap_warningType_vals), 0xfe00, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_emergency_user_alert, + { "Emergency User Alert", "sbc-ap.WarningType.emergency_user_alert", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_popup, + { "Popup", "sbc-ap.WarningType.popup", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Message_Contents_nb_pages, + { "Number of Pages", "sbc-ap.WarningMessageContents.nb_pages", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Message_Contents_decoded_page, + { "Decoded Page", "sbc-ap.WarningMessageContents.decoded_page", + FT_STRING, STR_UNICODE, NULL, 0, + NULL, HFILL }}, #include "packet-sbc-ap-hfarr.c" }; /* List of subtrees */ static gint *ett[] = { &ett_sbc_ap, + &ett_sbc_ap_Serial_Number, + &ett_sbc_ap_Warning_Type, + &ett_sbc_ap_Data_Coding_Scheme, + &ett_sbc_ap_Warning_Message_Contents, #include "packet-sbc-ap-ettarr.c" }; @@ -201,6 +268,15 @@ proto_reg_handoff_sbc_ap(void) } - - - +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ diff --git a/epan/dissectors/asn1/sbc-ap/sbc-ap.cnf b/epan/dissectors/asn1/sbc-ap/sbc-ap.cnf index b8af92f784..8be6db45b6 100644 --- a/epan/dissectors/asn1/sbc-ap/sbc-ap.cnf +++ b/epan/dissectors/asn1/sbc-ap/sbc-ap.cnf @@ -176,3 +176,74 @@ Stop-Warning-Request N sbc_ap.proc.imsg id-Stop-Warning Stop-Warning-Response N sbc_ap.proc.sout id-Stop-Warning #.END + +#.TYPE_ATTR +Message-Identifier TYPE = FT_UINT16 DISPLAY = BASE_DEC|BASE_EXT_STRING STRINGS = <e_rrc_messageIdentifier_vals_ext + +#.FN_BODY Message-Identifier VAL_PTR = ¶meter_tvb HF_INDEX = -1 + tvbuff_t *parameter_tvb = NULL; +%(DEFAULT_BODY)s + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + +#.FN_BODY Serial-Number VAL_PTR = ¶meter_tvb + tvbuff_t *parameter_tvb = NULL; +%(DEFAULT_BODY)s + if (parameter_tvb) { + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Serial_Number); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_gs, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_msg_code, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_upd_nb, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + +#.TYPE_ATTR +Repetition-Period DISPLAY=BASE_DEC|BASE_UNIT_STRING STRINGS=&units_seconds + +#.TYPE_ATTR +Extended-Repetition-Period DISPLAY=BASE_DEC|BASE_UNIT_STRING STRINGS=&units_seconds + +#.FN_BODY Warning-Type VAL_PTR = ¶meter_tvb + tvbuff_t *parameter_tvb = NULL; +%(DEFAULT_BODY)s + if (parameter_tvb) { + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Warning_Type); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_value, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_emergency_user_alert, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_popup, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + +#.FN_BODY Data-Coding-Scheme VAL_PTR = ¶meter_tvb + tvbuff_t *parameter_tvb = NULL; +%(DEFAULT_BODY)s + if (parameter_tvb) { + struct sbc_ap_private_data *sbc_ap_data = sbc_ap_get_private_data(actx->pinfo); + proto_tree *subtree; + + subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Data_Coding_Scheme); + sbc_ap_data->data_coding_scheme = dissect_cbs_data_coding_scheme(parameter_tvb, actx->pinfo, subtree, 0); + } + +#.FN_BODY Warning-Message-Content VAL_PTR = ¶meter_tvb + tvbuff_t *parameter_tvb = NULL; +%(DEFAULT_BODY)s + if (parameter_tvb) { + struct sbc_ap_private_data *sbc_ap_data = sbc_ap_get_private_data(actx->pinfo); + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Warning_Message_Contents); + dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, sbc_ap_data->data_coding_scheme, hf_sbc_ap_Warning_Message_Contents_nb_pages, hf_sbc_ap_Warning_Message_Contents_decoded_page); + } + + +# +# Editor modelines - http://www.wireshark.org/tools/modelines.html +# +# Local variables: +# c-basic-offset: 2 +# tab-width: 8 +# indent-tabs-mode: nil +# End: +# +# vi: set shiftwidth=2 tabstop=8 expandtab: +# :indentSize=2:tabSize=8:noTabs=true: +# diff --git a/epan/dissectors/packet-s1ap.c b/epan/dissectors/packet-s1ap.c index 4ac9c25ff8..e2f0455e17 100644 --- a/epan/dissectors/packet-s1ap.c +++ b/epan/dissectors/packet-s1ap.c @@ -1616,7 +1616,7 @@ s1ap_Time_UE_StayedInCell_EnhancedGranularity_fmt(gchar *s, guint32 v) g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fs", ((float)v)/10); } -static const value_string s1ap_serialNumber_gs_vals[] = { +const value_string s1ap_serialNumber_gs_vals[] = { { 0, "Display mode immediate, cell wide"}, { 1, "Display mode normal, PLMN wide"}, { 2, "Display mode normal, tracking area wide"}, @@ -1624,7 +1624,7 @@ static const value_string s1ap_serialNumber_gs_vals[] = { { 0, NULL}, }; -static const value_string s1ap_warningType_vals[] = { +const value_string s1ap_warningType_vals[] = { { 0, "Earthquake"}, { 1, "Tsunami"}, { 2, "Earthquake and Tsunami"}, @@ -1633,8 +1633,8 @@ static const value_string s1ap_warningType_vals[] = { { 0, NULL}, }; -static void -dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs) +void +dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs, int hf_nb_pages, int hf_decoded_page) { guint32 offset; guint8 nb_of_pages, length, *str; @@ -1643,7 +1643,7 @@ dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, int i; nb_of_pages = tvb_get_guint8(warning_msg_tvb, 0); - ti = proto_tree_add_uint(tree, hf_s1ap_WarningMessageContents_nb_pages, warning_msg_tvb, 0, 1, nb_of_pages); + ti = proto_tree_add_uint(tree, hf_nb_pages, warning_msg_tvb, 0, 1, nb_of_pages); if (nb_of_pages > 15) { expert_add_info_format(pinfo, ti, &ei_s1ap_number_pages_le15, "Number of pages should be <=15 (found %u)", nb_of_pages); @@ -1655,7 +1655,7 @@ dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, cb_data_tvb = dissect_cbs_data(dcs, cb_data_page_tvb, tree, pinfo, 0); if (cb_data_tvb) { str = tvb_get_string_enc(wmem_packet_scope(), cb_data_tvb, 0, tvb_reported_length(cb_data_tvb), ENC_UTF_8|ENC_NA); - proto_tree_add_string_format(tree, hf_s1ap_WarningMessageContents_decoded_page, warning_msg_tvb, offset, 83, + proto_tree_add_string_format(tree, hf_decoded_page, warning_msg_tvb, offset, 83, str, "Decoded Page %u: %s", i+1, str); } offset += 83; @@ -8129,7 +8129,7 @@ dissect_s1ap_WarningMessageContents(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_ if (parameter_tvb) { struct s1ap_private_data *s1ap_data = s1ap_get_private_data(actx->pinfo); proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_s1ap_WarningMessageContents); - dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, s1ap_data->data_coding_scheme); + dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, s1ap_data->data_coding_scheme, hf_s1ap_WarningMessageContents_nb_pages, hf_s1ap_WarningMessageContents_decoded_page); } diff --git a/epan/dissectors/packet-s1ap.h b/epan/dissectors/packet-s1ap.h index 8a175927ef..8da5fb4a09 100644 --- a/epan/dissectors/packet-s1ap.h +++ b/epan/dissectors/packet-s1ap.h @@ -38,6 +38,10 @@ typedef struct _s1ap_ctx_t { guint32 ProtocolExtensionID; } s1ap_ctx_t; +extern const value_string s1ap_warningType_vals[]; +extern const value_string s1ap_serialNumber_gs_vals[]; + +void dissect_s1ap_warningMessageContents(tvbuff_t *warning_msg_tvb, proto_tree *tree, packet_info *pinfo, guint8 dcs, int hf_nb_pages, int hf_decoded_page); /*--- Included file: packet-s1ap-exp.h ---*/ @@ -62,7 +66,7 @@ int dissect_s1ap_SONtransferResponseContainer_PDU(tvbuff_t *tvb _U_, packet_info int dissect_s1ap_SONtransferCause_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, void *data _U_); /*--- End of included file: packet-s1ap-exp.h ---*/ -#line 35 "./asn1/s1ap/packet-s1ap-template.h" +#line 39 "./asn1/s1ap/packet-s1ap-template.h" #endif /* PACKET_S1AP_H */ diff --git a/epan/dissectors/packet-sbc-ap.c b/epan/dissectors/packet-sbc-ap.c index e7e6fcfd25..a2f89fe8ea 100644 --- a/epan/dissectors/packet-sbc-ap.c +++ b/epan/dissectors/packet-sbc-ap.c @@ -36,10 +36,14 @@ #include #include #include +#include #include "packet-ber.h" #include "packet-per.h" #include "packet-e212.h" +#include "packet-gsm_map.h" +#include "packet-s1ap.h" +#include "packet-lte-rrc.h" #define PNAME "SBc Application Part" #define PSNAME "SBCAP" @@ -98,11 +102,19 @@ typedef enum _ProtocolIE_ID_enum { } ProtocolIE_ID_enum; /*--- End of included file: packet-sbc-ap-val.h ---*/ -#line 51 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 55 "./asn1/sbc-ap/packet-sbc-ap-template.c" /* Initialize the protocol and registered fields */ static int proto_sbc_ap = -1; +static int hf_sbc_ap_Serial_Number_gs = -1; +static int hf_sbc_ap_Serial_Number_msg_code = -1; +static int hf_sbc_ap_Serial_Number_upd_nb = -1; +static int hf_sbc_ap_Warning_Type_value = -1; +static int hf_sbc_ap_Warning_Type_emergency_user_alert = -1; +static int hf_sbc_ap_Warning_Type_popup = -1; +static int hf_sbc_ap_Warning_Message_Contents_nb_pages = -1; +static int hf_sbc_ap_Warning_Message_Contents_decoded_page = -1; /*--- Included file: packet-sbc-ap-hf.c ---*/ #line 1 "./asn1/sbc-ap/packet-sbc-ap-hf.c" @@ -163,10 +175,14 @@ static int hf_sbc_ap_successfulOutcome_value = -1; /* SuccessfulOutcome_value * static int hf_sbc_ap_unsuccessfulOutcome_value = -1; /* UnsuccessfulOutcome_value */ /*--- End of included file: packet-sbc-ap-hf.c ---*/ -#line 56 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 68 "./asn1/sbc-ap/packet-sbc-ap-template.c" /* Initialize the subtree pointers */ static int ett_sbc_ap = -1; +static int ett_sbc_ap_Serial_Number = -1; +static int ett_sbc_ap_Warning_Type = -1; +static int ett_sbc_ap_Data_Coding_Scheme = -1; +static int ett_sbc_ap_Warning_Message_Contents = -1; /*--- Included file: packet-sbc-ap-ett.c ---*/ @@ -196,7 +212,7 @@ static gint ett_sbc_ap_SuccessfulOutcome = -1; static gint ett_sbc_ap_UnsuccessfulOutcome = -1; /*--- End of included file: packet-sbc-ap-ett.c ---*/ -#line 61 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 77 "./asn1/sbc-ap/packet-sbc-ap-template.c" enum{ INITIATING_MESSAGE, @@ -204,6 +220,10 @@ enum{ UNSUCCESSFUL_OUTCOME }; +struct sbc_ap_private_data { + guint8 data_coding_scheme; +}; + /* Global variables */ static guint32 ProcedureCode; static guint32 ProtocolIE_ID; @@ -224,6 +244,18 @@ static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, pro static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *); +static struct sbc_ap_private_data* +sbc_ap_get_private_data(packet_info *pinfo) +{ + struct sbc_ap_private_data *sbc_ap_data = (struct sbc_ap_private_data*)p_get_proto_data(pinfo->pool, pinfo, proto_sbc_ap, 0); + if (!sbc_ap_data) { + sbc_ap_data = wmem_new0(pinfo->pool, struct sbc_ap_private_data); + p_add_proto_data(pinfo->pool, pinfo, proto_sbc_ap, 0, sbc_ap_data); + } + return sbc_ap_data; +} + + /*--- Included file: packet-sbc-ap-fn.c ---*/ #line 1 "./asn1/sbc-ap/packet-sbc-ap-fn.c" @@ -538,8 +570,20 @@ dissect_sbc_ap_Criticality_Diagnostics(tvbuff_t *tvb _U_, int offset _U_, asn1_c static int dissect_sbc_ap_Data_Coding_Scheme(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 218 "./asn1/sbc-ap/sbc-ap.cnf" + tvbuff_t *parameter_tvb = NULL; offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - 8, 8, FALSE, NULL, NULL); + 8, 8, FALSE, ¶meter_tvb, NULL); + + if (parameter_tvb) { + struct sbc_ap_private_data *sbc_ap_data = sbc_ap_get_private_data(actx->pinfo); + proto_tree *subtree; + + subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Data_Coding_Scheme); + sbc_ap_data->data_coding_scheme = dissect_cbs_data_coding_scheme(parameter_tvb, actx->pinfo, subtree, 0); + } + + return offset; } @@ -687,8 +731,16 @@ dissect_sbc_ap_List_of_TAIs(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx static int dissect_sbc_ap_Message_Identifier(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - 16, 16, FALSE, NULL, NULL); +#line 184 "./asn1/sbc-ap/sbc-ap.cnf" + tvbuff_t *parameter_tvb = NULL; + offset = dissect_per_bit_string(tvb, offset, actx, tree, -1, + 16, 16, FALSE, ¶meter_tvb, NULL); + + if (parameter_tvb) { + actx->created_item = proto_tree_add_item(tree, hf_index, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + return offset; } @@ -727,8 +779,19 @@ dissect_sbc_ap_Repetition_Period(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t * static int dissect_sbc_ap_Serial_Number(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 191 "./asn1/sbc-ap/sbc-ap.cnf" + tvbuff_t *parameter_tvb = NULL; offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, - 16, 16, FALSE, NULL, NULL); + 16, 16, FALSE, ¶meter_tvb, NULL); + + if (parameter_tvb) { + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Serial_Number); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_gs, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_msg_code, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Serial_Number_upd_nb, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + return offset; } @@ -775,8 +838,19 @@ dissect_sbc_ap_Warning_Area_List(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t * static int dissect_sbc_ap_Warning_Message_Content(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 229 "./asn1/sbc-ap/sbc-ap.cnf" + tvbuff_t *parameter_tvb = NULL; offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 1, 9600, FALSE, NULL); + 1, 9600, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + struct sbc_ap_private_data *sbc_ap_data = sbc_ap_get_private_data(actx->pinfo); + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Warning_Message_Contents); + dissect_s1ap_warningMessageContents(parameter_tvb, subtree, actx->pinfo, sbc_ap_data->data_coding_scheme, hf_sbc_ap_Warning_Message_Contents_nb_pages, hf_sbc_ap_Warning_Message_Contents_decoded_page); + } + + + return offset; } @@ -795,8 +869,20 @@ dissect_sbc_ap_Warning_Security_Information(tvbuff_t *tvb _U_, int offset _U_, a static int dissect_sbc_ap_Warning_Type(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { +#line 207 "./asn1/sbc-ap/sbc-ap.cnf" + tvbuff_t *parameter_tvb = NULL; offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, - 2, 2, FALSE, NULL); + 2, 2, FALSE, ¶meter_tvb); + + if (parameter_tvb) { + proto_tree *subtree = proto_item_add_subtree(actx->created_item, ett_sbc_ap_Warning_Type); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_value, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_emergency_user_alert, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + proto_tree_add_item(subtree, hf_sbc_ap_Warning_Type_popup, parameter_tvb, 0, 2, ENC_BIG_ENDIAN); + } + + + return offset; } @@ -1125,7 +1211,7 @@ static int dissect_SBC_AP_PDU_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pro /*--- End of included file: packet-sbc-ap-fn.c ---*/ -#line 88 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 120 "./asn1/sbc-ap/packet-sbc-ap-template.c" static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { @@ -1187,7 +1273,38 @@ void proto_register_sbc_ap(void) { /* List of fields */ static hf_register_info hf[] = { - + { &hf_sbc_ap_Serial_Number_gs, + { "Geographical Scope", "sbc_ap.SerialNumber.gs", + FT_UINT16, BASE_DEC, VALS(s1ap_serialNumber_gs_vals), 0xc000, + NULL, HFILL }}, + { &hf_sbc_ap_Serial_Number_msg_code, + { "Message Code", "sbc_ap.SerialNumber.msg_code", + FT_UINT16, BASE_DEC, NULL, 0x3ff0, + NULL, HFILL }}, + { &hf_sbc_ap_Serial_Number_upd_nb, + { "Update Number", "sbc_ap.SerialNumber.upd_nb", + FT_UINT16, BASE_DEC, NULL, 0x000f, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_value, + { "Warning Type Value", "sbc-ap.WarningType.value", + FT_UINT16, BASE_DEC, VALS(s1ap_warningType_vals), 0xfe00, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_emergency_user_alert, + { "Emergency User Alert", "sbc-ap.WarningType.emergency_user_alert", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0100, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Type_popup, + { "Popup", "sbc-ap.WarningType.popup", + FT_BOOLEAN, 16, TFS(&tfs_yes_no), 0x0080, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Message_Contents_nb_pages, + { "Number of Pages", "sbc-ap.WarningMessageContents.nb_pages", + FT_UINT8, BASE_DEC, NULL, 0, + NULL, HFILL }}, + { &hf_sbc_ap_Warning_Message_Contents_decoded_page, + { "Decoded Page", "sbc-ap.WarningMessageContents.decoded_page", + FT_STRING, STR_UNICODE, NULL, 0, + NULL, HFILL }}, /*--- Included file: packet-sbc-ap-hfarr.c ---*/ #line 1 "./asn1/sbc-ap/packet-sbc-ap-hfarr.c" @@ -1209,7 +1326,7 @@ void proto_register_sbc_ap(void) { NULL, HFILL }}, { &hf_sbc_ap_Extended_Repetition_Period_PDU, { "Extended-Repetition-Period", "sbc-ap.Extended_Repetition_Period", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0, NULL, HFILL }}, { &hf_sbc_ap_List_of_TAIs_PDU, { "List-of-TAIs", "sbc-ap.List_of_TAIs", @@ -1217,7 +1334,7 @@ void proto_register_sbc_ap(void) { NULL, HFILL }}, { &hf_sbc_ap_Message_Identifier_PDU, { "Message-Identifier", "sbc-ap.Message_Identifier", - FT_BYTES, BASE_NONE, NULL, 0, + FT_UINT16, BASE_DEC|BASE_EXT_STRING, <e_rrc_messageIdentifier_vals_ext, 0, NULL, HFILL }}, { &hf_sbc_ap_Number_of_Broadcasts_Requested_PDU, { "Number-of-Broadcasts-Requested", "sbc-ap.Number_of_Broadcasts_Requested", @@ -1229,7 +1346,7 @@ void proto_register_sbc_ap(void) { NULL, HFILL }}, { &hf_sbc_ap_Repetition_Period_PDU, { "Repetition-Period", "sbc-ap.Repetition_Period", - FT_UINT32, BASE_DEC, NULL, 0, + FT_UINT32, BASE_DEC|BASE_UNIT_STRING, &units_seconds, 0, NULL, HFILL }}, { &hf_sbc_ap_Serial_Number_PDU, { "Serial-Number", "sbc-ap.Serial_Number", @@ -1413,12 +1530,16 @@ void proto_register_sbc_ap(void) { "UnsuccessfulOutcome_value", HFILL }}, /*--- End of included file: packet-sbc-ap-hfarr.c ---*/ -#line 151 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 214 "./asn1/sbc-ap/packet-sbc-ap-template.c" }; /* List of subtrees */ static gint *ett[] = { &ett_sbc_ap, + &ett_sbc_ap_Serial_Number, + &ett_sbc_ap_Warning_Type, + &ett_sbc_ap_Data_Coding_Scheme, + &ett_sbc_ap_Warning_Message_Contents, /*--- Included file: packet-sbc-ap-ettarr.c ---*/ #line 1 "./asn1/sbc-ap/packet-sbc-ap-ettarr.c" @@ -1447,7 +1568,7 @@ void proto_register_sbc_ap(void) { &ett_sbc_ap_UnsuccessfulOutcome, /*--- End of included file: packet-sbc-ap-ettarr.c ---*/ -#line 157 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 224 "./asn1/sbc-ap/packet-sbc-ap-template.c" }; @@ -1505,7 +1626,7 @@ proto_reg_handoff_sbc_ap(void) /*--- End of included file: packet-sbc-ap-dis-tab.c ---*/ -#line 190 "./asn1/sbc-ap/packet-sbc-ap-template.c" +#line 257 "./asn1/sbc-ap/packet-sbc-ap-template.c" } else { if (SctpPort != 0) { dissector_delete_uint("sctp.port", SctpPort, sbc_ap_handle); @@ -1520,6 +1641,15 @@ proto_reg_handoff_sbc_ap(void) } - - - +/* + * Editor modelines + * + * Local Variables: + * c-basic-offset: 2 + * tab-width: 8 + * indent-tabs-mode: nil + * End: + * + * ex: set shiftwidth=2 tabstop=8 expandtab: + * :indentSize=2:tabSize=8:noTabs=true: + */ -- cgit v1.2.1