diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-02 20:52:14 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-02 19:44:53 +0000 |
commit | 470086f059246b7f4a204def34cea130e5a3af61 (patch) | |
tree | bc03ca8a522d42a94849384621ec4669703c8444 /epan/dissectors/asn1/x2ap | |
parent | 7a6610fc996940974eaafdcf8bff19298308ed72 (diff) |
X2AP: upgrade dissector to v13.5.0
Also get rid of two global variables
Change-Id: I8c20decb76f5c1773f58efd24d2e1e7d1177d358
Reviewed-on: https://code.wireshark.org/review/18029
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'epan/dissectors/asn1/x2ap')
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-CommonDataTypes.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-Constants.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-Containers.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-IEs.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-PDU-Contents.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/X2AP-PDU-Descriptions.asn | 2 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/packet-x2ap-template.c | 90 | ||||
-rw-r--r-- | epan/dissectors/asn1/x2ap/x2ap.cnf | 21 |
8 files changed, 82 insertions, 41 deletions
diff --git a/epan/dissectors/asn1/x2ap/X2AP-CommonDataTypes.asn b/epan/dissectors/asn1/x2ap/X2AP-CommonDataTypes.asn index 9500efc8d6..4d87b16f69 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-CommonDataTypes.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-CommonDataTypes.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.6 Common definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/X2AP-Constants.asn b/epan/dissectors/asn1/x2ap/X2AP-Constants.asn index 75c68bcb5a..f65e3958ec 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-Constants.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-Constants.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.7 Constant Definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/X2AP-Containers.asn b/epan/dissectors/asn1/x2ap/X2AP-Containers.asn index 229223136e..8559d4d5d7 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-Containers.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-Containers.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.8 Container Definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/X2AP-IEs.asn b/epan/dissectors/asn1/x2ap/X2AP-IEs.asn index 19ac734974..34d2feb466 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-IEs.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-IEs.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.5 Information Element Definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/X2AP-PDU-Contents.asn b/epan/dissectors/asn1/x2ap/X2AP-PDU-Contents.asn index cd3df4271c..c0f8197244 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-PDU-Contents.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-PDU-Contents.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.4 PDU Definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/X2AP-PDU-Descriptions.asn b/epan/dissectors/asn1/x2ap/X2AP-PDU-Descriptions.asn index e05000d143..aee262e1bf 100644 --- a/epan/dissectors/asn1/x2ap/X2AP-PDU-Descriptions.asn +++ b/epan/dissectors/asn1/x2ap/X2AP-PDU-Descriptions.asn @@ -1,4 +1,4 @@ --- 3GPP TS 36.423 V13.4.0 (2016-06) +-- 3GPP TS 36.423 V13.5.0 (2016-09) -- 9.3.3 Elementary Procedure Definitions -- ************************************************************** -- diff --git a/epan/dissectors/asn1/x2ap/packet-x2ap-template.c b/epan/dissectors/asn1/x2ap/packet-x2ap-template.c index 6bbe41d3f0..f932ee1a57 100644 --- a/epan/dissectors/asn1/x2ap/packet-x2ap-template.c +++ b/epan/dissectors/asn1/x2ap/packet-x2ap-template.c @@ -24,7 +24,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * Ref: - * 3GPP TS 36.423 V13.4.0 (2016-06) + * 3GPP TS 36.423 V13.5.0 (2016-09) */ #include "config.h" @@ -34,6 +34,7 @@ #include <epan/asn1.h> #include <epan/prefs.h> #include <epan/sctpppids.h> +#include <epan/proto_data.h> #include "packet-per.h" #include "packet-e212.h" @@ -136,10 +137,25 @@ static int ett_x2ap_transmissionModes = -1; static int ett_x2ap_X2AP_Message = -1; #include "packet-x2ap-ett.c" +struct x2ap_private_data { + guint32 procedure_code; + guint32 protocol_ie_id; +}; + +enum { + X2AP_RRC_CONTEXT_LTE, + X2AP_RRC_CONTEXT_NBIOT +}; + +static const enum_val_t x2ap_rrc_context_vals[] = { + {"lte", "LTE", X2AP_RRC_CONTEXT_LTE}, + {"nb-iot","NB-IoT", X2AP_RRC_CONTEXT_NBIOT}, + {NULL, NULL, -1} +}; + /* Global variables */ -static guint32 ProcedureCode; -static guint32 ProtocolIE_ID; static guint gbl_x2apSctpPort=SCTP_PORT_X2AP; +static gint g_x2ap_dissect_rrc_context_as = X2AP_RRC_CONTEXT_LTE; /* Dissector tables */ static dissector_table_t x2ap_ies_dissector_table; @@ -197,31 +213,52 @@ x2ap_Threshold_RSRQ_fmt(gchar *s, guint32 v) g_snprintf(s, ITEM_LABEL_LENGTH, "%.1fdB (%u)", ((float)v/2)-20, v); } +static struct x2ap_private_data* +x2ap_get_private_data(packet_info *pinfo) +{ + struct x2ap_private_data *x2ap_data = (struct x2ap_private_data*)p_get_proto_data(pinfo->pool, pinfo, proto_x2ap, 0); + if (!x2ap_data) { + x2ap_data = wmem_new0(pinfo->pool, struct x2ap_private_data); + p_add_proto_data(pinfo->pool, pinfo, proto_x2ap, 0, x2ap_data); + } + return x2ap_data; +} + #include "packet-x2ap-fn.c" static int dissect_ProtocolIEFieldValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return (dissector_try_uint(x2ap_ies_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(pinfo); + + return (dissector_try_uint(x2ap_ies_dissector_table, x2ap_data->protocol_ie_id, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; } static int dissect_ProtocolExtensionFieldExtensionValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return (dissector_try_uint(x2ap_extension_dissector_table, ProtocolIE_ID, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(pinfo); + + return (dissector_try_uint(x2ap_extension_dissector_table, x2ap_data->protocol_ie_id, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; } static int dissect_InitiatingMessageValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return (dissector_try_uint(x2ap_proc_imsg_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(pinfo); + + return (dissector_try_uint(x2ap_proc_imsg_dissector_table, x2ap_data->procedure_code, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; } static int dissect_SuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return (dissector_try_uint(x2ap_proc_sout_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(pinfo); + + return (dissector_try_uint(x2ap_proc_sout_dissector_table, x2ap_data->procedure_code, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; } static int dissect_UnsuccessfulOutcomeValue(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { - return (dissector_try_uint(x2ap_proc_uout_dissector_table, ProcedureCode, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(pinfo); + + return (dissector_try_uint(x2ap_proc_uout_dissector_table, x2ap_data->procedure_code, tvb, pinfo, tree)) ? tvb_captured_length(tvb) : 0; } static int @@ -515,7 +552,9 @@ void proto_register_x2ap(void) { "Set the SCTP port for X2AP messages", 10, &gbl_x2apSctpPort); - + prefs_register_enum_preference(x2ap_module, "dissect_rrc_context_as", "Dissect RRC Context as", + "Select whether RRC Context should be dissected as legacy LTE or NB-IOT", + &g_x2ap_dissect_rrc_context_as, x2ap_rrc_context_vals, FALSE); } @@ -523,25 +562,24 @@ void proto_register_x2ap(void) { void proto_reg_handoff_x2ap(void) { - static gboolean Initialized=FALSE; - static guint SctpPort; + static gboolean Initialized=FALSE; + static guint SctpPort; - if (!Initialized) { - dissector_add_for_decode_as("sctp.port", x2ap_handle); - dissector_add_uint("sctp.ppi", X2AP_PAYLOAD_PROTOCOL_ID, x2ap_handle); - Initialized=TRUE; + if (!Initialized) { + dissector_add_for_decode_as("sctp.port", x2ap_handle); + dissector_add_uint("sctp.ppi", X2AP_PAYLOAD_PROTOCOL_ID, x2ap_handle); + Initialized=TRUE; #include "packet-x2ap-dis-tab.c" - } else { - if (SctpPort != 0) { - dissector_delete_uint("sctp.port", SctpPort, x2ap_handle); - } - } - - SctpPort=gbl_x2apSctpPort; - if (SctpPort != 0) { - dissector_add_uint("sctp.port", SctpPort, x2ap_handle); - } - + } else { + if (SctpPort != 0) { + dissector_delete_uint("sctp.port", SctpPort, x2ap_handle); + } + } + + SctpPort=gbl_x2apSctpPort; + if (SctpPort != 0) { + dissector_add_uint("sctp.port", SctpPort, x2ap_handle); + } } diff --git a/epan/dissectors/asn1/x2ap/x2ap.cnf b/epan/dissectors/asn1/x2ap/x2ap.cnf index 52f14728dd..a35393e671 100644 --- a/epan/dissectors/asn1/x2ap/x2ap.cnf +++ b/epan/dissectors/asn1/x2ap/x2ap.cnf @@ -47,10 +47,12 @@ ProtocolIE-ContainerPair ProtocolIE-ContainerPairList #.END -#.FN_PARS ProtocolIE-ID VAL_PTR = &ProtocolIE_ID +#.FN_BODY ProtocolIE-ID VAL_PTR = &x2ap_data->protocol_ie_id + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(actx->pinfo); +%(DEFAULT_BODY)s #.FN_FTR ProtocolIE-ID if (tree) { - proto_item_append_text(proto_item_get_parent_nth(actx->created_item, 2), ": %s", val_to_str_ext(ProtocolIE_ID, &x2ap_ProtocolIE_ID_vals_ext, "unknown (%d)")); + proto_item_append_text(proto_item_get_parent_nth(actx->created_item, 2), ": %s", val_to_str_ext(x2ap_data->protocol_ie_id, &x2ap_ProtocolIE_ID_vals_ext, "unknown (%d)")); } #.END @@ -58,14 +60,11 @@ ProtocolIE-ContainerPairList #.FN_PARS ProtocolExtensionField/extensionValue FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_ProtocolExtensionFieldExtensionValue -#.FN_PARS ProcedureCode VAL_PTR = &ProcedureCode -#.END - -#.FN_HDR ProcedureCode - ProcedureCode = 0xFFFF; +#.FN_BODY ProcedureCode VAL_PTR = &x2ap_data->procedure_code + struct x2ap_private_data *x2ap_data = x2ap_get_private_data(actx->pinfo); +%(DEFAULT_BODY)s #.END - #.FN_PARS InitiatingMessage/value FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_InitiatingMessageValue #.FN_PARS SuccessfulOutcome/value FN_VARIANT=_pdu_new TYPE_REF_FN=dissect_SuccessfulOutcomeValue @@ -136,7 +135,11 @@ Port-Number TYPE = FT_UINT16 DISPLAY = BASE_DEC return offset; subtree = proto_item_add_subtree(actx->created_item, ett_x2ap_RRC_Context); - dissect_lte_rrc_HandoverPreparationInformation_PDU(parameter_tvb, actx->pinfo, subtree, NULL); + if (g_x2ap_dissect_rrc_context_as == X2AP_RRC_CONTEXT_NBIOT) { + dissect_lte_rrc_HandoverPreparationInformation_NB_PDU(parameter_tvb, actx->pinfo, subtree, NULL); + } else { + dissect_lte_rrc_HandoverPreparationInformation_PDU(parameter_tvb, actx->pinfo, subtree, NULL); + } #.FN_BODY UE-HistoryInformationFromTheUE VAL_PTR = ¶meter_tvb tvbuff_t *parameter_tvb = NULL; |