aboutsummaryrefslogtreecommitdiffstats
path: root/packet-mtp2.c
diff options
context:
space:
mode:
authorMichael Tüxen <tuexen@fh-muenster.de>2003-04-19 20:13:23 +0000
committerMichael Tüxen <tuexen@fh-muenster.de>2003-04-19 20:13:23 +0000
commitd8b05d1729d16c0484b66eb7cb9ddac4303621b7 (patch)
tree5d3d9da0bcc8e54c690e1309b9b42d05d837c7d5 /packet-mtp2.c
parent2f420ebf71a559ef42a7638af139b636c27ddae0 (diff)
downloadwireshark-d8b05d1729d16c0484b66eb7cb9ddac4303621b7.tar.gz
wireshark-d8b05d1729d16c0484b66eb7cb9ddac4303621b7.tar.bz2
wireshark-d8b05d1729d16c0484b66eb7cb9ddac4303621b7.zip
- add better INFO column handling using col_set_fence.
- change my e-mail. svn path=/trunk/; revision=7502
Diffstat (limited to 'packet-mtp2.c')
-rw-r--r--packet-mtp2.c137
1 files changed, 46 insertions, 91 deletions
diff --git a/packet-mtp2.c b/packet-mtp2.c
index 8aa2aba410..feec13a88d 100644
--- a/packet-mtp2.c
+++ b/packet-mtp2.c
@@ -3,9 +3,9 @@
* It is hopefully (needs testing) compliant to
* ITU-T Q.703
*
- * Copyright 2001, Michael Tuexen <michael.tuexen[AT]icn.siemens.de>
+ * Copyright 2001, Michael Tuexen <tuexen [AT] fh-muenster.de>
*
- * $Id: packet-mtp2.c,v 1.4 2002/08/28 21:00:22 jmayer Exp $
+ * $Id: packet-mtp2.c,v 1.5 2003/04/19 20:13:22 tuexen Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -33,7 +33,6 @@
#endif
#include <glib.h>
-
#include <epan/packet.h>
/* Initialize the protocol and registered fields */
@@ -57,14 +56,11 @@ static int mtp3_proto_id;
#define FSN_FIB_LENGTH 1
#define LI_LENGTH 1
#define HEADER_LENGTH (BSN_BIB_LENGTH + FSN_FIB_LENGTH + LI_LENGTH)
-#define SF_LENGTH 1
-#define LONG_SF_LENGTH 2
#define BSN_BIB_OFFSET 0
#define FSN_FIB_OFFSET (BSN_BIB_OFFSET + BSN_BIB_LENGTH)
#define LI_OFFSET (FSN_FIB_OFFSET + FSN_FIB_LENGTH)
#define SIO_OFFSET (LI_OFFSET + LI_LENGTH)
-#define SF_OFFSET (LI_OFFSET + LI_LENGTH)
#define BSN_MASK 0x7f
#define BIB_MASK 0x80
@@ -73,67 +69,58 @@ static int mtp3_proto_id;
#define LI_MASK 0x3f
#define SPARE_MASK 0xc0
-#define STATUS_O 0x0
-#define STATUS_N 0x1
-#define STATUS_E 0x2
-#define STATUS_OS 0x3
-#define STATUS_PO 0x4
-#define STATUS_B 0x5
-
-static const value_string status_field_vals[] = {
- { STATUS_O, "Status Indication O" },
- { STATUS_N, "Status Indication N" },
- { STATUS_E, "Status Indication E" },
- { STATUS_OS, "Status Indication OS" },
- { STATUS_PO, "Status Indication PO" },
- { STATUS_B, "Status Indication BO" },
- { 0, NULL}
-};
-
static void
dissect_mtp2_header(tvbuff_t *su_tvb, proto_item *mtp2_tree)
{
- guint8 bsn_bib, fsn_fib, li;
-
- bsn_bib = tvb_get_guint8(su_tvb, BSN_BIB_OFFSET);
- fsn_fib = tvb_get_guint8(su_tvb, FSN_FIB_OFFSET);
- li = tvb_get_guint8(su_tvb, LI_OFFSET);
-
if (mtp2_tree) {
- proto_tree_add_uint(mtp2_tree, hf_mtp2_bsn, su_tvb, BSN_BIB_OFFSET, BSN_BIB_LENGTH, bsn_bib);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_bib, su_tvb, BSN_BIB_OFFSET, BSN_BIB_LENGTH, bsn_bib);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_fsn, su_tvb, FSN_FIB_OFFSET, FSN_FIB_LENGTH, fsn_fib);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_fib, su_tvb, FSN_FIB_OFFSET, FSN_FIB_LENGTH, fsn_fib);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_li, su_tvb, LI_OFFSET, LI_LENGTH, li);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_spare, su_tvb, LI_OFFSET, LI_LENGTH, li);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_bsn, su_tvb, BSN_BIB_OFFSET, BSN_BIB_LENGTH, LITTLE_ENDIAN);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_bib, su_tvb, BSN_BIB_OFFSET, BSN_BIB_LENGTH, LITTLE_ENDIAN);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_fsn, su_tvb, FSN_FIB_OFFSET, FSN_FIB_LENGTH, LITTLE_ENDIAN);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_fib, su_tvb, FSN_FIB_OFFSET, FSN_FIB_LENGTH, LITTLE_ENDIAN);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_li, su_tvb, LI_OFFSET, LI_LENGTH, LITTLE_ENDIAN);
+ proto_tree_add_item(mtp2_tree, hf_mtp2_spare, su_tvb, LI_OFFSET, LI_LENGTH, LITTLE_ENDIAN);
}
}
static void
dissect_mtp2_fisu(packet_info *pinfo)
{
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_str(pinfo->cinfo, COL_INFO, "FISU");
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_set_str(pinfo->cinfo, COL_INFO, "FISU ");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ }
}
+static const value_string status_field_vals[] = {
+ { 0x0, "Status Indication O" },
+ { 0x1, "Status Indication N" },
+ { 0x2, "Status Indication E" },
+ { 0x3, "Status Indication OS" },
+ { 0x4, "Status Indication PO" },
+ { 0x5, "Status Indication BO" },
+ { 0, NULL}
+};
+
+#define SF_OFFSET (LI_OFFSET + LI_LENGTH)
+#define SF_LENGTH 1
+#define LONG_SF_LENGTH 2
+
static void
dissect_mtp2_lssu(tvbuff_t *su_tvb, packet_info *pinfo, proto_item *mtp2_tree)
{
- guint8 li, sf;
- guint16 long_sf;
-
- if (check_col(pinfo->cinfo, COL_INFO))
- col_append_str(pinfo->cinfo, COL_INFO, "LSSU");
+ guint8 li;
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_set_str(pinfo->cinfo, COL_INFO, "LSSU ");
+ col_set_fence(pinfo->cinfo, COL_INFO);
+ }
+
if (mtp2_tree) {
li = tvb_get_guint8(su_tvb, LI_OFFSET);
- if ((li & LI_MASK) == 1) {
- sf = tvb_get_guint8(su_tvb, SF_OFFSET);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_sf, su_tvb, SF_OFFSET, SF_LENGTH, sf);
- } else {
- long_sf = tvb_get_letohs(su_tvb, SF_OFFSET);
- proto_tree_add_uint(mtp2_tree, hf_mtp2_long_sf, su_tvb, SF_OFFSET, LONG_SF_LENGTH, long_sf);
- }
+ if ((li & LI_MASK) == 1)
+ proto_tree_add_item(mtp2_tree, hf_mtp2_sf, su_tvb, SF_OFFSET, SF_LENGTH, LITTLE_ENDIAN);
+ else
+ proto_tree_add_item(mtp2_tree, hf_mtp2_long_sf, su_tvb, SF_OFFSET, LONG_SF_LENGTH, LITTLE_ENDIAN);
}
}
@@ -143,8 +130,8 @@ dissect_mtp2_msu(tvbuff_t *su_tvb, packet_info *pinfo, proto_item *mtp2_item, pr
gint sif_sio_length;
tvbuff_t *sif_sio_tvb;
- if ((check_col(pinfo->cinfo, COL_INFO)) && (!proto_is_protocol_enabled(mtp3_proto_id)))
- col_append_str(pinfo->cinfo, COL_INFO, "MSU");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_set_str(pinfo->cinfo, COL_INFO, "MSU ");
sif_sio_length = tvb_length(su_tvb) - HEADER_LENGTH;
sif_sio_tvb = tvb_new_subset(su_tvb, SIO_OFFSET, sif_sio_length, sif_sio_length);
@@ -198,46 +185,14 @@ proto_register_mtp2(void)
{
static hf_register_info hf[] = {
- { &hf_mtp2_bsn,
- { "Backward sequence number", "mtp2.bsn",
- FT_UINT8, BASE_DEC, NULL, BSN_MASK,
- "", HFILL }
- },
- { &hf_mtp2_bib,
- { "Backward indicator bit", "mtp2.bib",
- FT_UINT8, BASE_DEC, NULL, BIB_MASK,
- "", HFILL }
- },
- { &hf_mtp2_fsn,
- { "Forward sequence number", "mtp2.fsn",
- FT_UINT8, BASE_DEC, NULL, FSN_MASK,
- "", HFILL }
- },
- { &hf_mtp2_fib,
- { "Forward indicator bit", "mtp2.fib",
- FT_UINT8, BASE_DEC, NULL, FIB_MASK,
- "", HFILL }
- },
- { &hf_mtp2_li,
- { "Length Indicator", "mtp2.li",
- FT_UINT8, BASE_DEC, NULL, LI_MASK,
- "", HFILL }
- },
- { &hf_mtp2_spare,
- { "Spare", "mtp2.spare",
- FT_UINT8, BASE_DEC, NULL, SPARE_MASK,
- "", HFILL }
- },
- { &hf_mtp2_sf,
- { "Status field", "mtp2.sf",
- FT_UINT8, BASE_DEC, VALS(status_field_vals), 0x0,
- "", HFILL }
- },
- { &hf_mtp2_long_sf,
- { "Status field", "mtp2.long_sf",
- FT_UINT16, BASE_HEX, NULL, 0x0,
- "", HFILL }
- }
+ { &hf_mtp2_bsn, { "Backward sequence number", "mtp2.bsn", FT_UINT8, BASE_DEC, NULL, BSN_MASK, "", HFILL } },
+ { &hf_mtp2_bib, { "Backward indicator bit", "mtp2.bib", FT_UINT8, BASE_DEC, NULL, BIB_MASK, "", HFILL } },
+ { &hf_mtp2_fsn, { "Forward sequence number", "mtp2.fsn", FT_UINT8, BASE_DEC, NULL, FSN_MASK, "", HFILL } },
+ { &hf_mtp2_fib, { "Forward indicator bit", "mtp2.fib", FT_UINT8, BASE_DEC, NULL, FIB_MASK, "", HFILL } },
+ { &hf_mtp2_li, { "Length Indicator", "mtp2.li", FT_UINT8, BASE_DEC, NULL, LI_MASK, "", HFILL } },
+ { &hf_mtp2_spare, { "Spare", "mtp2.spare", FT_UINT8, BASE_DEC, NULL, SPARE_MASK, "", HFILL } },
+ { &hf_mtp2_sf, { "Status field", "mtp2.sf", FT_UINT8, BASE_DEC, VALS(status_field_vals), 0x0, "", HFILL } },
+ { &hf_mtp2_long_sf, { "Status field", "mtp2.sf", FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL } }
};
static gint *ett[] = {