2000-08-25 13:05:32 +00:00
|
|
|
/* packet-sap.c
|
1999-11-17 02:17:29 +00:00
|
|
|
* Routines for sap packet dissection
|
2000-10-17 11:03:24 +00:00
|
|
|
* RFC 2974
|
1999-11-17 02:17:29 +00:00
|
|
|
*
|
|
|
|
* Heikki Vatiainen <hessu@cs.tut.fi>
|
|
|
|
*
|
2002-08-02 23:36:07 +00:00
|
|
|
* $Id: packet-sap.c,v 1.28 2002/08/02 23:36:00 jmayer Exp $
|
1999-11-17 02:17:29 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-04-23 18:19:03 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1999-11-17 02:17:29 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-tftp.c
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
1999-11-17 02:17:29 +00:00
|
|
|
#include "packet-ipv6.h"
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define UDP_PORT_SAP 9875
|
|
|
|
|
1999-11-17 02:17:29 +00:00
|
|
|
#define MCAST_SAP_VERSION_MASK 0xE0 /* 3 bits for SAP version*/
|
|
|
|
#define MCAST_SAP_VERSION_SHIFT 5 /* Right shift 5 bits to get the version */
|
|
|
|
#define MCAST_SAP_VER0 0 /* Version 0 */
|
|
|
|
#define MCAST_SAP_VER1PLUS 1 /* Version 1 or later */
|
|
|
|
static const value_string mcast_sap_ver[] = {
|
|
|
|
{ MCAST_SAP_VER0, "SAPv0"},
|
|
|
|
{ MCAST_SAP_VER1PLUS, "SAPv1 or later"},
|
|
|
|
{ 0, NULL} };
|
|
|
|
|
|
|
|
static const true_false_string mcast_sap_address_type = {
|
|
|
|
"IPv6",
|
|
|
|
"IPv4"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string flags_set_truth = {
|
|
|
|
"Set",
|
|
|
|
"Not set"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string mcast_sap_message_type = {
|
|
|
|
"Deletion",
|
|
|
|
"Announcement"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string mcast_sap_crypt_type = {
|
|
|
|
"Payload encrypted",
|
|
|
|
"Payload not encrypted "
|
|
|
|
};
|
|
|
|
|
|
|
|
static const true_false_string mcast_sap_comp_type = {
|
|
|
|
"Payload compressed",
|
|
|
|
"Payload not compressed"
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string mcast_sap_auth_ver[] = {
|
|
|
|
{ 1, "SAP authentication header v1"},
|
|
|
|
{ 0, NULL} };
|
|
|
|
|
|
|
|
static const true_false_string mcast_sap_auth_pad = {
|
|
|
|
"Authentication subheader padded to 32 bits",
|
|
|
|
"No padding required for the authentication subheader"
|
|
|
|
};
|
|
|
|
|
|
|
|
#define MCAST_SAP_AUTH_TYPE_MASK 0x0F /* 4 bits for the type of the authentication header */
|
|
|
|
#define MCAST_SAP_AUTH_TYPE_PGP 0
|
|
|
|
#define MCAST_SAP_AUTH_TYPE_CMS 1
|
|
|
|
static const value_string mcast_sap_auth_type[] = {
|
|
|
|
{ MCAST_SAP_AUTH_TYPE_PGP, "PGP"},
|
|
|
|
{ MCAST_SAP_AUTH_TYPE_CMS, "CMS"},
|
|
|
|
{ 0, NULL} };
|
|
|
|
|
|
|
|
#define MCAST_SAP_BIT_A 0x10 /* Address type: 0 IPv4, 1 IPv6 */
|
|
|
|
#define MCAST_SAP_BIT_R 0x08 /* Reserved: Must be 0 */
|
|
|
|
#define MCAST_SAP_BIT_T 0x04 /* Message Type: 0 announcement, 1 deletion */
|
|
|
|
#define MCAST_SAP_BIT_E 0x02 /* Encryption Bit: 1 payload encrypted */
|
|
|
|
#define MCAST_SAP_BIT_C 0x01 /* Compressed Bit: 1 payload zlib compressed */
|
|
|
|
|
|
|
|
#define MCAST_SAP_AUTH_BIT_P 0x10 /* Padding required for the authentication header */
|
|
|
|
|
|
|
|
|
|
|
|
static int proto_sap = -1;
|
|
|
|
static int hf_sap_flags = -1;
|
|
|
|
static int hf_sap_flags_v = -1;
|
|
|
|
static int hf_sap_flags_a = -1;
|
|
|
|
static int hf_sap_flags_r = -1;
|
|
|
|
static int hf_sap_flags_t = -1;
|
|
|
|
static int hf_sap_flags_e = -1;
|
|
|
|
static int hf_sap_flags_c = -1;
|
|
|
|
static int hf_auth_data = -1;
|
|
|
|
static int hf_auth_flags = -1;
|
|
|
|
static int hf_auth_flags_v = -1;
|
|
|
|
static int hf_auth_flags_p = -1;
|
|
|
|
static int hf_auth_flags_t = -1;
|
|
|
|
|
|
|
|
static gint ett_sap = -1;
|
|
|
|
static gint ett_sap_flags = -1;
|
|
|
|
static gint ett_sap_auth = -1;
|
|
|
|
static gint ett_sap_authf = -1;
|
|
|
|
|
Add a mechanism by which a dissector can be registered by name, another
dissector can get a "handle" for that dissector by name and then call
that dissector through the handle.
This allows dissectors that can't be called through a port table or a
heuristic table to be called from other dissectors without directly
referring to the dissector function - dynamically-loaded modules, under
Windows, cannot directly call functions in the main program, and
non-plugin dissectors are in the main program and thus cannot be called
from plugin dissectors unless either
1) a pointer to the dissector is put in the Big Transfer Vector
or
2) some other mechanism for getting a pointer to the dissector
is provided.
This mechanism could also support registering old-style dissectors and
calling them from new-style dissectors without the new-style dissector
having to do the argument translation itself (I didn't add support for
registering old-style dissectors because I'd prefer to have people
tvbuffify their code if they have to register a dissector...).
It could also, in the future, perhaps support
disabling of protocols;
setting "pinfo->current_proto";
inside "call_dissector()" - and inside "{old_}dissector_try_port()" and
"{old_"dissector_try_heuristic()" - allowing a pile of stuff that
currently has to be done in every dissector be done by common code.
(I have some ideas about how to do this, by
having "proto_register_protocol()" take an abbreviation - of the
sort that would be put in, for example, "pinfo->current_proto" -
as an argument;
having the calls to register dissectors take an index returned
by "proto_register_protocol()" as an argument.
The abbreviation could be used elsewhere as well, e.g. in the "Decoding"
tab of the "Edit->Protocols" dialog box, and in a GUI for constructing
protocol filters. Watch this space.)
Make "dissect_sdp()" the first client of this mechanism; it's now static
to "packet-sdp.c", and all dissectors that call it - including the MGCP
plugin - now call it through a dissector handle fetched by
"find_dissector()". (Next step - see if Ethereal can now compile on
Windows as a result of this.)
svn path=/trunk/; revision=2647
2000-11-15 07:07:52 +00:00
|
|
|
static dissector_handle_t sdp_handle;
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
static void
|
2000-11-10 06:50:37 +00:00
|
|
|
dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-11-17 02:17:29 +00:00
|
|
|
{
|
2000-11-10 06:50:37 +00:00
|
|
|
int offset = 0;
|
1999-11-17 02:17:29 +00:00
|
|
|
int sap_version, is_ipv6, is_del, is_enc, is_comp, addr_len;
|
2000-11-10 06:50:37 +00:00
|
|
|
guint8 vers_flags;
|
1999-11-17 02:17:29 +00:00
|
|
|
guint8 auth_len;
|
|
|
|
guint16 tmp1;
|
2001-03-13 21:34:28 +00:00
|
|
|
const guint8 *addr;
|
2000-11-10 06:50:37 +00:00
|
|
|
guint8 auth_flags;
|
2000-11-19 21:01:06 +00:00
|
|
|
tvbuff_t *next_tvb;
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
proto_item *si, *sif;
|
|
|
|
proto_tree *sap_tree, *sap_flags_tree;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
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);
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
"Tvbuffify" the Mobile IP dissector (it took old-style arguments, and
then converted them into tvbuff arguments, so there wasn't much to do,
other than to fix references to "fd" to refer to "pinfo->fd").
In the SCTP dissector, refer to the port type and source and destination
ports through "pinfo" rather than through the global "pi", as it's a
tvbuffified dissector.
In the SMTP and Time Protocol dissectors, use "pinfo->match_port" rather
than "TCP_PORT_SMTP" when checking whether the packet is a request or
reply, just in case somebody makes a non-standard port be dissected as
SMTP or Time. (Also, remove a bogus comment from the Time dissector; it
was probably cut-and-pasted from the TFTP dissector.)
svn path=/trunk/; revision=2938
2001-01-25 06:14:14 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
vers_flags = tvb_get_guint8(tvb, offset);
|
|
|
|
is_ipv6 = vers_flags&MCAST_SAP_BIT_A;
|
|
|
|
is_del = vers_flags&MCAST_SAP_BIT_T;
|
|
|
|
is_enc = vers_flags&MCAST_SAP_BIT_E;
|
|
|
|
is_comp = vers_flags&MCAST_SAP_BIT_C;
|
1999-11-17 02:17:29 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
sap_version = (vers_flags&MCAST_SAP_VERSION_MASK)>>MCAST_SAP_VERSION_SHIFT;
|
1999-11-17 02:17:29 +00:00
|
|
|
addr_len = (is_ipv6) ? sizeof(struct e_in6_addr) : 4;
|
|
|
|
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)",
|
1999-11-22 21:41:30 +00:00
|
|
|
(is_del) ? "Deletion" : "Announcement", sap_version);
|
1999-11-17 02:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tree) {
|
2002-01-24 09:20:54 +00:00
|
|
|
si = proto_tree_add_item(tree, proto_sap, tvb, offset, -1, FALSE);
|
1999-11-17 02:17:29 +00:00
|
|
|
sap_tree = proto_item_add_subtree(si, ett_sap);
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
sif = proto_tree_add_uint(sap_tree, hf_sap_flags, tvb, offset, 1, vers_flags);
|
1999-11-17 02:17:29 +00:00
|
|
|
sap_flags_tree = proto_item_add_subtree(sif, ett_sap_flags);
|
2000-11-10 06:50:37 +00:00
|
|
|
proto_tree_add_uint(sap_flags_tree, hf_sap_flags_v, tvb, offset, 1, vers_flags);
|
|
|
|
proto_tree_add_boolean(sap_flags_tree, hf_sap_flags_a, tvb, offset, 1, vers_flags);
|
|
|
|
proto_tree_add_boolean(sap_flags_tree, hf_sap_flags_r, tvb, offset, 1, vers_flags);
|
|
|
|
proto_tree_add_boolean(sap_flags_tree, hf_sap_flags_t, tvb, offset, 1, vers_flags);
|
|
|
|
proto_tree_add_boolean(sap_flags_tree, hf_sap_flags_e, tvb, offset, 1, vers_flags);
|
|
|
|
proto_tree_add_boolean(sap_flags_tree, hf_sap_flags_c, tvb, offset, 1, vers_flags);
|
1999-11-17 02:17:29 +00:00
|
|
|
offset++;
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
auth_len = tvb_get_guint8(tvb, offset);
|
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, 1, "Authentication Length: %u", auth_len);
|
1999-11-17 02:17:29 +00:00
|
|
|
offset++;
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
tmp1 = tvb_get_ntohs(tvb, offset);
|
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, 2, "Message Identifier Hash: 0x%x", tmp1);
|
1999-11-17 02:17:29 +00:00
|
|
|
offset +=2;
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
addr = tvb_get_ptr(tvb, offset, addr_len);
|
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, addr_len, "Originating Source: %s",
|
|
|
|
(is_ipv6) ? ip6_to_str((struct e_in6_addr*)addr) : ip_to_str(addr));
|
1999-11-17 02:17:29 +00:00
|
|
|
offset += addr_len;
|
|
|
|
|
|
|
|
/* Authentication data lives in its own subtree */
|
|
|
|
if (auth_len > 0) {
|
|
|
|
guint32 auth_data_len;
|
|
|
|
proto_item *sdi, *sai;
|
|
|
|
proto_tree *sa_tree, *saf_tree;
|
|
|
|
int has_pad;
|
|
|
|
guint8 pad_len = 0;
|
|
|
|
|
|
|
|
auth_data_len = auth_len * sizeof(guint32);
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
sdi = proto_tree_add_item(sap_tree, hf_auth_data, tvb, offset, auth_data_len, FALSE);
|
1999-11-17 02:17:29 +00:00
|
|
|
sa_tree = proto_item_add_subtree(sdi, ett_sap_auth);
|
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
auth_flags = tvb_get_guint8(tvb, offset);
|
|
|
|
sai = proto_tree_add_uint(sa_tree, hf_auth_flags, tvb, offset, 1, auth_flags);
|
1999-11-17 02:17:29 +00:00
|
|
|
saf_tree = proto_item_add_subtree(sai, ett_sap_authf);
|
2000-11-10 06:50:37 +00:00
|
|
|
proto_tree_add_uint(saf_tree, hf_auth_flags_v, tvb, offset, 1, auth_flags);
|
|
|
|
proto_tree_add_boolean(saf_tree, hf_auth_flags_p, tvb, offset, 1, auth_flags);
|
|
|
|
proto_tree_add_uint(saf_tree, hf_auth_flags_t, tvb, offset, 1, auth_flags);
|
1999-11-17 02:17:29 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
has_pad = auth_flags&MCAST_SAP_AUTH_BIT_P;
|
|
|
|
if (has_pad)
|
|
|
|
pad_len = tvb_get_guint8(tvb, offset+auth_data_len-1);
|
1999-11-17 02:17:29 +00:00
|
|
|
|
2000-11-10 06:50:37 +00:00
|
|
|
proto_tree_add_text(sa_tree, tvb, offset+1, auth_data_len-pad_len-1,
|
1999-11-17 06:52:19 +00:00
|
|
|
"Authentication subheader: (%u byte%s)",
|
|
|
|
auth_data_len-1, plurality(auth_data_len-1, "", "s"));
|
1999-11-17 02:17:29 +00:00
|
|
|
if (has_pad) {
|
2000-11-10 06:50:37 +00:00
|
|
|
proto_tree_add_text(sa_tree, tvb, offset+auth_data_len-pad_len, pad_len,
|
1999-11-17 06:52:19 +00:00
|
|
|
"Authentication data padding: (%u byte%s)",
|
|
|
|
pad_len, plurality(pad_len, "", "s"));
|
2000-11-10 06:50:37 +00:00
|
|
|
proto_tree_add_text(sa_tree, tvb, offset+auth_data_len-1, 1,
|
1999-11-17 06:52:19 +00:00
|
|
|
"Authentication data pad count: %u byte%s",
|
|
|
|
pad_len, plurality(pad_len, "", "s"));
|
1999-11-17 02:17:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset += auth_data_len;
|
|
|
|
}
|
|
|
|
if (is_enc || is_comp) {
|
2000-10-17 11:03:24 +00:00
|
|
|
char *mangle;
|
|
|
|
if (is_enc && is_comp) mangle = "compressed and encrypted";
|
|
|
|
else if (is_enc) mangle = "encrypted";
|
|
|
|
else mangle = "compressed";
|
2002-01-24 09:20:54 +00:00
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, -1,
|
2000-10-17 11:03:24 +00:00
|
|
|
"The rest of the packet is %s", mangle);
|
1999-11-17 02:17:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do we have the optional payload type aka. MIME content specifier */
|
2000-11-19 21:01:06 +00:00
|
|
|
if (tvb_strneql(tvb, offset, "v=", strlen("v="))) {
|
2000-11-10 06:50:37 +00:00
|
|
|
gint remaining_len;
|
|
|
|
guint32 pt_len;
|
|
|
|
int pt_string_len;
|
|
|
|
|
|
|
|
remaining_len = tvb_length_remaining(tvb, offset);
|
|
|
|
if (remaining_len == 0) {
|
|
|
|
/*
|
|
|
|
* "tvb_strneql()" failed because there was no
|
|
|
|
* data left in the packet.
|
|
|
|
*
|
|
|
|
* Set the remaining length to 1, so that
|
|
|
|
* we throw the appropriate exception in
|
|
|
|
* "tvb_get_ptr()", rather than displaying
|
|
|
|
* the payload type.
|
|
|
|
*/
|
|
|
|
remaining_len = 1;
|
|
|
|
}
|
|
|
|
pt_string_len = tvb_strnlen(tvb, offset, remaining_len);
|
|
|
|
if (pt_string_len == -1) {
|
|
|
|
/*
|
|
|
|
* We didn't find a terminating '\0'; run to the
|
|
|
|
* end of the buffer.
|
|
|
|
*/
|
|
|
|
pt_string_len = remaining_len;
|
|
|
|
pt_len = pt_string_len;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Include the '\0' in the total item length.
|
|
|
|
*/
|
|
|
|
pt_len = pt_string_len + 1;
|
|
|
|
}
|
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, pt_len,
|
|
|
|
"Payload type: %.*s", pt_string_len,
|
|
|
|
tvb_get_ptr(tvb, offset, pt_string_len));
|
1999-11-17 02:17:29 +00:00
|
|
|
offset += pt_len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-19 21:01:06 +00:00
|
|
|
/* Done with SAP */
|
|
|
|
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
|
|
|
|
call_dissector(sdp_handle, next_tvb, pinfo, tree);
|
|
|
|
|
1999-11-17 02:17:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void proto_register_sap(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_sap_flags,
|
|
|
|
{ "Flags", "sap.flags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Bits in the beginning of the SAP header", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_v,
|
|
|
|
{ "Version Number", "sap.flags.v",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(mcast_sap_ver), MCAST_SAP_VERSION_MASK,
|
2001-06-18 02:18:27 +00:00
|
|
|
"3 bit version field in the SAP header", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_a,
|
|
|
|
{ "Address Type", "sap.flags.a",
|
|
|
|
FT_BOOLEAN, 8, TFS(&mcast_sap_address_type), MCAST_SAP_BIT_A,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Originating source address type", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_r,
|
|
|
|
{ "Reserved", "sap.flags.r",
|
|
|
|
FT_BOOLEAN, 8, TFS(&flags_set_truth), MCAST_SAP_BIT_R,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Reserved", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_t,
|
|
|
|
{ "Message Type", "sap.flags.t",
|
|
|
|
FT_BOOLEAN, 8, TFS(&mcast_sap_message_type), MCAST_SAP_BIT_T,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Announcement type", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_e,
|
|
|
|
{ "Encryption Bit", "sap.flags.e",
|
|
|
|
FT_BOOLEAN, 8, TFS(&mcast_sap_crypt_type), MCAST_SAP_BIT_E,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Encryption", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_sap_flags_c,
|
|
|
|
{ "Compression Bit", "sap.flags.c",
|
|
|
|
FT_BOOLEAN, 8, TFS(&mcast_sap_comp_type), MCAST_SAP_BIT_C,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Compression", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_auth_data,
|
|
|
|
{ "Authentication data", "sap.auth",
|
|
|
|
FT_NONE, BASE_NONE, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Auth data", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_auth_flags,
|
|
|
|
{ "Authentication data flags", "sap.auth.flags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Auth flags", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_auth_flags_v,
|
|
|
|
{ "Version Number", "sap.auth.flags.v",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(&mcast_sap_auth_ver), MCAST_SAP_VERSION_MASK,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Version", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_auth_flags_p,
|
|
|
|
{ "Padding Bit", "sap.auth.flags.p",
|
|
|
|
FT_BOOLEAN, 8, TFS(&mcast_sap_auth_pad), MCAST_SAP_AUTH_BIT_P,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Compression", HFILL }},
|
1999-11-17 02:17:29 +00:00
|
|
|
|
|
|
|
{ &hf_auth_flags_t,
|
|
|
|
{ "Authentication Type", "sap.auth.flags.t",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(&mcast_sap_auth_type), MCAST_SAP_AUTH_TYPE_MASK,
|
2001-06-18 02:18:27 +00:00
|
|
|
"Auth type", HFILL }}
|
1999-11-17 02:17:29 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_sap,
|
|
|
|
&ett_sap_flags,
|
|
|
|
&ett_sap_auth,
|
|
|
|
&ett_sap_authf,
|
|
|
|
};
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_sap = proto_register_protocol("Session Announcement Protocol", "SAP",
|
|
|
|
"sap");
|
1999-11-17 02:17:29 +00:00
|
|
|
proto_register_field_array(proto_sap, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_sap(void)
|
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t sap_handle;
|
|
|
|
|
|
|
|
sap_handle = create_dissector_handle(dissect_sap, proto_sap);
|
|
|
|
dissector_add("udp.port", UDP_PORT_SAP, sap_handle);
|
Add a mechanism by which a dissector can be registered by name, another
dissector can get a "handle" for that dissector by name and then call
that dissector through the handle.
This allows dissectors that can't be called through a port table or a
heuristic table to be called from other dissectors without directly
referring to the dissector function - dynamically-loaded modules, under
Windows, cannot directly call functions in the main program, and
non-plugin dissectors are in the main program and thus cannot be called
from plugin dissectors unless either
1) a pointer to the dissector is put in the Big Transfer Vector
or
2) some other mechanism for getting a pointer to the dissector
is provided.
This mechanism could also support registering old-style dissectors and
calling them from new-style dissectors without the new-style dissector
having to do the argument translation itself (I didn't add support for
registering old-style dissectors because I'd prefer to have people
tvbuffify their code if they have to register a dissector...).
It could also, in the future, perhaps support
disabling of protocols;
setting "pinfo->current_proto";
inside "call_dissector()" - and inside "{old_}dissector_try_port()" and
"{old_"dissector_try_heuristic()" - allowing a pile of stuff that
currently has to be done in every dissector be done by common code.
(I have some ideas about how to do this, by
having "proto_register_protocol()" take an abbreviation - of the
sort that would be put in, for example, "pinfo->current_proto" -
as an argument;
having the calls to register dissectors take an index returned
by "proto_register_protocol()" as an argument.
The abbreviation could be used elsewhere as well, e.g. in the "Decoding"
tab of the "Edit->Protocols" dialog box, and in a GUI for constructing
protocol filters. Watch this space.)
Make "dissect_sdp()" the first client of this mechanism; it's now static
to "packet-sdp.c", and all dissectors that call it - including the MGCP
plugin - now call it through a dissector handle fetched by
"find_dissector()". (Next step - see if Ethereal can now compile on
Windows as a result of this.)
svn path=/trunk/; revision=2647
2000-11-15 07:07:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get a handle for the SDP dissector.
|
|
|
|
*/
|
|
|
|
sdp_handle = find_dissector("sdp");
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|