diff options
-rw-r--r-- | packet-rx.c | 93 | ||||
-rw-r--r-- | packet-rx.h | 60 |
2 files changed, 49 insertions, 104 deletions
diff --git a/packet-rx.c b/packet-rx.c index f178890aad..b6d6948755 100644 --- a/packet-rx.c +++ b/packet-rx.c @@ -4,7 +4,7 @@ * Based on routines from tcpdump patches by * Ken Hornstein <kenh@cmf.nrl.navy.mil> * - * $Id: packet-rx.c,v 1.24 2001/08/04 04:04:34 guy Exp $ + * $Id: packet-rx.c,v 1.25 2001/08/20 02:11:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -166,16 +166,14 @@ dissect_rx_response_encrypted(tvbuff_t *tvb, packet_info *pinfo, proto_tree *par } /* cid : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_cid, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, FALSE); offset += 4; /*FIXME dont know how to handle this checksum, skipping it */ offset += 4; /* sequrityindex : 1 byte */ - proto_tree_add_uint(tree, hf_rx_securityindex, tvb, - offset, 1, tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_rx_securityindex, tvb, offset, 1, FALSE); offset += 4; for (i=0; i<RX_MAXCALLS; i++) { @@ -187,13 +185,11 @@ dissect_rx_response_encrypted(tvbuff_t *tvb, packet_info *pinfo, proto_tree *par } /* inc nonce : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_inc_nonce, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_inc_nonce, tvb, offset, 4, FALSE); offset += 4; /* level : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_level, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_level, tvb, offset, 4, FALSE); offset += 4; proto_item_set_len(item, offset-old_offset); @@ -239,8 +235,7 @@ dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset = dissect_rx_response_encrypted(tvb, pinfo, tree, offset); /* kvno */ - proto_tree_add_uint(tree, hf_rx_kvno, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_kvno, tvb, offset, 4, FALSE); offset += 4; /* ticket_len */ @@ -288,12 +283,10 @@ dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset += 4; if (version==2) { - proto_tree_add_uint(tree, hf_rx_nonce, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_nonce, tvb, offset, 4, FALSE); offset += 4; - proto_tree_add_uint(tree, hf_rx_min_level, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_min_level, tvb, offset, 4, FALSE); offset += 4; } @@ -328,44 +321,37 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int /* bufferspace: 2 bytes*/ - proto_tree_add_uint(tree, hf_rx_bufferspace, tvb, - offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(tree, hf_rx_bufferspace, tvb, offset, 2, FALSE); offset += 2; /* maxskew: 2 bytes*/ - proto_tree_add_uint(tree, hf_rx_maxskew, tvb, - offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(tree, hf_rx_maxskew, tvb, offset, 2, FALSE); offset += 2; /* first packet: 4 bytes*/ - proto_tree_add_uint(tree, hf_rx_first_packet, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_first_packet, tvb, offset, 4, FALSE); offset += 4; /* prev packet: 4 bytes*/ - proto_tree_add_uint(tree, hf_rx_prev_packet, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_prev_packet, tvb, offset, 4, FALSE); offset += 4; /* serial : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_serial, tvb, - offset, 4, tvb_get_ntohl(tvb, offset) ); + proto_tree_add_item(tree, hf_rx_serial, tvb, offset, 4, FALSE); offset += 4; /* reason : 1 byte */ - proto_tree_add_uint(tree, hf_rx_reason, tvb, - offset, 1, tvb_get_guint8(tvb, offset) ); + proto_tree_add_item(tree, hf_rx_reason, tvb, offset, 1, FALSE); offset += 1; /* nACKs */ num = tvb_get_guint8(tvb, offset); - proto_tree_add_uint(tree, hf_rx_numacks, tvb, - offset, 1, tvb_get_guint8(tvb, offset) ); + proto_tree_add_uint(tree, hf_rx_numacks, tvb, offset, 1, num); offset += 1; while(num--){ - proto_tree_add_uint(tree, hf_rx_ack_type, tvb, - offset, 1, tvb_get_guint8(tvb, offset) ); + proto_tree_add_item(tree, hf_rx_ack_type, tvb, offset, 1, + FALSE); offset += 1; } @@ -380,24 +366,24 @@ dissect_rx_acks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int if (tvb_length_remaining(tvb, offset)>3) { offset += 3; /* guess. some implementations adds 3 bytes */ - if (tvb_length_remaining(tvb, offset) >= 4){ - proto_tree_add_uint(tree, hf_rx_ifmtu, tvb, offset, 4, - tvb_get_ntohl(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) >= 4){ + proto_tree_add_item(tree, hf_rx_ifmtu, tvb, offset, 4, + FALSE); offset += 4; } - if (tvb_length_remaining(tvb, offset) >= 4){ - proto_tree_add_uint(tree, hf_rx_maxmtu, tvb, offset, 4, - tvb_get_ntohl(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) >= 4){ + proto_tree_add_item(tree, hf_rx_maxmtu, tvb, offset, 4, + FALSE); offset += 4; } - if (tvb_length_remaining(tvb, offset) >= 4){ - proto_tree_add_uint(tree, hf_rx_rwind, tvb, offset, 4, - tvb_get_ntohl(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) >= 4){ + proto_tree_add_item(tree, hf_rx_rwind, tvb, offset, 4, + FALSE); offset += 4; } - if (tvb_length_remaining(tvb, offset) >= 4){ - proto_tree_add_uint(tree, hf_rx_maxpackets, tvb, offset, 4, - tvb_get_ntohl(tvb, offset)); + if (tvb_reported_length_remaining(tvb, offset) >= 4){ + proto_tree_add_item(tree, hf_rx_maxpackets, tvb, offset, 4, + FALSE); offset += 4; } } @@ -468,8 +454,7 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } /* cid : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_cid, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_cid, tvb, offset, 4, FALSE); offset += 4; /* callnumber : 4 bytes */ @@ -487,8 +472,7 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) rxinfo.seq = seq; /* serial : 4 bytes */ - proto_tree_add_uint(tree, hf_rx_serial, tvb, - offset, 4, tvb_get_ntohl(tvb, offset)); + proto_tree_add_item(tree, hf_rx_serial, tvb, offset, 4, FALSE); offset += 4; /* type : 1 byte */ @@ -502,18 +486,21 @@ dissect_rx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) offset = dissect_rx_flags(tvb, &rxinfo, tree, offset); /* userstatus : 1 byte */ - proto_tree_add_uint(tree, hf_rx_userstatus, tvb, - offset, 1, tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_rx_userstatus, tvb, offset, 1, FALSE); offset += 1; /* sequrityindex : 1 byte */ - proto_tree_add_uint(tree, hf_rx_securityindex, tvb, - offset, 1, tvb_get_guint8(tvb, offset)); + proto_tree_add_item(tree, hf_rx_securityindex, tvb, offset, 1, FALSE); offset += 1; + /* + * How clever: even though the AFS header files indicate that the + * serviceId is first, it's really encoded _after_ the spare field. + * I wasted a day figuring that out! + */ + /* spare */ - proto_tree_add_uint(tree, hf_rx_spare, tvb, - offset, 2, tvb_get_ntohs(tvb, offset)); + proto_tree_add_item(tree, hf_rx_spare, tvb, offset, 2, FALSE); offset += 2; /* service id : 2 bytes */ diff --git a/packet-rx.h b/packet-rx.h index aef406405e..187af98d04 100644 --- a/packet-rx.h +++ b/packet-rx.h @@ -1,7 +1,7 @@ /* packet-rx.h * Definitions for packet disassembly structures and routines * - * $Id: packet-rx.h,v 1.6 2001/08/04 04:04:34 guy Exp $ + * $Id: packet-rx.h,v 1.7 2001/08/20 02:11:13 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -39,13 +39,10 @@ struct rxinfo { /* * RX protocol definitions. */ -struct rx_header { - guint32 epoch; - guint32 cid; - guint32 callNumber; - guint32 seq; - guint32 serial; - u_char type; + +/* + * Packet types. + */ #define RX_PACKET_TYPE_DATA 1 #define RX_PACKET_TYPE_ACK 2 #define RX_PACKET_TYPE_BUSY 3 @@ -56,30 +53,15 @@ struct rx_header { #define RX_PACKET_TYPE_DEBUG 8 #define RX_PACKET_TYPE_PARAMS 9 #define RX_PACKET_TYPE_VERSION 13 - u_char flags; + +/* + * Flag bits in the RX header. + */ #define RX_CLIENT_INITIATED 1 #define RX_REQUEST_ACK 2 #define RX_LAST_PACKET 4 #define RX_MORE_PACKETS 8 #define RX_FREE_PACKET 16 - u_char userStatus; - u_char securityIndex; - guint16 spare; /* How clever: even though the AFS */ - guint16 serviceId; /* header files indicate that the */ -}; /* serviceId is first, it's really */ - /* encoded _after_ the spare field */ - /* I wasted a day figuring that out! */ -#define RX_MAXACKS 255 -struct rx_ack_header { - guint16 bufferspace; /* # of packet buffers available */ - guint16 maxskew; - guint32 firstpacket; /* First packet in acks below */ - guint32 prevpacket; - guint32 serial; /* Packet that prompted this one */ - u_char reason; /* rx_ack_reason */ - u_char nAcks; /* number of acks*/ - u_char acks[RX_MAXACKS]; -}; #define RX_ACK_TYPE_NACK 0 #define RX_ACK_TYPE_ACK 1 @@ -93,30 +75,6 @@ struct rx_ack_header { #define RX_ACK_PING_RESPONSE 7 #define RX_ACK_DELAY 8 -struct rxkad_challenge { - guint32 version; - guint32 nonce; - guint32 min_level; - guint32 unused; -}; - #define RX_MAXCALLS 4 -struct rxkad_response { - guint32 version; - guint32 unused; - struct { - guint32 epoch; - guint32 cid; - guint32 cksum; - guint32 security_index; - guint32 call_numbers[RX_MAXCALLS]; - guint32 inc_nonce; - guint32 level; - } encrypted; - guint32 kvno; - guint32 ticket_len; - u_char the_ticket[0]; -}; - #endif |