aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-07-02 00:19:34 +0000
committerGuy Harris <guy@alum.mit.edu>2001-07-02 00:19:34 +0000
commit7ee4a188045b5be59fc12a387437384b03293d70 (patch)
tree4a17b6f0efc2b6b2e48459cfbbd5362e6c1dce43
parent6bdba27db55ea1743ef4e89ebd4a28b00fcbe06d (diff)
Tvbuffified ISIS dissector, from Ronnie Sahlberg.
svn path=/trunk/; revision=3626
-rw-r--r--AUTHORS1
-rw-r--r--packet-isis-clv.c229
-rw-r--r--packet-isis-clv.h53
-rw-r--r--packet-isis-hello.c315
-rw-r--r--packet-isis-hello.h8
-rw-r--r--packet-isis-lsp.c800
-rw-r--r--packet-isis-lsp.h12
-rw-r--r--packet-isis-snp.c205
-rw-r--r--packet-isis-snp.h12
-rw-r--r--packet-isis.c171
-rw-r--r--packet-isis.h8
11 files changed, 921 insertions, 893 deletions
diff --git a/AUTHORS b/AUTHORS
index c1a5e10c8b..79d9e59ae6 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -536,6 +536,7 @@ Ronnie Sahlberg <rsahlber@bigpond.net.au> {
DVMRP support
MRDISC support
MSNIP support
+ Tvbuffified ISIS dissector
}
Borosa Tomislav <tomislav.borosa@SIEMENS.HR> {
diff --git a/packet-isis-clv.c b/packet-isis-clv.c
index 41841cdba7..dad016cff0 100644
--- a/packet-isis-clv.c
+++ b/packet-isis-clv.c
@@ -1,7 +1,7 @@
/* packet-isis-clv.c
* Common CLV decode routines.
*
- * $Id: packet-isis-clv.c,v 1.13 2001/06/23 19:45:12 guy Exp $
+ * $Id: packet-isis-clv.c,v 1.14 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -56,31 +56,32 @@
* CLV is n, x byte hex strings.
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_area_address_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree ) {
+isis_dissect_area_address_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length)
+{
char *sbuf;
int mylen;
while ( length > 0 ) {
- mylen = pd[offset];
+ mylen = tvb_get_guint8(tvb, offset);
length--;
if (length<=0) {
- isis_dissect_unknown( offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short address (no length for payload)");
return;
}
if ( mylen > length) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short address, packet say %d, we have %d left",
mylen, length );
return;
@@ -90,11 +91,11 @@ isis_dissect_area_address_clv(const u_char *pd, int offset,
* Lets turn the area address into "standard" 0000.0000.etc
* format string.
*/
-/* sbuf = isis_address_to_string ( pd, offset + 1, mylen );*/
- sbuf = print_nsap_net( pd + offset + 1, mylen );
+/* sbuf = isis_address_to_string ( tvb, offset + 1, mylen );*/
+ sbuf = print_nsap_net( tvb_get_ptr(tvb, offset + 1, mylen), mylen );
/* and spit it out */
if ( tree ) {
- proto_tree_add_text ( tree, NullTVB, offset, mylen + 1,
+ proto_tree_add_text ( tree, tvb, offset, mylen + 1,
"Area address (%d): %s", mylen, sbuf );
}
offset += mylen + 1;
@@ -116,19 +117,20 @@ isis_dissect_area_address_clv(const u_char *pd, int offset,
* use to name this.
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
* char * : Password meaning
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
- frame_data *fd, proto_tree *tree, char *meaning) {
+isis_dissect_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, char *meaning)
+{
u_char pw_type;
char sbuf[300]; /* 255 + header info area */
char *s = sbuf;
@@ -138,7 +140,8 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
return;
}
- pw_type = pd[offset++];
+ pw_type = tvb_get_guint8(tvb, offset);
+ offset += 1;
length--;
auth_unsupported = FALSE;
@@ -147,7 +150,7 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
s += sprintf ( s, "clear text (1), password (length %d) = ", length );
if ( length > 0 ) {
- strncpy(s, &pd[offset], length);
+ strncpy(s, tvb_get_ptr(tvb, offset, length), length);
s[length] = 0;
} else {
strcat(s, "no clear-text password found!!!" );
@@ -157,10 +160,12 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
s += sprintf ( s, "hmac-md5 (54), password (length %d) = ", length );
if ( length == 16 ) {
- s += sprintf ( s, "0x%02x", pd[offset++] );
+ s += sprintf ( s, "0x%02x", tvb_get_guint8(tvb, offset) );
+ offset += 1;
length--;
while (length > 0) {
- s += sprintf ( s, "%02x", pd[offset++] );
+ s += sprintf ( s, "%02x", tvb_get_guint8(tvb, offset) );
+ offset += 1;
length--;
}
s = 0;
@@ -174,11 +179,11 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
break;
}
- proto_tree_add_text ( tree, NullTVB, offset - 1, length + 1,
+ proto_tree_add_text ( tree, tvb, offset - 1, length + 1,
"%s %s", meaning, sbuf );
if ( auth_unsupported ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Unknown authentication type" );
}
}
@@ -191,12 +196,11 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
* pls note that the hostname is not null terminated
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
- * char * : Password meaning
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
@@ -204,35 +208,29 @@ isis_dissect_authentication_clv(const u_char *pd, int offset, guint length,
void
-isis_dissect_hostname_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree ) {
- char sbuf[256*6];
- char *s = sbuf;
- int hlen = length;
- int old_offset = offset;
-
-
+isis_dissect_hostname_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length)
+{
if ( !tree ) return; /* nothing to do! */
- memcpy ( s, &pd[offset], hlen);
- sbuf[hlen] = 0; /* don't forget null termination */
-
- if ( hlen == 0 ) {
- sprintf ( sbuf, "--none--" );
+ if ( length == 0 ) {
+ proto_tree_add_text ( tree, tvb, offset, length,
+ "Hostname: --none--" );
+ } else {
+ proto_tree_add_text ( tree, tvb, offset, length,
+ "Hostname: %.*s", length,
+ tvb_get_ptr(tvb, offset, length) );
}
-
- proto_tree_add_text ( tree, NullTVB, old_offset, hlen,
- "Hostname: %s", sbuf );
}
void
-isis_dissect_mt_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id ) {
-
- int mt_block;
+isis_dissect_mt_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id)
+{
+ guint16 mt_block;
char mt_desc[60];
while (length>1) {
@@ -241,7 +239,7 @@ isis_dissect_mt_clv(const u_char *pd, int offset,
if (length!=1)
{
/* fetch two bytes */
- mt_block=(*(pd+offset)<<8)+(*(pd+offset+1));
+ mt_block=tvb_get_ntohs(tvb, offset);
/* mask out the lower 12 bits */
switch(mt_block&0x0fff) {
@@ -263,7 +261,7 @@ isis_dissect_mt_clv(const u_char *pd, int offset,
default:
strcpy(mt_desc,"Reserved for IETF Consensus");
}
- proto_tree_add_text ( tree, NullTVB, offset, 2 ,
+ proto_tree_add_text ( tree, tvb, offset, 2 ,
"%s Topology (0x%x)%s%s",
mt_desc,
mt_block&0xfff,
@@ -271,7 +269,7 @@ isis_dissect_mt_clv(const u_char *pd, int offset,
(mt_block&0x4000) ? ", ATT bit set" : "" );
}
else {
- proto_tree_add_text ( tree, NullTVB, offset, 1 ,
+ proto_tree_add_text ( tree, tvb, offset, 2 ,
"malformed MT-ID");
break;
}
@@ -291,33 +289,36 @@ isis_dissect_mt_clv(const u_char *pd, int offset,
* addresses, plain and simple.
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
- * gint : tree id to use for proto tree.
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
+ * int : tree id to use for proto tree.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_ip_int_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id ) {
+isis_dissect_ip_int_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id)
+{
guint32 addr;
+
if ( length <= 0 ) {
return;
}
while ( length > 0 ) {
if ( length < 4 ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Short ip interface address (%d vs 4)",length );
return;
}
- memcpy(&addr, &pd[offset], sizeof(addr));
+
+ tvb_memcpy(tvb, (guint8 *)&addr, offset, sizeof(addr));
if ( tree ) {
- proto_tree_add_ipv4(tree, tree_id, NullTVB, offset, 4, addr);
+ proto_tree_add_ipv4(tree, tree_id, tvb, offset, 4, addr);
}
offset += 4;
length -= 4;
@@ -334,19 +335,20 @@ isis_dissect_ip_int_clv(const u_char *pd, int offset,
* addresses, plain and simple.
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
- * gint : tree id to use for proto tree.
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
+ * int : tree id to use for proto tree.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_ipv6_int_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id ) {
+isis_dissect_ipv6_int_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id)
+{
guint8 addr [16];
if ( length <= 0 ) {
@@ -355,19 +357,20 @@ isis_dissect_ipv6_int_clv(const u_char *pd, int offset,
while ( length > 0 ) {
if ( length < 16 ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Short IPv6 interface address (%d vs 16)",length );
return;
}
- memcpy(addr, &pd[offset], sizeof(addr));
+ tvb_memcpy(tvb, addr, offset, sizeof(addr));
if ( tree ) {
- proto_tree_add_ipv6(tree, tree_id, NullTVB, offset, 16, addr);
+ proto_tree_add_ipv6(tree, tree_id, tvb, offset, 16, addr);
}
offset += 16;
length -= 16;
}
}
+
/*
* Name: isis_dissect_te_router_id_clv()
*
@@ -377,32 +380,34 @@ isis_dissect_ipv6_int_clv(const u_char *pd, int offset,
* only _one_ IP address is present
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
- * gint : tree id to use for proto tree.
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
+ * int : tree id to use for proto tree.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_te_router_id_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id ) {
+isis_dissect_te_router_id_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id)
+{
guint32 addr;
+
if ( length <= 0 ) {
return;
}
if ( length != 4 ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"malformed Traffic Engineering Router ID (%d vs 4)",length );
return;
}
- memcpy(&addr, &pd[offset], sizeof(addr));
+ tvb_memcpy(tvb, (guint8 *)&addr, offset, sizeof(addr));
if ( tree ) {
- proto_tree_add_ipv4(tree, tree_id, NullTVB, offset, 4, addr);
+ proto_tree_add_ipv4(tree, tree_id, tvb, offset, 4, addr);
}
}
@@ -416,18 +421,19 @@ isis_dissect_te_router_id_clv(const u_char *pd, int offset,
* plus 1 for zero termination. We just just 256*6 for simplicity.
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
+ * int : offset into packet data where we are.
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_nlpid_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree ) {
+isis_dissect_nlpid_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length)
+{
char sbuf[256*6];
char *s = sbuf;
int hlen = length;
@@ -440,7 +446,8 @@ isis_dissect_nlpid_clv(const u_char *pd, int offset,
s += sprintf ( s, ", " );
}
s += sprintf ( s, "%s (0x%02x)",
- val_to_str(pd[offset], nlpid_vals, "Unknown"), pd[offset]);
+ val_to_str(tvb_get_guint8(tvb, offset), nlpid_vals,
+ "Unknown"), tvb_get_guint8(tvb, offset));
offset++;
}
@@ -448,7 +455,7 @@ isis_dissect_nlpid_clv(const u_char *pd, int offset,
sprintf ( sbuf, "--none--" );
}
- proto_tree_add_text ( tree, NullTVB, old_offset, hlen,
+ proto_tree_add_text ( tree, tvb, old_offset, hlen,
"NLPID(s): %s", sbuf );
}
@@ -464,23 +471,24 @@ isis_dissect_nlpid_clv(const u_char *pd, int offset,
* "unknown" clv entrie using the passed in unknown clv tree id.
*
* Input:
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : offset into packet data where we are.
* isis_clv_handle_t * : NULL dissector terminated array of codes
* and handlers (along with tree text and tree id's).
* int : length of CLV area.
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
- * gint : unknown clv tree id
+ * int : length of IDs in packet.
+ * int : unknown clv tree id
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_clvs(const isis_clv_handle_t *opts, int len, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
- gint unknown_tree_id ) {
+isis_dissect_clvs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, const isis_clv_handle_t *opts, int len, int id_length,
+ int unknown_tree_id)
+{
guint8 code;
guint8 length;
int q;
@@ -490,12 +498,16 @@ isis_dissect_clvs(const isis_clv_handle_t *opts, int len, int id_length,
int adj;
while ( len > 0 ) {
- code = pd[offset++];
- length = pd[offset++];
+ code = tvb_get_guint8(tvb, offset);
+ offset += 1;
+
+ length = tvb_get_guint8(tvb, offset);
+ offset += 1;
+
adj = (sizeof(code) + sizeof(length) + length);
len -= adj;
- if ( len < 0 || !BYTES_ARE_IN_FRAME(offset, length) ) {
- isis_dissect_unknown(offset, adj, tree, fd,
+ if ( len < 0 ) {
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Short CLV header (%d vs %d)",
adj, len + adj );
return;
@@ -509,20 +521,20 @@ isis_dissect_clvs(const isis_clv_handle_t *opts, int len, int id_length,
/* adjust by 2 for code/len octets */
snprintf ( sbuf, sizeof(sbuf), "%s (%d)",
opts[q].tree_text, length );
- ti = proto_tree_add_text(tree, NullTVB, offset - 2,
+ ti = proto_tree_add_text(tree, tvb, offset - 2,
length + 2, sbuf);
clv_tree = proto_item_add_subtree(ti,
*opts[q].tree_id );
} else {
clv_tree = NULL;
}
- opts[q].dissect(pd, offset, length, id_length, fd,
- clv_tree );
+ opts[q].dissect(tvb, pinfo, clv_tree, offset,
+ id_length, length);
} else {
if (tree) {
snprintf ( sbuf, sizeof(sbuf),
"Unknown code (%d:%d)", code, length );
- ti = proto_tree_add_text(tree, NullTVB, offset - 2,
+ ti = proto_tree_add_text(tree, tvb, offset - 2,
length + 2, sbuf);
clv_tree = proto_item_add_subtree(ti,
unknown_tree_id );
@@ -533,3 +545,4 @@ isis_dissect_clvs(const isis_clv_handle_t *opts, int len, int id_length,
offset += length;
}
}
+
diff --git a/packet-isis-clv.h b/packet-isis-clv.h
index a74f5c0101..4f2136da16 100644
--- a/packet-isis-clv.h
+++ b/packet-isis-clv.h
@@ -1,7 +1,7 @@
/* packet-isis-clv.h
* Declares for common clv decoding functions.
*
- * $Id: packet-isis-clv.h,v 1.6 2001/06/23 19:45:12 guy Exp $
+ * $Id: packet-isis-clv.h,v 1.7 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -34,33 +34,38 @@ typedef struct {
int optcode; /* code for option */
char *tree_text; /* text for fold out */
gint *tree_id; /* id for add_item */
- void (*dissect)(const u_char *pd, int offset, guint length,
- int id_length, frame_data *fd, proto_tree *tree );
+ void (*dissect)(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int id_length, int length);
} isis_clv_handle_t;
/*
* Published API functions. NOTE, this are "local" API functions and
* are only valid from with isis decodes.
*/
-extern void isis_dissect_clvs(const isis_clv_handle_t *opts, int len,
- int id_length, const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree, int unknown_ett_handle );
-extern void isis_dissect_area_address_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree );
-extern void isis_dissect_metric(proto_tree *tree, int offset, guint8 value,
- char *pstr, int force_supported, gint tree_id );
-extern void isis_dissect_authentication_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, char *meaning);
-extern void isis_dissect_ip_int_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id );
-extern void isis_dissect_ipv6_int_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id );
-extern void isis_dissect_nlpid_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree );
-extern void isis_dissect_hostname_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree );
-extern void isis_dissect_mt_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id );
-extern void isis_dissect_te_router_id_clv(const u_char *pd, int offset,
- guint length, frame_data *fd, proto_tree *tree, gint tree_id );
+extern void isis_dissect_clvs(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ const isis_clv_handle_t *opts, int len, int id_length,
+ int unknown_tree_id);
+
+extern void isis_dissect_nlpid_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length);
+extern void isis_dissect_te_router_id_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id);
+extern void isis_dissect_ipv6_int_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id);
+extern void isis_dissect_ip_int_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id);
+extern void isis_dissect_mt_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, int tree_id);
+extern void isis_dissect_hostname_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length);
+extern void isis_dissect_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length, char *meaning);
+extern void isis_dissect_area_address_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int length);
+
+extern void isis_dissect_metric(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ guint8 value, char *pstr, int force_supported);
+
#endif /* _PACKET_ISIS_CLV_H */
diff --git a/packet-isis-hello.c b/packet-isis-hello.c
index ebd076d77a..ed16d5a3bb 100644
--- a/packet-isis-hello.c
+++ b/packet-isis-hello.c
@@ -1,7 +1,7 @@
/* packet-isis-hello.c
* Routines for decoding isis hello packets and their CLVs
*
- * $Id: packet-isis-hello.c,v 1.18 2001/06/26 20:50:30 guy Exp $
+ * $Id: packet-isis-hello.c,v 1.19 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -78,25 +78,33 @@ static const value_string isis_hello_circuit_type_vals[] = {
/*
* Predclare dissectors for use in clv dissection.
*/
-static void dissect_hello_area_address_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_padding_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_nlpid_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_ip_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_ipv6_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_ptp_adj_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_hello_mt_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-
+static void dissect_hello_padding_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_is_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_area_address_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_mt_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_hello_nlpid_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
static const isis_clv_handle_t clv_l1_hello_opts[] = {
@@ -296,20 +304,22 @@ static const isis_clv_handle_t clv_ptp_hello_opts[] = {
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_nlpid_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_nlpid_clv(pd, offset, length, fd, tree );
+dissect_hello_nlpid_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_nlpid_clv(tvb, pinfo, tree, offset, length);
}
/*
@@ -320,21 +330,23 @@ dissect_hello_nlpid_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_mt_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_mt_clv(pd, offset, length, fd, tree,
+dissect_hello_mt_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_mt_clv(tvb, pinfo, tree, offset, length,
hf_isis_hello_clv_mt );
}
@@ -346,20 +358,22 @@ dissect_hello_mt_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_ip_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_ip_int_clv(pd, offset, length, fd, tree,
+dissect_hello_ip_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_ip_int_clv(tvb, pinfo, tree, offset, length,
hf_isis_hello_clv_ipv4_int_addr );
}
@@ -371,20 +385,22 @@ dissect_hello_ip_int_addr_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_ipv6_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_ipv6_int_clv(pd, offset, length, fd, tree,
+dissect_hello_ipv6_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_ipv6_int_clv(tvb, pinfo, tree, offset, length,
hf_isis_hello_clv_ipv6_int_addr );
}
@@ -397,21 +413,23 @@ dissect_hello_ipv6_int_addr_clv(const u_char *pd, int offset,
* password.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_authentication_clv(pd, offset, length, fd, tree,
- "authentication" );
+dissect_hello_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_authentication_clv(tvb, pinfo, tree, offset,
+ length, "authentication" );
}
/*
@@ -422,29 +440,34 @@ dissect_hello_auth_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_hello_area_address_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_area_address_clv(pd, offset, length, fd, tree );
+dissect_hello_area_address_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_area_address_clv(tvb, pinfo, tree, offset, length);
}
-void
-dissect_hello_ptp_adj_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree ) {
+
+static void
+dissect_hello_ptp_adj_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
char adj_state[20];
- switch((int)*(pd+offset)) {
+ switch(tvb_get_guint8(tvb, offset)) {
case 0:
strcpy(adj_state,"Up");
break;
@@ -460,35 +483,35 @@ dissect_hello_ptp_adj_clv(const u_char *pd, int offset,
switch(length) {
case 1:
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text ( tree, tvb, offset, 1,
"Adjacency State: %s", adj_state );
break;
case 5:
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text ( tree, tvb, offset, 1,
"Adjacency State: %s", adj_state );
- proto_tree_add_text ( tree, NullTVB, offset+1, 4,
- "Extended Local Circuit ID: %d", (gint32)*(pd+offset+1) );
+ proto_tree_add_text ( tree, tvb, offset+1, 4,
+ "Extended Local Circuit ID: %u", tvb_get_ntohl(tvb, offset+1) );
break;
case 11:
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text ( tree, tvb, offset, 1,
"Adjacency State: %s", adj_state );
- proto_tree_add_text ( tree, NullTVB, offset+1, 4,
- "Extended Local Circuit ID: %d", (gint32)*(pd+offset+1) );
- proto_tree_add_text ( tree, NullTVB, offset+5, 6,
- "Neighbor System ID: %s", print_system_id( pd+offset+5, 6 ) );
+ proto_tree_add_text ( tree, tvb, offset+1, 4,
+ "Extended Local Circuit ID: %u", tvb_get_ntohl(tvb, offset+1) );
+ proto_tree_add_text ( tree, tvb, offset+5, 6,
+ "Neighbor System ID: %s", print_system_id( tvb_get_ptr(tvb, offset+5, 6), 6 ) );
break;
case 15:
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text ( tree, tvb, offset, 1,
"Adjacency State: %s", adj_state );
- proto_tree_add_text ( tree, NullTVB, offset+1, 4,
- "Extended Local Circuit ID: %d", (gint32)*(pd+offset+1) );
- proto_tree_add_text ( tree, NullTVB, offset+5, 6,
- "Neighbor System ID: %s", print_system_id( pd+offset+5, 6 ) );
- proto_tree_add_text ( tree, NullTVB, offset+11, 4,
- "Neighbor Extended Local Circuit ID: %d", (gint32)*(pd+offset+11) );
+ proto_tree_add_text ( tree, tvb, offset+1, 4,
+ "Extended Local Circuit ID: %u", tvb_get_ntohl(tvb, offset+1) );
+ proto_tree_add_text ( tree, tvb, offset+5, 6,
+ "Neighbor System ID: %s", print_system_id( tvb_get_ptr(tvb, offset+5, 6), 6 ) );
+ proto_tree_add_text ( tree, tvb, offset+11, 4,
+ "Neighbor Extended Local Circuit ID: %u", tvb_get_ntohl(tvb, offset+11) );
break;
default:
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"malformed TLV (%d vs 1,5,11,15)", length );
return;
}
@@ -502,23 +525,23 @@ dissect_hello_ptp_adj_clv(const u_char *pd, int offset,
* (they tend to be an 802.3 MAC address, but its not required).
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
- * gint : tree id to use for proto tree.
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
-void
-dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree ) {
+static void
+dissect_hello_is_neighbors_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int id_length, int length)
+{
while ( length > 0 ) {
if (length<6) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short is neighbor (%d vs 6)", length );
return;
}
@@ -527,15 +550,14 @@ dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
* format string.
*/
if ( tree ) {
- proto_tree_add_text ( tree, NullTVB, offset, 6,
- "IS Neighbor: %s", print_system_id( pd + offset, 6 ) );
+ proto_tree_add_text ( tree, tvb, offset, 6,
+ "IS Neighbor: %s", print_system_id( tvb_get_ptr(tvb, offset, 6), 6 ) );
}
offset += 6;
length -= 6;
}
}
-
/*
* Name: dissect_hello_padding_clv()
*
@@ -544,22 +566,24 @@ dissect_hello_is_neighbors_clv(const u_char *pd, int offset,
* so we just return.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void
*/
static void
-dissect_hello_padding_clv(const u_char *pd, int offset, guint length,
- int id_length, frame_data *fd, proto_tree *tree) {
+dissect_hello_padding_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, int id_length, int length)
+{
/* nothing to do here! */
}
+
/*
* Name: isis_dissect_isis_hello()
*
@@ -569,100 +593,90 @@ dissect_hello_padding_clv(const u_char *pd, int offset, guint length,
* a shorter header.
*
* Input:
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to add to. May be NULL.
+ * int offset : our offset into packet data.
* int : hello type, a la packet-isis.h ISIS_TYPE_* values
* int : header length of packet.
* int : length of IDs in packet.
- * u_char * : packet data
- * int offset : our offset into packet data.
- * frame_data * : frame data
- * proto_tree * : protocol display tree to add to. May be NULL.
*
* Output:
* void, will modify proto_tree if not NULL.
*/
void
-isis_dissect_isis_hello(int hello_type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
+isis_dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int hello_type, int header_length, int id_length)
+{
proto_item *ti;
proto_tree *hello_tree = NULL;
int len;
- int hlen;
guint16 pdu_length;
- OLD_CHECK_DISPLAY_AS_DATA(proto_isis_hello, pd, offset, fd, tree);
-
- if (hello_type == ISIS_TYPE_PTP_HELLO) {
- hlen = 1+id_length+2+2+1;
- } else {
- hlen = 1+id_length+2+2+1+id_length+1;
- }
-
- if (!BYTES_ARE_IN_FRAME(offset, hlen)) {
- isis_dissect_unknown(offset, hlen, tree, fd,
- "not enough capture data for header (%d vs %d)",
- hlen, END_OF_FRAME);
+ if (!proto_is_protocol_enabled(proto_isis_hello)) {
+ dissect_data(tvb, offset, pinfo, tree);
return;
}
if (tree) {
- ti = proto_tree_add_item(tree, proto_isis_hello, NullTVB,
- offset, END_OF_FRAME, FALSE);
+ ti = proto_tree_add_item(tree, proto_isis_hello, tvb,
+ offset, tvb_length_remaining(tvb, offset), FALSE);
hello_tree = proto_item_add_subtree(ti, ett_isis_hello);
proto_tree_add_uint_format(hello_tree,
hf_isis_hello_circuit_reserved,
- NullTVB, offset, 1, pd[offset],
+ tvb, offset, 1, tvb_get_guint8(tvb, offset),
"Circuit type : %s, reserved(0x%02x == 0)",
- val_to_str(pd[offset]&ISIS_HELLO_CTYPE_MASK,
+ val_to_str(tvb_get_guint8(tvb, offset)&ISIS_HELLO_CTYPE_MASK,
isis_hello_circuit_type_vals,
"Unknown (0x%x)"),
- pd[offset]&ISIS_HELLO_CT_RESERVED_MASK
+ tvb_get_guint8(tvb, offset)&ISIS_HELLO_CT_RESERVED_MASK
);
}
offset += 1;
if (tree) {
- proto_tree_add_bytes_format(hello_tree, hf_isis_hello_source_id, NullTVB,
- offset, id_length, &pd[offset],
+ proto_tree_add_bytes_format(hello_tree, hf_isis_hello_source_id, tvb,
+ offset, id_length, tvb_get_ptr(tvb, offset, id_length),
"SystemID{ Sender of PDU } : %s",
- print_system_id( pd + offset, id_length ) );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
}
offset += id_length;
if (tree) {
- proto_tree_add_uint(hello_tree, hf_isis_hello_holding_timer, NullTVB,
- offset, 2, pntohs(&pd[offset]));
+ proto_tree_add_uint(hello_tree, hf_isis_hello_holding_timer, tvb,
+ offset, 2, tvb_get_ntohs(tvb, offset));
}
offset += 2;
- pdu_length = pntohs(&pd[offset]);
+ pdu_length = tvb_get_ntohs(tvb, offset);
if (tree) {
- proto_tree_add_uint(hello_tree, hf_isis_hello_pdu_length, NullTVB,
+ proto_tree_add_uint(hello_tree, hf_isis_hello_pdu_length, tvb,
offset, 2, pdu_length);
}
offset += 2;
if (hello_type == ISIS_TYPE_PTP_HELLO) {
if (tree) {
- proto_tree_add_uint(hello_tree, hf_isis_hello_local_circuit_id, NullTVB,
- offset, 1, pd[offset] );
+ proto_tree_add_uint(hello_tree, hf_isis_hello_local_circuit_id, tvb,
+ offset, 1, tvb_get_guint8(tvb, offset) );
}
offset += 1;
} else {
if (tree) {
- proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, NullTVB,
- offset, 1, pd[offset],
+ proto_tree_add_uint_format(hello_tree, hf_isis_hello_priority_reserved, tvb,
+ offset, 1, tvb_get_guint8(tvb, offset),
"Priority : %d, reserved(0x%02x == 0)",
- pd[offset]&ISIS_HELLO_PRIORITY_MASK,
- pd[offset]&ISIS_HELLO_P_RESERVED_MASK );
+ tvb_get_guint8(tvb, offset)&ISIS_HELLO_PRIORITY_MASK,
+ tvb_get_guint8(tvb, offset)&ISIS_HELLO_P_RESERVED_MASK );
}
offset += 1;
if (tree) {
- proto_tree_add_bytes_format(hello_tree, hf_isis_hello_lan_id, NullTVB,
- offset, id_length + 1, &pd[offset],
+ proto_tree_add_bytes_format(hello_tree, hf_isis_hello_lan_id, tvb,
+ offset, id_length + 1, tvb_get_ptr(tvb, offset, id_length+1),
"SystemID{ Designated IS } : %s",
- print_system_id( pd + offset, id_length + 1 ) );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length + 1 ) );
}
offset += id_length + 1;
}
@@ -670,7 +684,7 @@ isis_dissect_isis_hello(int hello_type, int header_length, int id_length,
len = pdu_length;
len -= header_length;
if (len < 0) {
- isis_dissect_unknown(offset, header_length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"packet header length %d went beyond packet",
header_length );
return;
@@ -680,14 +694,17 @@ isis_dissect_isis_hello(int hello_type, int header_length, int id_length,
* our list of valid ones!
*/
if (hello_type == ISIS_TYPE_L1_HELLO){
- isis_dissect_clvs ( clv_l1_hello_opts, len, id_length, pd,
- offset, fd, hello_tree, ett_isis_hello_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+ clv_l1_hello_opts, len, id_length,
+ ett_isis_hello_clv_unknown);
} else if (hello_type == ISIS_TYPE_L2_HELLO) {
- isis_dissect_clvs ( clv_l2_hello_opts, len, id_length, pd,
- offset, fd, hello_tree, ett_isis_hello_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+ clv_l2_hello_opts, len, id_length,
+ ett_isis_hello_clv_unknown);
} else {
- isis_dissect_clvs ( clv_ptp_hello_opts, len, id_length, pd,
- offset, fd, hello_tree, ett_isis_hello_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, hello_tree, offset,
+ clv_ptp_hello_opts, len, id_length,
+ ett_isis_hello_clv_unknown);
}
}
diff --git a/packet-isis-hello.h b/packet-isis-hello.h
index d82d74c9d3..cf1f030529 100644
--- a/packet-isis-hello.h
+++ b/packet-isis-hello.h
@@ -1,7 +1,7 @@
/* packet-isis-hello.h
* Declares for hello handling inside isis.
*
- * $Id: packet-isis-hello.h,v 1.4 2001/06/23 19:45:12 guy Exp $
+ * $Id: packet-isis-hello.h,v 1.5 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -97,7 +97,7 @@
* Published API functions. NOTE, this are "local" API functions and
* are only valid from with isis decodes.
*/
-extern void isis_dissect_isis_hello(int hello_type, int header_length,
- int id_length, const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree);
+extern void isis_dissect_isis_hello(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int hello_type, int header_length,int id_length);
#endif /* _PACKET_ISIS_HELLO_H */
diff --git a/packet-isis-lsp.c b/packet-isis-lsp.c
index 6d48a6b4d9..9882fd257b 100644
--- a/packet-isis-lsp.c
+++ b/packet-isis-lsp.c
@@ -1,7 +1,7 @@
/* packet-isis-lsp.c
* Routines for decoding isis lsp packets and their CLVs
*
- * $Id: packet-isis-lsp.c,v 1.19 2001/07/01 20:37:02 guy Exp $
+ * $Id: packet-isis-lsp.c,v 1.20 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -99,44 +99,65 @@ static const value_string isis_lsp_istype_vals[] = {
/*
* Predclare dissectors for use in clv dissection.
*/
-static void dissect_lsp_area_address_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_l1_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_l1_es_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_l2_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ext_is_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_partition_dis_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_prefix_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ext_ip_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ipv6_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_nlpid_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_hostname_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_te_router_id_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ip_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_ipv6_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_l1_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_l2_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_mt_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
-static void dissect_lsp_mt_is_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree);
+static void dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_partition_dis_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_area_address_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_l2_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_l1_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_te_router_id_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_hostname_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_mt_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_nlpid_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_lsp_ip_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length);
+
+
static const isis_clv_handle_t clv_l1_lsp_opts[] = {
{
@@ -386,25 +407,27 @@ static const isis_clv_handle_t clv_l2_lsp_opts[] = {
* The 7th bit must be zero (reserved).
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out. May be NULL
+ * int : offset into packet data where we are.
+ * guint8 : value of the metric.
+ * char * : string giving type of the metric.
* int : force supported. True is the supported bit MUST be zero.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_metric(proto_tree *tree, int offset, guint8 value,
- char *pstr, int force_supported ) {
+dissect_metric(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, guint8 value, char *pstr, int force_supported )
+{
int s;
if ( !tree ) return;
s = ISIS_LSP_CLV_METRIC_SUPPORTED(value);
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text(tree, tvb, offset, 1,
"%s Metric: %s%s %s%d:%d", pstr,
s ? "Not supported" : "Supported",
(s && force_supported) ? "(but is required to be)":"",
@@ -412,9 +435,8 @@ dissect_metric(proto_tree *tree, int offset, guint8 value,
ISIS_LSP_CLV_METRIC_VALUE(value), value );
}
-
/*
- * Name: dissect_lsp_ip_reachabillity_clv()
+ * Name: dissect_lsp_ip_reachability_clv()
*
* Description:
* Decode an IP reachability CLV. This can be either internal or
@@ -423,19 +445,21 @@ dissect_metric(proto_tree *tree, int offset, guint8 value,
* are a metric block followed by an IP addr and mask.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+dissect_lsp_ip_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
proto_item *ti;
proto_tree *ntree = NULL;
guint32 src, mask, prefix_len;
@@ -455,7 +479,7 @@ dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
while ( length > 0 ) {
if (length<12) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short IP reachability (%d vs 12)", length );
return;
}
@@ -463,8 +487,8 @@ dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
* Gotta build a sub-tree for all our pieces
*/
if ( tree ) {
- memcpy(&src, &pd[offset+4], 4);
- memcpy(&mask, &pd[offset+8], 4);
+ tvb_memcpy(tvb, (guint8 *)&src, offset+4, 4);
+ tvb_memcpy(tvb, (guint8 *)&mask, offset+8, 4);
/* find out if the mask matches one of 33 possible prefix lengths */
@@ -481,12 +505,12 @@ dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
lets dump the mask, otherwise print the prefix_len */
if(prefix_len==34) {
- ti = proto_tree_add_text ( tree, NullTVB, offset, 12,
+ ti = proto_tree_add_text ( tree, tvb, offset, 12,
"IPv4 prefix: %s mask %s",
ip_to_str((guint8*)&src),
ip_to_str((guint8*)&mask));
} else {
- ti = proto_tree_add_text ( tree, NullTVB, offset, 12,
+ ti = proto_tree_add_text ( tree, tvb, offset, 12,
"IPv4 prefix: %s/%d",
ip_to_str((guint8*)&src),
prefix_len );
@@ -495,35 +519,35 @@ dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
ntree = proto_item_add_subtree(ti,
ett_isis_lsp_clv_ip_reachability);
- proto_tree_add_text (ntree, NullTVB, offset, 1,
+ proto_tree_add_text (ntree, tvb, offset, 1,
"Default Metric: %d, %s, Distribution: %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset]) ? "External" : "Internal",
- ISIS_LSP_CLV_METRIC_UPDOWN(pd[offset]) ? "down" : "up");
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal",
+ ISIS_LSP_CLV_METRIC_UPDOWN(tvb_get_guint8(tvb, offset)) ? "down" : "up");
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+1])) {
- proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
+ proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+1]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+1]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
}
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+2])) {
- proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
+ proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Exense Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+2]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+2]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+2, 1, "Exense Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
}
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+3])) {
- proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
+ proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+3]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+3]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
}
}
offset += 12;
@@ -542,19 +566,21 @@ dissect_lsp_ip_reachability_clv(const u_char *pd, int offset,
* sub-CLV(s).
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_ext_ip_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+dissect_lsp_ext_ip_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
proto_item *pi = NULL;
proto_tree *subtree = NULL;
guint8 ctrl_info;
@@ -566,27 +592,27 @@ dissect_lsp_ext_ip_reachability_clv(const u_char *pd, int offset,
while (length > 0) {
memset (prefix, 0, 4);
- ctrl_info = pd[offset+4];
+ ctrl_info = tvb_get_guint8(tvb, offset+4);
bit_length = ctrl_info & 0x3f;
byte_length = (bit_length + 7) / 8;
- memcpy (prefix, &pd[offset+5], byte_length);
- pi = proto_tree_add_text (tree, NullTVB, offset, 0,
+ tvb_memcpy (tvb, prefix, offset+5, byte_length);
+ pi = proto_tree_add_text (tree, tvb, offset, 0,
"IPv4 prefix: %s/%d",
ip_to_str (prefix),
bit_length );
subtree = proto_item_add_subtree (pi,
ett_isis_lsp_part_of_clv_ext_ip_reachability);
- proto_tree_add_text (subtree, NullTVB, offset, 4,
- "Metric: %d, Distribution: %s", pntohl (&pd[offset]), ((ctrl_info & 0x80) == 0) ? "up" : "down" );
+ proto_tree_add_text (subtree, tvb, offset, 4,
+ "Metric: %d, Distribution: %s", tvb_get_ntohl(tvb, offset), ((ctrl_info & 0x80) == 0) ? "up" : "down" );
- proto_tree_add_text (subtree, NullTVB, offset+4, 1,
+ proto_tree_add_text (subtree, tvb, offset+4, 1,
"%s sub-TLVs present",
((ctrl_info & 0x40) == 0) ? "no" : "" );
len = 5 + byte_length;
if ((ctrl_info & 0x40) != 0)
- len += 1 + pd[offset+len] ;
+ len += 1 + tvb_get_guint8(tvb, offset+len) ;
proto_item_set_len (pi, len);
offset += len;
length -= len;
@@ -599,19 +625,21 @@ dissect_lsp_ext_ip_reachability_clv(const u_char *pd, int offset,
* Description: Decode an IPv6 reachability CLV - code 236.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_ipv6_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+dissect_lsp_ipv6_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
proto_item *ti;
proto_tree *ntree = NULL;
guint8 bit_length, byte_length;
@@ -625,35 +653,35 @@ dissect_lsp_ipv6_reachability_clv(const u_char *pd, int offset,
memset (prefix.s6_addr, 0, 16);
while (length > 0) {
- bit_length = pd[offset+5];
+ bit_length = tvb_get_guint8(tvb, offset+5);
byte_length = (bit_length + 7) / 8;
- memcpy (prefix.s6_addr, &pd[offset+6], byte_length);
- ti = proto_tree_add_text (tree, NullTVB, offset, 0,
+ tvb_memcpy (tvb, prefix.s6_addr, offset+6, byte_length);
+ ti = proto_tree_add_text (tree, tvb, offset, 0,
"IP prefix: %s /%d",
ip6_to_str (&prefix),
bit_length );
ntree = proto_item_add_subtree (ti, ett_isis_lsp_part_of_clv_ipv6_reachability);
- metric = pntohl (&pd[offset]);
- proto_tree_add_text (ntree, NullTVB, offset, 4,
+ metric = tvb_get_ntohl(tvb, offset);
+ proto_tree_add_text (ntree, tvb, offset, 4,
"Metric: %d", metric);
- ctrl_info = pd[offset+4];
- proto_tree_add_text (ntree, NullTVB, offset+4, 1,
+ ctrl_info = tvb_get_guint8(tvb, offset+4);
+ proto_tree_add_text (ntree, tvb, offset+4, 1,
"Distribution: %s, %s",
((ctrl_info & 0x80) == 0) ? "up" : "down",
((ctrl_info & 0x40) == 0) ? "internal" : "external" );
- proto_tree_add_text (ntree, NullTVB, offset+4, 1,
+ proto_tree_add_text (ntree, tvb, offset+4, 1,
"Reserved bits: 0x%x",
(ctrl_info & 0x1f) );
- proto_tree_add_text (ntree, NullTVB, offset+4, 1,
+ proto_tree_add_text (ntree, tvb, offset+4, 1,
"sub-TLVs: %s",
((ctrl_info & 0x20) == 0) ? "no" : "yes" );
len = 6 + byte_length;
if ((ctrl_info & 0x20) != 0)
- len += 1 + pd[offset+len] ;
+ len += 1 + tvb_get_guint8(tvb, offset+len);
proto_item_set_len (ti, len);
offset += len;
length -= len;
@@ -668,20 +696,22 @@ dissect_lsp_ipv6_reachability_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_nlpid_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_nlpid_clv(pd, offset, length, fd, tree );
+dissect_lsp_nlpid_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_nlpid_clv(tvb, pinfo, tree, offset, length);
}
/*
@@ -702,11 +732,12 @@ dissect_lsp_nlpid_clv(const u_char *pd, int offset,
* Output:
* void, will modify proto_tree if not null.
*/
-
static void
-dissect_lsp_mt_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_mt_clv(pd, offset, length, fd, tree,
+dissect_lsp_mt_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_mt_clv(tvb, pinfo, tree, offset, length,
hf_isis_lsp_clv_mt );
}
@@ -718,21 +749,22 @@ dissect_lsp_mt_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
-
static void
-dissect_lsp_hostname_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_hostname_clv(pd, offset, length, fd, tree );
+dissect_lsp_hostname_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_hostname_clv(tvb, pinfo, tree, offset, length);
}
@@ -744,26 +776,26 @@ dissect_lsp_hostname_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
-static void
-dissect_lsp_te_router_id_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_te_router_id_clv(pd, offset, length, fd, tree,
+static void
+dissect_lsp_te_router_id_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_te_router_id_clv(tvb, pinfo, tree, offset, length,
hf_isis_lsp_clv_te_router_id );
}
-
-
/*
* Name: dissect_lsp_ip_int_addr_clv()
*
@@ -772,20 +804,22 @@ dissect_lsp_te_router_id_clv(const u_char *pd, int offset,
* clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_ip_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_ip_int_clv(pd, offset, length, fd, tree,
+dissect_lsp_ip_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_ip_int_clv(tvb, pinfo, tree, offset, length,
hf_isis_lsp_clv_ipv4_int_addr );
}
@@ -797,20 +831,22 @@ dissect_lsp_ip_int_addr_clv(const u_char *pd, int offset,
* Calls into the clv common one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_ipv6_int_addr_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_ipv6_int_clv(pd, offset, length, fd, tree,
+dissect_lsp_ipv6_int_addr_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_ipv6_int_clv(tvb, pinfo, tree, offset, length,
hf_isis_lsp_clv_ipv6_int_addr );
}
@@ -822,20 +858,22 @@ dissect_lsp_ipv6_int_addr_clv(const u_char *pd, int offset,
* clv common one. An auth inside a L1 LSP is a per area password
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_l1_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_authentication_clv(pd, offset, length, fd, tree,
+dissect_lsp_l1_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_authentication_clv(tvb, pinfo, tree, offset, length,
"Per area authentication" );
}
@@ -847,20 +885,22 @@ dissect_lsp_l1_auth_clv(const u_char *pd, int offset,
* clv common one. An auth inside a L2 LSP is a per domain password
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_lsp_l2_auth_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_authentication_clv(pd, offset, length, fd, tree,
+dissect_lsp_l2_auth_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_authentication_clv(tvb, pinfo, tree, offset, length,
"Per domain authentication" );
}
@@ -872,20 +912,22 @@ dissect_lsp_l2_auth_clv(const u_char *pd, int offset,
* one.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_area_address_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_area_address_clv(pd, offset, length, fd, tree );
+dissect_lsp_area_address_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_area_address_clv(tvb, pinfo, tree, offset, length);
}
/*
@@ -901,12 +943,12 @@ dissect_lsp_area_address_clv(const u_char *pd, int offset,
* addresses.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
* int : set to decode first octet as virtual vs reserved == 0
* int : set to indicate EIS instead of IS (6 octet per addr instead of 7)
*
@@ -914,9 +956,10 @@ dissect_lsp_area_address_clv(const u_char *pd, int offset,
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_eis_neighbors_clv_inner(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree,
- int show_virtual, int is_eis) {
+dissect_lsp_eis_neighbors_clv_inner(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int length, int id_length, int show_virtual, int is_eis)
+{
proto_item *ti;
proto_tree *ntree = NULL;
int tlen;
@@ -926,12 +969,12 @@ dissect_lsp_eis_neighbors_clv_inner(const u_char *pd, int offset,
if ( tree ) {
if ( show_virtual ) {
/* virtual path flag */
- proto_tree_add_text ( tree, NullTVB, offset, 1,
- pd[offset] ? "IsNotVirtual" : "IsVirtual" );
+ proto_tree_add_text ( tree, tvb, offset, 1,
+ tvb_get_guint8(tvb, offset) ? "IsNotVirtual" : "IsVirtual" );
} else {
- proto_tree_add_text ( tree, NullTVB, offset, 1,
+ proto_tree_add_text ( tree, tvb, offset, 1,
"Reserved value 0x%02x, must == 0",
- pd[offset] );
+ tvb_get_guint8(tvb, offset) );
}
}
offset++;
@@ -941,7 +984,7 @@ dissect_lsp_eis_neighbors_clv_inner(const u_char *pd, int offset,
while ( length > 0 ) {
if (length<tlen) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short E/IS reachability (%d vs %d)", length,
tlen );
return;
@@ -951,47 +994,47 @@ dissect_lsp_eis_neighbors_clv_inner(const u_char *pd, int offset,
*/
if ( tree ) {
if ( is_eis ) {
- ti = proto_tree_add_text ( tree, NullTVB, offset, tlen,
+ ti = proto_tree_add_text(tree, tvb, offset, tlen,
"ES Neighbor: %s",
- print_system_id( pd + offset + 4, id_length ) );
+ print_system_id( tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
} else {
- ti = proto_tree_add_text ( tree, NullTVB, offset, tlen,
+ ti = proto_tree_add_text(tree, tvb, offset, tlen,
"IS Neighbor: %s",
- print_system_id( pd + offset + 4, id_length ) );
+ print_system_id(tvb_get_ptr(tvb, offset+4, id_length), id_length ) );
}
ntree = proto_item_add_subtree(ti,
ett_isis_lsp_clv_is_neighbors);
- proto_tree_add_text (ntree, NullTVB, offset, 1,
+ proto_tree_add_text (ntree, tvb, offset, 1,
"Default Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset]) ? "External" : "Internal");
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset)) ? "External" : "Internal");
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+1])) {
- proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+1))) {
+ proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+1, 1, "Delay Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+1]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+1]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+1, 1, "Delay Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+1)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+1)) ? "External" : "Internal");
}
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+2])) {
- proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+2))) {
+ proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+2, 1, "Expense Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+2]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+2]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+2, 1, "Expense Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+2)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+2)) ? "External" : "Internal");
}
- if (ISIS_LSP_CLV_METRIC_SUPPORTED(pd[offset+3])) {
- proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric: Not supported");
+ if (ISIS_LSP_CLV_METRIC_SUPPORTED(tvb_get_guint8(tvb, offset+3))) {
+ proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: Not supported");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+3, 1, "Error Metric: %d, %s",
- ISIS_LSP_CLV_METRIC_VALUE(pd[offset+3]),
- ISIS_LSP_CLV_METRIC_IE(pd[offset+3]) ? "External" : "Internal");
+ proto_tree_add_text (ntree, tvb, offset+3, 1, "Error Metric: %d, %s",
+ ISIS_LSP_CLV_METRIC_VALUE(tvb_get_guint8(tvb, offset+3)),
+ ISIS_LSP_CLV_METRIC_IE(tvb_get_guint8(tvb, offset+3)) ? "External" : "Internal");
}
}
@@ -1008,21 +1051,23 @@ dissect_lsp_eis_neighbors_clv_inner(const u_char *pd, int offset,
* the inner function with show virtual set to TRUE and is es set to FALSE.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_l1_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- dissect_lsp_eis_neighbors_clv_inner( pd, offset, length, id_length,
- fd, tree, TRUE, FALSE );
+dissect_lsp_l1_is_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
+ length, id_length, TRUE, FALSE);
}
/*
@@ -1033,21 +1078,23 @@ dissect_lsp_l1_is_neighbors_clv(const u_char *pd, int offset,
* the inner function with show virtual set to TRUE and es set to TRUE.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_l1_es_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- dissect_lsp_eis_neighbors_clv_inner( pd, offset, length, id_length,
- fd, tree, TRUE, TRUE);
+dissect_lsp_l1_es_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
+ length, id_length, TRUE, TRUE);
}
/*
@@ -1059,23 +1106,26 @@ dissect_lsp_l1_es_neighbors_clv(const u_char *pd, int offset,
* to FALSE
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_l2_is_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- dissect_lsp_eis_neighbors_clv_inner(pd, offset, length, id_length,
- fd, tree, FALSE, FALSE);
+dissect_lsp_l2_is_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ dissect_lsp_eis_neighbors_clv_inner(tvb, pinfo, tree, offset,
+ length, id_length, FALSE, FALSE);
}
+
/*
* Name: dissect_subclv_admin_group ()
*
@@ -1085,29 +1135,30 @@ dissect_lsp_l2_is_neighbors_clv(const u_char *pd, int offset,
* for dissect the administrive group sub-CLV (code 3).
*
* Input:
- * u_char * : packet data
- * int : offset into packet data where we are (beginning of the sub_clv value).
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : protocol display tree to fill out.
+ * int : offset into packet data where we are (beginning of the sub_clv value).
*
* Output:
* void
*/
static void
-dissect_subclv_admin_group (const u_char *pd, int offset, proto_tree *tree) {
+dissect_subclv_admin_group (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
proto_item *ti;
proto_tree *ntree;
guint32 clv_value;
guint32 mask;
int i;
- ti = proto_tree_add_text (tree, NullTVB, offset-2, 6, "Administrative group(s):");
+ ti = proto_tree_add_text(tree, tvb, offset-2, 6, "Administrative group(s):");
ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_admin_group);
- clv_value = pntohl (&pd[offset]);
+ clv_value = tvb_get_ntohl(tvb, offset);
mask = 1;
for (i = 0 ; i < 32 ; i++) {
if ( (clv_value & mask) != 0 ) {
- proto_tree_add_text (ntree, NullTVB, offset, 4, "group %d", i);
+ proto_tree_add_text (ntree, tvb, offset, 4, "group %d", i);
}
mask <<= 1;
}
@@ -1130,13 +1181,14 @@ dissect_subclv_admin_group (const u_char *pd, int offset, proto_tree *tree) {
* void
*/
static void
-dissect_subclv_max_bw (const u_char *pd, int offset, proto_tree *tree) {
+dissect_subclv_max_bw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
+{
guint32 ui;
gfloat bw;
- ui = pntohl (&pd[offset]);
+ ui = tvb_get_ntohl(tvb, offset);
memcpy (&bw, &ui, 4);
- proto_tree_add_text (tree, NullTVB, offset-2, 6,
+ proto_tree_add_text (tree, tvb, offset-2, 6,
"Maximum link bandwidth : %.2f Mbps", bw*8/1000000 );
}
@@ -1157,13 +1209,14 @@ dissect_subclv_max_bw (const u_char *pd, int offset, proto_tree *tree) {
* void
*/
static void
-dissect_subclv_rsv_bw (const u_char *pd, int offset, proto_tree *tree) {
+dissect_subclv_rsv_bw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
+{
guint32 ui;
gfloat bw;
- ui = pntohl (&pd[offset]);
+ ui = tvb_get_ntohl(tvb, offset);
memcpy (&bw, &ui, 4);
- proto_tree_add_text (tree, NullTVB, offset-2, 6,
+ proto_tree_add_text (tree, tvb, offset-2, 6,
"Reservable link bandwidth: %.2f Mbps", bw*8/1000000 );
}
@@ -1184,20 +1237,21 @@ dissect_subclv_rsv_bw (const u_char *pd, int offset, proto_tree *tree) {
* void
*/
static void
-dissect_subclv_unrsv_bw (const u_char *pd, int offset, proto_tree *tree) {
+dissect_subclv_unrsv_bw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
+{
proto_item *ti;
proto_tree *ntree;
guint32 ui;
gfloat bw;
int i;
- ti = proto_tree_add_text (tree, NullTVB, offset-2, 34, "Unreserved bandwidth:");
+ ti = proto_tree_add_text (tree, tvb, offset-2, 34, "Unreserved bandwidth:");
ntree = proto_item_add_subtree (ti, ett_isis_lsp_subclv_unrsv_bw);
for (i = 0 ; i < 8 ; i++) {
- ui = pntohl (&pd[offset]);
+ ui = tvb_get_ntohl(tvb, offset);;
memcpy (&bw, &ui, 4);
- proto_tree_add_text (ntree, NullTVB, offset+4*i, 4,
+ proto_tree_add_text (ntree, tvb, offset+4*i, 4,
"priority level %d: %.2f Mbps", i, bw*8/1000000 );
}
}
@@ -1212,19 +1266,21 @@ dissect_subclv_unrsv_bw (const u_char *pd, int offset, proto_tree *tree) {
* as a 24-bit unsigned interger and allows to add sub-CLV(s).
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_ext_is_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+dissect_lsp_ext_is_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
proto_item *ti;
proto_tree *ntree = NULL;
guint8 subclvs_len;
@@ -1234,61 +1290,61 @@ dissect_lsp_ext_is_reachability_clv(const u_char *pd, int offset,
if (!tree) return;
while (length > 0) {
- ti = proto_tree_add_text (tree, NullTVB, offset, 0,
+ ti = proto_tree_add_text (tree, tvb, offset, 0,
"IS neighbor: %s",
- print_system_id (&pd[offset], 7) );
+ print_system_id (tvb_get_ptr(tvb, offset, 7), 7) );
ntree = proto_item_add_subtree (ti,
ett_isis_lsp_part_of_clv_ext_is_reachability );
- proto_tree_add_text (ntree, NullTVB, offset+7, 3,
- "Metric: %d", pntoh24 (&pd[offset+7]) );
+ proto_tree_add_text (ntree, tvb, offset+7, 3,
+ "Metric: %d", tvb_get_ntoh24(tvb, offset+7) );
- subclvs_len = pd[offset+10];
+ subclvs_len = tvb_get_guint8(tvb, offset+10);
if (subclvs_len == 0) {
- proto_tree_add_text (ntree, NullTVB, offset+10, 1, "no sub-TLVs present");
+ proto_tree_add_text (ntree, tvb, offset+10, 1, "no sub-TLVs present");
}
else {
i = 0;
while (i < subclvs_len) {
- clv_code = pd[offset+11+i];
- clv_len = pd[offset+12+i];
+ clv_code = tvb_get_guint8(tvb, offset+11+i);
+ clv_len = tvb_get_guint8(tvb, offset+12+i);
switch (clv_code) {
case 3 :
- dissect_subclv_admin_group (pd, offset+13+i, ntree);
+ dissect_subclv_admin_group(tvb, pinfo, ntree, offset+13+i);
break;
case 6 :
- proto_tree_add_text (ntree, NullTVB, offset+11+i, 6,
- "IPv4 interface address: %s", ip_to_str (&pd[offset+13+i]) );
+ proto_tree_add_text (ntree, tvb, offset+11+i, 6,
+ "IPv4 interface address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
break;
case 8 :
- proto_tree_add_text (ntree, NullTVB, offset+11+i, 6,
- "IPv4 neighbor address: %s", ip_to_str (&pd[offset+13+i]) );
+ proto_tree_add_text (ntree, tvb, offset+11+i, 6,
+ "IPv4 neighbor address: %s", ip_to_str (tvb_get_ptr(tvb, offset+13+i, 4)) );
break;
case 9 :
- dissect_subclv_max_bw (pd, offset+13+i, ntree);
+ dissect_subclv_max_bw (tvb, pinfo, ntree, offset+13+i);
break;
case 10:
- dissect_subclv_rsv_bw (pd, offset+13+i, ntree);
+ dissect_subclv_rsv_bw (tvb, pinfo, ntree, offset+13+i);
break;
case 11:
- dissect_subclv_unrsv_bw (pd, offset+13+i, ntree);
+ dissect_subclv_unrsv_bw (tvb, pinfo, ntree, offset+13+i);
break;
case 18:
- proto_tree_add_text (ntree, NullTVB, offset+11+i, 5,
+ proto_tree_add_text (ntree, tvb, offset+11+i, 5,
"Traffic engineering default metric: %d",
- pntoh24 (&pd[offset+13+i]) );
+ tvb_get_ntoh24(tvb, offset+13+i) );
break;
case 250:
case 251:
case 252:
case 253:
case 254:
- proto_tree_add_text (ntree, NullTVB, offset+11+i, clv_len+2,
+ proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
"Unknown Cisco specific extensions: code %d, length %d",
clv_code, clv_len );
break;
default :
- proto_tree_add_text (ntree, NullTVB, offset+11+i, clv_len+2,
+ proto_tree_add_text (ntree, tvb, offset+11+i, clv_len+2,
"Unknown sub-CLV: code %d, length %d", clv_code, clv_len );
break;
}
@@ -1305,9 +1361,13 @@ dissect_lsp_ext_is_reachability_clv(const u_char *pd, int offset,
/* MT IS */
-static void
-dissect_lsp_mt_is_reachability_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+
+
+
+static void dissect_lsp_mt_is_reachability_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
proto_item *ti;
proto_tree *ntree = NULL;
guint8 subclvs_len;
@@ -1320,12 +1380,10 @@ dissect_lsp_mt_is_reachability_clv(const u_char *pd, int offset,
while (length > 0) {
- /* fetch two bytes */
-
- mt_block=(*(pd+offset)<<8)+(*(pd+offset+1));
-
-
- /* mask out the lower 12 bits */
+ /* fetch two bytes */
+ mt_block = tvb_get_ntohs(tvb, offset);
+
+ /* mask out the lower 12 bits */
switch(mt_block&0x0fff) {
case 0:
strcpy(mt_desc,"IPv4 unicast");
@@ -1346,26 +1404,26 @@ dissect_lsp_mt_is_reachability_clv(const u_char *pd, int offset,
strcpy(mt_desc,"Reserved for IETF Consensus");
}
- proto_tree_add_text ( tree, NullTVB, offset, 2 ,
+ proto_tree_add_text ( tree, tvb, offset, 2 ,
"%s Topology (0x%x)",
mt_desc,
mt_block&0xfff );
- ti = proto_tree_add_text (tree, NullTVB, offset+2, 0,
+ ti = proto_tree_add_text (tree, tvb, offset+2, 0,
"IS neighbor: %s",
- print_system_id (&pd[offset+2], 7) );
+ print_system_id(tvb_get_ptr(tvb, offset+2, 7), 7) );
ntree = proto_item_add_subtree (ti,
ett_isis_lsp_part_of_clv_mt_is );
- proto_tree_add_text (ntree, NullTVB, offset+9, 3,
- "Metric: %d", pntoh24 (&pd[offset+9]) );
+ proto_tree_add_text (ntree, tvb, offset+9, 3,
+ "Metric: %d", tvb_get_ntoh24(tvb, offset+9) );
- subclvs_len = pd[offset+12];
+ subclvs_len = tvb_get_guint8(tvb, offset+12);
if (subclvs_len == 0) {
- proto_tree_add_text (ntree, NullTVB, offset+12, 1, "no sub-TLVs present");
+ proto_tree_add_text (ntree, tvb, offset+12, 1, "no sub-TLVs present");
} else {
- proto_tree_add_text (ntree, NullTVB, offset+12, 1, "sub-TLVs present");
+ proto_tree_add_text (ntree, tvb, offset+12, 1, "sub-TLVs present");
}
len = 13 + subclvs_len;
@@ -1385,22 +1443,23 @@ dissect_lsp_mt_is_reachability_clv(const u_char *pd, int offset,
* "id_length"-octet IS.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_partition_dis_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
-
+dissect_lsp_partition_dis_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
if ( length < id_length ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"short lsp parition DIS(%d vs %d)", length,
id_length );
return;
@@ -1409,14 +1468,14 @@ dissect_lsp_partition_dis_clv(const u_char *pd, int offset,
* Gotta build a sub-tree for all our pieces
*/
if ( tree ) {
- proto_tree_add_text ( tree, NullTVB, offset, id_length,
+ proto_tree_add_text ( tree, tvb, offset, id_length,
"Partition designated L2 IS: %s",
- print_system_id( pd + offset, id_length ) );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ) );
}
length -= id_length;
offset += id_length;
if ( length > 0 ){
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Long lsp parition DIS, %d left over", length );
return;
}
@@ -1431,48 +1490,51 @@ dissect_lsp_partition_dis_clv(const u_char *pd, int offset,
* (see dissect_metric) followed by n addresses.
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of clv we are decoding
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
+ * int : length of clv we are decoding
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_lsp_prefix_neighbors_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
+dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb,
+ packet_info *pinfo, proto_tree *tree, int offset,
+ int id_length, int length)
+{
char *sbuf;
int mylen;
if ( length < 4 ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Short lsp prefix neighbors (%d vs 4)", length );
return;
}
if ( tree ) {
- dissect_metric ( tree, offset, pd[offset], "Default", TRUE );
- dissect_metric ( tree, offset + 1, pd[offset+1],
- "Delay", FALSE );
- dissect_metric ( tree, offset + 2, pd[offset+2],
- "Expense", FALSE );
- dissect_metric ( tree, offset + 3, pd[offset+3],
- "Error", FALSE );
+ dissect_metric (tvb, pinfo, tree, offset,
+ tvb_get_guint8(tvb, offset), "Default", TRUE );
+ dissect_metric (tvb, pinfo, tree, offset+1,
+ tvb_get_guint8(tvb, offset+1), "Delay", FALSE );
+ dissect_metric (tvb, pinfo, tree, offset+2,
+ tvb_get_guint8(tvb, offset+2), "Expense", FALSE );
+ dissect_metric (tvb, pinfo, tree, offset+3,
+ tvb_get_guint8(tvb, offset+3), "Error", FALSE );
}
offset += 4;
length -= 4;
while ( length > 0 ) {
- mylen = pd[offset];
+ mylen = tvb_get_guint8(tvb, offset);
length--;
if (length<=0) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Zero payload space after length in prefix neighbor" );
return;
}
if ( mylen > length) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Interal length of prefix neighbor too long (%d vs %d)",
mylen, length );
return;
@@ -1482,10 +1544,10 @@ dissect_lsp_prefix_neighbors_clv(const u_char *pd, int offset,
* Lets turn the area address into "standard" 0000.0000.etc
* format string.
*/
- sbuf = print_area( pd + offset + 1, mylen );
+ sbuf = print_area( tvb_get_ptr(tvb, offset+1, mylen), mylen );
/* and spit it out */
if ( tree ) {
- proto_tree_add_text ( tree, NullTVB, offset, mylen + 1,
+ proto_tree_add_text ( tree, tvb, offset, mylen + 1,
"Area address (%d): %s", mylen, sbuf );
}
offset += mylen + 1;
@@ -1500,23 +1562,25 @@ dissect_lsp_prefix_neighbors_clv(const u_char *pd, int offset,
* Display a LSP id into the display tree.
*
* Input:
- * char * : title string
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : tree to display into. REQUIRED
- * u_char * : packet data
* int : offset into packet data where we are.
+ * char * : title string
* int : length of IDs in packet.
*
* Output:
* void, but we will add to proto tree
*/
void
-isis_lsp_decode_lsp_id(char *tstr, proto_tree *tree, const u_char *pd,
- int offset, int id_length ) {
- proto_tree_add_text(tree, NullTVB, offset, id_length + 2,
+isis_lsp_decode_lsp_id(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, char *tstr, int id_length)
+{
+ proto_tree_add_text(tree, tvb, offset, id_length + 2,
"%s: %s.%02x-%02x", tstr,
- print_system_id( pd + offset, id_length ),
- pd[offset + id_length],
- pd[offset + id_length + 1] );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length), id_length ),
+ tvb_get_guint8(tvb, offset+id_length),
+ tvb_get_guint8(tvb, offset+id_length+1) );
}
/*
@@ -1527,74 +1591,68 @@ isis_lsp_decode_lsp_id(char *tstr, proto_tree *tree, const u_char *pd,
* de-mangler with the right list of valid CLVs.
*
* Input:
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to add to. May be NULL.
+ * int offset : our offset into packet data.
* int : LSP type, a la packet-isis.h ISIS_TYPE_* values
* int : header length of packet.
* int : length of IDs in packet.
- * u_char * : packet data
- * int offset : our offset into packet data.
- * frame_data * : frame data
- * proto_tree * : protocol display tree to add to. May be NULL.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
+isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int lsp_type, int header_length, int id_length)
+{
proto_item *ti;
proto_tree *lsp_tree = NULL;
- int hlen;
guint16 pdu_length;
char sbuf[128];
int inx, q, some, value, len;
- OLD_CHECK_DISPLAY_AS_DATA(proto_isis_lsp, pd, offset, fd, tree);
-
- hlen = 2+2+id_length+2+4+2+1;
-
- if (!BYTES_ARE_IN_FRAME(offset, hlen)) {
- isis_dissect_unknown(offset, hlen, tree, fd,
- "not enough capture data for header (%d vs %d)",
- hlen, END_OF_FRAME);
+ if (!proto_is_protocol_enabled(proto_isis_lsp)) {
+ dissect_data(tvb, offset, pinfo, tree);
return;
}
-
+
if (tree) {
- ti = proto_tree_add_item(tree, proto_isis_lsp, NullTVB,
- offset, END_OF_FRAME, FALSE);
+ ti = proto_tree_add_item(tree, proto_isis_lsp, tvb,
+ offset, tvb_length_remaining(tvb, offset), FALSE);
lsp_tree = proto_item_add_subtree(ti, ett_isis_lsp);
}
- pdu_length = pntohs(&pd[offset]);
+ pdu_length = tvb_get_ntohs(tvb, offset);
if (tree) {
- proto_tree_add_uint(lsp_tree, hf_isis_lsp_pdu_length, NullTVB,
+ proto_tree_add_uint(lsp_tree, hf_isis_lsp_pdu_length, tvb,
offset, 2, pdu_length);
}
offset += 2;
if (tree) {
- proto_tree_add_uint(lsp_tree, hf_isis_lsp_remaining_life, NullTVB,
- offset, 2, pntohs(&pd[offset]));
+ proto_tree_add_uint(lsp_tree, hf_isis_lsp_remaining_life, tvb,
+ offset, 2, tvb_get_ntohs(tvb, offset));
}
offset += 2;
if (tree) {
- isis_lsp_decode_lsp_id("LSP ID", lsp_tree, pd, offset,
- id_length );
+ isis_lsp_decode_lsp_id(tvb, pinfo, lsp_tree, offset,
+ "LSP ID", id_length);
}
offset += id_length + 2;
if (tree) {
- proto_tree_add_uint(lsp_tree, hf_isis_lsp_sequence_number, NullTVB,
+ proto_tree_add_uint(lsp_tree, hf_isis_lsp_sequence_number, tvb,
offset, 4,
- pntohl(&pd[offset]));
+ tvb_get_ntohl(tvb, offset));
}
offset += 4;
if (tree) {
/* XXX -> we could validate the cksum here! */
- proto_tree_add_uint(lsp_tree, hf_isis_lsp_checksum, NullTVB,
- offset, 2, pntohs(&pd[offset]));
+ proto_tree_add_uint(lsp_tree, hf_isis_lsp_checksum, tvb,
+ offset, 2, tvb_get_ntohs(tvb, offset));
}
offset += 2;
@@ -1604,7 +1662,7 @@ isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
*/
sbuf[0] = 0;
some = 0;
- value = ISIS_LSP_ATT(pd[offset]);
+ value = ISIS_LSP_ATT(tvb_get_guint8(tvb, offset));
inx = 0;
for ( q = (1<<ISIS_LSP_ATT_SHIFT); q > 0; q = q >> 1 ){
if (q & value) {
@@ -1618,13 +1676,13 @@ isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
if (!some) {
strcat ( sbuf, "default-only" );
}
- proto_tree_add_text(lsp_tree, NullTVB, offset + 18, 1,
+ proto_tree_add_text(lsp_tree, tvb, offset + 18, 1,
"Type block(0x%02x): P:%d, Supported metric(s): %s, OL:%d, istype:%s",
- pd[offset],
- ISIS_LSP_PARTITION(pd[offset]) ? 1 : 0,
+ tvb_get_guint8(tvb, offset),
+ ISIS_LSP_PARTITION(tvb_get_guint8(tvb, offset)) ? 1 : 0,
sbuf,
- ISIS_LSP_HIPPITY(pd[offset]) ? 1 : 0,
- val_to_str(ISIS_LSP_IS_TYPE(pd[offset]),
+ ISIS_LSP_HIPPITY(tvb_get_guint8(tvb, offset)) ? 1 : 0,
+ val_to_str(ISIS_LSP_IS_TYPE(tvb_get_guint8(tvb, offset)),
isis_lsp_istype_vals, "Unknown (0x%x)")
);
}
@@ -1632,7 +1690,7 @@ isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
len = pdu_length - header_length;
if (len < 0) {
- isis_dissect_unknown(offset, header_length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"packet header length %d went beyond packet",
header_length );
return;
@@ -1642,11 +1700,13 @@ isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
* our list of valid ones!
*/
if (lsp_type == ISIS_TYPE_L1_LSP){
- isis_dissect_clvs ( clv_l1_lsp_opts, len, id_length, pd,
- offset, fd, lsp_tree, ett_isis_lsp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, lsp_tree, offset,
+ clv_l1_lsp_opts, len, id_length,
+ ett_isis_lsp_clv_unknown );
} else {
- isis_dissect_clvs ( clv_l2_lsp_opts, len, id_length, pd,
- offset, fd, lsp_tree, ett_isis_lsp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, lsp_tree, offset,
+ clv_l2_lsp_opts, len, id_length,
+ ett_isis_lsp_clv_unknown );
}
}
/*
@@ -1656,16 +1716,6 @@ isis_dissect_isis_lsp(int lsp_type, int header_length, int id_length,
* Register our protocol sub-sets with protocol manager.
* NOTE: this procedure is autolinked by the makefile process that
* builds register.c
- *
- * Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
- *
- * Output:
- * void, but we will add to proto tree if !NULL.
*/
void
proto_register_isis_lsp(void) {
diff --git a/packet-isis-lsp.h b/packet-isis-lsp.h
index 3ea6818305..cb858ac379 100644
--- a/packet-isis-lsp.h
+++ b/packet-isis-lsp.h
@@ -1,7 +1,7 @@
/* packet-isis-lsp.h
* Defines and such for LSP and their CLV decodes
*
- * $Id: packet-isis-lsp.h,v 1.8 2001/06/23 19:45:12 guy Exp $
+ * $Id: packet-isis-lsp.h,v 1.9 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -110,10 +110,10 @@
* Published API functions. NOTE, this are "local" API functions and
* are only valid from with isis decodes.
*/
-extern void isis_dissect_isis_lsp(int hello_type, int header_length,
- int id_length, const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree);
-extern void isis_lsp_decode_lsp_id(char *tstr, proto_tree *tree,
- const u_char *pd, int offset, int id_length);
+extern void isis_dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int hello_type, int header_length, int id_length);
+extern void isis_lsp_decode_lsp_id(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, char *tstr, int id_length);
#endif /* _PACKET_ISIS_LSP_H */
diff --git a/packet-isis-snp.c b/packet-isis-snp.c
index 39e41191a9..b35926613d 100644
--- a/packet-isis-snp.c
+++ b/packet-isis-snp.c
@@ -1,7 +1,7 @@
/* packet-isis-snp.c
* Routines for decoding isis complete & partial SNP and their payload
*
- * $Id: packet-isis-snp.c,v 1.9 2001/06/18 02:17:47 guy Exp $
+ * $Id: packet-isis-snp.c,v 1.10 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -60,12 +60,15 @@ static gint ett_isis_psnp_lsp_entries = -1;
static gint ett_isis_psnp_authentication = -1;
static gint ett_isis_psnp_clv_unknown = -1;
-static void dissect_snp_lsp_entries(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree );
-static void dissect_l1_snp_authentication_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree );
-static void dissect_l2_snp_authentication_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree );
+static void dissect_l1_snp_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_l2_snp_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int id_length, int length);
+static void dissect_snp_lsp_entries(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int id_length, int length);
static const isis_clv_handle_t clv_l1_csnp_opts[] = {
{
@@ -174,46 +177,47 @@ static const isis_clv_handle_t clv_l2_psnp_opts[] = {
* 2 : checksum
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to fill out. May be NULL
* int : offset into packet data where we are.
- * guint : length of payload to decode.
+ * int : length of payload to decode.
* int : length of IDs in packet.
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
static void
-dissect_snp_lsp_entries(const u_char *pd, int offset, guint length,
- int id_length, frame_data *fd, proto_tree *tree ) {
+dissect_snp_lsp_entries(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int id_length, int length)
+{
while ( length > 0 ) {
if ( length < 2+id_length+2+4+2 ) {
- isis_dissect_unknown(offset, length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Short SNP header entry (%d vs %d)", length,
2+id_length+2+4+2 );
return;
}
- proto_tree_add_text(tree, NullTVB, offset, 2, "Remaining life : %d",
- pntohs(&pd[offset]));
+ proto_tree_add_text(tree, tvb, offset, 2, "Remaining life : %d",
+ tvb_get_ntohs(tvb, offset));
length -= 2;
offset += 2;
- isis_lsp_decode_lsp_id( "LSP ID ", tree, pd,
- offset, id_length);
+ isis_lsp_decode_lsp_id(tvb, pinfo, tree, offset,
+ "LSP ID ", id_length);
length -= id_length + 2;
offset += id_length + 2;
- proto_tree_add_text(tree, NullTVB, offset, 4,
+ proto_tree_add_text(tree, tvb, offset, 4,
"LSP Sequence Number : 0x%04x",
- pntohl(&pd[offset]));
+ tvb_get_ntohl(tvb, offset));
length -= 4;
offset += 4;
- proto_tree_add_text(tree, NullTVB, offset, 2,
+ proto_tree_add_text(tree, tvb, offset, 2,
"LSP checksum : 0x%02x",
- pntohs(&pd[offset]));
+ tvb_get_ntohs(tvb, offset));
length -= 2;
offset += 2;
}
@@ -228,66 +232,60 @@ dissect_snp_lsp_entries(const u_char *pd, int offset, guint length,
* to pull apart the lsp id payload.
*
* Input:
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to add to. May be NULL.
+ * int offset : our offset into packet data.
* int : type (l1 csnp, l2 csnp)
* int : header length of packet.
* int : length of IDs in packet.
- * u_char * : packet data
- * int offset : our offset into packet data.
- * frame_data * : frame data
- * proto_tree * : protocol display tree to add to. May be NULL.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_isis_csnp(int type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
+isis_dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int type, int header_length, int id_length)
+{
proto_item *ti;
proto_tree *csnp_tree = NULL;
- int hlen;
guint16 pdu_length;
int len;
- OLD_CHECK_DISPLAY_AS_DATA(proto_isis_csnp, pd, offset, fd, tree);
-
- hlen = 2+id_length+1+id_length+2+id_length+2;
-
- if (!BYTES_ARE_IN_FRAME(offset, hlen)) {
- isis_dissect_unknown(offset, hlen, tree, fd,
- "not enough capture data for header (%d vs %d)",
- hlen, END_OF_FRAME);
+ if (!proto_is_protocol_enabled(proto_isis_csnp)) {
+ dissect_data(tvb, offset, pinfo, tree);
return;
}
-
+
if (tree) {
- ti = proto_tree_add_item(tree, proto_isis_csnp, NullTVB,
- offset, END_OF_FRAME, FALSE);
+ ti = proto_tree_add_item(tree, proto_isis_csnp, tvb,
+ offset, tvb_length_remaining(tvb, offset), FALSE);
csnp_tree = proto_item_add_subtree(ti, ett_isis_csnp);
}
- pdu_length = pntohs(&pd[offset]);
+ pdu_length = tvb_get_ntohs(tvb, offset);
if (tree) {
- proto_tree_add_uint(csnp_tree, hf_isis_csnp_pdu_length, NullTVB,
+ proto_tree_add_uint(csnp_tree, hf_isis_csnp_pdu_length, tvb,
offset, 2, pdu_length);
}
offset += 2;
if (tree) {
- proto_tree_add_text(csnp_tree, NullTVB, offset, id_length + 1,
+ proto_tree_add_text(csnp_tree, tvb, offset, id_length + 1,
"Source id : %s",
- print_system_id( pd + offset, id_length + 1 ) );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length+1 ) );
}
offset += id_length + 1;
if (tree) {
- isis_lsp_decode_lsp_id( "Start LSP id ", csnp_tree, pd, offset,
- id_length );
+ isis_lsp_decode_lsp_id(tvb, pinfo, csnp_tree, offset,
+ "Start LSP id ", id_length );
}
offset += id_length + 2;
if (tree) {
- isis_lsp_decode_lsp_id( "End LSP id ", csnp_tree, pd, offset,
- id_length );
+ isis_lsp_decode_lsp_id(tvb, pinfo, csnp_tree, offset,
+ "End LSP id ", id_length );
}
offset += id_length + 2;
@@ -297,11 +295,13 @@ isis_dissect_isis_csnp(int type, int header_length, int id_length,
}
/* Call into payload dissector */
if (type == ISIS_TYPE_L1_CSNP ) {
- isis_dissect_clvs ( clv_l1_csnp_opts, len, id_length, pd,
- offset, fd, csnp_tree, ett_isis_csnp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, csnp_tree, offset,
+ clv_l1_csnp_opts, len, id_length,
+ ett_isis_csnp_clv_unknown );
} else {
- isis_dissect_clvs ( clv_l2_csnp_opts, len, id_length, pd,
- offset, fd, csnp_tree, ett_isis_csnp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, csnp_tree, offset,
+ clv_l2_csnp_opts, len, id_length,
+ ett_isis_csnp_clv_unknown );
}
}
@@ -313,71 +313,67 @@ isis_dissect_isis_csnp(int type, int header_length, int id_length,
* to pull apart the lsp id payload.
*
* Input:
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : protocol display tree to add to. May be NULL.
+ * int : our offset into packet data
* int : type (l1 psnp, l2 psnp)
* int : header length of packet.
* int : length of IDs in packet.
- * u_char * : packet data
- * int offset : our offset into packet data.
- * frame_data * : frame data
- * proto_tree * : protocol display tree to add to. May be NULL.
*
* Output:
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_isis_psnp(int type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree){
+isis_dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, int type, int header_length, int id_length)
+{
proto_item *ti;
proto_tree *psnp_tree = NULL;
- int hlen;
guint16 pdu_length;
int len;
- OLD_CHECK_DISPLAY_AS_DATA(proto_isis_psnp, pd, offset, fd, tree);
-
- hlen = 2+id_length+1;
-
- if (!BYTES_ARE_IN_FRAME(offset, hlen)) {
- isis_dissect_unknown(offset, hlen, tree, fd,
- "not enough capture data for header (%d vs %d)",
- hlen, END_OF_FRAME);
+ if (!proto_is_protocol_enabled(proto_isis_psnp)) {
+ dissect_data(tvb, offset, pinfo, tree);
return;
}
-
+
if (tree) {
- ti = proto_tree_add_item(tree, proto_isis_psnp, NullTVB,
- offset, END_OF_FRAME, FALSE);
+ ti = proto_tree_add_item(tree, proto_isis_psnp, tvb,
+ offset, tvb_length_remaining(tvb, offset), FALSE);
psnp_tree = proto_item_add_subtree(ti, ett_isis_psnp);
}
- pdu_length = pntohs(&pd[offset]);
+ pdu_length = tvb_get_ntohs(tvb, offset);
if (tree) {
- proto_tree_add_uint(psnp_tree, hf_isis_psnp_pdu_length, NullTVB,
+ proto_tree_add_uint(psnp_tree, hf_isis_psnp_pdu_length, tvb,
offset, 2, pdu_length);
}
offset += 2;
if (tree) {
- proto_tree_add_text(psnp_tree, NullTVB, offset, id_length + 1,
+ proto_tree_add_text(psnp_tree, tvb, offset, id_length + 1,
"Source id: %s",
- print_system_id( pd + offset, id_length + 1 ) );
+ print_system_id( tvb_get_ptr(tvb, offset, id_length+1), id_length + 1 ) );
}
offset += id_length + 1;
len = pdu_length - header_length;
if (len < 0) {
- isis_dissect_unknown(offset, header_length, tree, fd,
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"packet header length %d went beyond packet",
header_length );
return;
}
/* Call into payload dissector */
if (type == ISIS_TYPE_L1_CSNP ) {
- isis_dissect_clvs ( clv_l1_csnp_opts, len, id_length, pd,
- offset, fd, psnp_tree, ett_isis_psnp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, psnp_tree, offset,
+ clv_l1_csnp_opts, len, id_length,
+ ett_isis_psnp_clv_unknown );
} else {
- isis_dissect_clvs ( clv_l2_csnp_opts, len, id_length, pd,
- offset, fd, psnp_tree, ett_isis_psnp_clv_unknown );
+ isis_dissect_clvs(tvb, pinfo, psnp_tree, offset,
+ clv_l2_csnp_opts, len, id_length,
+ ett_isis_psnp_clv_unknown );
}
}
@@ -389,20 +385,22 @@ isis_dissect_isis_psnp(int type, int header_length, int id_length,
* clv common one. An auth inside a L1 SNP is a per area password
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_l1_snp_authentication_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_authentication_clv(pd, offset, length, fd, tree,
+dissect_l1_snp_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_authentication_clv(tvb, pinfo, tree, offset, length,
"Per area authentication" );
}
@@ -414,20 +412,22 @@ dissect_l1_snp_authentication_clv(const u_char *pd, int offset,
* clv common one. An auth inside a L2 LSP is a per domain password
*
* Input:
- * u_char * : packet data
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
+ * proto_tree * : proto tree to build on (may be null)
* int : current offset into packet data
- * guint : length of this clv
* int : length of IDs in packet.
- * frame_data * : frame data
- * proto_tree * : proto tree to build on (may be null)
+ * int : length of this clv
*
* Output:
* void, will modify proto_tree if not null.
*/
static void
-dissect_l2_snp_authentication_clv(const u_char *pd, int offset,
- guint length, int id_length, frame_data *fd, proto_tree *tree) {
- isis_dissect_authentication_clv(pd, offset, length, fd, tree,
+dissect_l2_snp_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int id_length, int length)
+{
+ isis_dissect_authentication_clv(tvb, pinfo, tree, offset, length,
"Per domain authentication" );
}
@@ -439,15 +439,6 @@ dissect_l2_snp_authentication_clv(const u_char *pd, int offset,
* NOTE: this procedure is autolinked by the makefile process that
* builds register.c
*
- * Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
- *
- * Output:
- * void, but we will add to proto tree if !NULL.
*/
void
proto_register_isis_csnp(void) {
@@ -477,16 +468,6 @@ proto_register_isis_csnp(void) {
* Register our protocol sub-sets with protocol manager.
* NOTE: this procedure is autolinked by the makefile process that
* builds register.c
- *
- * Input:
- * u_char * : packet data
- * int : offset into packet data where we are.
- * guint : length of clv we are decoding
- * frame_data * : frame data (complete frame)
- * proto_tree * : protocol display tree to fill out. May be NULL
- *
- * Output:
- * void, but we will add to proto tree if !NULL.
*/
void
proto_register_isis_psnp(void) {
diff --git a/packet-isis-snp.h b/packet-isis-snp.h
index e83a6c215d..05b02f63c1 100644
--- a/packet-isis-snp.h
+++ b/packet-isis-snp.h
@@ -1,7 +1,7 @@
/* packet-isis-snp.h
* Defines and such for CSNP, PSNP, and their payloads
*
- * $Id: packet-isis-snp.h,v 1.2 2000/06/19 08:33:50 guy Exp $
+ * $Id: packet-isis-snp.h,v 1.3 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -66,9 +66,11 @@
* Published API functions. NOTE, this are "local" API functions and
* are only valid from with isis decodes.
*/
-extern void isis_dissect_isis_csnp(int type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
-extern void isis_dissect_isis_psnp(int type, int header_length, int id_length,
- const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
+extern void isis_dissect_isis_csnp(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int type, int header_length, int id_length);
+extern void isis_dissect_isis_psnp(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset,
+ int type, int header_length, int id_length);
#endif /* _PACKET_ISIS_CSNP_H */
diff --git a/packet-isis.c b/packet-isis.c
index b8895b30c5..8228340072 100644
--- a/packet-isis.c
+++ b/packet-isis.c
@@ -2,7 +2,7 @@
* Routines for ISO/OSI network and transport protocol packet disassembly, core
* bits.
*
- * $Id: packet-isis.c,v 1.21 2001/06/18 02:17:48 guy Exp $
+ * $Id: packet-isis.c,v 1.22 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -82,38 +82,27 @@ static const value_string isis_vals[] = {
* that we make sure we don't go off the end of the bleedin packet here!
*
* Input
- * unt offset : Current offset into packet data.
- * int len : length of to dump.
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : tree of display data. May be NULL.
- * frame_data * fd : frame data
+ * int : current offset into packet data
* char * : format text
*
* Output:
* void (may modify proto tree)
*/
void
-isis_dissect_unknown(int offset,guint length,proto_tree *tree,frame_data *fd,
- char *fmat, ...){
+isis_dissect_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
+ int offset, char *fmat, ...)
+{
va_list ap;
- if ( !IS_DATA_IN_FRAME(offset) ) {
- /*
- * big oops They were off the end of the packet already.
- * Just ignore this one.
- */
- return;
- }
- if ( !BYTES_ARE_IN_FRAME(offset, length) ) {
- /*
- * length will take us past eop. Truncate length.
- */
- length = END_OF_FRAME;
- }
-
va_start(ap, fmat);
- proto_tree_add_text_valist(tree, NullTVB, offset, length, fmat, ap);
+ proto_tree_add_text_valist(tree, tvb, offset,
+ tvb_length_remaining(tvb, offset), fmat, ap);
va_end(ap);
}
+
/*
* Name: dissect_isis()
*
@@ -122,71 +111,65 @@ isis_dissect_unknown(int offset,guint length,proto_tree *tree,frame_data *fd,
* main isis tree data and call the sub-protocols as needed.
*
* Input:
- * u_char * : packet data
- * int : offset into packet where we are (packet_data[offset]== start
- * of what we care about)
- * frame_data * : frame data (whole packet with extra info)
+ * tvbuff_t * : tvbuffer for packet data
+ * packet_info * : info for current packet
* proto_tree * : tree of display data. May be NULL.
*
* Output:
* void, but we will add to the proto_tree if it is not NULL.
*/
static void
-dissect_isis(const u_char *pd, int offset, frame_data *fd,
- proto_tree *tree) {
- isis_hdr_t *ihdr;
+dissect_isis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+{
+ isis_hdr_t ihdr;
proto_item *ti;
proto_tree *isis_tree = NULL;
int id_length;
+ int offset = 0;
- OLD_CHECK_DISPLAY_AS_DATA(proto_isis, pd, offset, fd, tree);
-
- if (check_col(fd, COL_PROTOCOL))
- col_set_str(fd, COL_PROTOCOL, "ISIS");
-
- if (!BYTES_ARE_IN_FRAME(offset, sizeof(*ihdr))) {
- isis_dissect_unknown(offset, sizeof(*ihdr), tree, fd,
- "not enough capture data for header (%d vs %d)",
- sizeof(*ihdr), END_OF_FRAME);
- return;
- }
+ if (check_col(pinfo->fd, COL_PROTOCOL))
+ col_set_str(pinfo->fd, COL_PROTOCOL, "ISIS");
+ if (check_col(pinfo->fd, COL_INFO))
+ col_clear(pinfo->fd, COL_INFO);
- ihdr = (isis_hdr_t *) &pd[offset];
+ tvb_memcpy(tvb, (guint8 *)&ihdr, offset, sizeof(isis_hdr_t));
- if (ihdr->isis_version != ISIS_REQUIRED_VERSION){
- isis_dissect_unknown(offset, END_OF_FRAME, tree, fd,
+ if (ihdr.isis_version != ISIS_REQUIRED_VERSION){
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
"Unknown ISIS version (%d vs %d)",
- ihdr->isis_version, ISIS_REQUIRED_VERSION );
+ ihdr.isis_version, ISIS_REQUIRED_VERSION);
return;
}
if (tree) {
- ti = proto_tree_add_item(tree, proto_isis, NullTVB, offset,
- END_OF_FRAME, FALSE );
+ ti = proto_tree_add_item(tree, proto_isis, tvb, offset,
+ tvb_length_remaining(tvb, 0), FALSE );
+
isis_tree = proto_item_add_subtree(ti, ett_isis);
- proto_tree_add_uint(isis_tree, hf_isis_irpd, NullTVB, offset, 1,
- ihdr->isis_irpd );
- proto_tree_add_uint(isis_tree, hf_isis_header_length, NullTVB,
- offset + 1, 1, ihdr->isis_header_length );
- proto_tree_add_uint(isis_tree, hf_isis_version, NullTVB,
- offset + 2, 1, ihdr->isis_version );
- proto_tree_add_uint(isis_tree, hf_isis_system_id_length, NullTVB,
- offset + 3, 1, ihdr->isis_system_id_len );
- proto_tree_add_uint_format(isis_tree, hf_isis_type, NullTVB,
- offset + 4, 1, ihdr->isis_type,
+
+ proto_tree_add_uint(isis_tree, hf_isis_irpd, tvb, offset, 1,
+ ihdr.isis_irpd );
+ proto_tree_add_uint(isis_tree, hf_isis_header_length, tvb,
+ offset + 1, 1, ihdr.isis_header_length );
+ proto_tree_add_uint(isis_tree, hf_isis_version, tvb,
+ offset + 2, 1, ihdr.isis_version );
+ proto_tree_add_uint(isis_tree, hf_isis_system_id_length, tvb,
+ offset + 3, 1, ihdr.isis_system_id_len );
+ proto_tree_add_uint_format(isis_tree, hf_isis_type, tvb,
+ offset + 4, 1, ihdr.isis_type,
"PDU Type : %s (R:%s%s%s)",
- val_to_str(ihdr->isis_type & ISIS_TYPE_MASK, isis_vals,
+ val_to_str(ihdr.isis_type & ISIS_TYPE_MASK, isis_vals,
"Unknown (0x%x)"),
- (ihdr->isis_type & ISIS_R8_MASK) ? "1" : "0",
- (ihdr->isis_type & ISIS_R7_MASK) ? "1" : "0",
- (ihdr->isis_type & ISIS_R6_MASK) ? "1" : "0");
- proto_tree_add_uint(isis_tree, hf_isis_version2, NullTVB,
- offset + 5, 1, ihdr->isis_version2 );
- proto_tree_add_uint(isis_tree, hf_isis_reserved, NullTVB,
- offset + 6, 1, ihdr->isis_reserved );
- proto_tree_add_uint(isis_tree, hf_isis_max_area_adr, NullTVB,
- offset + 7, 1, ihdr->isis_max_area_adr );
+ (ihdr.isis_type & ISIS_R8_MASK) ? "1" : "0",
+ (ihdr.isis_type & ISIS_R7_MASK) ? "1" : "0",
+ (ihdr.isis_type & ISIS_R6_MASK) ? "1" : "0");
+ proto_tree_add_uint(isis_tree, hf_isis_version2, tvb,
+ offset + 5, 1, ihdr.isis_version2 );
+ proto_tree_add_uint(isis_tree, hf_isis_reserved, tvb,
+ offset + 6, 1, ihdr.isis_reserved );
+ proto_tree_add_uint(isis_tree, hf_isis_max_area_adr, tvb,
+ offset + 7, 1, ihdr.isis_max_area_adr );
}
@@ -195,16 +178,16 @@ dissect_isis(const u_char *pd, int offset, frame_data *fd,
* here. First, dump the name into info column, and THEN
* dispatch the sub-type.
*/
- if (check_col(fd, COL_INFO)) {
- col_add_str(fd, COL_INFO, val_to_str (
- ihdr->isis_type&ISIS_TYPE_MASK, isis_vals,
+ if (check_col(pinfo->fd, COL_INFO)) {
+ col_add_str(pinfo->fd, COL_INFO, val_to_str (
+ ihdr.isis_type&ISIS_TYPE_MASK, isis_vals,
"Unknown (0x%x)" ) );
}
/*
* Interpret the system ID length.
*/
- id_length = ihdr->isis_system_id_len;
+ id_length = ihdr.isis_system_id_len;
if (id_length == 0)
id_length = 6; /* zero means 6-octet ID field length */
else if (id_length == 255) {
@@ -216,56 +199,32 @@ dissect_isis(const u_char *pd, int offset, frame_data *fd,
/*
* Advance offset (we are past the header).
*/
- offset += sizeof(*ihdr);
- switch (ihdr->isis_type) {
+ offset += sizeof(ihdr);
+ switch (ihdr.isis_type) {
case ISIS_TYPE_L1_HELLO:
- isis_dissect_isis_hello(ISIS_TYPE_L1_HELLO,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
- break;
case ISIS_TYPE_L2_HELLO:
- isis_dissect_isis_hello(ISIS_TYPE_L2_HELLO,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
- break;
case ISIS_TYPE_PTP_HELLO:
- isis_dissect_isis_hello(ISIS_TYPE_PTP_HELLO,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
+ isis_dissect_isis_hello(tvb, pinfo, isis_tree, offset,
+ ihdr.isis_type, ihdr.isis_header_length, id_length);
break;
case ISIS_TYPE_L1_LSP:
- isis_dissect_isis_lsp(ISIS_TYPE_L1_LSP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
- break;
case ISIS_TYPE_L2_LSP:
- isis_dissect_isis_lsp(ISIS_TYPE_L2_LSP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
+ isis_dissect_isis_lsp(tvb, pinfo, isis_tree, offset,
+ ihdr.isis_type, ihdr.isis_header_length, id_length);
break;
case ISIS_TYPE_L1_CSNP:
- isis_dissect_isis_csnp(ISIS_TYPE_L1_CSNP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
- break;
case ISIS_TYPE_L2_CSNP:
- isis_dissect_isis_csnp(ISIS_TYPE_L2_CSNP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
+ isis_dissect_isis_csnp(tvb, pinfo, isis_tree, offset,
+ ihdr.isis_type, ihdr.isis_header_length, id_length);
break;
case ISIS_TYPE_L1_PSNP:
- isis_dissect_isis_psnp(ISIS_TYPE_L1_PSNP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
- break;
case ISIS_TYPE_L2_PSNP:
- isis_dissect_isis_psnp(ISIS_TYPE_L2_PSNP,
- ihdr->isis_header_length, id_length,
- pd, offset, fd, isis_tree);
+ isis_dissect_isis_psnp(tvb, pinfo, isis_tree, offset,
+ ihdr.isis_type, ihdr.isis_header_length, id_length);
break;
default:
- isis_dissect_unknown(offset, END_OF_FRAME, tree, fd,
- "unknown ISIS packet type" );
+ isis_dissect_unknown(tvb, pinfo, tree, offset,
+ "Unknown ISIS packet type");
}
} /* dissect_isis */
@@ -337,5 +296,5 @@ proto_register_isis(void) {
void
proto_reg_handoff_isis(void)
{
- old_dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis, proto_isis);
+ dissector_add("osinl", NLPID_ISO10589_ISIS, dissect_isis, proto_isis);
}
diff --git a/packet-isis.h b/packet-isis.h
index 34ec6a0f23..498c8beaaf 100644
--- a/packet-isis.h
+++ b/packet-isis.h
@@ -1,7 +1,7 @@
/* packet-isis.h
* Defines and such for core isis protcol decode.
*
- * $Id: packet-isis.h,v 1.4 2000/04/17 01:36:31 guy Exp $
+ * $Id: packet-isis.h,v 1.5 2001/07/02 00:19:34 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
@@ -76,8 +76,8 @@ typedef struct {
* published API functions
*/
-extern char *isis_address_to_string ( const u_char *pd, int offset, int len );
-extern void isis_dissect_unknown( int offset, guint length, proto_tree *tree,
- frame_data *fd, char *fmat, ...);
+extern char *isis_address_to_string(tvbuff_t *tvb, int offset, int len);
+extern void isis_dissect_unknown(tvbuff_t *tvb, packet_info *pinfo,
+ proto_tree *tree, int offset, char *fmat, ...);
#endif /* _PACKET_ISIS_H */