2005-09-20 22:53:31 +00:00
|
|
|
/* packet-h221_nonstd.c
|
2005-05-18 05:44:12 +00:00
|
|
|
* Routines for H.221 nonstandard parameters disassembly
|
2005-09-20 22:53:31 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-05-18 05:44:12 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2005-05-18 05:44:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_nonstd(void);
|
|
|
|
void proto_reg_handoff_nonstd(void);
|
|
|
|
|
2005-05-18 05:44:12 +00:00
|
|
|
/* Define the nonstd proto */
|
|
|
|
static int proto_nonstd = -1;
|
|
|
|
|
2014-08-09 17:43:44 +00:00
|
|
|
static int hf_h221_nonstd_netmeeting_codec = -1;
|
|
|
|
static int hf_h221_nonstd_netmeeting_non_standard = -1;
|
|
|
|
|
2005-05-18 05:44:12 +00:00
|
|
|
/*
|
|
|
|
* Define the trees for nonstd
|
|
|
|
* We need one for nonstd itself and one for the nonstd paramters
|
|
|
|
*/
|
|
|
|
static int ett_nonstd = -1;
|
|
|
|
|
2005-05-19 20:35:30 +00:00
|
|
|
const value_string ms_codec_vals[] = {
|
2011-05-23 14:30:00 +00:00
|
|
|
{ 0x0111, "L&H CELP 4.8k" },
|
|
|
|
{ 0x0200, "MS-ADPCM" },
|
|
|
|
{ 0x0211, "L&H CELP 8k" },
|
|
|
|
{ 0x0311, "L&H CELP 12k" },
|
|
|
|
{ 0x0411, "L&H CELP 16k" },
|
|
|
|
{ 0x1100, "IMA-ADPCM" },
|
|
|
|
{ 0x3100, "MS-GSM" },
|
|
|
|
{ 0xfeff, "E-AMR" },
|
|
|
|
{ 0, NULL }
|
2005-05-19 20:35:30 +00:00
|
|
|
};
|
|
|
|
|
2015-11-15 21:51:45 +00:00
|
|
|
static int
|
|
|
|
dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
|
2005-05-18 05:44:12 +00:00
|
|
|
{
|
2005-05-19 09:26:15 +00:00
|
|
|
proto_item *it;
|
|
|
|
proto_tree *tr;
|
|
|
|
guint32 offset=0;
|
2005-05-18 05:44:12 +00:00
|
|
|
gint tvb_len;
|
2014-08-09 17:43:44 +00:00
|
|
|
guint16 codec_extra;
|
2005-05-18 05:44:12 +00:00
|
|
|
|
2014-11-21 14:54:59 +00:00
|
|
|
it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_reported_length(tvb), "Microsoft NonStd");
|
2011-05-23 14:30:00 +00:00
|
|
|
tr=proto_item_add_subtree(it, ett_nonstd);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
|
2014-08-09 17:43:44 +00:00
|
|
|
tvb_len = tvb_reported_length(tvb);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
2011-05-23 14:30:00 +00:00
|
|
|
/*
|
|
|
|
* XXX - why do this test? Are there any cases where throwing
|
|
|
|
* an exception if the tvbuff is too short causes subsequent stuff
|
|
|
|
* in the packet not to be dissected (e.g., if the octet string
|
|
|
|
* containing the non-standard data is too short for the data
|
|
|
|
* supposedly contained in it, and is followed by more items)?
|
|
|
|
*
|
|
|
|
* If so, the right fix might be to catch ReportedBoundsError in
|
|
|
|
* the dissector calling this dissector, and report a malformed
|
|
|
|
* nonStandardData item, and rethrow other exceptions (as a
|
|
|
|
* BoundsError means you really *have* run out of packet data).
|
|
|
|
*/
|
|
|
|
if(tvb_len >= 23)
|
|
|
|
{
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
codec_extra = tvb_get_ntohs(tvb,offset+22);
|
|
|
|
|
|
|
|
if(codec_extra == 0x0100)
|
|
|
|
{
|
|
|
|
|
2014-08-09 17:43:44 +00:00
|
|
|
proto_tree_add_item(tr, hf_h221_nonstd_netmeeting_codec, tvb, offset+20, 2, ENC_BIG_ENDIAN);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
2014-08-09 17:43:44 +00:00
|
|
|
proto_tree_add_item(tr, hf_h221_nonstd_netmeeting_non_standard, tvb, offset, -1, ENC_NA);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
}
|
2011-05-23 14:30:00 +00:00
|
|
|
}
|
2015-11-15 21:51:45 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2005-05-18 05:44:12 +00:00
|
|
|
}
|
2011-05-23 14:30:00 +00:00
|
|
|
|
2005-05-18 05:44:12 +00:00
|
|
|
/* Register all the bits needed with the filtering engine */
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_nonstd(void)
|
|
|
|
{
|
2014-08-09 17:43:44 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_h221_nonstd_netmeeting_codec,
|
|
|
|
{ "Microsoft NetMeeting Codec", "h221nonstd.netmeeting.codec", FT_UINT32, BASE_HEX,
|
|
|
|
VALS(ms_codec_vals), 0, NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_h221_nonstd_netmeeting_non_standard,
|
2014-11-07 03:10:11 +00:00
|
|
|
{ "Microsoft NetMeeting Non Standard", "h221nonstd.netmeeting.non_standard", FT_BYTES, BASE_NONE,
|
2014-08-09 17:43:44 +00:00
|
|
|
NULL, 0, NULL, HFILL }
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-05-23 14:30:00 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_nonstd,
|
|
|
|
};
|
2005-05-18 05:44:12 +00:00
|
|
|
|
2011-05-23 14:30:00 +00:00
|
|
|
proto_nonstd = proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
|
2005-05-18 05:44:12 +00:00
|
|
|
|
2011-05-23 14:30:00 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2014-08-09 17:43:44 +00:00
|
|
|
proto_register_field_array(proto_nonstd, hf, array_length(hf));
|
2005-05-18 05:44:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* The registration hand-off routine */
|
|
|
|
void
|
|
|
|
proto_reg_handoff_nonstd(void)
|
|
|
|
{
|
2011-05-23 14:30:00 +00:00
|
|
|
static dissector_handle_t ms_nonstd_handle;
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
2011-05-23 14:30:00 +00:00
|
|
|
dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle);
|
|
|
|
dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle);
|
2005-05-18 05:44:12 +00:00
|
|
|
|
|
|
|
}
|
2014-09-28 23:25:09 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|