*
* Heikki Vatiainen <hessu@cs.tut.fi>
*
- * $Id: packet-sap.c,v 1.17 2001/01/03 06:55:31 guy Exp $
+ * $Id: packet-sap.c,v 1.28 2002/08/02 23:36:00 jmayer Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* Copied from packet-tftp.c
# include "config.h"
#endif
-#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-ipv6.h"
#define UDP_PORT_SAP 9875
guint8 vers_flags;
guint8 auth_len;
guint16 tmp1;
- guint8 *addr;
+ const guint8 *addr;
guint8 auth_flags;
tvbuff_t *next_tvb;
proto_item *si, *sif;
proto_tree *sap_tree, *sap_flags_tree;
- CHECK_DISPLAY_AS_DATA(proto_sap, tvb, pinfo, tree);
-
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_clear(pinfo->cinfo, COL_INFO);
+
vers_flags = tvb_get_guint8(tvb, offset);
is_ipv6 = vers_flags&MCAST_SAP_BIT_A;
is_del = vers_flags&MCAST_SAP_BIT_T;
sap_version = (vers_flags&MCAST_SAP_VERSION_MASK)>>MCAST_SAP_VERSION_SHIFT;
addr_len = (is_ipv6) ? sizeof(struct e_in6_addr) : 4;
- pinfo->current_proto = "SAP";
-
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "SAP");
-
- if (check_col(pinfo->fd, COL_INFO)) {
- col_add_fstr(pinfo->fd, COL_INFO, "%s (v%u)",
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)",
(is_del) ? "Deletion" : "Announcement", sap_version);
}
if (tree) {
- si = proto_tree_add_item(tree, proto_sap, tvb, offset, END_OF_FRAME, FALSE);
+ si = proto_tree_add_item(tree, proto_sap, tvb, offset, -1, FALSE);
sap_tree = proto_item_add_subtree(si, ett_sap);
sif = proto_tree_add_uint(sap_tree, hf_sap_flags, tvb, offset, 1, vers_flags);
if (is_enc && is_comp) mangle = "compressed and encrypted";
else if (is_enc) mangle = "encrypted";
else mangle = "compressed";
- proto_tree_add_text(sap_tree, tvb, offset,
- tvb_length_remaining(tvb, offset),
+ proto_tree_add_text(sap_tree, tvb, offset, -1,
"The rest of the packet is %s", mangle);
return;
}
{ &hf_sap_flags,
{ "Flags", "sap.flags",
FT_UINT8, BASE_HEX, NULL, 0x0,
- "Bits in the beginning of the SAP header" }},
+ "Bits in the beginning of the SAP header", HFILL }},
{ &hf_sap_flags_v,
{ "Version Number", "sap.flags.v",
FT_UINT8, BASE_DEC, VALS(mcast_sap_ver), MCAST_SAP_VERSION_MASK,
- "3 bit version field in the SAP header" }},
+ "3 bit version field in the SAP header", HFILL }},
{ &hf_sap_flags_a,
{ "Address Type", "sap.flags.a",
FT_BOOLEAN, 8, TFS(&mcast_sap_address_type), MCAST_SAP_BIT_A,
- "Originating source address type" }},
+ "Originating source address type", HFILL }},
{ &hf_sap_flags_r,
{ "Reserved", "sap.flags.r",
FT_BOOLEAN, 8, TFS(&flags_set_truth), MCAST_SAP_BIT_R,
- "Reserved" }},
+ "Reserved", HFILL }},
{ &hf_sap_flags_t,
{ "Message Type", "sap.flags.t",
FT_BOOLEAN, 8, TFS(&mcast_sap_message_type), MCAST_SAP_BIT_T,
- "Announcement type" }},
+ "Announcement type", HFILL }},
{ &hf_sap_flags_e,
{ "Encryption Bit", "sap.flags.e",
FT_BOOLEAN, 8, TFS(&mcast_sap_crypt_type), MCAST_SAP_BIT_E,
- "Encryption" }},
+ "Encryption", HFILL }},
{ &hf_sap_flags_c,
{ "Compression Bit", "sap.flags.c",
FT_BOOLEAN, 8, TFS(&mcast_sap_comp_type), MCAST_SAP_BIT_C,
- "Compression" }},
+ "Compression", HFILL }},
{ &hf_auth_data,
{ "Authentication data", "sap.auth",
FT_NONE, BASE_NONE, NULL, 0x0,
- "Auth data" }},
+ "Auth data", HFILL }},
{ &hf_auth_flags,
{ "Authentication data flags", "sap.auth.flags",
FT_UINT8, BASE_HEX, NULL, 0x0,
- "Auth flags" }},
+ "Auth flags", HFILL }},
{ &hf_auth_flags_v,
{ "Version Number", "sap.auth.flags.v",
FT_UINT8, BASE_DEC, VALS(&mcast_sap_auth_ver), MCAST_SAP_VERSION_MASK,
- "Version" }},
+ "Version", HFILL }},
{ &hf_auth_flags_p,
{ "Padding Bit", "sap.auth.flags.p",
FT_BOOLEAN, 8, TFS(&mcast_sap_auth_pad), MCAST_SAP_AUTH_BIT_P,
- "Compression" }},
+ "Compression", HFILL }},
{ &hf_auth_flags_t,
{ "Authentication Type", "sap.auth.flags.t",
FT_UINT8, BASE_DEC, VALS(&mcast_sap_auth_type), MCAST_SAP_AUTH_TYPE_MASK,
- "Auth type" }}
+ "Auth type", HFILL }}
};
static gint *ett[] = {
&ett_sap,
void
proto_reg_handoff_sap(void)
{
- dissector_add("udp.port", UDP_PORT_SAP, dissect_sap);
+ dissector_handle_t sap_handle;
+
+ sap_handle = create_dissector_handle(dissect_sap, proto_sap);
+ dissector_add("udp.port", UDP_PORT_SAP, sap_handle);
/*
* Get a handle for the SDP dissector.