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