aboutsummaryrefslogtreecommitdiffstats
path: root/packet-x25.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2000-05-31 05:09:07 +0000
committerGuy Harris <guy@alum.mit.edu>2000-05-31 05:09:07 +0000
commit283ce59938ad2be252a6232e40a958e177a40e1a (patch)
treeb451d4a712d9b914022ba872296e70e55b8d9bc5 /packet-x25.c
parentaa553f63ecc7b9e310a05b743502c50f6dffb800 (diff)
Add routines for adding items to a protocol tree that take arguments of
a particular type, rather than taking a varargs list, along the lines of the "proto_tree_add_XXX_format()" routines. Replace most calls to "proto_tree_add_item()" and "proto_tree_add_item_hidden()" with calls to those routines. Rename "proto_tree_add_item()" and "proto_tree_add_item_hidden()" to "proto_tree_add_item_old()" and "proto_tree_add_item_hidden_old()", and add new "proto_tree_add_item()" and "proto_tree_add_item_hidden()" routines that don't take the item to be added as an argument - instead, they fetch the argument from the packet whose tvbuff was handed to them, from the offset handed to them. svn path=/trunk/; revision=2031
Diffstat (limited to 'packet-x25.c')
-rw-r--r--packet-x25.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/packet-x25.c b/packet-x25.c
index 140201b42e..710e5fb2ce 100644
--- a/packet-x25.c
+++ b/packet-x25.c
@@ -2,7 +2,7 @@
* Routines for x25 packet disassembly
* Olivier Abad <oabad@cybercable.fr>
*
- * $Id: packet-x25.c,v 1.31 2000/05/29 22:35:11 oabad Exp $
+ * $Id: packet-x25.c,v 1.32 2000/05/31 05:07:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -1432,14 +1432,14 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
"X.25");
x25_tree = proto_item_add_subtree(ti, ett_x25);
if (bytes0_1 & 0x8000)
- proto_tree_add_item(x25_tree,
+ proto_tree_add_boolean(x25_tree,
(modulo == 8) ? hf_x25_qbit : hf_ex25_qbit, tvb, 0, 2,
bytes0_1);
if (bytes0_1 & 0x4000)
- proto_tree_add_item(x25_tree,
+ proto_tree_add_boolean(x25_tree,
(modulo == 8) ? hf_x25_dbit : hf_ex25_dbit, tvb, 0, 2,
bytes0_1);
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_mod : hf_ex25_mod,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_mod : hf_ex25_mod,
tvb, 0, 2, bytes0_1);
}
@@ -1452,7 +1452,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
: "Call req." ,
vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree,
+ proto_tree_add_uint(x25_tree,
(modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree,
@@ -1566,7 +1566,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
: "Call acc." ,
vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
tvb, 0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree,
(modulo == 8) ? hf_x25_type : hf_ex25_type,
@@ -1598,7 +1598,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
x25_hash_add_proto_end(vc, pinfo->fd->abs_secs, pinfo->fd->abs_usecs);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree,
(modulo == 8) ? hf_x25_type : hf_ex25_type,
@@ -1616,9 +1616,9 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_fstr(pinfo->fd, COL_INFO, "Clear Conf. VC:%d", vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_CLEAR_CONFIRMATION);
}
localoffset = x25_pkt_len;
@@ -1635,7 +1635,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(int)tvb_get_guint8(tvb, 3));
}
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_DIAGNOSTIC);
proto_tree_add_text(x25_tree, tvb, 3, 1,
"Diagnostic : %d", (int)tvb_get_guint8(tvb, 3));
@@ -1646,9 +1646,9 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_fstr(pinfo->fd, COL_INFO, "Interrupt VC:%d", vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_INTERRUPT);
}
localoffset = x25_pkt_len;
@@ -1657,9 +1657,9 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_fstr(pinfo->fd, COL_INFO, "Interrupt Conf. VC:%d", vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_INTERRUPT_CONFIRMATION);
}
localoffset = x25_pkt_len;
@@ -1674,7 +1674,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
x25_hash_add_proto_end(vc, pinfo->fd->abs_secs, pinfo->fd->abs_usecs);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
proto_tree_add_uint_format(x25_tree,
(modulo == 8) ? hf_x25_type : hf_ex25_type, tvb, 2, 1,
@@ -1692,9 +1692,9 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_fstr(pinfo->fd, COL_INFO, "Reset conf. VC:%d", vc);
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn, tvb,
0, 2, bytes0_1);
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_RESET_CONFIRMATION);
}
localoffset = x25_pkt_len;
@@ -1724,7 +1724,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_str(pinfo->fd, COL_INFO, "Restart conf.");
if (x25_tree)
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_RESTART_CONFIRMATION);
localoffset = x25_pkt_len;
break;
@@ -1732,7 +1732,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_str(pinfo->fd, COL_INFO, "Registration req.");
if (x25_tree)
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_REGISTRATION_REQUEST);
localoffset = 3;
if (localoffset < x25_pkt_len)
@@ -1754,7 +1754,7 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if(check_col(pinfo->fd, COL_INFO))
col_add_str(pinfo->fd, COL_INFO, "Registration conf.");
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_type : hf_ex25_type, tvb,
2, 1, X25_REGISTRATION_CONFIRMATION);
proto_tree_add_text(x25_tree, tvb, 3, 1,
"Cause: %s", registration_code(tvb_get_guint8(tvb, 3)));
@@ -1796,31 +1796,31 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
(tvb_get_guint8(tvb, localoffset+1) & 0x01) ? " M" : "");
}
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
tvb, localoffset-2, 2, bytes0_1);
if (modulo == 8) {
- proto_tree_add_item_hidden(x25_tree, hf_x25_type, tvb,
+ proto_tree_add_uint_hidden(x25_tree, hf_x25_type, tvb,
localoffset, 1, X25_DATA);
- proto_tree_add_item(x25_tree, hf_x25_p_r, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_r, tvb,
localoffset, 1, pkt_type);
if (pkt_type & 0x10)
- proto_tree_add_item(x25_tree, hf_x25_mbit, tvb, localoffset, 1,
+ proto_tree_add_boolean(x25_tree, hf_x25_mbit, tvb, localoffset, 1,
pkt_type);
- proto_tree_add_item(x25_tree, hf_x25_p_s, tvb, localoffset, 1,
+ proto_tree_add_uint(x25_tree, hf_x25_p_s, tvb, localoffset, 1,
pkt_type);
proto_tree_add_text(x25_tree, tvb, localoffset, 1,
decode_boolean_bitfield(pkt_type, 0x01, 1*8,
NULL, "DATA"));
}
else {
- proto_tree_add_item_hidden(x25_tree, hf_ex25_type, tvb,
+ proto_tree_add_uint_hidden(x25_tree, hf_ex25_type, tvb,
localoffset, 1, X25_DATA);
- proto_tree_add_item(x25_tree, hf_x25_p_r, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_r, tvb,
localoffset, 1, pkt_type);
- proto_tree_add_item(x25_tree, hf_x25_p_s, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_s, tvb,
localoffset+1, 1, tvb_get_guint8(tvb, localoffset+1));
if (tvb_get_guint8(tvb, localoffset+1) & 0x01)
- proto_tree_add_item(x25_tree, hf_ex25_mbit, tvb,
+ proto_tree_add_boolean(x25_tree, hf_ex25_mbit, tvb,
localoffset+1, 1, tvb_get_guint8(tvb, localoffset+1));
}
}
@@ -1839,19 +1839,19 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
vc, tvb_get_guint8(tvb, localoffset+1) >> 1);
}
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
tvb, localoffset-2, 2, bytes0_1);
if (modulo == 8) {
- proto_tree_add_item(x25_tree, hf_x25_p_r, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_r, tvb,
localoffset, 1, pkt_type);
- proto_tree_add_item(x25_tree, hf_x25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_type, tvb,
localoffset, 1, X25_RR);
}
else {
- proto_tree_add_item(x25_tree, hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_ex25_type, tvb,
localoffset, 1, X25_RR);
proto_tree_add_item(x25_tree, hf_ex25_p_r, tvb,
- localoffset+1, 1, tvb_get_guint8(tvb, localoffset+1));
+ localoffset+1, 1, FALSE);
}
}
break;
@@ -1866,19 +1866,19 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
vc, tvb_get_guint8(tvb, localoffset+1) >> 1);
}
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
tvb, localoffset-2, 2, bytes0_1);
if (modulo == 8) {
- proto_tree_add_item(x25_tree, hf_x25_p_r, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_r, tvb,
localoffset, 1, pkt_type);
- proto_tree_add_item(x25_tree, hf_x25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_type, tvb,
localoffset, 1, X25_RNR);
}
else {
- proto_tree_add_item(x25_tree, hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_ex25_type, tvb,
localoffset, 1, X25_RNR);
proto_tree_add_item(x25_tree, hf_ex25_p_r, tvb,
- localoffset+1, 1, tvb_get_guint8(tvb, localoffset+1));
+ localoffset+1, 1, FALSE);
}
}
break;
@@ -1893,19 +1893,19 @@ dissect_x25(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
vc, tvb_get_guint8(tvb, localoffset+1) >> 1);
}
if (x25_tree) {
- proto_tree_add_item(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
+ proto_tree_add_uint(x25_tree, (modulo == 8) ? hf_x25_lcn : hf_ex25_lcn,
tvb, localoffset-2, 2, bytes0_1);
if (modulo == 8) {
- proto_tree_add_item(x25_tree, hf_x25_p_r, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_p_r, tvb,
localoffset, 1, pkt_type);
- proto_tree_add_item(x25_tree, hf_x25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_x25_type, tvb,
localoffset, 1, X25_REJ);
}
else {
- proto_tree_add_item(x25_tree, hf_ex25_type, tvb,
+ proto_tree_add_uint(x25_tree, hf_ex25_type, tvb,
localoffset, 1, X25_REJ);
proto_tree_add_item(x25_tree, hf_ex25_p_r, tvb,
- localoffset+1, 1, tvb_get_guint8(tvb, localoffset+1));
+ localoffset+1, 1, FALSE);
}
}
}