3 * Routines for ITU-T Recommendation H.261 dissection
5 * Copyright 2000, Philips Electronics N.V.
6 * Andreas Sikkema <h323@ramdyne.nl>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * SPDX-License-Identifier: GPL-2.0-or-later
16 * This dissector tries to dissect the H.261 protocol according to Annex C
17 * of ITU-T Recommendation H.225.0 (02/98)
23 #include <epan/packet.h>
25 #include <epan/rtp_pt.h>
26 #include <epan/iax2_codec_type.h>
28 void proto_register_h261(void);
29 void proto_reg_handoff_h261(void);
31 static dissector_handle_t h261_handle
;
33 /* H.261 header fields */
34 static int proto_h261
;
35 static int hf_h261_sbit
;
36 static int hf_h261_ebit
;
37 static int hf_h261_ibit
;
38 static int hf_h261_vbit
;
39 static int hf_h261_gobn
;
40 static int hf_h261_mbap
;
41 static int hf_h261_quant
;
42 static int hf_h261_hmvd
; /* Mislabeled in a figure in section C.3.1 as HMDV */
43 static int hf_h261_vmvd
;
44 static int hf_h261_data
;
46 /* H.261 fields defining a sub tree */
50 dissect_h261( tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
52 proto_item
*ti
= NULL
;
53 proto_tree
*h261_tree
= NULL
;
54 unsigned int offset
= 0;
55 static int * const bits
[] = {
56 /* SBIT 1st octet, 3 bits */
58 /* EBIT 1st octet, 3 bits */
67 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "H.261");
69 col_set_str(pinfo
->cinfo
, COL_INFO
, "H.261 message");
71 ti
= proto_tree_add_item( tree
, proto_h261
, tvb
, offset
, -1, ENC_NA
);
72 h261_tree
= proto_item_add_subtree( ti
, ett_h261
);
74 proto_tree_add_bitmask_list(h261_tree
, tvb
, offset
, 1, bits
, ENC_NA
);
77 /* GOBN 2nd octet, 4 bits */
78 proto_tree_add_item( h261_tree
, hf_h261_gobn
, tvb
, offset
, 1, ENC_NA
);
79 /* MBAP 2nd octet, 4 bits, 3rd octet 1 bit */
80 proto_tree_add_item( h261_tree
, hf_h261_mbap
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
83 /* QUANT 3rd octet, 5 bits (starting at bit 2!) */
84 proto_tree_add_item( h261_tree
, hf_h261_quant
, tvb
, offset
, 1, ENC_NA
);
86 /* HMVD 3rd octet 2 bits, 4th octet 3 bits */
87 proto_tree_add_item( h261_tree
, hf_h261_hmvd
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
90 /* VMVD 4th octet, last 5 bits */
91 proto_tree_add_item( h261_tree
, hf_h261_vmvd
, tvb
, offset
, 1, ENC_NA
);
94 /* The rest of the packet is the H.261 stream */
95 proto_tree_add_item( h261_tree
, hf_h261_data
, tvb
, offset
, -1, ENC_NA
);
97 return tvb_captured_length(tvb
);
101 proto_register_h261(void)
103 static hf_register_info hf
[] =
108 "Start bit position",
132 "Intra frame encoded data flag",
144 "Motion vector flag",
168 "Macroblock address predictor",
192 "Horizontal motion vector data",
204 "Vertical motion vector data",
233 proto_h261
= proto_register_protocol("ITU-T Recommendation H.261",
235 proto_register_field_array(proto_h261
, hf
, array_length(hf
));
236 proto_register_subtree_array(ett
, array_length(ett
));
238 h261_handle
= register_dissector("h261", dissect_h261
, proto_h261
);
242 proto_reg_handoff_h261(void)
244 dissector_add_uint("rtp.pt", PT_H261
, h261_handle
);
245 dissector_add_uint("iax2.codec", AST_FORMAT_H261
, h261_handle
);
249 * Editor modelines - https://www.wireshark.org/tools/modelines.html
254 * indent-tabs-mode: t
257 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
258 * :indentSize=8:tabSize=8:noTabs=false: