1 /* packet-h221_nonstd.c
2 * Routines for H.221 nonstandard parameters disassembly
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28 #include <epan/packet.h>
30 void proto_register_nonstd(void);
31 void proto_reg_handoff_nonstd(void);
33 /* Define the nonstd proto */
34 static int proto_nonstd = -1;
37 * Define the trees for nonstd
38 * We need one for nonstd itself and one for the nonstd paramters
40 static int ett_nonstd = -1;
42 const value_string ms_codec_vals[] = {
43 { 0x0111, "L&H CELP 4.8k" },
44 { 0x0200, "MS-ADPCM" },
45 { 0x0211, "L&H CELP 8k" },
46 { 0x0311, "L&H CELP 12k" },
47 { 0x0411, "L&H CELP 16k" },
48 { 0x1100, "IMA-ADPCM" },
55 dissect_ms_nonstd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
61 guint16 codec_value, codec_extra;
63 it=proto_tree_add_protocol_format(tree, proto_nonstd, tvb, 0, tvb_length(tvb), "Microsoft NonStd");
64 tr=proto_item_add_subtree(it, ett_nonstd);
67 tvb_len = tvb_length(tvb);
70 * XXX - why do this test? Are there any cases where throwing
71 * an exception if the tvbuff is too short causes subsequent stuff
72 * in the packet not to be dissected (e.g., if the octet string
73 * containing the non-standard data is too short for the data
74 * supposedly contained in it, and is followed by more items)?
76 * If so, the right fix might be to catch ReportedBoundsError in
77 * the dissector calling this dissector, and report a malformed
78 * nonStandardData item, and rethrow other exceptions (as a
79 * BoundsError means you really *have* run out of packet data).
84 codec_value = tvb_get_ntohs(tvb,offset+20);
85 codec_extra = tvb_get_ntohs(tvb,offset+22);
87 if(codec_extra == 0x0100)
90 proto_tree_add_text(tr, tvb, offset+20, 2, "Microsoft NetMeeting Codec=0x%04X %s",
91 codec_value,val_to_str(codec_value, ms_codec_vals,"Unknown (%u)"));
97 proto_tree_add_text(tr, tvb, offset, -1, "Microsoft NetMeeting Non Standard");
103 /* Register all the bits needed with the filtering engine */
106 proto_register_nonstd(void)
108 static gint *ett[] = {
112 proto_nonstd = proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
114 proto_register_subtree_array(ett, array_length(ett));
117 /* The registration hand-off routine */
119 proto_reg_handoff_nonstd(void)
121 static dissector_handle_t ms_nonstd_handle;
124 ms_nonstd_handle = create_dissector_handle(dissect_ms_nonstd, proto_nonstd);
126 dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle);
127 dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle);