diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2012-10-25 15:34:57 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2012-10-25 15:34:57 +0000 |
commit | d407ce0d36fb1014daaf55a9218ae3ca6eefc002 (patch) | |
tree | d79b155f43f6c52d11a0be8db234e2017454c787 /epan/dissectors | |
parent | ae4115bcdb445c3b8a97edc2317eaccdf2e0a83b (diff) | |
download | wireshark-d407ce0d36fb1014daaf55a9218ae3ca6eefc002.tar.gz |
Create and start using macros for MTP3 network indicators.
Export the network indicator value_string and use it in M3UA.
svn path=/trunk/; revision=45784
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-m3ua.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-mtp3.h | 22 |
3 files changed, 31 insertions, 26 deletions
diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c index 7cbb3a157d..bf83c09582 100644 --- a/epan/dissectors/packet-m3ua.c +++ b/epan/dissectors/packet-m3ua.c @@ -1141,17 +1141,16 @@ dissect_protocol_data_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pro item = proto_tree_add_item(parameter_tree, hf_protocol_data_opc, parameter_tvb, DATA_OPC_OFFSET, DATA_OPC_LENGTH, ENC_BIG_ENDIAN); if (mtp3_pc_structured()) proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntohl(parameter_tvb, DATA_OPC_OFFSET))); - if(mtp3_tap->addr_opc.ni == 0) - { + if(mtp3_tap->addr_opc.ni == MTP3_NI_INT0) { q708_tree = proto_item_add_subtree(item,ett_q708_opc); - /* Q.708 (1984-10) Numbering of International Signalling Point Codes */ + /* Q.708 (1984-10) Numbering of International Signalling Point Codes */ analyze_q708_ispc(parameter_tvb, q708_tree, DATA_OPC_OFFSET, DATA_OPC_LENGTH, mtp3_tap->addr_opc.pc); } + item = proto_tree_add_item(parameter_tree, hf_protocol_data_dpc, parameter_tvb, DATA_DPC_OFFSET, DATA_DPC_LENGTH, ENC_BIG_ENDIAN); if (mtp3_pc_structured()) proto_item_append_text(item, " (%s)", mtp3_pc_to_str(tvb_get_ntohl(parameter_tvb, DATA_DPC_OFFSET))); - if(mtp3_tap->addr_dpc.ni == 0) - { + if(mtp3_tap->addr_dpc.ni == MTP3_NI_INT0) { q708_tree = proto_item_add_subtree(item,ett_q708_dpc); analyze_q708_ispc(parameter_tvb, q708_tree, DATA_DPC_OFFSET, DATA_DPC_LENGTH, mtp3_tap->addr_dpc.pc); } @@ -2030,7 +2029,7 @@ proto_register_m3ua(void) { &hf_protocol_data_mtp3_dpc, { "DPC", "mtp3.dpc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_protocol_data_mtp3_pc, { "PC", "mtp3.pc", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_protocol_data_si, { "SI", "m3ua.protocol_data_si", FT_UINT8, BASE_DEC, VALS(mtp3_service_indicator_code_short_vals), 0x0, "Service Indicator", HFILL } }, - { &hf_protocol_data_ni, { "NI", "m3ua.protocol_data_ni", FT_UINT8, BASE_DEC, NULL, 0x0, "Network Indicator", HFILL } }, + { &hf_protocol_data_ni, { "NI", "m3ua.protocol_data_ni", FT_UINT8, BASE_DEC, VALS(mtp3_network_indicator_vals), 0x0, "Network Indicator", HFILL } }, { &hf_protocol_data_mtp3_ni, { "NI", "mtp3.ni", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_protocol_data_mp, { "MP", "m3ua.protocol_data_mp", FT_UINT8, BASE_DEC, NULL, 0x0, "Message Priority", HFILL } }, { &hf_protocol_data_sls, { "SLS", "m3ua.protocol_data_sls", FT_UINT8, BASE_DEC, NULL, 0x0, "Signalling Link Selection", HFILL } }, diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 09f9c76c7e..ccea3669ad 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -218,11 +218,11 @@ const value_string mtp3_service_indicator_code_short_vals[] = { { 0, NULL } }; -static const value_string network_indicator_vals[] = { - { 0x0, "International network" }, - { 0x1, "Spare (for international use only)" }, - { 0x2, "National network" }, - { 0x3, "Reserved for national use" }, +const value_string mtp3_network_indicator_vals[] = { + { MTP3_NI_INT0, "International network" }, + { MTP3_NI_INT1, "Spare (for international use only)" }, + { MTP3_NI_NAT0, "National network" }, + { MTP3_NI_NAT0, "Reserved for national use" }, { 0, NULL } }; @@ -522,21 +522,21 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_t label_dpc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_dpc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label); if (mtp3_pc_structured()) proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc)); - if(mtp3_addr_dpc->ni == 0) - { + + if(mtp3_addr_dpc->ni == MTP3_NI_INT0) { pc_subtree = proto_item_add_subtree(label_dpc_item, ett_mtp3_label_dpc); analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc); - } + } label_opc_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_opc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label); if (mtp3_pc_structured()) proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc)); - if(mtp3_addr_opc->ni == 0) - { + + if(mtp3_addr_opc->ni == MTP3_NI_INT0) { pc_subtree = proto_item_add_subtree(label_opc_item, ett_mtp3_label_opc); analyze_q708_ispc(tvb, pc_subtree, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc); - } + } proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label); break; @@ -786,7 +786,7 @@ proto_register_mtp3(void) /* Setup list of header fields See Section 1.6.1 for details*/ static hf_register_info hf[] = { { &hf_mtp3_service_indicator, { "Service indicator", "mtp3.service_indicator", FT_UINT8, BASE_HEX, VALS(mtp3_service_indicator_code_vals), SERVICE_INDICATOR_MASK, NULL, HFILL }}, - { &hf_mtp3_network_indicator, { "Network indicator", "mtp3.network_indicator", FT_UINT8, BASE_HEX, VALS(network_indicator_vals), NETWORK_INDICATOR_MASK, NULL, HFILL }}, + { &hf_mtp3_network_indicator, { "Network indicator", "mtp3.network_indicator", FT_UINT8, BASE_HEX, VALS(mtp3_network_indicator_vals), NETWORK_INDICATOR_MASK, NULL, HFILL }}, { &hf_mtp3_itu_spare, { "Spare", "mtp3.spare", FT_UINT8, BASE_HEX, NULL, SPARE_MASK, NULL, HFILL }}, { &hf_mtp3_itu_priority, { "ITU priority", "mtp3.priority", FT_UINT8, BASE_DEC, NULL, SPARE_MASK, NULL, HFILL }}, { &hf_mtp3_ansi_priority, { "ANSI Priority", "mtp3.priority", FT_UINT8, BASE_DEC, NULL, ANSI_PRIORITY_MASK, NULL, HFILL }}, diff --git a/epan/dissectors/packet-mtp3.h b/epan/dissectors/packet-mtp3.h index 400fcfd3a7..b9b09d9eda 100644 --- a/epan/dissectors/packet-mtp3.h +++ b/epan/dissectors/packet-mtp3.h @@ -36,8 +36,8 @@ extern gboolean mtp3_heuristic_standard; WS_VAR_IMPORT const value_string mtp3_standard_vals[]; typedef enum { - MTP3_ADDR_FMT_DEC = 1, - MTP3_ADDR_FMT_HEX = 2, + MTP3_ADDR_FMT_DEC = 1, + MTP3_ADDR_FMT_HEX = 2, MTP3_ADDR_FMT_NI_DEC = 3, MTP3_ADDR_FMT_NI_HEX = 4, MTP3_ADDR_FMT_DASHED = 5 @@ -85,16 +85,16 @@ extern guint32 mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p); * needed by to_str.c, so just don't prototype it there (or anywhere * without proto.h). */ -extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, - proto_tree *tree, gint ett_pc, - int hf_pc, int hf_pc_network, - int hf_pc_cluster, int hf_pc_member, - int hf_dpc, int pc); +extern void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, + proto_tree *tree, gint ett_pc, + int hf_pc, int hf_pc_network, + int hf_pc_cluster, int hf_pc_member, + int hf_dpc, int pc); #endif /* * the following allows TAP code access to the messages - * without having to duplicate it. With MSVC and a + * without having to duplicate it. With MSVC and a * libwireshark.dll, we need a special declaration. */ WS_VAR_IMPORT const value_string mtp3_service_indicator_code_short_vals[]; @@ -119,4 +119,10 @@ WS_VAR_IMPORT const value_string mtp3_service_indicator_code_short_vals[]; */ #define MTP3_NUM_SI_CODE 9 +#define MTP3_NI_INT0 0x0 +#define MTP3_NI_INT1 0x1 +#define MTP3_NI_NAT0 0x2 +#define MTP3_NI_NAT1 0x3 +WS_VAR_IMPORT const value_string mtp3_network_indicator_vals[]; + #endif |