2000-10-19 06:45:11 +00:00
|
|
|
/* packet-h261.c
|
|
|
|
*
|
|
|
|
* Routines for ITU-T Recommendation H.261 dissection
|
2001-06-12 06:32:39 +00:00
|
|
|
*
|
2000-10-19 06:45:11 +00:00
|
|
|
* Copyright 2000, Philips Electronics N.V.
|
2004-02-14 22:48:53 +00:00
|
|
|
* Andreas Sikkema <h323@ramdyne.nl>
|
2000-10-19 06:45:11 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2000-10-19 06:45:11 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2018-02-12 11:23:27 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2000-10-19 06:45:11 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2000-10-22 07:53:19 +00:00
|
|
|
* This dissector tries to dissect the H.261 protocol according to Annex C
|
2000-10-19 06:45:11 +00:00
|
|
|
* of ITU-T Recommendation H.225.0 (02/98)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/rtp_pt.h>
|
2009-08-21 20:25:24 +00:00
|
|
|
#include <epan/iax2_codec_type.h>
|
2003-08-23 06:36:46 +00:00
|
|
|
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_h261(void);
|
|
|
|
void proto_reg_handoff_h261(void);
|
|
|
|
|
2000-10-22 07:53:19 +00:00
|
|
|
/* H.261 header fields */
|
2000-10-19 06:45:11 +00:00
|
|
|
static int proto_h261 = -1;
|
|
|
|
static int hf_h261_sbit = -1;
|
|
|
|
static int hf_h261_ebit = -1;
|
|
|
|
static int hf_h261_ibit = -1;
|
|
|
|
static int hf_h261_vbit = -1;
|
|
|
|
static int hf_h261_gobn = -1;
|
|
|
|
static int hf_h261_mbap = -1;
|
|
|
|
static int hf_h261_quant = -1;
|
|
|
|
static int hf_h261_hmvd = -1; /* Mislabeled in a figure in section C.3.1 as HMDV */
|
|
|
|
static int hf_h261_vmvd = -1;
|
|
|
|
static int hf_h261_data = -1;
|
|
|
|
|
2000-10-22 07:53:19 +00:00
|
|
|
/* H.261 fields defining a sub tree */
|
2000-10-19 06:45:11 +00:00
|
|
|
static gint ett_h261 = -1;
|
|
|
|
|
2015-11-15 21:51:45 +00:00
|
|
|
static int
|
|
|
|
dissect_h261( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ )
|
2000-10-19 06:45:11 +00:00
|
|
|
{
|
|
|
|
proto_item *ti = NULL;
|
|
|
|
proto_tree *h261_tree = NULL;
|
|
|
|
unsigned int offset = 0;
|
2020-06-19 01:14:46 +00:00
|
|
|
static int * const bits[] = {
|
2015-04-22 11:57:37 +00:00
|
|
|
/* SBIT 1st octet, 3 bits */
|
|
|
|
&hf_h261_sbit,
|
|
|
|
/* EBIT 1st octet, 3 bits */
|
|
|
|
&hf_h261_ebit,
|
|
|
|
/* I flag, 1 bit */
|
|
|
|
&hf_h261_ibit,
|
|
|
|
/* V flag, 1 bit */
|
|
|
|
&hf_h261_vbit,
|
|
|
|
NULL
|
|
|
|
};
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "H.261");
|
2002-08-28 21:04:11 +00:00
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_INFO, "H.261 message");
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
ti = proto_tree_add_item( tree, proto_h261, tvb, offset, -1, ENC_NA);
|
|
|
|
h261_tree = proto_item_add_subtree( ti, ett_h261 );
|
2015-04-22 11:57:37 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
proto_tree_add_bitmask_list(h261_tree, tvb, offset, 1, bits, ENC_NA);
|
|
|
|
offset++;
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
/* GOBN 2nd octet, 4 bits */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_gobn, tvb, offset, 1, ENC_NA);
|
|
|
|
/* MBAP 2nd octet, 4 bits, 3rd octet 1 bit */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_mbap, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset++;
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
/* QUANT 3rd octet, 5 bits (starting at bit 2!) */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_quant, tvb, offset, 1, ENC_NA);
|
2003-01-03 20:42:43 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
/* HMVD 3rd octet 2 bits, 4th octet 3 bits */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_hmvd, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset++;
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2023-01-18 20:33:59 +00:00
|
|
|
/* VMVD 4th octet, last 5 bits */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_vmvd, tvb, offset, 1, ENC_NA);
|
|
|
|
offset++;
|
|
|
|
|
|
|
|
/* The rest of the packet is the H.261 stream */
|
|
|
|
proto_tree_add_item( h261_tree, hf_h261_data, tvb, offset, -1, ENC_NA);
|
2000-10-19 06:45:11 +00:00
|
|
|
|
2015-11-15 21:51:45 +00:00
|
|
|
return tvb_captured_length(tvb);
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_h261(void)
|
|
|
|
{
|
2002-08-28 21:04:11 +00:00
|
|
|
static hf_register_info hf[] =
|
2000-10-19 06:45:11 +00:00
|
|
|
{
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_sbit,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Start bit position",
|
|
|
|
"h261.sbit",
|
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2015-10-21 15:27:11 +00:00
|
|
|
0xe0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_ebit,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"End bit position",
|
|
|
|
"h261.ebit",
|
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2015-10-21 15:27:11 +00:00
|
|
|
0x1c,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_ibit,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Intra frame encoded data flag",
|
|
|
|
"h261.i",
|
|
|
|
FT_BOOLEAN,
|
2015-10-21 15:27:11 +00:00
|
|
|
8,
|
2002-08-28 21:04:11 +00:00
|
|
|
NULL,
|
2015-10-21 15:27:11 +00:00
|
|
|
0x02,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_vbit,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Motion vector flag",
|
|
|
|
"h261.v",
|
|
|
|
FT_BOOLEAN,
|
2015-10-21 15:27:11 +00:00
|
|
|
8,
|
2002-08-28 21:04:11 +00:00
|
|
|
NULL,
|
2015-10-21 15:27:11 +00:00
|
|
|
0x01,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_gobn,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"GOB Number",
|
|
|
|
"h261.gobn",
|
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2017-05-21 11:39:32 +00:00
|
|
|
0xF0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_mbap,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Macroblock address predictor",
|
|
|
|
"h261.mbap",
|
2022-02-03 10:16:52 +00:00
|
|
|
FT_UINT16,
|
2002-08-28 21:04:11 +00:00
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2022-02-03 10:16:52 +00:00
|
|
|
0x0F80,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_quant,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Quantizer",
|
|
|
|
"h261.quant",
|
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2017-05-21 11:39:32 +00:00
|
|
|
0x7C,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_hmvd,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Horizontal motion vector data",
|
|
|
|
"h261.hmvd",
|
2022-02-03 10:16:52 +00:00
|
|
|
FT_UINT16,
|
2002-08-28 21:04:11 +00:00
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2017-05-21 11:39:32 +00:00
|
|
|
0x03E0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_vmvd,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"Vertical motion vector data",
|
|
|
|
"h261.vmvd",
|
|
|
|
FT_UINT8,
|
|
|
|
BASE_DEC,
|
|
|
|
NULL,
|
2000-10-19 06:45:11 +00:00
|
|
|
0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
2000-10-19 06:45:11 +00:00
|
|
|
&hf_h261_data,
|
2002-08-28 21:04:11 +00:00
|
|
|
{
|
|
|
|
"H.261 stream",
|
|
|
|
"h261.stream",
|
|
|
|
FT_BYTES,
|
|
|
|
BASE_NONE,
|
|
|
|
NULL,
|
2000-10-19 06:45:11 +00:00
|
|
|
0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|
2002-08-28 21:04:11 +00:00
|
|
|
|
|
|
|
static gint *ett[] =
|
2000-10-19 06:45:11 +00:00
|
|
|
{
|
|
|
|
&ett_h261,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_h261 = proto_register_protocol("ITU-T Recommendation H.261",
|
|
|
|
"H.261", "h261");
|
2000-10-19 06:45:11 +00:00
|
|
|
proto_register_field_array(proto_h261, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2003-08-23 06:36:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_h261(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t h261_handle;
|
2001-05-27 07:37:46 +00:00
|
|
|
|
2015-12-09 03:49:44 +00:00
|
|
|
h261_handle = create_dissector_handle(dissect_h261, proto_h261);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("rtp.pt", PT_H261, h261_handle);
|
|
|
|
dissector_add_uint("iax2.codec", AST_FORMAT_H261, h261_handle);
|
2000-10-19 06:45:11 +00:00
|
|
|
}
|
2014-10-04 15:28:35 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-10-04 15:28:35 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|