diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-11 08:18:09 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2000-05-11 08:18:09 +0000 |
commit | 292e38e2c61edcd14bfa30ca3c72bacda1bcbe32 (patch) | |
tree | db4edef02456a48d0f6d505166ac7d70f6c0f644 /packet-icp.c | |
parent | 162800efb308901e0c302517be01226130e39b19 (diff) | |
download | wireshark-292e38e2c61edcd14bfa30ca3c72bacda1bcbe32.tar.gz wireshark-292e38e2c61edcd14bfa30ca3c72bacda1bcbe32.tar.bz2 wireshark-292e38e2c61edcd14bfa30ca3c72bacda1bcbe32.zip |
Add tvbuff class.
Add exceptions routines.
Convert proto_tree_add_*() routines to require tvbuff_t* argument.
Convert all dissectors to pass NULL argument ("NullTVB" macro == NULL) as
the tvbuff_t* argument to proto_tree_add_*() routines.
dissect_packet() creates a tvbuff_t, wraps the next dissect call in
a TRY block, will print "Short Frame" on the proto_tree if a BoundsError
exception is caught.
The FDDI dissector is converted to use tvbuff's.
svn path=/trunk/; revision=1939
Diffstat (limited to 'packet-icp.c')
-rw-r--r-- | packet-icp.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/packet-icp.c b/packet-icp.c index 2562f502d5..f890d9603d 100644 --- a/packet-icp.c +++ b/packet-icp.c @@ -2,7 +2,7 @@ * Routines for ICP (internet cache protocol) packet disassembly * RFC 2186 && RFC 2187 * - * $Id: packet-icp.c,v 1.6 2000/04/08 07:07:18 guy Exp $ + * $Id: packet-icp.c,v 1.7 2000/05/11 08:15:10 gram Exp $ * * Ethereal - Network traffic analyzer * By Peter Torvals @@ -114,7 +114,7 @@ guint16 objectlength; { case CODE_ICP_OP_QUERY: /* 4 byte requester host address */ - proto_tree_add_text(pload_tree,offset,4, + proto_tree_add_text(pload_tree, NullTVB,offset,4, "Requester Host Address %u.%u.%u.%u", (guint8)pd[offset], (guint8)pd[offset+1], @@ -129,7 +129,7 @@ guint16 objectlength; } textbuf[i]=0; i++; - proto_tree_add_text(pload_tree, offset+4,i, + proto_tree_add_text(pload_tree, NullTVB, offset+4,i, "URL: %s", textbuf); break; case CODE_ICP_OP_HIT_OBJ: @@ -141,17 +141,17 @@ guint16 objectlength; } textbuf[i]=0; i++; - proto_tree_add_text(pload_tree, offset,i, + proto_tree_add_text(pload_tree, NullTVB, offset,i, "URL: %s", textbuf); /* 2 byte object size */ /* object data not recommended by standard*/ objectlength=pntohs(&pd[offset]); - proto_tree_add_text(pload_tree,offset,2,"object length: %u", objectlength); + proto_tree_add_text(pload_tree, NullTVB,offset,2,"object length: %u", objectlength); /* object data not recommended by standard*/ - proto_tree_add_text(pload_tree,offset+2, maxlength-2,"object data"); + proto_tree_add_text(pload_tree, NullTVB,offset+2, maxlength-2,"object data"); if (objectlength > maxlength-2) { - proto_tree_add_text(pload_tree,offset,0, + proto_tree_add_text(pload_tree, NullTVB,offset,0, "Packet is fragmented, rest of object is in next udp packet"); } case CODE_ICP_OP_MISS: @@ -163,7 +163,7 @@ guint16 objectlength; } textbuf[i]=0; i++; - proto_tree_add_text(pload_tree, offset,i, + proto_tree_add_text(pload_tree, NullTVB, offset,i, "URL: %s", textbuf); default: /* check for fragmentation and add message if next part @@ -209,47 +209,47 @@ static void dissect_icp(const u_char *pd, int offset, frame_data *fd, if (tree) { - ti = proto_tree_add_item(tree,proto_icp ,offset,fd->pkt_len-offset, + ti = proto_tree_add_item(tree,proto_icp , NullTVB,offset,fd->pkt_len-offset, NULL); icp_tree = proto_item_add_subtree(ti, ett_icp); - proto_tree_add_uint_format(icp_tree,hf_icp_opcode, offset, 1, + proto_tree_add_uint_format(icp_tree,hf_icp_opcode, NullTVB, offset, 1, icph.opcode, "Opcode:0x%01x (%s)",icph.opcode, opcodestrval); - proto_tree_add_uint_format(icp_tree,hf_icp_version, offset+1, 1, + proto_tree_add_uint_format(icp_tree,hf_icp_version, NullTVB, offset+1, 1, icph.version,"Version: 0x%01x (%d)", icph.version, (int)icph.version); - proto_tree_add_uint_format(icp_tree,hf_icp_length, offset+2, 2, + proto_tree_add_uint_format(icp_tree,hf_icp_length, NullTVB, offset+2, 2, icph.message_length, "Length: 0x%02x (%d)", icph.message_length,(int)icph.message_length); - proto_tree_add_uint_format(icp_tree,hf_icp_request_nr, offset+4, 4, + proto_tree_add_uint_format(icp_tree,hf_icp_request_nr, NullTVB, offset+4, 4, icph.request_number, "Request Number: 0x%04x (%u)", icph.request_number,icph.request_number); if ( (icph.opcode == CODE_ICP_OP_QUERY) && ((icph.options & 0x80000000 ) != 0) ) { - proto_tree_add_text(icp_tree,offset+8,4, + proto_tree_add_text(icp_tree, NullTVB,offset+8,4, "option: ICP_FLAG_HIT_OBJ"); } if ( (icph.opcode == CODE_ICP_OP_QUERY)&& ((icph.options & 0x40000000 ) != 0) ) { - proto_tree_add_text(icp_tree,offset+8,4, + proto_tree_add_text(icp_tree, NullTVB,offset+8,4, "option:ICP_FLAG_SRC_RTT"); } if ((icph.opcode != CODE_ICP_OP_QUERY)&& ((icph.options & 0x40000000 ) != 0)) { - proto_tree_add_text(icp_tree,offset+8,8, + proto_tree_add_text(icp_tree, NullTVB,offset+8,8, "option: ICP_FLAG_SCR_RTT RTT=%u", icph.option_data & 0x0000ffff); } - proto_tree_add_text(icp_tree,offset+16, 4, + proto_tree_add_text(icp_tree, NullTVB,offset+16, 4, "Sender Host IP address %u.%u.%u.%u", (guint8)icph.sender_address[0], (guint8)icph.sender_address[1], (guint8)icph.sender_address[2], (guint8)icph.sender_address[3]); - payloadtf = proto_tree_add_text(icp_tree, + payloadtf = proto_tree_add_text(icp_tree, NullTVB, offset+20,icph.message_length - 20, "Payload"); payload_tree = proto_item_add_subtree(payloadtf, ett_icp_payload); |