* Based on routines from tcpdump patches by
* Ken Hornstein <kenh@cmf.nrl.navy.mil>
*
- * $Id: packet-rx.c,v 1.28 2001/12/03 03:59:39 guy Exp $
+ * $Id: packet-rx.c,v 1.39 2003/09/21 20:06:01 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-# include <netinet/in.h>
-#endif
-
#include <string.h>
#include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
#include "packet-rx.h"
-#include "resolv.h"
+#include <epan/resolv.h>
#define UDP_PORT_RX_LOW 7000
#define UDP_PORT_RX_HIGH 7009
{ 0, NULL },
};
-static const value_string rx_flags[] = {
- { RX_CLIENT_INITIATED, "client-init" },
- { RX_REQUEST_ACK, "req-ack" },
- { RX_LAST_PACKET, "last-pckt" },
- { RX_MORE_PACKETS, "more-pckts" },
- { RX_FREE_PACKET, "free-pckt" },
- { 0, NULL }
-};
-
static const value_string rx_reason[] = {
{ RX_ACK_REQUESTED, "Ack Requested" },
{ RX_ACK_DUPLICATE, "Duplicate Packet" },
{ RX_ACK_OUT_OF_SEQUENCE, "Out Of Sequence" },
- { RX_ACK_EXEEDS_WINDOW, "Exceeds Window" },
+ { RX_ACK_EXEEDS_WINDOW, "Exceeds Window" },
{ RX_ACK_NOSPACE, "No Space" },
{ RX_ACK_PING, "Ping" },
{ RX_ACK_PING_RESPONSE, "Ping Response" },
{ RX_ACK_DELAY, "Delay" },
+ { RX_ACK_IDLE, "Idle" },
{ 0, NULL }
};
static int hf_rx_maxmtu = -1;
static int hf_rx_rwind = -1;
static int hf_rx_maxpackets = -1;
+static int hf_rx_abort = -1;
+static int hf_rx_abortcode = -1;
static gint ett_rx = -1;
static gint ett_rx_flags = -1;
static gint ett_rx_challenge = -1;
static gint ett_rx_response = -1;
static gint ett_rx_encrypted = -1;
+static gint ett_rx_abort = -1;
static dissector_handle_t afs_handle;
static int
-dissect_rx_response_encrypted(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset)
+dissect_rx_response_encrypted(tvbuff_t *tvb, proto_tree *parent_tree, int offset)
{
proto_tree *tree;
proto_item *item;
int i;
guint32 callnumber;
- item = proto_tree_add_item(parent_tree, hf_rx_encrypted, tvb, offset, 0, FALSE);
+ item = proto_tree_add_item(parent_tree, hf_rx_encrypted, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_rx_encrypted);
/* epoch : 4 bytes */
nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = 0;
-
+
proto_tree_add_time(tree, hf_rx_epoch, tvb,
offset, 4, &ts);
offset += 4;
/* level : 4 bytes */
proto_tree_add_item(tree, hf_rx_level, tvb, offset, 4, FALSE);
offset += 4;
-
- proto_item_set_len(item, offset-old_offset);
+
+ proto_item_set_len(item, offset-old_offset);
return offset;
}
-
+
static int
dissect_rx_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, guint32 seq, guint32 callnumber)
guint32 version, tl;
int old_offset=offset;
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO,
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO,
"RESPONSE "
"Seq: %lu "
"Call: %lu "
);
}
- item = proto_tree_add_item(parent_tree, hf_rx_response, tvb, offset, 0, FALSE);
+ item = proto_tree_add_item(parent_tree, hf_rx_response, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_rx_response);
version = tvb_get_ntohl(tvb, offset);
offset += 4;
/* encrypted : struct */
- offset = dissect_rx_response_encrypted(tvb, pinfo, tree, offset);
+ offset = dissect_rx_response_encrypted(tvb, tree, offset);
/* kvno */
proto_tree_add_item(tree, hf_rx_kvno, tvb, offset, 4, FALSE);
offset += 4;
-
+
/* ticket_len */
tl = tvb_get_ntohl(tvb, offset);
proto_tree_add_uint(tree, hf_rx_ticket_len, tvb,
offset, 4, tl);
offset += 4;
-
+
proto_tree_add_item(tree, hf_rx_ticket, tvb, offset, tl, FALSE);
- offset += tl;
+ offset += tl;
}
- proto_item_set_len(item, offset-old_offset);
+ proto_item_set_len(item, offset-old_offset);
return offset;
}
+static int
+dissect_rx_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, guint32 seq, guint32 callnumber)
+{
+ proto_tree *tree;
+ proto_item *item;
+ int old_offset=offset;
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO,
+ "ABORT "
+ "Seq: %lu "
+ "Call: %lu "
+ "Source Port: %s "
+ "Destination Port: %s ",
+ (unsigned long)seq,
+ (unsigned long)callnumber,
+ get_udp_port(pinfo->srcport),
+ get_udp_port(pinfo->destport)
+ );
+ }
+
+ item = proto_tree_add_item(parent_tree, hf_rx_abort, tvb, offset, -1, FALSE);
+ tree = proto_item_add_subtree(item, ett_rx_abort);
+
+ /* kvno */
+ proto_tree_add_item(tree, hf_rx_abortcode, tvb, offset, 4, FALSE);
+ offset += 4;
+
+ proto_item_set_len(item, offset-old_offset);
+ return offset;
+}
+
+
static int
dissect_rx_challenge(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset, guint32 seq, guint32 callnumber)
{
guint32 version;
int old_offset=offset;
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO,
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO,
"CHALLENGE "
"Seq: %lu "
"Call: %lu "
);
}
- item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, 0, FALSE);
+ item = proto_tree_add_item(parent_tree, hf_rx_challenge, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_rx_challenge);
version = tvb_get_ntohl(tvb, offset);
offset += 4;
}
- proto_item_set_len(item, offset-old_offset);
+ proto_item_set_len(item, offset-old_offset);
return offset;
}
guint8 num;
int old_offset = offset;
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO,
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO,
"ACK "
"Seq: %lu "
"Call: %lu "
);
}
- item = proto_tree_add_item(parent_tree, hf_rx_ack, tvb, offset, 0, FALSE);
+ item = proto_tree_add_item(parent_tree, hf_rx_ack, tvb, offset, -1, FALSE);
tree = proto_item_add_subtree(item, ett_rx_ack);
/* bufferspace: 2 bytes*/
proto_tree_add_item(tree, hf_rx_bufferspace, tvb, offset, 2, FALSE);
offset += 2;
-
+
/* maxskew: 2 bytes*/
proto_tree_add_item(tree, hf_rx_maxskew, tvb, offset, 2, FALSE);
offset += 2;
-
+
/* first packet: 4 bytes*/
proto_tree_add_item(tree, hf_rx_first_packet, tvb, offset, 4, FALSE);
offset += 4;
-
+
/* prev packet: 4 bytes*/
proto_tree_add_item(tree, hf_rx_prev_packet, tvb, offset, 4, FALSE);
offset += 4;
- /* serial : 4 bytes */
+ /* serial : 4 bytes */
proto_tree_add_item(tree, hf_rx_serial, tvb, offset, 4, FALSE);
offset += 4;
}
}
- proto_item_set_len(item, offset-old_offset);
+ proto_item_set_len(item, offset-old_offset);
return offset;
}
offset, 1, flags);
tree = proto_item_add_subtree(item, ett_rx_flags);
- proto_tree_add_uint(tree, hf_rx_flags_free_packet, tvb,
+ proto_tree_add_boolean(tree, hf_rx_flags_free_packet, tvb,
offset, 1, flags);
- proto_tree_add_uint(tree, hf_rx_flags_more_packets, tvb,
+ proto_tree_add_boolean(tree, hf_rx_flags_more_packets, tvb,
offset, 1, flags);
- proto_tree_add_uint(tree, hf_rx_flags_last_packet, tvb,
+ proto_tree_add_boolean(tree, hf_rx_flags_last_packet, tvb,
offset, 1, flags);
- proto_tree_add_uint(tree, hf_rx_flags_request_ack, tvb,
+ proto_tree_add_boolean(tree, hf_rx_flags_request_ack, tvb,
offset, 1, flags);
- proto_tree_add_uint(tree, hf_rx_flags_clientinit, tvb,
+ proto_tree_add_boolean(tree, hf_rx_flags_clientinit, tvb,
offset, 1, flags);
offset += 1;
guint32 seq, callnumber;
guint16 serviceid;
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "RX");
- if (check_col(pinfo->fd, COL_INFO))
- col_clear(pinfo->fd, COL_INFO);
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "RX");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
- item = proto_tree_add_protocol_format(parent_tree, proto_rx, tvb,
+ item = proto_tree_add_protocol_format(parent_tree, proto_rx, tvb,
offset, 28, "RX Protocol");
tree = proto_item_add_subtree(item, ett_rx);
/* epoch : 4 bytes */
{
- nstime_t ts;;
+ nstime_t ts;
ts.secs = tvb_get_ntohl(tvb, offset);
ts.nsecs = 0;
-
+
proto_tree_add_time(tree, hf_rx_epoch, tvb,
offset, 4, &ts);
offset += 4;
switch (type) {
case RX_PACKET_TYPE_ACK:
- /*dissect_rx_acks(tvb, pinfo, parent_tree, offset,
+ /*dissect_rx_acks(tvb, pinfo, parent_tree, offset,
cant create it in a parallell tree, then ett seasrch
wont work */
- dissect_rx_acks(tvb, pinfo, tree, offset,
+ dissect_rx_acks(tvb, pinfo, tree, offset,
seq, callnumber);
break;
case RX_PACKET_TYPE_ACKALL:
/* does not contain any payload */
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO,
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO,
"ACKALL "
"Seq: %lu "
"Call: %lu "
call_dissector(afs_handle, next_tvb, pinfo, parent_tree);
};
break;
+ case RX_PACKET_TYPE_ABORT:
+ dissect_rx_abort(tvb, pinfo, tree, offset, seq, callnumber);
+ break;
}
}
NULL, 0, "Flags", HFILL }},
{ &hf_rx_flags_clientinit, {
- "Client Initiated", "rx.flags.client_init", FT_UINT8, BASE_BIN,
+ "Client Initiated", "rx.flags.client_init", FT_BOOLEAN, 8,
NULL, RX_CLIENT_INITIATED, "Client Initiated", HFILL }},
{ &hf_rx_flags_request_ack, {
- "Request Ack", "rx.flags.request_ack", FT_UINT8, BASE_BIN,
+ "Request Ack", "rx.flags.request_ack", FT_BOOLEAN, 8,
NULL, RX_REQUEST_ACK, "Request Ack", HFILL }},
{ &hf_rx_flags_last_packet, {
- "Last Packet", "rx.flags.last_packet", FT_UINT8, BASE_BIN,
+ "Last Packet", "rx.flags.last_packet", FT_BOOLEAN, 8,
NULL, RX_LAST_PACKET, "Last Packet", HFILL }},
{ &hf_rx_flags_more_packets, {
- "More Packets", "rx.flags.more_packets", FT_UINT8, BASE_BIN,
+ "More Packets", "rx.flags.more_packets", FT_BOOLEAN, 8,
NULL, RX_MORE_PACKETS, "More Packets", HFILL }},
{ &hf_rx_flags_free_packet, {
- "Free Packet", "rx.flags.free_packet", FT_UINT8, BASE_BIN,
+ "Free Packet", "rx.flags.free_packet", FT_BOOLEAN, 8,
NULL, RX_FREE_PACKET, "Free Packet", HFILL }},
+ /* XXX - what about RX_SLOW_START_OR_JUMBO? */
+
{ &hf_rx_userstatus, {
"User Status", "rx.userstatus", FT_UINT32, BASE_DEC,
NULL, 0, "User Status", HFILL }},
"RESPONSE Packet", "rx.response", FT_NONE, BASE_NONE,
NULL, 0, "RESPONSE Packet", HFILL }},
+ { &hf_rx_abort, {
+ "ABORT Packet", "rx.abort", FT_NONE, BASE_NONE,
+ NULL, 0, "ABORT Packet", HFILL }},
+
{ &hf_rx_encrypted, {
"Encrypted", "rx.encrypted", FT_NONE, BASE_NONE,
NULL, 0, "Encrypted part of response packet", HFILL }},
"Max Packets", "rx.max_packets", FT_UINT32, BASE_DEC,
NULL, 0, "Max Packets", HFILL }},
+ { &hf_rx_abortcode, {
+ "Abort Code", "rx.abort_code", FT_UINT32, BASE_DEC,
+ NULL, 0, "Abort Code", HFILL }},
+
};
static gint *ett[] = {
&ett_rx,
&ett_rx_challenge,
&ett_rx_response,
&ett_rx_encrypted,
+ &ett_rx_abort
};
proto_rx = proto_register_protocol("RX Protocol", "RX", "rx");