2 * Definitions for H.248/MEGACO packet dissection
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * SPDX-License-Identifier: GPL-2.0-or-later
17 #include "ws_symbol_export.h"
19 #include <epan/packet.h>
20 #include <epan/expert.h>
21 #include <wsutil/nstime.h>
23 /* Gateway Control Protocol -- Context Tracking */
25 typedef struct _gcp_hf_ett_t
{
43 #define NULL_CONTEXT 0
44 #define CHOOSE_CONTEXT 0xFFFFFFFE
45 #define ALL_CONTEXTS 0xFFFFFFFF
59 GCP_CMD_CTX_ATTR_AUDIT_REQ
,
65 GCP_CMD_AUDITCAP_REPLY
,
66 GCP_CMD_AUDITVAL_REPLY
,
69 GCP_CMD_TOPOLOGY_REPLY
,
82 typedef struct _gcp_msg_t
{
87 struct _gcp_trx_msg_t
* trxs
;
91 typedef struct _gcp_trx_msg_t
{
92 struct _gcp_trx_t
* trx
;
93 struct _gcp_trx_msg_t
* next
;
94 struct _gcp_trx_msg_t
* last
;
97 typedef struct _gcp_cmd_msg_t
{
98 struct _gcp_cmd_t
* cmd
;
99 struct _gcp_cmd_msg_t
* next
;
100 struct _gcp_cmd_msg_t
* last
;
103 typedef struct _gcp_trx_t
{
108 struct _gcp_cmd_msg_t
* cmds
;
109 struct _gcp_trx_ctx_t
* ctxs
;
113 #define GCP_TERM_TYPE_UNKNOWN 0
114 #define GCP_TERM_TYPE_AAL1 1
115 #define GCP_TERM_TYPE_AAL2 2
116 #define GCP_TERM_TYPE_AAL1_STRUCT 3
117 #define GCP_TERM_TYPE_IP_RTP 4
118 #define GCP_TERM_TYPE_TDM 5
120 typedef enum _gcp_wildcard_t
{
126 typedef struct _gcp_term_t
{
129 const uint8_t* buffer
;
140 typedef struct _gcp_terms_t
{
142 struct _gcp_terms_t
* next
;
143 struct _gcp_terms_t
* last
;
146 typedef struct _gcp_cmd_t
{
151 struct _gcp_msg_t
* msg
;
152 struct _gcp_trx_t
* trx
;
153 struct _gcp_ctx_t
* ctx
;
158 typedef struct _gcp_ctx_t
{
161 struct _gcp_cmd_msg_t
* cmds
;
162 struct _gcp_ctx_t
* prev
;
166 extern gcp_msg_t
* gcp_msg(packet_info
* pinfo
, int o
, bool persistent
);
167 extern gcp_trx_t
* gcp_trx(gcp_msg_t
* m
,uint32_t t_id
, gcp_trx_type_t type
, packet_info
*pinfo
, bool persistent
);
168 extern gcp_ctx_t
* gcp_ctx(gcp_msg_t
* m
, gcp_trx_t
* t
, uint32_t c_id
, packet_info
*pinfo
, bool persistent
);
169 extern gcp_cmd_t
* gcp_cmd(gcp_msg_t
* m
, gcp_trx_t
* t
, gcp_ctx_t
* c
, gcp_cmd_type_t type
, unsigned offset
, packet_info
*pinfo
, bool persistent
);
170 extern gcp_term_t
* gcp_cmd_add_term(gcp_msg_t
* m
, gcp_trx_t
* tr
, gcp_cmd_t
* c
, gcp_term_t
* t
, gcp_wildcard_t wildcard
, packet_info
*pinfo
, bool persistent
);
171 extern void gcp_analyze_msg(proto_tree
* gcp_tree
, packet_info
* pinfo
, tvbuff_t
* gcp_tvb
, gcp_msg_t
* m
, gcp_hf_ett_t
* ids
, expert_field
* command_err
);
173 #define GCP_ETT_ARR_ELEMS(gi) &(gi.ett.ctx),&(gi.ett.ctx_cmds),&(gi.ett.ctx_terms),&(gi.ett.ctx_term)
175 #define GCP_HF_ARR_ELEMS(n,gi) \
176 { &(gi.hf.ctx), { "Context", n ".ctx", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, \
177 { &(gi.hf.ctx_term), { "Termination", n ".ctx.term", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
178 { &(gi.hf.ctx_term_type), { "Type", n ".ctx.term.type", FT_UINT32, BASE_HEX, VALS(gcp_term_types), 0, NULL, HFILL }}, \
179 { &(gi.hf.ctx_term_bir), { "BIR", n ".ctx.term.bir", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
180 { &(gi.hf.ctx_term_nsap), { "NSAP", n ".ctx.term.nsap", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
181 { &(gi.hf.ctx_cmd), { "Command in Frame", n ".ctx.cmd", FT_FRAMENUM, BASE_NONE, NULL, 0, NULL, HFILL }}
183 WS_DLL_PUBLIC
const value_string gcp_cmd_type
[];
184 WS_DLL_PUBLIC
const value_string gcp_term_types
[];
186 extern const char* gcp_msg_to_str(gcp_msg_t
* m
, wmem_allocator_t
*scope
, bool persistent
);
188 #define gcp_cmd_set_error(c,e) (c->error = e)
189 #define gcp_trx_set_error(t,e) (t->error = e)
191 /* END Gateway Control Protocol -- Context Tracking */
193 typedef struct _h248_curr_info_t h248_curr_info_t
;
195 typedef void (*h248_pkg_param_dissector_t
)(proto_tree
* tree
, tvbuff_t
* tvb
, packet_info
* pinfo _U_
, int hfid
, h248_curr_info_t
*, void*);
197 extern void h248_param_bytes_item(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* ignored
);
198 extern void h248_param_uint_item(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* ignored
);
199 WS_DLL_PUBLIC
void h248_param_ber_integer(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* ignored
);
200 extern void h248_param_ber_octetstring(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* ignored
);
201 extern void h248_param_ber_boolean(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* ignored
);
202 extern void external_dissector(proto_tree
*, tvbuff_t
*, packet_info
* , int, h248_curr_info_t
*,void* dissector_handle
);
203 extern void h248_param_PkgdName(proto_tree
* tree
, tvbuff_t
* tvb
, packet_info
* pinfo
, int hfid _U_
, h248_curr_info_t
* u _U_
, void* dissector_hdl
);
204 extern void h248_param_external_dissector(proto_tree
* tree
, tvbuff_t
* tvb
, packet_info
* pinfo
, int hfid _U_
, h248_curr_info_t
* u _U_
, void* dissector_hdl
);
207 ADD_PKG
, /* add package at registration ONLY if no matching package ID */
208 REPLACE_PKG
, /* replace/add package at registration */
209 MERGE_PKG_HIGH
, /* merge h248_package_t at registration favor new package */
210 MERGE_PKG_LOW
/* merge h248_package_t at registration favor current package */
213 typedef struct _h248_pkg_param_t
{
216 h248_pkg_param_dissector_t dissector
;
220 typedef struct _h248_pkg_sig_t
{
224 const h248_pkg_param_t
* parameters
;
225 const value_string
* param_names
;
228 typedef struct _h248_pkg_evt_t
{
232 const h248_pkg_param_t
* parameters
;
233 const value_string
* param_names
;
236 typedef struct _h248_pkg_stat_t
{
240 const h248_pkg_param_t
* parameters
;
241 const value_string
* param_names
;
244 typedef struct _h248_package_t
{
245 uint32_t id
; /**< Package ID */
246 int* hfid
; /**< hfid that will display the package name */
247 int* ett
; /**< The ett for this item */
248 const value_string
* param_names
; /**< The parameter names, Value 00000 should be the package name */
249 const value_string
* signal_names
;
250 const value_string
* event_names
;
251 const value_string
* stats_names
;
252 const h248_pkg_param_t
* properties
;
253 const h248_pkg_sig_t
* signals
;
254 const h248_pkg_evt_t
* events
;
255 const h248_pkg_stat_t
* statistics
;
258 typedef struct _save_h248_package_t
{
263 struct _h248_curr_info_t
{
269 const h248_package_t
* pkg
;
270 const h248_pkg_evt_t
* evt
;
271 const h248_pkg_sig_t
* sig
;
272 const h248_pkg_stat_t
* stat
;
273 const h248_pkg_param_t
* par
;
276 typedef struct h248_term_info
{
282 void h248_register_package(h248_package_t
* pkg
, pkg_reg_action reg_action
);
284 #endif /* PACKET_H248_H */