1999-10-22 08:11:40 +00:00
|
|
|
/* packet-atalk.c
|
|
|
|
* Routines for Appletalk packet disassembly (DDP, currently).
|
1998-10-16 01:18:35 +00:00
|
|
|
*
|
2002-01-21 07:37:49 +00:00
|
|
|
* $Id: packet-atalk.c,v 1.62 2002/01/21 07:36:32 guy Exp $
|
1999-09-23 05:26:18 +00:00
|
|
|
*
|
1998-10-16 01:18:35 +00:00
|
|
|
* Simon Wilkinson <sxw@dcs.ed.ac.uk>
|
|
|
|
*
|
2001-12-03 04:00:26 +00:00
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
|
|
|
* Copyright 1998
|
|
|
|
*
|
1998-10-16 01:18:35 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
1999-11-04 07:06:50 +00:00
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
# include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
1999-03-23 03:14:46 +00:00
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
#include "etypes.h"
|
2000-04-16 21:37:07 +00:00
|
|
|
#include "ppptypes.h"
|
2000-11-17 06:02:21 +00:00
|
|
|
#include "aftypes.h"
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/atalk-utils.h>
|
1999-03-23 03:14:46 +00:00
|
|
|
|
2001-11-30 07:14:22 +00:00
|
|
|
static int proto_llap = -1;
|
|
|
|
static int hf_llap_dst = -1;
|
|
|
|
static int hf_llap_src = -1;
|
|
|
|
static int hf_llap_type = -1;
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
static int proto_ddp = -1;
|
1999-10-07 17:11:11 +00:00
|
|
|
static int hf_ddp_hopcount = -1;
|
|
|
|
static int hf_ddp_len = -1;
|
|
|
|
static int hf_ddp_checksum = -1;
|
|
|
|
static int hf_ddp_dst_net = -1;
|
|
|
|
static int hf_ddp_src_net = -1;
|
|
|
|
static int hf_ddp_dst_node = -1;
|
|
|
|
static int hf_ddp_src_node = -1;
|
|
|
|
static int hf_ddp_dst_socket = -1;
|
|
|
|
static int hf_ddp_src_socket = -1;
|
|
|
|
static int hf_ddp_type = -1;
|
1999-07-29 05:47:07 +00:00
|
|
|
|
1999-12-08 23:55:01 +00:00
|
|
|
static int proto_nbp = -1;
|
|
|
|
static int hf_nbp_op = -1;
|
|
|
|
static int hf_nbp_info = -1;
|
|
|
|
static int hf_nbp_count = -1;
|
|
|
|
static int hf_nbp_tid = -1;
|
|
|
|
|
1999-12-09 17:06:37 +00:00
|
|
|
static int hf_nbp_node_net = -1;
|
|
|
|
static int hf_nbp_node_port = -1;
|
|
|
|
static int hf_nbp_node_node = -1;
|
|
|
|
static int hf_nbp_node_enum = -1;
|
|
|
|
static int hf_nbp_node_object = -1;
|
|
|
|
static int hf_nbp_node_type = -1;
|
|
|
|
static int hf_nbp_node_zone = -1;
|
|
|
|
|
|
|
|
static int proto_rtmp = -1;
|
|
|
|
static int hf_rtmp_net = -1;
|
|
|
|
static int hf_rtmp_node_len = -1;
|
|
|
|
static int hf_rtmp_node = -1;
|
2000-11-13 04:26:14 +00:00
|
|
|
static int hf_rtmp_tuple_net = -1;
|
|
|
|
static int hf_rtmp_tuple_range_start = -1;
|
|
|
|
static int hf_rtmp_tuple_range_end = -1;
|
|
|
|
static int hf_rtmp_tuple_dist = -1;
|
|
|
|
static int hf_rtmp_function = -1;
|
1999-12-09 04:02:50 +00:00
|
|
|
|
1999-12-08 23:55:01 +00:00
|
|
|
static gint ett_nbp = -1;
|
|
|
|
static gint ett_nbp_info = -1;
|
1999-12-09 04:02:50 +00:00
|
|
|
static gint ett_nbp_node = -1;
|
1999-12-09 17:06:37 +00:00
|
|
|
static gint ett_rtmp = -1;
|
|
|
|
static gint ett_rtmp_tuple = -1;
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ddp = -1;
|
2001-11-30 07:14:22 +00:00
|
|
|
static gint ett_llap = -1;
|
1999-12-09 04:02:50 +00:00
|
|
|
static gint ett_pstring = -1;
|
1999-11-16 11:44:20 +00:00
|
|
|
|
2000-05-28 22:59:18 +00:00
|
|
|
static dissector_table_t ddp_dissector_table;
|
|
|
|
|
2001-11-26 01:03:35 +00:00
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
2001-11-30 07:14:22 +00:00
|
|
|
#define DDP_SHORT_HEADER_SIZE 5
|
|
|
|
|
2000-11-11 09:18:15 +00:00
|
|
|
/*
|
|
|
|
* P = Padding, H = Hops, L = Len
|
|
|
|
*
|
|
|
|
* PPHHHHLL LLLLLLLL
|
|
|
|
*
|
|
|
|
* Assumes the argument is in host byte order.
|
|
|
|
*/
|
|
|
|
#define ddp_hops(x) ( ( x >> 10) & 0x3C )
|
|
|
|
#define ddp_len(x) ( x & 0x03ff )
|
1999-02-08 20:02:35 +00:00
|
|
|
typedef struct _e_ddp {
|
|
|
|
guint16 hops_len; /* combines pad, hops, and len */
|
1998-10-16 01:18:35 +00:00
|
|
|
guint16 sum,dnet,snet;
|
|
|
|
guint8 dnode,snode;
|
|
|
|
guint8 dport,sport;
|
|
|
|
guint8 type;
|
|
|
|
} e_ddp;
|
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
#define DDP_HEADER_SIZE 13
|
1998-10-16 01:18:35 +00:00
|
|
|
|
1999-10-22 08:11:40 +00:00
|
|
|
|
|
|
|
static const value_string op_vals[] = {
|
|
|
|
{DDP_RTMPDATA, "AppleTalk Routing Table response or data" },
|
|
|
|
{DDP_NBP, "AppleTalk Name Binding Protocol packet"},
|
|
|
|
{DDP_ATP, "AppleTalk Transaction Protocol packet"},
|
|
|
|
{DDP_AEP, "AppleTalk Echo Protocol packet"},
|
|
|
|
{DDP_RTMPREQ, "AppleTalk Routing Table request"},
|
|
|
|
{DDP_ZIP, "AppleTalk Zone Information Protocol packet"},
|
|
|
|
{DDP_ADSP, "AppleTalk Data Stream Protocol"},
|
2000-05-22 18:09:36 +00:00
|
|
|
{DDP_EIGRP, "Cisco EIGRP for AppleTalk"},
|
1999-10-22 08:11:40 +00:00
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
static const value_string rtmp_function_vals[] = {
|
|
|
|
{1, "Request"},
|
|
|
|
{2, "Route Data Request (split horizon processed)"},
|
|
|
|
{3, "Route Data Request (no split horizon processing)"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
1999-12-09 17:06:37 +00:00
|
|
|
#define NBP_LOOKUP 2
|
|
|
|
#define NBP_FORWARD 4
|
|
|
|
#define NBP_REPLY 3
|
|
|
|
|
1999-12-08 23:55:01 +00:00
|
|
|
static const value_string nbp_op_vals[] = {
|
|
|
|
{NBP_LOOKUP, "lookup"},
|
1999-12-09 17:06:37 +00:00
|
|
|
{NBP_FORWARD, "forward request"},
|
|
|
|
{NBP_REPLY, "reply"},
|
1999-12-08 23:55:01 +00:00
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
/*
|
|
|
|
* XXX - do this with an FT_UINT_STRING?
|
|
|
|
* Unfortunately, you can't extract from an FT_UINT_STRING the string,
|
|
|
|
* which we'd want to do in order to put it into the "Data:" portion.
|
|
|
|
*/
|
|
|
|
int dissect_pascal_string(tvbuff_t *tvb, int offset, proto_tree *tree,
|
|
|
|
int hf_index)
|
1999-12-09 04:02:50 +00:00
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
len = tvb_get_guint8(tvb, offset);
|
1999-12-09 04:02:50 +00:00
|
|
|
offset++;
|
|
|
|
|
|
|
|
if ( tree )
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
proto_tree *item;
|
|
|
|
proto_tree *subtree;
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
/*
|
|
|
|
* XXX - if we could do this inside the protocol tree
|
|
|
|
* code, we could perhaps avoid allocating and freeing
|
|
|
|
* this string buffer.
|
|
|
|
*/
|
1999-12-09 04:02:50 +00:00
|
|
|
tmp = g_malloc( len+1 );
|
2000-11-13 04:26:14 +00:00
|
|
|
tvb_memcpy(tvb, tmp, offset, len);
|
1999-12-09 04:02:50 +00:00
|
|
|
tmp[len] = 0;
|
2000-11-13 04:26:14 +00:00
|
|
|
item = proto_tree_add_string(tree, hf_index, tvb, offset-1, len+1, tmp);
|
1999-12-09 04:02:50 +00:00
|
|
|
|
|
|
|
subtree = proto_item_add_subtree(item, ett_pstring);
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree_add_text(subtree, tvb, offset-1, 1, "Length: %d", len);
|
|
|
|
proto_tree_add_text(subtree, tvb, offset, len, "Data: %s", tmp);
|
1999-12-09 04:02:50 +00:00
|
|
|
|
|
|
|
g_free(tmp);
|
|
|
|
}
|
|
|
|
offset += len;
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
1999-12-08 23:21:08 +00:00
|
|
|
static void
|
2000-11-13 04:26:14 +00:00
|
|
|
dissect_rtmp_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|
|
|
proto_tree *rtmp_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 function;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-01-22 03:33:45 +00:00
|
|
|
|
|
|
|
function = tvb_get_guint8(tvb, 0);
|
2000-11-13 04:26:14 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "%s",
|
2000-11-13 04:26:14 +00:00
|
|
|
val_to_str(function, rtmp_function_vals, "Unknown function (%02)"));
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_rtmp, tvb, 0, 1, FALSE);
|
|
|
|
rtmp_tree = proto_item_add_subtree(ti, ett_rtmp);
|
|
|
|
|
|
|
|
proto_tree_add_uint(rtmp_tree, hf_rtmp_function, tvb, 0, 1, function);
|
|
|
|
}
|
1999-12-08 23:25:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-11-13 04:26:14 +00:00
|
|
|
dissect_rtmp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
1999-12-09 17:06:37 +00:00
|
|
|
proto_tree *rtmp_tree;
|
|
|
|
proto_item *ti;
|
2000-11-13 04:26:14 +00:00
|
|
|
int offset = 0;
|
1999-12-09 17:06:37 +00:00
|
|
|
guint16 net;
|
|
|
|
guint8 nodelen,nodelen_bits;
|
|
|
|
guint16 node; /* might be more than 8 bits */
|
|
|
|
int i;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RTMP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
1999-12-09 17:06:37 +00:00
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
net = tvb_get_ntohs(tvb, offset);
|
|
|
|
nodelen_bits = tvb_get_guint8(tvb, offset+2);
|
1999-12-09 17:06:37 +00:00
|
|
|
if ( nodelen_bits <= 8 ) {
|
2000-11-13 04:26:14 +00:00
|
|
|
node = tvb_get_guint8(tvb, offset)+1;
|
|
|
|
nodelen = 1;
|
1999-12-09 17:06:37 +00:00
|
|
|
} else {
|
2000-11-13 04:26:14 +00:00
|
|
|
node = tvb_get_ntohs(tvb, offset);
|
|
|
|
nodelen = 2;
|
1999-12-09 17:06:37 +00:00
|
|
|
}
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Net: %u Node Len: %u Node: %u",
|
1999-12-09 17:06:37 +00:00
|
|
|
net, nodelen_bits, node);
|
|
|
|
|
|
|
|
if (tree) {
|
Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff". This can be used if
1) the item covers the entire packet or the remaining payload in
the packet
or
2) the item's length won't be known until it's dissected, and
will be then set with "proto_item_set_len()" - if an
exception is thrown in the dissection, it means the item ran
*past* the end of the tvbuff, so saying it runs to the end of
the tvbuff is reasonable.
Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).
In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).
Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.
Fix some indentation.
svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_rtmp, tvb, offset, -1, FALSE);
|
1999-12-09 17:06:37 +00:00
|
|
|
rtmp_tree = proto_item_add_subtree(ti, ett_rtmp);
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree_add_uint(rtmp_tree, hf_rtmp_net, tvb, offset, 2, net);
|
|
|
|
proto_tree_add_uint(rtmp_tree, hf_rtmp_node_len, tvb, offset+2, 1,
|
|
|
|
nodelen_bits);
|
|
|
|
proto_tree_add_uint(rtmp_tree, hf_rtmp_node, tvb, offset+3, nodelen,
|
|
|
|
node);
|
1999-12-09 17:06:37 +00:00
|
|
|
offset += 3 + nodelen;
|
|
|
|
|
|
|
|
i = 1;
|
2000-11-13 08:58:17 +00:00
|
|
|
while (tvb_offset_exists(tvb, offset)) {
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree *tuple_item, *tuple_tree;
|
|
|
|
guint16 tuple_net;
|
|
|
|
guint8 tuple_dist;
|
|
|
|
guint16 tuple_range_end;
|
|
|
|
|
|
|
|
tuple_net = tvb_get_ntohs(tvb, offset);
|
|
|
|
tuple_dist = tvb_get_guint8(tvb, offset+2);
|
|
|
|
|
|
|
|
if (tuple_dist & 0x80) {
|
|
|
|
tuple_range_end = tvb_get_ntohs(tvb, offset+3);
|
|
|
|
tuple_item = proto_tree_add_text(rtmp_tree, tvb, offset, 6,
|
|
|
|
"Tuple %d: Range Start: %u Dist: %u Range End: %u",
|
|
|
|
i, tuple_net, tuple_dist&0x7F, tuple_range_end);
|
|
|
|
} else {
|
|
|
|
tuple_item = proto_tree_add_text(rtmp_tree, tvb, offset, 3,
|
|
|
|
"Tuple %d: Net: %u Dist: %u",
|
1999-12-09 17:06:37 +00:00
|
|
|
i, tuple_net, tuple_dist);
|
2000-11-13 04:26:14 +00:00
|
|
|
}
|
|
|
|
tuple_tree = proto_item_add_subtree(tuple_item, ett_rtmp_tuple);
|
1999-12-09 17:06:37 +00:00
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
if (tuple_dist & 0x80) {
|
|
|
|
proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_range_start, tvb, offset, 2,
|
1999-12-09 17:06:37 +00:00
|
|
|
tuple_net);
|
2000-11-13 04:26:14 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_net, tvb, offset, 2,
|
|
|
|
tuple_net);
|
|
|
|
}
|
|
|
|
proto_tree_add_uint(tuple_tree, hf_rtmp_tuple_dist, tvb, offset+2, 1,
|
|
|
|
tuple_dist & 0x7F);
|
|
|
|
|
|
|
|
if (tuple_dist & 0x80) {
|
|
|
|
/*
|
|
|
|
* Extended network tuple.
|
|
|
|
*/
|
|
|
|
proto_tree_add_item(tuple_tree, hf_rtmp_tuple_range_end, tvb, offset+3, 2,
|
|
|
|
FALSE);
|
|
|
|
offset += 6;
|
|
|
|
} else
|
|
|
|
offset += 3;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
1999-12-09 17:06:37 +00:00
|
|
|
}
|
1999-12-08 23:21:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-11-13 04:26:14 +00:00
|
|
|
dissect_nbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
1999-12-08 23:55:01 +00:00
|
|
|
proto_tree *nbp_tree;
|
|
|
|
proto_tree *nbp_info_tree;
|
|
|
|
proto_item *ti, *info_item;
|
2000-11-13 04:26:14 +00:00
|
|
|
int offset = 0;
|
|
|
|
guint8 info;
|
1999-12-08 23:55:01 +00:00
|
|
|
guint op, count;
|
2001-04-27 01:27:37 +00:00
|
|
|
unsigned int i;
|
1999-12-08 23:55:01 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
1999-12-08 23:55:01 +00:00
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
info = tvb_get_guint8(tvb, offset);
|
|
|
|
op = info >> 4;
|
|
|
|
count = info & 0x0F;
|
1999-12-08 23:55:01 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Op: %s Count: %u",
|
2000-11-13 04:26:14 +00:00
|
|
|
val_to_str(op, nbp_op_vals, "Unknown (0x%01x)"), count);
|
1999-12-08 23:55:01 +00:00
|
|
|
|
|
|
|
if (tree) {
|
Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff". This can be used if
1) the item covers the entire packet or the remaining payload in
the packet
or
2) the item's length won't be known until it's dissected, and
will be then set with "proto_item_set_len()" - if an
exception is thrown in the dissection, it means the item ran
*past* the end of the tvbuff, so saying it runs to the end of
the tvbuff is reasonable.
Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).
In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).
Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.
Fix some indentation.
svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_nbp, tvb, offset, -1, FALSE);
|
1999-12-08 23:55:01 +00:00
|
|
|
nbp_tree = proto_item_add_subtree(ti, ett_nbp);
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
info_item = proto_tree_add_uint_format(nbp_tree, hf_nbp_info, tvb, offset, 1,
|
|
|
|
info,
|
|
|
|
"Info: 0x%01X Operation: %s Count: %u", info,
|
|
|
|
val_to_str(op, nbp_op_vals, "Unknown (0x%01X)"),
|
1999-12-08 23:55:01 +00:00
|
|
|
count);
|
2000-11-13 04:26:14 +00:00
|
|
|
nbp_info_tree = proto_item_add_subtree(info_item, ett_nbp_info);
|
|
|
|
proto_tree_add_uint(nbp_info_tree, hf_nbp_op, tvb, offset, 1, info);
|
|
|
|
proto_tree_add_uint(nbp_info_tree, hf_nbp_count, tvb, offset, 1, info);
|
|
|
|
proto_tree_add_item(nbp_tree, hf_nbp_tid, tvb, offset+1, 1, FALSE);
|
|
|
|
offset += 2;
|
1999-12-09 04:02:50 +00:00
|
|
|
|
|
|
|
for (i=0; i<count; i++) {
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree *node_item,*node_tree;
|
|
|
|
int soffset = offset;
|
1999-12-09 04:02:50 +00:00
|
|
|
|
Allow a length of -1 to be specified when adding FT_NONE and FT_PROTOCOL
items to the protocol tree; it's interpreted as "the rest of the data in
the tvbuff". This can be used if
1) the item covers the entire packet or the remaining payload in
the packet
or
2) the item's length won't be known until it's dissected, and
will be then set with "proto_item_set_len()" - if an
exception is thrown in the dissection, it means the item ran
*past* the end of the tvbuff, so saying it runs to the end of
the tvbuff is reasonable.
Convert a number of "proto_tree_add_XXX()" calls using
"tvb_length_remaining()", values derived from the result of
"tvb_length()", or 0 (in the case of items whose length is unknown) to
use -1 instead (using 0 means that if an exception is thrown, selecting
the item highlights nothing; using -1 means it highlights all the data
for that item that's available).
In some places where "tvb_length()" or "tvb_length_remaining()" was used
to determine how large a packet is, use "tvb_reported_length()" or
"tvb_reported_length_remaining()", instead - the first two calls
indicate how much captured data was in the packet, the latter two calls
indicate how large the packet actually was (and the fact that using the
latter could cause BoundsError exceptions to be thrown is a feature - if
such an exception is thrown, the frame really *was* short, and it should
be tagged as such).
Replace some "proto_tree_add_XXX()" calls with equivalent
"proto_tree_add_item()" calls.
Fix some indentation.
svn path=/trunk/; revision=4578
2002-01-20 22:12:39 +00:00
|
|
|
node_item = proto_tree_add_text(nbp_tree, tvb, offset, -1,
|
1999-12-09 04:02:50 +00:00
|
|
|
"Node %d", i+1);
|
2000-11-13 04:26:14 +00:00
|
|
|
node_tree = proto_item_add_subtree(node_item, ett_nbp_node);
|
|
|
|
|
|
|
|
proto_tree_add_item(node_tree, hf_nbp_node_net, tvb, offset, 2, FALSE);
|
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_item(node_tree, hf_nbp_node_node, tvb, offset, 1, FALSE);
|
|
|
|
offset++;
|
|
|
|
proto_tree_add_item(node_tree, hf_nbp_node_port, tvb, offset, 1, FALSE);
|
|
|
|
offset++;
|
|
|
|
proto_tree_add_item(node_tree, hf_nbp_node_enum, tvb, offset, 1, FALSE);
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_object);
|
|
|
|
offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_type);
|
|
|
|
offset = dissect_pascal_string(tvb, offset, node_tree, hf_nbp_node_zone);
|
|
|
|
|
|
|
|
proto_item_set_len(node_item, offset-soffset);
|
|
|
|
}
|
1999-12-08 23:55:01 +00:00
|
|
|
}
|
|
|
|
|
1999-12-08 23:21:08 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2000-11-17 06:02:21 +00:00
|
|
|
static void
|
2001-11-30 07:14:22 +00:00
|
|
|
dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, guint8 dnode,
|
|
|
|
guint8 snode, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint16 len;
|
|
|
|
guint8 dport;
|
|
|
|
guint8 sport;
|
|
|
|
guint8 type;
|
|
|
|
proto_tree *ddp_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
static struct atalk_ddp_addr src, dst;
|
|
|
|
tvbuff_t *new_tvb;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-11-30 07:14:22 +00:00
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_ddp, tvb, 0, DDP_SHORT_HEADER_SIZE,
|
|
|
|
FALSE);
|
|
|
|
ddp_tree = proto_item_add_subtree(ti, ett_ddp);
|
|
|
|
}
|
|
|
|
len = tvb_get_ntohs(tvb, 0);
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_len, tvb, 0, 2, len);
|
|
|
|
dport = tvb_get_guint8(tvb, 2);
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_dst_socket, tvb, 2, 1, dport);
|
|
|
|
sport = tvb_get_guint8(tvb, 3);
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_src_socket, tvb, 3, 1, sport);
|
|
|
|
type = tvb_get_guint8(tvb, 4);
|
|
|
|
|
|
|
|
src.net = 0;
|
|
|
|
src.node = snode;
|
|
|
|
src.port = sport;
|
|
|
|
dst.net = 0;
|
|
|
|
dst.node = dnode;
|
|
|
|
dst.port = dport;
|
|
|
|
SET_ADDRESS(&pinfo->net_src, AT_ATALK, sizeof src, (guint8 *)&src);
|
|
|
|
SET_ADDRESS(&pinfo->src, AT_ATALK, sizeof src, (guint8 *)&src);
|
|
|
|
SET_ADDRESS(&pinfo->net_dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
|
|
|
|
SET_ADDRESS(&pinfo->dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2001-11-30 07:14:22 +00:00
|
|
|
val_to_str(type, op_vals, "Unknown DDP protocol (%02x)"));
|
|
|
|
}
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_type, tvb, 4, 1, type);
|
|
|
|
|
|
|
|
new_tvb = tvb_new_subset(tvb, DDP_SHORT_HEADER_SIZE, -1, -1);
|
|
|
|
|
|
|
|
if (!dissector_try_port(ddp_dissector_table, type, new_tvb, pinfo, tree))
|
|
|
|
call_dissector(data_handle,new_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
1998-10-16 01:18:35 +00:00
|
|
|
e_ddp ddp;
|
1999-03-23 03:14:46 +00:00
|
|
|
proto_tree *ddp_tree;
|
|
|
|
proto_item *ti;
|
2000-11-19 08:20:34 +00:00
|
|
|
static struct atalk_ddp_addr src, dst;
|
2000-11-13 04:26:14 +00:00
|
|
|
tvbuff_t *new_tvb;
|
1998-10-16 01:18:35 +00:00
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
1999-10-07 17:11:11 +00:00
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *)&ddp, 0, sizeof(e_ddp));
|
1998-10-16 01:18:35 +00:00
|
|
|
ddp.dnet=ntohs(ddp.dnet);
|
|
|
|
ddp.snet=ntohs(ddp.snet);
|
|
|
|
ddp.sum=ntohs(ddp.sum);
|
2000-11-11 09:18:15 +00:00
|
|
|
ddp.hops_len=ntohs(ddp.hops_len);
|
1998-10-16 01:18:35 +00:00
|
|
|
|
1999-10-22 08:11:40 +00:00
|
|
|
src.net = ddp.snet;
|
|
|
|
src.node = ddp.snode;
|
|
|
|
src.port = ddp.sport;
|
|
|
|
dst.net = ddp.dnet;
|
|
|
|
dst.node = ddp.dnode;
|
|
|
|
dst.port = ddp.dport;
|
2000-11-13 04:26:14 +00:00
|
|
|
SET_ADDRESS(&pinfo->net_src, AT_ATALK, sizeof src, (guint8 *)&src);
|
|
|
|
SET_ADDRESS(&pinfo->src, AT_ATALK, sizeof src, (guint8 *)&src);
|
|
|
|
SET_ADDRESS(&pinfo->net_dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
|
|
|
|
SET_ADDRESS(&pinfo->dst, AT_ATALK, sizeof dst, (guint8 *)&dst);
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
1998-10-20 05:31:03 +00:00
|
|
|
val_to_str(ddp.type, op_vals, "Unknown DDP protocol (%02x)"));
|
1998-10-16 01:18:35 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-11-13 04:26:14 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ddp, tvb, 0, DDP_HEADER_SIZE,
|
|
|
|
FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
ddp_tree = proto_item_add_subtree(ti, ett_ddp);
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_hopcount, tvb, 0, 1,
|
1999-10-07 17:11:11 +00:00
|
|
|
ddp_hops(ddp.hops_len));
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_len, tvb, 0, 2,
|
1999-10-07 17:11:11 +00:00
|
|
|
ddp_len(ddp.hops_len));
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_checksum, tvb, 2, 2,
|
|
|
|
ddp.sum);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_dst_net, tvb, 4, 2,
|
|
|
|
ddp.dnet);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_src_net, tvb, 6, 2,
|
|
|
|
ddp.snet);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_dst_node, tvb, 8, 1,
|
|
|
|
ddp.dnode);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_src_node, tvb, 9, 1,
|
|
|
|
ddp.snode);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_dst_socket, tvb, 10, 1,
|
|
|
|
ddp.dport);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_src_socket, tvb, 11, 1,
|
|
|
|
ddp.sport);
|
|
|
|
proto_tree_add_uint(ddp_tree, hf_ddp_type, tvb, 12, 1,
|
|
|
|
ddp.type);
|
1998-10-16 01:18:35 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
new_tvb = tvb_new_subset(tvb, DDP_HEADER_SIZE, -1, -1);
|
1998-10-16 01:18:35 +00:00
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
if (!dissector_try_port(ddp_dissector_table, ddp.type, new_tvb, pinfo, tree))
|
2001-11-26 01:03:35 +00:00
|
|
|
call_dissector(data_handle,new_tvb, pinfo, tree);
|
1998-10-16 01:18:35 +00:00
|
|
|
}
|
1999-07-29 05:47:07 +00:00
|
|
|
|
2001-11-30 07:14:22 +00:00
|
|
|
static const value_string llap_type_vals[] = {
|
|
|
|
{0x01, "Short DDP"},
|
|
|
|
{0x02, "DDP" },
|
|
|
|
{0x81, "Enquiry"},
|
|
|
|
{0x82, "Acknowledgement"},
|
|
|
|
{0x84, "RTS"},
|
|
|
|
{0x85, "CTS"},
|
|
|
|
{0, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
capture_llap(const u_char *pd, int len, packet_counts *ld)
|
|
|
|
{
|
|
|
|
ld->other++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_llap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint8 dnode;
|
|
|
|
guint8 snode;
|
|
|
|
guint8 type;
|
|
|
|
proto_tree *llap_tree = NULL;
|
|
|
|
proto_item *ti;
|
|
|
|
tvbuff_t *new_tvb;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "LLAP");
|
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-11-30 07:14:22 +00:00
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
ti = proto_tree_add_item(tree, proto_llap, tvb, 0, 3, FALSE);
|
|
|
|
llap_tree = proto_item_add_subtree(ti, ett_llap);
|
|
|
|
}
|
|
|
|
|
|
|
|
dnode = tvb_get_guint8(tvb, 0);
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(llap_tree, hf_llap_dst, tvb, 0, 1, dnode);
|
|
|
|
snode = tvb_get_guint8(tvb, 1);
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(llap_tree, hf_llap_src, tvb, 1, 1, snode);
|
|
|
|
type = tvb_get_guint8(tvb, 2);
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2001-11-30 07:14:22 +00:00
|
|
|
val_to_str(type, llap_type_vals, "Unknown LLAP type (%02x)"));
|
|
|
|
}
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(llap_tree, hf_llap_type, tvb, 2, 1, type);
|
|
|
|
|
|
|
|
new_tvb = tvb_new_subset(tvb, 3, -1, -1);
|
|
|
|
|
|
|
|
if (proto_is_protocol_enabled(proto_ddp)) {
|
|
|
|
pinfo->current_proto = "DDP";
|
|
|
|
switch (type) {
|
|
|
|
|
|
|
|
case 0x01:
|
|
|
|
dissect_ddp_short(new_tvb, pinfo, dnode, snode, tree);
|
|
|
|
return;
|
|
|
|
|
|
|
|
case 0x02:
|
|
|
|
dissect_ddp(new_tvb, pinfo, tree);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
call_dissector(data_handle,new_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
|
1999-07-29 05:47:07 +00:00
|
|
|
void
|
|
|
|
proto_register_atalk(void)
|
|
|
|
{
|
2001-11-30 07:14:22 +00:00
|
|
|
static hf_register_info hf_llap[] = {
|
|
|
|
{ &hf_llap_dst,
|
|
|
|
{ "Destination Node", "llap.dst", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_llap_src,
|
|
|
|
{ "Source Node", "llap.src", FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_llap_type,
|
|
|
|
{ "Type", "llap.type", FT_UINT8, BASE_HEX, VALS(llap_type_vals), 0x0,
|
|
|
|
"", HFILL }},
|
|
|
|
};
|
|
|
|
|
1999-12-08 23:55:01 +00:00
|
|
|
static hf_register_info hf_ddp[] = {
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_hopcount,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Hop count", "ddp.hopcount", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_len,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Datagram length", "ddp.len", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_checksum,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Checksum", "ddp.checksum", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_dst_net,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Destination Net", "ddp.dst.net", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_src_net,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source Net", "ddp.src.net", FT_UINT16, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_dst_node,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Destination Node", "ddp.dst.node", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_src_node,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source Node", "ddp.src.node", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_dst_socket,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Destination Socket", "ddp.dst.socket", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_src_socket,
|
1999-10-12 06:21:15 +00:00
|
|
|
{ "Source Socket", "ddp.src.socket", FT_UINT8, BASE_DEC, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-12 06:21:15 +00:00
|
|
|
|
1999-10-07 17:11:11 +00:00
|
|
|
{ &hf_ddp_type,
|
1999-10-22 08:11:40 +00:00
|
|
|
{ "Protocol type", "ddp.type", FT_UINT8, BASE_DEC, VALS(op_vals), 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"", HFILL }},
|
1999-10-07 17:11:11 +00:00
|
|
|
};
|
1999-12-08 23:55:01 +00:00
|
|
|
|
|
|
|
static hf_register_info hf_nbp[] = {
|
|
|
|
{ &hf_nbp_op,
|
|
|
|
{ "Operation", "nbp.op", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
VALS(nbp_op_vals), 0xF0, "Operation", HFILL }},
|
1999-12-08 23:55:01 +00:00
|
|
|
{ &hf_nbp_info,
|
|
|
|
{ "Info", "nbp.info", FT_UINT8, BASE_HEX,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Info", HFILL }},
|
1999-12-08 23:55:01 +00:00
|
|
|
{ &hf_nbp_count,
|
|
|
|
{ "Count", "nbp.count", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0F, "Count", HFILL }},
|
1999-12-09 04:02:50 +00:00
|
|
|
{ &hf_nbp_node_net,
|
|
|
|
{ "Network", "nbp.net", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Network", HFILL }},
|
1999-12-09 04:02:50 +00:00
|
|
|
{ &hf_nbp_node_node,
|
|
|
|
{ "Node", "nbp.node", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Node", HFILL }},
|
1999-12-09 04:02:50 +00:00
|
|
|
{ &hf_nbp_node_port,
|
|
|
|
{ "Port", "nbp.port", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Port", HFILL }},
|
1999-12-09 15:31:24 +00:00
|
|
|
{ &hf_nbp_node_enum,
|
|
|
|
{ "Enumerator", "nbp.enum", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Enumerator", HFILL }},
|
1999-12-09 15:31:24 +00:00
|
|
|
{ &hf_nbp_node_object,
|
|
|
|
{ "Object", "nbp.object", FT_STRING, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Object", HFILL }},
|
1999-12-09 04:02:50 +00:00
|
|
|
{ &hf_nbp_node_type,
|
|
|
|
{ "Type", "nbp.type", FT_STRING, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Type", HFILL }},
|
1999-12-09 15:31:24 +00:00
|
|
|
{ &hf_nbp_node_zone,
|
|
|
|
{ "Zone", "nbp.zone", FT_STRING, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Zone", HFILL }},
|
1999-12-08 23:55:01 +00:00
|
|
|
{ &hf_nbp_tid,
|
|
|
|
{ "Transaction ID", "nbp.tid", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Transaction ID", HFILL }}
|
1999-12-08 23:55:01 +00:00
|
|
|
};
|
|
|
|
|
1999-12-09 17:06:37 +00:00
|
|
|
static hf_register_info hf_rtmp[] = {
|
|
|
|
{ &hf_rtmp_net,
|
|
|
|
{ "Net", "rtmp.net", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Net", HFILL }},
|
1999-12-09 17:06:37 +00:00
|
|
|
{ &hf_rtmp_node,
|
|
|
|
{ "Node", "nbp.nodeid", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Node", HFILL }},
|
1999-12-09 17:06:37 +00:00
|
|
|
{ &hf_rtmp_node_len,
|
|
|
|
{ "Node Length", "nbp.nodeid.length", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Node Length", HFILL }},
|
1999-12-09 17:06:37 +00:00
|
|
|
{ &hf_rtmp_tuple_net,
|
|
|
|
{ "Net", "rtmp.tuple.net", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Net", HFILL }},
|
2000-11-13 04:26:14 +00:00
|
|
|
{ &hf_rtmp_tuple_range_start,
|
|
|
|
{ "Range Start", "rtmp.tuple.range_start", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Range Start", HFILL }},
|
2000-11-13 04:26:14 +00:00
|
|
|
{ &hf_rtmp_tuple_range_end,
|
|
|
|
{ "Range End", "rtmp.tuple.range_end", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Range End", HFILL }},
|
1999-12-09 17:06:37 +00:00
|
|
|
{ &hf_rtmp_tuple_dist,
|
|
|
|
{ "Distance", "rtmp.tuple.dist", FT_UINT16, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
NULL, 0x0, "Distance", HFILL }},
|
2000-11-13 04:26:14 +00:00
|
|
|
{ &hf_rtmp_function,
|
|
|
|
{ "Function", "rtmp.function", FT_UINT8, BASE_DEC,
|
2001-06-18 02:18:27 +00:00
|
|
|
VALS(rtmp_function_vals), 0x0, "Request Function", HFILL }}
|
1999-12-09 17:06:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
2001-11-30 07:14:22 +00:00
|
|
|
&ett_llap,
|
2001-01-03 06:56:03 +00:00
|
|
|
&ett_ddp,
|
1999-12-08 23:55:01 +00:00
|
|
|
&ett_nbp,
|
1999-12-09 04:02:50 +00:00
|
|
|
&ett_nbp_info,
|
|
|
|
&ett_nbp_node,
|
1999-12-09 17:06:37 +00:00
|
|
|
&ett_pstring,
|
|
|
|
&ett_rtmp,
|
|
|
|
&ett_rtmp_tuple
|
1999-11-16 11:44:20 +00:00
|
|
|
};
|
1999-07-29 05:47:07 +00:00
|
|
|
|
2001-11-30 07:14:22 +00:00
|
|
|
proto_llap = proto_register_protocol("LocalTalk Link Access Protocol", "LLAP", "llap");
|
|
|
|
proto_register_field_array(proto_llap, hf_llap, array_length(hf_llap));
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_ddp = proto_register_protocol("Datagram Delivery Protocol", "DDP", "ddp");
|
1999-12-08 23:55:01 +00:00
|
|
|
proto_register_field_array(proto_ddp, hf_ddp, array_length(hf_ddp));
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_nbp = proto_register_protocol("Name Binding Protocol", "NBP", "nbp");
|
1999-12-08 23:55:01 +00:00
|
|
|
proto_register_field_array(proto_nbp, hf_nbp, array_length(hf_nbp));
|
|
|
|
|
2000-11-13 04:26:14 +00:00
|
|
|
proto_rtmp = proto_register_protocol("Routing Table Maintenance Protocol",
|
2001-01-03 06:56:03 +00:00
|
|
|
"RTMP", "rtmp");
|
1999-12-09 17:06:37 +00:00
|
|
|
proto_register_field_array(proto_rtmp, hf_rtmp, array_length(hf_rtmp));
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-05-28 22:59:18 +00:00
|
|
|
|
|
|
|
/* subdissector code */
|
2001-12-08 06:41:48 +00:00
|
|
|
ddp_dissector_table = register_dissector_table("ddp.type", "DDP packet type",
|
|
|
|
FT_UINT8, BASE_HEX);
|
1999-07-29 05:47:07 +00:00
|
|
|
}
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_atalk(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t ddp_handle, nbp_handle, rtmp_request_handle;
|
|
|
|
dissector_handle_t rtmp_data_handle, llap_handle;
|
|
|
|
|
|
|
|
ddp_handle = create_dissector_handle(dissect_ddp, proto_ddp);
|
|
|
|
dissector_add("ethertype", ETHERTYPE_ATALK, ddp_handle);
|
|
|
|
dissector_add("chdlctype", ETHERTYPE_ATALK, ddp_handle);
|
|
|
|
dissector_add("ppp.protocol", PPP_AT, ddp_handle);
|
|
|
|
dissector_add("null.type", BSD_AF_APPLETALK, ddp_handle);
|
|
|
|
|
|
|
|
nbp_handle = create_dissector_handle(dissect_nbp, proto_nbp);
|
|
|
|
dissector_add("ddp.type", DDP_NBP, nbp_handle);
|
|
|
|
|
|
|
|
rtmp_request_handle = create_dissector_handle(dissect_rtmp_request, proto_rtmp);
|
|
|
|
rtmp_data_handle = create_dissector_handle(dissect_rtmp_data, proto_rtmp);
|
|
|
|
dissector_add("ddp.type", DDP_RTMPREQ, rtmp_request_handle);
|
|
|
|
dissector_add("ddp.type", DDP_RTMPDATA, rtmp_data_handle);
|
|
|
|
|
|
|
|
llap_handle = create_dissector_handle(dissect_llap, proto_llap);
|
|
|
|
dissector_add("wtap_encap", WTAP_ENCAP_LOCALTALK, llap_handle);
|
|
|
|
|
2001-11-26 01:03:35 +00:00
|
|
|
data_handle = find_dissector("data");
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
}
|