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>
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-11-17 02:17:29 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-11-17 02:17:29 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-tftp.c
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-17 02:17:29 +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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-17 02:17:29 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-11-17 02:17:29 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
1999-11-17 02:17:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
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 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;
|
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;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP");
|
2009-08-09 07:36:13 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2002-08-28 21:04:11 +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) {
|
2011-10-21 02:10:19 +00:00
|
|
|
si = proto_tree_add_item(tree, proto_sap, tvb, offset, -1, ENC_NA);
|
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
|
|
|
proto_tree_add_text(sap_tree, tvb, offset, addr_len, "Originating Source: %s",
|
2011-01-16 20:51:21 +00:00
|
|
|
(is_ipv6) ? tvb_ip6_to_str(tvb, offset) : tvb_ip_to_str(tvb, offset));
|
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);
|
|
|
|
|
2011-10-04 22:44:31 +00:00
|
|
|
sdi = proto_tree_add_item(sap_tree, hf_auth_data, tvb, offset, auth_data_len, ENC_NA);
|
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)
|
2004-12-06 22:32:50 +00:00
|
|
|
pad_len = tvb_get_guint8(tvb, offset+auth_data_len-1);
|
|
|
|
|
|
|
|
if ((int) auth_data_len - pad_len - 1 < 0) {
|
|
|
|
proto_tree_add_text(sa_tree, tvb, 0, 0,
|
|
|
|
"Bogus authentication length (%d) or pad length (%d)",
|
|
|
|
auth_len, pad_len);
|
|
|
|
return;
|
|
|
|
}
|
2010-10-30 18:18:12 +00:00
|
|
|
|
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) {
|
2005-08-05 00:23:22 +00:00
|
|
|
const char *mangle;
|
2000-10-17 11:03:24 +00:00
|
|
|
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 */
|
2010-10-30 18:18:12 +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,
|
2011-01-16 20:51:21 +00:00
|
|
|
tvb_get_ephemeral_string(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 */
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2000-11-19 21:01:06 +00:00
|
|
|
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",
|
2009-07-07 14:54:15 +00:00
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), MCAST_SAP_BIT_R,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, 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",
|
2009-11-17 18:35:27 +00:00
|
|
|
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",
|
2009-11-17 18:35:27 +00:00
|
|
|
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);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("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
|
|
|
}
|