2 * Routines for G.723 dissection
3 * Copyright 2005, Anders Broman <anders.broman[at]ericsson.com>
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <gerald@wireshark.org>
7 * Copyright 1998 Gerald Combs
9 * SPDX-License-Identifier: GPL-2.0-or-later
16 #include <epan/packet.h>
17 #include <epan/rtp_pt.h>
19 void proto_reg_handoff_g723(void);
20 void proto_register_g723(void);
22 /* Initialize the protocol and registered fields */
23 static int proto_g723 = -1;
24 static int hf_g723_frame_size_and_codec = -1;
25 static int hf_g723_lpc_B5_B0 = -1;
27 /* Initialize the subtree pointers */
28 static int ett_g723 = -1;
32 The least significant two bits of the first
33 octet in the frame determine the frame size and codec type:
34 bits content octets/frame
35 00 high-rate speech (6.3 kb/s) 24
36 01 low-rate speech (5.3 kb/s) 20
41 static const value_string g723_frame_size_and_codec_type_value[] = {
42 {0, "High-rate speech (6.3 kb/s)"},
43 {1, "Low-rate speech (5.3 kb/s)"}, /* Not coded */
52 dissect_g723(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
58 proto_tree *g723_tree;
60 col_set_str(pinfo->cinfo, COL_PROTOCOL, "G.723.1");
62 ti = proto_tree_add_item(tree, proto_g723, tvb, 0, -1, ENC_NA);
64 g723_tree = proto_item_add_subtree(ti, ett_g723);
66 octet = tvb_get_guint8(tvb,offset);
67 proto_tree_add_item(g723_tree, hf_g723_frame_size_and_codec, tvb, offset, 1, ENC_BIG_ENDIAN);
68 proto_tree_add_item(g723_tree, hf_g723_lpc_B5_B0, tvb, offset, 1, ENC_BIG_ENDIAN);
70 if ((octet & 0x1) == 1 ) /* Low rate */
71 return tvb_captured_length(tvb);
74 return tvb_captured_length(tvb);
78 proto_reg_handoff_g723(void)
80 dissector_handle_t g723_handle;
82 g723_handle = create_dissector_handle(dissect_g723, proto_g723);
84 dissector_add_uint("rtp.pt", PT_G723, g723_handle);
89 proto_register_g723(void)
93 static hf_register_info hf[] = {
94 { &hf_g723_frame_size_and_codec,
95 { "Frame size and codec type", "g723.frame_size_and_codec",
96 FT_UINT8, BASE_HEX, VALS(g723_frame_size_and_codec_type_value), 0x03,
97 "RATEFLAG_B0", HFILL }
100 { "LPC_B5...LPC_B0", "g723.lpc.b5b0",
101 FT_UINT8, BASE_HEX, NULL, 0xfc,
107 static gint *ett[] = {
111 proto_g723 = proto_register_protocol("G.723","G.723", "g723");
113 proto_register_field_array(proto_g723, hf, array_length(hf));
114 proto_register_subtree_array(ett, array_length(ett));
119 * Editor modelines - http://www.wireshark.org/tools/modelines.html
124 * indent-tabs-mode: t
127 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
128 * :indentSize=8:tabSize=8:noTabs=false: