diff options
Diffstat (limited to 'epan/dissectors/packet-mtp3.c')
-rw-r--r-- | epan/dissectors/packet-mtp3.c | 863 |
1 files changed, 438 insertions, 425 deletions
diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c index 7621b0ee34..b2966e560e 100644 --- a/epan/dissectors/packet-mtp3.c +++ b/epan/dissectors/packet-mtp3.c @@ -117,7 +117,7 @@ typedef enum { JAPAN_PC_STRUCTURE_3_4_4_5 = 3 } JAPAN_PC_Structure_Type; -static gint itu_pc_structure = ITU_PC_STRUCTURE_NONE; +static gint itu_pc_structure = ITU_PC_STRUCTURE_NONE; static gint japan_pc_structure = JAPAN_PC_STRUCTURE_NONE; #include <packet-mtp3.h> @@ -127,11 +127,11 @@ gboolean mtp3_heuristic_standard = FALSE; static gint pref_mtp3_standard; const value_string mtp3_standard_vals[] = { - { ITU_STANDARD, "ITU_STANDARD" }, - { ANSI_STANDARD, "ANSI_STANDARD" }, - { CHINESE_ITU_STANDARD, "CHINESE_ITU_STANDARD" }, - { JAPAN_STANDARD, "JAPAN_STANDARD" }, - { 0, NULL } + { ITU_STANDARD, "ITU_STANDARD" }, + { ANSI_STANDARD, "ANSI_STANDARD" }, + { CHINESE_ITU_STANDARD, "CHINESE_ITU_STANDARD" }, + { JAPAN_STANDARD, "JAPAN_STANDARD" }, + { 0, NULL } }; static gboolean mtp3_use_ansi_5_bit_sls = FALSE; @@ -185,49 +185,49 @@ static gint mtp3_addr_fmt = MTP3_ADDR_FMT_DASHED; /* the higher values are taken from the M3UA RFC */ static const value_string mtp3_service_indicator_code_vals[] = { - { MTP_SI_SNM, "Signalling Network Management Message (SNM)" }, - { MTP_SI_MTN, "Maintenance Regular Message (MTN)" }, - { MTP_SI_MTNS, "Maintenance Special Message (MTNS)" }, - { MTP_SI_SCCP, "SCCP" }, - { MTP_SI_TUP, "TUP" }, - { MTP_SI_ISUP, "ISUP" }, - { MTP_SI_DUP_CC, "DUP (call and circuit related messages)" }, - { MTP_SI_DUP_FAC, "DUP (facility registration and cancellation message)" }, - { MTP_SI_MTP_TEST, "MTP testing user part" }, - { MTP_SI_ISUP_B, "Broadband ISUP" }, - { MTP_SI_ISUP_S, "Satellite ISUP" }, - { 0xb, "Spare" }, - { MTP_SI_AAL2, "AAL type2 Signaling" }, - { MTP_SI_BICC, "Bearer Independent Call Control (BICC)" }, - { MTP_SI_GCP, "Gateway Control Protocol" }, - { 0xf, "Spare" }, - { 0, NULL } + { MTP_SI_SNM, "Signalling Network Management Message (SNM)" }, + { MTP_SI_MTN, "Maintenance Regular Message (MTN)" }, + { MTP_SI_MTNS, "Maintenance Special Message (MTNS)" }, + { MTP_SI_SCCP, "SCCP" }, + { MTP_SI_TUP, "TUP" }, + { MTP_SI_ISUP, "ISUP" }, + { MTP_SI_DUP_CC, "DUP (call and circuit related messages)" }, + { MTP_SI_DUP_FAC, "DUP (facility registration and cancellation message)" }, + { MTP_SI_MTP_TEST, "MTP testing user part" }, + { MTP_SI_ISUP_B, "Broadband ISUP" }, + { MTP_SI_ISUP_S, "Satellite ISUP" }, + { 0xb, "Spare" }, + { MTP_SI_AAL2, "AAL type2 Signaling" }, + { MTP_SI_BICC, "Bearer Independent Call Control (BICC)" }, + { MTP_SI_GCP, "Gateway Control Protocol" }, + { 0xf, "Spare" }, + { 0, NULL } }; const value_string mtp3_service_indicator_code_short_vals[] = { - { MTP_SI_SNM, "SNM" }, - { MTP_SI_MTN, "MTN" }, - { MTP_SI_MTNS, "MTNS" }, - { MTP_SI_SCCP, "SCCP" }, - { MTP_SI_TUP, "TUP" }, - { MTP_SI_ISUP, "ISUP" }, - { MTP_SI_DUP_CC, "DUP (CC)" }, - { MTP_SI_DUP_FAC, "DUP (FAC/CANC)" }, - { MTP_SI_MTP_TEST, "MTP Test" }, - { MTP_SI_ISUP_B, "ISUP-b" }, - { MTP_SI_ISUP_S, "ISUP-s" }, - { MTP_SI_AAL2, "AAL type 2" }, - { MTP_SI_BICC, "BICC" }, - { MTP_SI_GCP, "GCP" }, - { 0, NULL } + { MTP_SI_SNM, "SNM" }, + { MTP_SI_MTN, "MTN" }, + { MTP_SI_MTNS, "MTNS" }, + { MTP_SI_SCCP, "SCCP" }, + { MTP_SI_TUP, "TUP" }, + { MTP_SI_ISUP, "ISUP" }, + { MTP_SI_DUP_CC, "DUP (CC)" }, + { MTP_SI_DUP_FAC, "DUP (FAC/CANC)" }, + { MTP_SI_MTP_TEST, "MTP Test" }, + { MTP_SI_ISUP_B, "ISUP-b" }, + { MTP_SI_ISUP_S, "ISUP-s" }, + { MTP_SI_AAL2, "AAL type 2" }, + { MTP_SI_BICC, "BICC" }, + { MTP_SI_GCP, "GCP" }, + { 0, NULL } }; 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_NAT1, "Reserved for national use" }, - { 0, NULL } + { MTP3_NI_INT0, "International network" }, + { MTP3_NI_INT1, "Spare (for international use only)" }, + { MTP3_NI_NAT0, "National network" }, + { MTP3_NI_NAT1, "Reserved for national use" }, + { 0, NULL } }; static dissector_handle_t data_handle; @@ -244,19 +244,19 @@ mtp3_pc_to_str_buf(const guint32 pc, gchar *buf, int buf_len) { case ITU_STANDARD: switch (itu_pc_structure) { - case ITU_PC_STRUCTURE_NONE: - g_snprintf(buf, buf_len, "%u", pc); - break; - case ITU_PC_STRUCTURE_3_8_3: - /* this format is used in international ITU networks */ - g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0x3800)>>11, (pc & 0x7f8) >> 3, (pc & 0x07) >> 0); - break; - case ITU_PC_STRUCTURE_4_3_4_3: - /* this format is used in some national ITU networks, the German one for example. */ - g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0x3c00) >>10, (pc & 0x0380) >> 7, (pc & 0x0078) >> 3, (pc & 0x0007) >> 0); - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); + case ITU_PC_STRUCTURE_NONE: + g_snprintf(buf, buf_len, "%u", pc); + break; + case ITU_PC_STRUCTURE_3_8_3: + /* this format is used in international ITU networks */ + g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0x3800)>>11, (pc & 0x7f8) >> 3, (pc & 0x07) >> 0); + break; + case ITU_PC_STRUCTURE_4_3_4_3: + /* this format is used in some national ITU networks, the German one for example. */ + g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0x3c00) >>10, (pc & 0x0380) >> 7, (pc & 0x0078) >> 3, (pc & 0x0007) >> 0); + break; + default: + DISSECTOR_ASSERT_NOT_REACHED(); } break; case ANSI_STANDARD: @@ -265,24 +265,24 @@ mtp3_pc_to_str_buf(const guint32 pc, gchar *buf, int buf_len) break; case JAPAN_STANDARD: switch (japan_pc_structure) { - case JAPAN_PC_STRUCTURE_NONE: - g_snprintf(buf, buf_len, "%u", pc); - break; - case JAPAN_PC_STRUCTURE_7_4_5: - /* This format is specified by NTT */ - g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0xfe00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f)); - break; - case JAPAN_PC_STRUCTURE_3_4_4_5: - /* Where does this format come from? */ - g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0xe000)>>13, (pc & 0x1e00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f)); - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); + case JAPAN_PC_STRUCTURE_NONE: + g_snprintf(buf, buf_len, "%u", pc); + break; + case JAPAN_PC_STRUCTURE_7_4_5: + /* This format is specified by NTT */ + g_snprintf(buf, buf_len, "%u-%u-%u", (pc & 0xfe00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f)); + break; + case JAPAN_PC_STRUCTURE_3_4_4_5: + /* Where does this format come from? */ + g_snprintf(buf, buf_len, "%u-%u-%u-%u", (pc & 0xe000)>>13, (pc & 0x1e00)>>9, (pc & 0x1e0)>>5, (pc & 0x1f)); + break; + default: + DISSECTOR_ASSERT_NOT_REACHED(); } break; default: DISSECTOR_ASSERT_NOT_REACHED(); - } + } } #define MAX_STRUCTURED_PC_LENGTH 20 @@ -314,149 +314,149 @@ mtp3_pc_structured(void) void mtp3_addr_to_str_buf(const mtp3_addr_pc_t *addr_pc_p, - gchar *buf, int buf_len) + gchar *buf, int buf_len) { switch (mtp3_addr_fmt) { - case MTP3_ADDR_FMT_DEC: - switch (addr_pc_p->type) - { - case ITU_STANDARD: - g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ITU_PC_MASK); - break; - case JAPAN_STANDARD: - g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & JAPAN_PC_MASK); - break; - default: - /* assuming 24-bit */ - g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ANSI_PC_MASK); + case MTP3_ADDR_FMT_DEC: + switch (addr_pc_p->type) + { + case ITU_STANDARD: + g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ITU_PC_MASK); + break; + case JAPAN_STANDARD: + g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & JAPAN_PC_MASK); + break; + default: + /* assuming 24-bit */ + g_snprintf(buf, buf_len, "%u", addr_pc_p->pc & ANSI_PC_MASK); + break; + } break; - } - break; - case MTP3_ADDR_FMT_HEX: - switch (addr_pc_p->type) - { - case ITU_STANDARD: - g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ITU_PC_MASK); - break; - case JAPAN_STANDARD: - g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & JAPAN_PC_MASK); - break; - default: - /* assuming 24-bit */ - g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ANSI_PC_MASK); + case MTP3_ADDR_FMT_HEX: + switch (addr_pc_p->type) + { + case ITU_STANDARD: + g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ITU_PC_MASK); + break; + case JAPAN_STANDARD: + g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & JAPAN_PC_MASK); + break; + default: + /* assuming 24-bit */ + g_snprintf(buf, buf_len, "%x", addr_pc_p->pc & ANSI_PC_MASK); + break; + } break; - } - break; - case MTP3_ADDR_FMT_NI_DEC: - switch (addr_pc_p->type) - { - case ITU_STANDARD: - g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK); - break; - case JAPAN_STANDARD: - g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK); - break; - default: - /* assuming 24-bit */ - g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK); + case MTP3_ADDR_FMT_NI_DEC: + switch (addr_pc_p->type) + { + case ITU_STANDARD: + g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK); + break; + case JAPAN_STANDARD: + g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK); + break; + default: + /* assuming 24-bit */ + g_snprintf(buf, buf_len, "%u:%u", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK); + break; + } break; - } - break; - case MTP3_ADDR_FMT_NI_HEX: - switch (addr_pc_p->type) - { - case ITU_STANDARD: - g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK); - break; - case JAPAN_STANDARD: - g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK); - break; - default: - /* assuming 24-bit */ - g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK); + case MTP3_ADDR_FMT_NI_HEX: + switch (addr_pc_p->type) + { + case ITU_STANDARD: + g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ITU_PC_MASK); + break; + case JAPAN_STANDARD: + g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & JAPAN_PC_MASK); + break; + default: + /* assuming 24-bit */ + g_snprintf(buf, buf_len, "%u:%x", addr_pc_p->ni, addr_pc_p->pc & ANSI_PC_MASK); + break; + } break; - } - break; - default: - /* FALLTHRU */ + default: + /* FALLTHRU */ - case MTP3_ADDR_FMT_DASHED: - mtp3_pc_to_str_buf(addr_pc_p->pc, buf, buf_len); - break; + case MTP3_ADDR_FMT_DASHED: + mtp3_pc_to_str_buf(addr_pc_p->pc, buf, buf_len); + break; } } guint32 mtp3_pc_hash(const mtp3_addr_pc_t *addr_pc_p) { - guint32 pc; + guint32 pc; - switch (addr_pc_p->type) - { - case ITU_STANDARD: - pc = (addr_pc_p->pc & ITU_PC_MASK) | ((addr_pc_p->ni % 4) << 14) ; - break; - default: - /* assuming 24-bit */ - pc = (addr_pc_p->pc & ANSI_PC_MASK) | ((addr_pc_p->ni) << 24) ; - break; - } + switch (addr_pc_p->type) + { + case ITU_STANDARD: + pc = (addr_pc_p->pc & ITU_PC_MASK) | ((addr_pc_p->ni % 4) << 14) ; + break; + default: + /* assuming 24-bit */ + pc = (addr_pc_p->pc & ANSI_PC_MASK) | ((addr_pc_p->ni) << 24) ; + break; + } - return pc; + return pc; } /* Common function for dissecting 3-byte (ANSI or China) PCs. */ void dissect_mtp3_3byte_pc(tvbuff_t *tvb, guint offset, proto_tree *tree, gint ett_pc, int hf_pc_string, int hf_pc_network, - int hf_pc_cluster, int hf_pc_member, int hf_dpc, int hf_pc) + int hf_pc_cluster, int hf_pc_member, int hf_dpc, int hf_pc) { - guint32 pc; - proto_item *pc_item, *hidden_item; - proto_tree *pc_tree; - char pc_string[MAX_STRUCTURED_PC_LENGTH]; - - pc = tvb_get_letoh24(tvb, offset); - mtp3_pc_to_str_buf(pc, pc_string, sizeof(pc_string)); - - pc_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); - - /* Add alternate formats of the PC - * NOTE: each of these formats is shown to the user, - * so I think that using hidden fields in this case is OK. - */ - g_snprintf(pc_string, sizeof(pc_string), "%u", pc); - proto_item_append_text(pc_item, " (%s)", pc_string); - hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + guint32 pc; + proto_item *pc_item, *hidden_item; + proto_tree *pc_tree; + char pc_string[MAX_STRUCTURED_PC_LENGTH]; + + pc = tvb_get_letoh24(tvb, offset); + mtp3_pc_to_str_buf(pc, pc_string, sizeof(pc_string)); + + pc_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + + /* Add alternate formats of the PC + * NOTE: each of these formats is shown to the user, + * so I think that using hidden fields in this case is OK. + */ + g_snprintf(pc_string, sizeof(pc_string), "%u", pc); + proto_item_append_text(pc_item, " (%s)", pc_string); + hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + PROTO_ITEM_SET_HIDDEN(hidden_item); + g_snprintf(pc_string, sizeof(pc_string), "0x%x", pc); + proto_item_append_text(pc_item, " (%s)", pc_string); + hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + PROTO_ITEM_SET_HIDDEN(hidden_item); + + pc_tree = proto_item_add_subtree(pc_item, ett_pc); + + proto_tree_add_uint(pc_tree, hf_pc_network, tvb, offset + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, pc); + proto_tree_add_uint(pc_tree, hf_pc_cluster, tvb, offset + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, pc); + proto_tree_add_uint(pc_tree, hf_pc_member, tvb, offset + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, pc); + + /* add full integer values of DPC as hidden for filtering purposes */ + if (hf_dpc) { + hidden_item = proto_tree_add_uint(pc_tree, hf_dpc, tvb, offset, ANSI_PC_LENGTH, pc); PROTO_ITEM_SET_HIDDEN(hidden_item); - g_snprintf(pc_string, sizeof(pc_string), "0x%x", pc); - proto_item_append_text(pc_item, " (%s)", pc_string); - hidden_item = proto_tree_add_string(tree, hf_pc_string, tvb, offset, ANSI_PC_LENGTH, pc_string); + } + if (hf_pc) { + hidden_item = proto_tree_add_uint(pc_tree, hf_pc, tvb, offset, ANSI_PC_LENGTH, pc); PROTO_ITEM_SET_HIDDEN(hidden_item); - - pc_tree = proto_item_add_subtree(pc_item, ett_pc); - - proto_tree_add_uint(pc_tree, hf_pc_network, tvb, offset + ANSI_NETWORK_OFFSET, ANSI_NCM_LENGTH, pc); - proto_tree_add_uint(pc_tree, hf_pc_cluster, tvb, offset + ANSI_CLUSTER_OFFSET, ANSI_NCM_LENGTH, pc); - proto_tree_add_uint(pc_tree, hf_pc_member, tvb, offset + ANSI_MEMBER_OFFSET, ANSI_NCM_LENGTH, pc); - - /* add full integer values of DPC as hidden for filtering purposes */ - if (hf_dpc) { - hidden_item = proto_tree_add_uint(pc_tree, hf_dpc, tvb, offset, ANSI_PC_LENGTH, pc); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } - if (hf_pc) { - hidden_item = proto_tree_add_uint(pc_tree, hf_pc, tvb, offset, ANSI_PC_LENGTH, pc); - PROTO_ITEM_SET_HIDDEN(hidden_item); - } + } } static void dissect_mtp3_sio(tvbuff_t *tvb, proto_tree *mtp3_tree, - mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc) + mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc) { guint8 sio; proto_tree *sio_tree; @@ -470,22 +470,22 @@ dissect_mtp3_sio(tvbuff_t *tvb, proto_tree *mtp3_tree, mtp3_addr_dpc->ni = (sio & NETWORK_INDICATOR_MASK) >> 6; switch(mtp3_standard){ - case ANSI_STANDARD: - proto_tree_add_uint(sio_tree, hf_mtp3_ansi_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio); - break; - case ITU_STANDARD: - case CHINESE_ITU_STANDARD: - if (mtp3_show_itu_priority) - proto_tree_add_uint(sio_tree, hf_mtp3_itu_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio); - else + case ANSI_STANDARD: + proto_tree_add_uint(sio_tree, hf_mtp3_ansi_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio); + break; + case ITU_STANDARD: + case CHINESE_ITU_STANDARD: + if (mtp3_show_itu_priority) + proto_tree_add_uint(sio_tree, hf_mtp3_itu_priority, tvb, SIO_OFFSET, SIO_LENGTH, sio); + else + proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio); + break; + case JAPAN_STANDARD: + /* The Japan variant has priority but it's on the LI which belongs to + * layer 2. Not sure what we can do about that... + */ proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio); - break; - case JAPAN_STANDARD: - /* The Japan variant has priority but it's on the LI which belongs to - * layer 2. Not sure what we can do about that... - */ - proto_tree_add_uint(sio_tree, hf_mtp3_itu_spare, tvb, SIO_OFFSET, SIO_LENGTH, sio); - break; + break; } proto_tree_add_uint(sio_tree, hf_mtp3_service_indicator, tvb, SIO_OFFSET, SIO_LENGTH, sio); @@ -493,7 +493,7 @@ dissect_mtp3_sio(tvbuff_t *tvb, proto_tree *mtp3_tree, static void dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_tree, - mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc) + mtp3_addr_pc_t *mtp3_addr_opc, mtp3_addr_pc_t *mtp3_addr_dpc) { guint32 label, dpc, opc; proto_item *label_dpc_item, *label_opc_item; @@ -505,109 +505,109 @@ dissect_mtp3_routing_label(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mtp3_t switch (mtp3_standard) { - case ITU_STANDARD: - label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); - - label = tvb_get_letohl(tvb, ROUTING_LABEL_OFFSET); + case ITU_STANDARD: + label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); - opc = (label & ITU_OPC_MASK) >> 14; - dpc = label & ITU_DPC_MASK; + label = tvb_get_letohl(tvb, ROUTING_LABEL_OFFSET); - hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc); - PROTO_ITEM_SET_HIDDEN(hidden_item); - hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc); - PROTO_ITEM_SET_HIDDEN(hidden_item); + opc = (label & ITU_OPC_MASK) >> 14; + dpc = label & ITU_DPC_MASK; - 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)); + hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, opc); + PROTO_ITEM_SET_HIDDEN(hidden_item); + hidden_item = proto_tree_add_uint(label_tree, hf_mtp3_itu_pc, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, dpc); + PROTO_ITEM_SET_HIDDEN(hidden_item); - 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_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 == 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 == 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); - } + 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)); - proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label); - break; + 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); + } - case ANSI_STANDARD: - case CHINESE_ITU_STANDARD: - if (mtp3_standard == ANSI_STANDARD) - { - hf_dpc_string = hf_mtp3_ansi_dpc; - hf_opc_string = hf_mtp3_ansi_opc; - } else /* CHINESE_ITU_STANDARD */ { - hf_dpc_string = hf_mtp3_chinese_dpc; - hf_opc_string = hf_mtp3_chinese_opc; - } + proto_tree_add_uint(label_tree, hf_mtp3_itu_sls, tvb, ROUTING_LABEL_OFFSET, ITU_ROUTING_LABEL_LENGTH, label); + break; - /* Create the Routing Label Tree */ - label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); - - /* create and fill the DPC tree */ - dissect_mtp3_3byte_pc(tvb, ANSI_DPC_OFFSET, label_tree, ett_mtp3_label_dpc, hf_dpc_string, hf_mtp3_dpc_network, - hf_mtp3_dpc_cluster, hf_mtp3_dpc_member, hf_mtp3_24bit_dpc, hf_mtp3_24bit_pc); - /* Store dpc for mtp3_addr below */ - dpc = tvb_get_letoh24(tvb, ANSI_DPC_OFFSET); - - /* create and fill the OPC tree */ - dissect_mtp3_3byte_pc(tvb, ANSI_OPC_OFFSET, label_tree, ett_mtp3_label_opc, hf_opc_string, hf_mtp3_opc_network, - hf_mtp3_opc_cluster, hf_mtp3_opc_member, hf_mtp3_24bit_opc, hf_mtp3_24bit_pc); - /* Store opc for mtp3_addr below */ - opc = tvb_get_letoh24(tvb, ANSI_OPC_OFFSET); - - /* SLS */ - if (mtp3_standard == ANSI_STANDARD) { - if (mtp3_use_ansi_5_bit_sls) - proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); - else - proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); - } else /* CHINESE_ITU_STANDARD */ { - proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); - } - break; + case ANSI_STANDARD: + case CHINESE_ITU_STANDARD: + if (mtp3_standard == ANSI_STANDARD) + { + hf_dpc_string = hf_mtp3_ansi_dpc; + hf_opc_string = hf_mtp3_ansi_opc; + } else /* CHINESE_ITU_STANDARD */ { + hf_dpc_string = hf_mtp3_chinese_dpc; + hf_opc_string = hf_mtp3_chinese_opc; + } - case JAPAN_STANDARD: - label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, JAPAN_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); + /* Create the Routing Label Tree */ + label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, ANSI_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); + + /* create and fill the DPC tree */ + dissect_mtp3_3byte_pc(tvb, ANSI_DPC_OFFSET, label_tree, ett_mtp3_label_dpc, hf_dpc_string, hf_mtp3_dpc_network, + hf_mtp3_dpc_cluster, hf_mtp3_dpc_member, hf_mtp3_24bit_dpc, hf_mtp3_24bit_pc); + /* Store dpc for mtp3_addr below */ + dpc = tvb_get_letoh24(tvb, ANSI_DPC_OFFSET); + + /* create and fill the OPC tree */ + dissect_mtp3_3byte_pc(tvb, ANSI_OPC_OFFSET, label_tree, ett_mtp3_label_opc, hf_opc_string, hf_mtp3_opc_network, + hf_mtp3_opc_cluster, hf_mtp3_opc_member, hf_mtp3_24bit_opc, hf_mtp3_24bit_pc); + /* Store opc for mtp3_addr below */ + opc = tvb_get_letoh24(tvb, ANSI_OPC_OFFSET); + + /* SLS */ + if (mtp3_standard == ANSI_STANDARD) { + if (mtp3_use_ansi_5_bit_sls) + proto_tree_add_item(label_tree, hf_mtp3_ansi_5_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); + else + proto_tree_add_item(label_tree, hf_mtp3_ansi_8_bit_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); + } else /* CHINESE_ITU_STANDARD */ { + proto_tree_add_item(label_tree, hf_mtp3_chinese_itu_sls, tvb, ANSI_SLS_OFFSET, SLS_LENGTH, ENC_NA); + } + break; - label_dpc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_dpc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); - dpc = tvb_get_letohs(tvb, ROUTING_LABEL_OFFSET); - if (mtp3_pc_structured()) { - proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc)); - } + case JAPAN_STANDARD: + label_tree = proto_tree_add_subtree(mtp3_tree, tvb, ROUTING_LABEL_OFFSET, JAPAN_ROUTING_LABEL_LENGTH, ett_mtp3_label, NULL, "Routing label"); - label_opc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_opc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); - opc = tvb_get_letohs(tvb, JAPAN_OPC_OFFSET); - if (mtp3_pc_structured()) { - proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc)); - } + label_dpc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_dpc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); + dpc = tvb_get_letohs(tvb, ROUTING_LABEL_OFFSET); + if (mtp3_pc_structured()) { + proto_item_append_text(label_dpc_item, " (%s)", mtp3_pc_to_str(dpc)); + } - hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); - PROTO_ITEM_SET_HIDDEN(hidden_item); - hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); - PROTO_ITEM_SET_HIDDEN(hidden_item); + label_opc_item = proto_tree_add_item(label_tree, hf_mtp3_japan_opc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); + opc = tvb_get_letohs(tvb, JAPAN_OPC_OFFSET); + if (mtp3_pc_structured()) { + proto_item_append_text(label_opc_item, " (%s)", mtp3_pc_to_str(opc)); + } - if (mtp3_use_japan_5_bit_sls) { - proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); - proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); - } else { - proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); - proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); - } + hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, ROUTING_LABEL_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); + PROTO_ITEM_SET_HIDDEN(hidden_item); + hidden_item = proto_tree_add_item(label_tree, hf_mtp3_japan_pc, tvb, JAPAN_OPC_OFFSET, JAPAN_PC_LENGTH, ENC_LITTLE_ENDIAN); + PROTO_ITEM_SET_HIDDEN(hidden_item); + + if (mtp3_use_japan_5_bit_sls) { + proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); + proto_tree_add_item(label_tree, hf_mtp3_japan_5_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); + } else { + proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); + proto_tree_add_item(label_tree, hf_mtp3_japan_4_bit_sls_spare, tvb, JAPAN_SLS_OFFSET, JAPAN_SLS_SPARE_LENGTH, ENC_NA); + } - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); + break; + default: + DISSECTOR_ASSERT_NOT_REACHED(); } mtp3_addr_opc->type = (Standard_Type)mtp3_standard; @@ -630,18 +630,18 @@ dissect_mtp3_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) service_indicator = sio & SERVICE_INDICATOR_MASK; switch (mtp3_standard) { - case ITU_STANDARD: - payload_tvb = tvb_new_subset_remaining(tvb, ITU_MTP_PAYLOAD_OFFSET); - break; - case ANSI_STANDARD: - case CHINESE_ITU_STANDARD: - payload_tvb = tvb_new_subset_remaining(tvb, ANSI_MTP_PAYLOAD_OFFSET); - break; - case JAPAN_STANDARD: - payload_tvb = tvb_new_subset_remaining(tvb, JAPAN_MTP_PAYLOAD_OFFSET); - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); + case ITU_STANDARD: + payload_tvb = tvb_new_subset_remaining(tvb, ITU_MTP_PAYLOAD_OFFSET); + break; + case ANSI_STANDARD: + case CHINESE_ITU_STANDARD: + payload_tvb = tvb_new_subset_remaining(tvb, ANSI_MTP_PAYLOAD_OFFSET); + break; + case JAPAN_STANDARD: + payload_tvb = tvb_new_subset_remaining(tvb, JAPAN_MTP_PAYLOAD_OFFSET); + break; + default: + DISSECTOR_ASSERT_NOT_REACHED(); } col_set_str(pinfo->cinfo, COL_INFO, "DATA "); @@ -653,34 +653,34 @@ dissect_mtp3_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static guint heur_mtp3_standard(tvbuff_t *tvb, packet_info *pinfo, guint8 si) { - tvbuff_t *payload; + tvbuff_t *payload; - switch (si) { + switch (si) { case MTP_SI_SCCP: - { - payload = tvb_new_subset_remaining(tvb, ITU_HEADER_LENGTH); - if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ITU_STANDARD)) { - return ITU_STANDARD; - } - payload = tvb_new_subset_remaining(tvb, ANSI_HEADER_LENGTH); - if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ANSI_STANDARD)) { - return ANSI_STANDARD; - } - payload = tvb_new_subset_remaining(tvb, ANSI_HEADER_LENGTH); - if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, CHINESE_ITU_STANDARD)) { - return CHINESE_ITU_STANDARD; - } - payload = tvb_new_subset_remaining(tvb, JAPAN_HEADER_LENGTH); - if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, JAPAN_STANDARD)) { - return JAPAN_STANDARD; - } - - return HEURISTIC_FAILED_STANDARD; - - } - default: - return HEURISTIC_FAILED_STANDARD; + { + payload = tvb_new_subset_remaining(tvb, ITU_HEADER_LENGTH); + if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ITU_STANDARD)) { + return ITU_STANDARD; + } + payload = tvb_new_subset_remaining(tvb, ANSI_HEADER_LENGTH); + if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, ANSI_STANDARD)) { + return ANSI_STANDARD; + } + payload = tvb_new_subset_remaining(tvb, ANSI_HEADER_LENGTH); + if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, CHINESE_ITU_STANDARD)) { + return CHINESE_ITU_STANDARD; + } + payload = tvb_new_subset_remaining(tvb, JAPAN_HEADER_LENGTH); + if (looks_like_valid_sccp(PINFO_FD_NUM(pinfo), payload, JAPAN_STANDARD)) { + return JAPAN_STANDARD; + } + + return HEURISTIC_FAILED_STANDARD; + } + default: + return HEURISTIC_FAILED_STANDARD; + } } @@ -694,81 +694,81 @@ reset_mtp3_standard(void) static void dissect_mtp3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - mtp3_tap_rec_t* tap_rec = wmem_new0(wmem_packet_scope(), mtp3_tap_rec_t); - gint heuristic_standard; - guint8 si; - mtp3_addr_pc_t* mtp3_addr_dpc; - mtp3_addr_pc_t* mtp3_addr_opc; - - /* Set up structures needed to add the protocol subtree and manage it */ - proto_item *mtp3_item = NULL, *gen_item; - proto_tree *mtp3_tree; - - pref_mtp3_standard = mtp3_standard; - - mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, 0, ENC_NA); - - si = tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK; - if (mtp3_heuristic_standard) { - heuristic_standard = heur_mtp3_standard(tvb, pinfo, si); - if (heuristic_standard == HEURISTIC_FAILED_STANDARD) { - gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, mtp3_standard, - "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); - } else { - gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, heuristic_standard, - "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); - mtp3_standard = heuristic_standard; - - /* Register a frame-end routine to ensure mtp3_standard is set - * back even if an exception is thrown. - */ - register_frame_end_routine(pinfo, reset_mtp3_standard); - } - PROTO_ITEM_SET_GENERATED(gen_item); + mtp3_tap_rec_t* tap_rec = wmem_new0(wmem_packet_scope(), mtp3_tap_rec_t); + gint heuristic_standard; + guint8 si; + mtp3_addr_pc_t* mtp3_addr_dpc; + mtp3_addr_pc_t* mtp3_addr_opc; + + /* Set up structures needed to add the protocol subtree and manage it */ + proto_item *mtp3_item = NULL, *gen_item; + proto_tree *mtp3_tree; + + pref_mtp3_standard = mtp3_standard; + + mtp3_item = proto_tree_add_item(tree, proto_mtp3, tvb, 0, 0, ENC_NA); + + si = tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK; + if (mtp3_heuristic_standard) { + heuristic_standard = heur_mtp3_standard(tvb, pinfo, si); + if (heuristic_standard == HEURISTIC_FAILED_STANDARD) { + gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, mtp3_standard, + "Could not determine Heuristic using %s", val_to_str_const(mtp3_standard, mtp3_standard_vals, "unknown")); + } else { + gen_item = proto_tree_add_uint_format(tree, hf_mtp3_heuristic_standard, tvb, 0, 0, heuristic_standard, + "%s", val_to_str_const(heuristic_standard, mtp3_standard_vals, "unknown")); + mtp3_standard = heuristic_standard; + + /* Register a frame-end routine to ensure mtp3_standard is set + * back even if an exception is thrown. + */ + register_frame_end_routine(pinfo, reset_mtp3_standard); } + PROTO_ITEM_SET_GENERATED(gen_item); + } - /* Make entries in Protocol column on summary display */ - switch(mtp3_standard) { + /* Make entries in Protocol column on summary display */ + switch(mtp3_standard) { case ITU_STANDARD: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Int. ITU)"); - proto_item_set_len(mtp3_item, ITU_HEADER_LENGTH); - break; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Int. ITU)"); + proto_item_set_len(mtp3_item, ITU_HEADER_LENGTH); + break; case ANSI_STANDARD: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (ANSI)"); - proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH); - break; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (ANSI)"); + proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH); + break; case CHINESE_ITU_STANDARD: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Chin. ITU)"); - proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH); - break; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Chin. ITU)"); + proto_item_set_len(mtp3_item, ANSI_HEADER_LENGTH); + break; case JAPAN_STANDARD: - col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Japan)"); - proto_item_set_len(mtp3_item, JAPAN_HEADER_LENGTH); - break; - }; + col_set_str(pinfo->cinfo, COL_PROTOCOL, "MTP3 (Japan)"); + proto_item_set_len(mtp3_item, JAPAN_HEADER_LENGTH); + break; + }; - /* create display subtree for the protocol */ - mtp3_tree = proto_item_add_subtree(mtp3_item, ett_mtp3); + /* create display subtree for the protocol */ + mtp3_tree = proto_item_add_subtree(mtp3_item, ett_mtp3); - mtp3_addr_opc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t)); - mtp3_addr_dpc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t)); + mtp3_addr_opc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t)); + mtp3_addr_dpc = (mtp3_addr_pc_t *)wmem_alloc0(pinfo->pool, sizeof(mtp3_addr_pc_t)); - /* Dissect the packet (even if !tree so can call sub-dissectors and update - * the source and destination address columns) */ - dissect_mtp3_sio(tvb, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc); - dissect_mtp3_routing_label(tvb, pinfo, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc); + /* Dissect the packet (even if !tree so can call sub-dissectors and update + * the source and destination address columns) */ + dissect_mtp3_sio(tvb, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc); + dissect_mtp3_routing_label(tvb, pinfo, mtp3_tree, mtp3_addr_opc, mtp3_addr_dpc); - memcpy(&(tap_rec->addr_opc), mtp3_addr_opc, sizeof(mtp3_addr_pc_t)); - memcpy(&(tap_rec->addr_dpc), mtp3_addr_dpc, sizeof(mtp3_addr_pc_t)); + memcpy(&(tap_rec->addr_opc), mtp3_addr_opc, sizeof(mtp3_addr_pc_t)); + memcpy(&(tap_rec->addr_dpc), mtp3_addr_dpc, sizeof(mtp3_addr_pc_t)); - tap_rec->si_code = (tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK); - tap_rec->size = tvb_length(tvb); + tap_rec->si_code = (tvb_get_guint8(tvb, SIO_OFFSET) & SERVICE_INDICATOR_MASK); + tap_rec->size = tvb_length(tvb); - tap_queue_packet(mtp3_tap, pinfo, tap_rec); + tap_queue_packet(mtp3_tap, pinfo, tap_rec); - dissect_mtp3_payload(tvb, pinfo, tree); + dissect_mtp3_payload(tvb, pinfo, tree); - mtp3_standard = pref_mtp3_standard; + mtp3_standard = pref_mtp3_standard; } void @@ -822,39 +822,39 @@ proto_register_mtp3(void) }; static const enum_val_t mtp3_options[] = { - { "itu", "ITU", ITU_STANDARD }, - { "ansi", "ANSI", ANSI_STANDARD }, - { "chinese-itu", "Chinese ITU", CHINESE_ITU_STANDARD }, - { "japan", "Japan", JAPAN_STANDARD }, - { NULL, NULL, 0 } + { "itu", "ITU", ITU_STANDARD }, + { "ansi", "ANSI", ANSI_STANDARD }, + { "chinese-itu", "Chinese ITU", CHINESE_ITU_STANDARD }, + { "japan", "Japan", JAPAN_STANDARD }, + { NULL, NULL, 0 } }; static const enum_val_t mtp3_addr_fmt_str_e[] = { - { "decimal", "Decimal", MTP3_ADDR_FMT_DEC }, - { "hexadecimal", "Hexadecimal", MTP3_ADDR_FMT_HEX }, - { "ni-decimal", "NI-Decimal", MTP3_ADDR_FMT_NI_DEC }, - { "ni-hexadecimal", "NI-Hexadecimal", MTP3_ADDR_FMT_NI_HEX }, - { "dashed", "Dashed", MTP3_ADDR_FMT_DASHED }, - { NULL, NULL, 0 } + { "decimal", "Decimal", MTP3_ADDR_FMT_DEC }, + { "hexadecimal", "Hexadecimal", MTP3_ADDR_FMT_HEX }, + { "ni-decimal", "NI-Decimal", MTP3_ADDR_FMT_NI_DEC }, + { "ni-hexadecimal", "NI-Hexadecimal", MTP3_ADDR_FMT_NI_HEX }, + { "dashed", "Dashed", MTP3_ADDR_FMT_DASHED }, + { NULL, NULL, 0 } }; static const enum_val_t itu_pc_structures[] = { - { "unstructured", "Unstructured", ITU_PC_STRUCTURE_NONE}, - { "3-8-3", "3-8-3", ITU_PC_STRUCTURE_3_8_3 }, - { "4-3-4-3", "4-3-4-3", ITU_PC_STRUCTURE_4_3_4_3 }, - { NULL, NULL, 0 } + { "unstructured", "Unstructured", ITU_PC_STRUCTURE_NONE}, + { "3-8-3", "3-8-3", ITU_PC_STRUCTURE_3_8_3 }, + { "4-3-4-3", "4-3-4-3", ITU_PC_STRUCTURE_4_3_4_3 }, + { NULL, NULL, 0 } }; static const enum_val_t japan_pc_structures[] = { - { "unstructured", "Unstructured", JAPAN_PC_STRUCTURE_NONE}, - { "7-4-5", "7-4-5", JAPAN_PC_STRUCTURE_7_4_5 }, - { "3-4-4-5", "3-4-4-5", JAPAN_PC_STRUCTURE_3_4_4_5 }, - { NULL, NULL, 0 } + { "unstructured", "Unstructured", JAPAN_PC_STRUCTURE_NONE}, + { "7-4-5", "7-4-5", JAPAN_PC_STRUCTURE_7_4_5 }, + { "3-4-4-5", "3-4-4-5", JAPAN_PC_STRUCTURE_3_4_4_5 }, + { NULL, NULL, 0 } }; /* Register the protocol name and description */ proto_mtp3 = proto_register_protocol("Message Transfer Part Level 3", - "MTP3", "mtp3"); + "MTP3", "mtp3"); mtp3_handle = register_dissector("mtp3", dissect_mtp3, proto_mtp3); /* Required function calls to register the header fields and subtrees used */ @@ -862,48 +862,48 @@ proto_register_mtp3(void) proto_register_subtree_array(ett, array_length(ett)); mtp3_sio_dissector_table = register_dissector_table("mtp3.service_indicator", - "MTP3 Service indicator", - FT_UINT8, BASE_HEX); + "MTP3 Service indicator", + FT_UINT8, BASE_HEX); mtp3_tap = register_tap("mtp3"); mtp3_module = prefs_register_protocol(proto_mtp3, NULL); prefs_register_bool_preference(mtp3_module, "heuristic_standard", - "Try to determine the MTP3 standard heuristically", - "This only works for SCCP traffic for now", - &mtp3_heuristic_standard); + "Try to determine the MTP3 standard heuristically", + "This only works for SCCP traffic for now", + &mtp3_heuristic_standard); prefs_register_enum_preference(mtp3_module, "standard", "MTP3 standard", - "The SS7 standard used in MTP3 packets", - &mtp3_standard, mtp3_options, FALSE); + "The SS7 standard used in MTP3 packets", + &mtp3_standard, mtp3_options, FALSE); prefs_register_enum_preference(mtp3_module, "itu_pc_structure", "ITU Pointcode structure", - "The structure of the pointcodes in ITU networks", - &itu_pc_structure, itu_pc_structures, FALSE); + "The structure of the pointcodes in ITU networks", + &itu_pc_structure, itu_pc_structures, FALSE); prefs_register_enum_preference(mtp3_module, "japan_pc_structure", "Japan Pointcode structure", - "The structure of the pointcodes in Japan networks", - &japan_pc_structure, japan_pc_structures, FALSE); + "The structure of the pointcodes in Japan networks", + &japan_pc_structure, japan_pc_structures, FALSE); prefs_register_bool_preference(mtp3_module, "ansi_5_bit_sls", - "Use 5-bit SLS (ANSI only)", - "Use 5-bit (instead of 8-bit) SLS in ANSI MTP3 packets", - &mtp3_use_ansi_5_bit_sls); + "Use 5-bit SLS (ANSI only)", + "Use 5-bit (instead of 8-bit) SLS in ANSI MTP3 packets", + &mtp3_use_ansi_5_bit_sls); prefs_register_bool_preference(mtp3_module, "japan_5_bit_sls", - "Use 5-bit SLS (Japan only)", - "Use 5-bit (instead of 4-bit) SLS in Japan MTP3 packets", - &mtp3_use_japan_5_bit_sls); + "Use 5-bit SLS (Japan only)", + "Use 5-bit (instead of 4-bit) SLS in Japan MTP3 packets", + &mtp3_use_japan_5_bit_sls); prefs_register_enum_preference(mtp3_module, "addr_format", "Address Format", - "Format for point code in the address columns", - &mtp3_addr_fmt, mtp3_addr_fmt_str_e, FALSE); + "Format for point code in the address columns", + &mtp3_addr_fmt, mtp3_addr_fmt_str_e, FALSE); prefs_register_bool_preference(mtp3_module, "itu_priority", - "Show MSU priority (national option, ITU and China ITU only)", - "Decode the spare bits of the SIO as the MSU priority (a national option in ITU)", - &mtp3_show_itu_priority); + "Show MSU priority (national option, ITU and China ITU only)", + "Decode the spare bits of the SIO as the MSU priority (a national option in ITU)", + &mtp3_show_itu_priority); } @@ -915,3 +915,16 @@ proto_reg_handoff_mtp3(void) data_handle = find_dissector("data"); } + +/* + * Editor modelines - http://www.wireshark.org/tools/modelines.html + * + * 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: + */ |