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 * SPDX-License-Identifier: GPL-2.0-or-later
13 #include <epan/packet.h>
15 void proto_register_nonstd(void);
16 void proto_reg_handoff_nonstd(void);
18 static dissector_handle_t ms_nonstd_handle
;
20 /* Define the nonstd proto */
21 static int proto_nonstd
;
23 static int hf_h221_nonstd_netmeeting_codec
;
24 static int hf_h221_nonstd_netmeeting_non_standard
;
27 * Define the trees for nonstd
28 * We need one for nonstd itself and one for the nonstd paramters
30 static int ett_nonstd
;
32 static const value_string ms_codec_vals
[] = {
33 { 0x0111, "L&H CELP 4.8k" },
34 { 0x0200, "MS-ADPCM" },
35 { 0x0211, "L&H CELP 8k" },
36 { 0x0311, "L&H CELP 12k" },
37 { 0x0411, "L&H CELP 16k" },
38 { 0x1100, "IMA-ADPCM" },
45 dissect_ms_nonstd(tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
, void* data _U_
)
53 it
=proto_tree_add_protocol_format(tree
, proto_nonstd
, tvb
, 0, tvb_reported_length(tvb
), "Microsoft NonStd");
54 tr
=proto_item_add_subtree(it
, ett_nonstd
);
57 tvb_len
= tvb_reported_length(tvb
);
60 * XXX - why do this test? Are there any cases where throwing
61 * an exception if the tvbuff is too short causes subsequent stuff
62 * in the packet not to be dissected (e.g., if the octet string
63 * containing the non-standard data is too short for the data
64 * supposedly contained in it, and is followed by more items)?
66 * If so, the right fix might be to catch ReportedBoundsError in
67 * the dissector calling this dissector, and report a malformed
68 * nonStandardData item, and rethrow other exceptions (as a
69 * BoundsError means you really *have* run out of packet data).
74 codec_extra
= tvb_get_ntohs(tvb
,offset
+22);
76 if(codec_extra
== 0x0100)
79 proto_tree_add_item(tr
, hf_h221_nonstd_netmeeting_codec
, tvb
, offset
+20, 2, ENC_BIG_ENDIAN
);
85 proto_tree_add_item(tr
, hf_h221_nonstd_netmeeting_non_standard
, tvb
, offset
, -1, ENC_NA
);
89 return tvb_captured_length(tvb
);
92 /* Register all the bits needed with the filtering engine */
95 proto_register_nonstd(void)
97 static hf_register_info hf
[] = {
98 { &hf_h221_nonstd_netmeeting_codec
,
99 { "Microsoft NetMeeting Codec", "h221nonstd.netmeeting.codec", FT_UINT32
, BASE_HEX
,
100 VALS(ms_codec_vals
), 0, NULL
, HFILL
}
102 { &hf_h221_nonstd_netmeeting_non_standard
,
103 { "Microsoft NetMeeting Non Standard", "h221nonstd.netmeeting.non_standard", FT_BYTES
, BASE_NONE
,
104 NULL
, 0, NULL
, HFILL
}
108 static int *ett
[] = {
112 proto_nonstd
= proto_register_protocol("H221NonStandard","h221nonstd", "h221nonstd");
114 proto_register_subtree_array(ett
, array_length(ett
));
115 proto_register_field_array(proto_nonstd
, hf
, array_length(hf
));
117 ms_nonstd_handle
= register_dissector("h221nonstd", dissect_ms_nonstd
, proto_nonstd
);
120 /* The registration hand-off routine */
122 proto_reg_handoff_nonstd(void)
124 dissector_add_uint("h245.nsp.h221",0xb500534c, ms_nonstd_handle
);
125 dissector_add_uint("h225.nsp.h221",0xb500534c, ms_nonstd_handle
);
129 * Editor modelines - https://www.wireshark.org/tools/modelines.html
134 * indent-tabs-mode: nil
137 * vi: set shiftwidth=4 tabstop=8 expandtab:
138 * :indentSize=4:tabSize=8:noTabs=true: