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 static dissector_handle_t g723_handle
;
24 /* Initialize the protocol and registered fields */
25 static int proto_g723
;
26 static int hf_g723_frame_size_and_codec
;
27 static int hf_g723_lpc_B5_B0
;
29 /* Initialize the subtree pointers */
34 The least significant two bits of the first
35 octet in the frame determine the frame size and codec type:
36 bits content octets/frame
37 00 high-rate speech (6.3 kb/s) 24
38 01 low-rate speech (5.3 kb/s) 20
43 static const value_string g723_frame_size_and_codec_type_value
[] = {
44 {0, "High-rate speech (6.3 kb/s)"},
45 {1, "Low-rate speech (5.3 kb/s)"}, /* Not coded */
54 dissect_g723(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
60 proto_tree
*g723_tree
;
62 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "G.723.1");
64 ti
= proto_tree_add_item(tree
, proto_g723
, tvb
, 0, -1, ENC_NA
);
66 g723_tree
= proto_item_add_subtree(ti
, ett_g723
);
68 octet
= tvb_get_uint8(tvb
,offset
);
69 proto_tree_add_item(g723_tree
, hf_g723_frame_size_and_codec
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
70 proto_tree_add_item(g723_tree
, hf_g723_lpc_B5_B0
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
72 if ((octet
& 0x1) == 1 ) /* Low rate */
73 return tvb_captured_length(tvb
);
76 return tvb_captured_length(tvb
);
80 proto_reg_handoff_g723(void)
82 dissector_add_uint("rtp.pt", PT_G723
, g723_handle
);
87 proto_register_g723(void)
91 static hf_register_info hf
[] = {
92 { &hf_g723_frame_size_and_codec
,
93 { "Frame size and codec type", "g723.frame_size_and_codec",
94 FT_UINT8
, BASE_HEX
, VALS(g723_frame_size_and_codec_type_value
), 0x03,
95 "RATEFLAG_B0", HFILL
}
98 { "LPC_B5...LPC_B0", "g723.lpc.b5b0",
99 FT_UINT8
, BASE_HEX
, NULL
, 0xfc,
105 static int *ett
[] = {
109 proto_g723
= proto_register_protocol("G.723","G.723", "g723");
111 proto_register_field_array(proto_g723
, hf
, array_length(hf
));
112 proto_register_subtree_array(ett
, array_length(ett
));
114 g723_handle
= register_dissector("g723", dissect_g723
, proto_g723
);
118 * Editor modelines - https://www.wireshark.org/tools/modelines.html
123 * indent-tabs-mode: t
126 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
127 * :indentSize=8:tabSize=8:noTabs=false: