/* packet-isis-clv.c
* Common CLV decode routines.
*
- * $Id: packet-isis-clv.c,v 1.17 2002/04/02 01:25:08 guy Exp $
+ * $Id: packet-isis-clv.c,v 1.19 2002/04/07 23:39:00 guy Exp $
* Stuart Stanley <stuarts@mxmail.net>
*
* Ethereal - Network traffic analyzer
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_area_address_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length)
+isis_dissect_area_address_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length)
{
char *sbuf;
int mylen;
mylen = tvb_get_guint8(tvb, offset);
length--;
if (length<=0) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"short address (no length for payload)");
return;
}
if ( mylen > length) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"short address, packet say %d, we have %d left",
mylen, length );
return;
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_authentication_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length, char *meaning)
+isis_dissect_authentication_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length, char *meaning)
{
u_char pw_type;
char sbuf[300]; /* 255 + header info area */
"%s %s", meaning, sbuf );
if ( auth_unsupported ) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"Unknown authentication type" );
}
}
*
* 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.
* int : length of clv we are decoding
void
-isis_dissect_hostname_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length)
+isis_dissect_hostname_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length)
{
if ( !tree ) return; /* nothing to do! */
void
-isis_dissect_mt_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length, int tree_id)
+isis_dissect_mt_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length,
+ int tree_id)
{
- guint16 mt_block;
- char mt_desc[60];
-
- while (length>1) {
- /* length can only be a multiple of 2, otherwise there is
- something broken -> so decode down until length is 1 */
- if (length!=1)
- {
- /* 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");
- break;
- case 1:
- strcpy(mt_desc,"In-Band Management");
- break;
- case 2:
- strcpy(mt_desc,"IPv6 unicast");
- break;
- case 3:
- strcpy(mt_desc,"Multicast");
- break;
- case 4095:
- strcpy(mt_desc,"Development, Experimental or Proprietary");
- break;
- default:
- strcpy(mt_desc,"Reserved for IETF Consensus");
- }
- proto_tree_add_text ( tree, tvb, offset, 2 ,
- "%s Topology (0x%03x)%s%s",
+ guint16 mt_block;
+ char mt_desc[60];
+
+ while (length>0) {
+ /* length can only be a multiple of 2, otherwise there is
+ something broken -> so decode down until length is 1 */
+ if (length!=1) {
+ /* 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");
+ break;
+ case 1:
+ strcpy(mt_desc,"In-Band Management");
+ break;
+ case 2:
+ strcpy(mt_desc,"IPv6 unicast");
+ break;
+ case 3:
+ strcpy(mt_desc,"Multicast");
+ break;
+ case 4095:
+ strcpy(mt_desc,"Development, Experimental or Proprietary");
+ break;
+ default:
+ strcpy(mt_desc,"Reserved for IETF Consensus");
+ break;
+ }
+ proto_tree_add_uint_format ( tree, tree_id, tvb, offset, 2,
+ mt_block,
+ "%s Topology (0x%03x)%s%s",
mt_desc,
mt_block&0xfff,
(mt_block&0x8000) ? "" : ", no sub-TLVs present",
(mt_block&0x4000) ? ", ATT bit set" : "" );
+ } else {
+ proto_tree_add_text ( tree, tvb, offset, 1,
+ "malformed MT-ID");
+ break;
}
- else {
- proto_tree_add_text ( tree, tvb, offset, 2 ,
- "malformed MT-ID");
- break;
- }
- length=length-2;
- offset=offset+2;
+ length=length-2;
+ offset=offset+2;
}
}
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_ip_int_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length, int tree_id)
+isis_dissect_ip_int_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length, int tree_id)
{
if ( length <= 0 ) {
return;
while ( length > 0 ) {
if ( length < 4 ) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"Short ip interface address (%d vs 4)",length );
return;
}
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_ipv6_int_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length, int tree_id)
+isis_dissect_ipv6_int_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length, int tree_id)
{
guint8 addr [16];
while ( length > 0 ) {
if ( length < 16 ) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"Short IPv6 interface address (%d vs 16)",length );
return;
}
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_te_router_id_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length, int tree_id)
+isis_dissect_te_router_id_clv(tvbuff_t *tvb, proto_tree *tree, int offset,
+ int length, int tree_id)
{
if ( length <= 0 ) {
return;
}
if ( length != 4 ) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"malformed Traffic Engineering Router ID (%d vs 4)",length );
return;
}
*
* 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.
* int : length of clv we are decoding
* void, but we will add to proto tree if !NULL.
*/
void
-isis_dissect_nlpid_clv(tvbuff_t *tvb, packet_info *pinfo,
- proto_tree *tree, int offset, int length)
+isis_dissect_nlpid_clv(tvbuff_t *tvb, proto_tree *tree, int offset, int length)
{
char sbuf[256*6];
char *s = sbuf;
* search the passed in valid clv's for this protocol (opts) for
* a matching code. If found, we add to the display tree and
* then call the dissector. If it is not, we just post an
- * "unknown" clv entrie using the passed in unknown clv tree id.
+ * "unknown" clv entry 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
* void, but we will add to proto tree if !NULL.
*/
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,
+isis_dissect_clvs(tvbuff_t *tvb, proto_tree *tree, int offset,
+ const isis_clv_handle_t *opts, int len, int id_length,
int unknown_tree_id)
{
guint8 code;
adj = (sizeof(code) + sizeof(length) + length);
len -= adj;
if ( len < 0 ) {
- isis_dissect_unknown(tvb, pinfo, tree, offset,
+ isis_dissect_unknown(tvb, tree, offset,
"Short CLV header (%d vs %d)",
adj, len + adj );
return;
} else {
clv_tree = NULL;
}
- opts[q].dissect(tvb, pinfo, clv_tree, offset,
+ opts[q].dissect(tvb, clv_tree, offset,
id_length, length);
} else {
if (tree) {