Wireshark  4.3.0
The Wireshark network protocol analyzer
packet-h248.h
1 /* Do not modify this file. Changes will be overwritten. */
2 /* Generated automatically by the ASN.1 to Wireshark dissector compiler */
3 /* packet-h248.h */
4 /* asn2wrs.py -b -q -L -p h248 -c ./h248.cnf -s ./packet-h248-template -D . -O ../.. h248v3.asn h248v1support.asn */
5 
6 /* packet-h248.h
7  * Definitions for H.248/MEGACO packet dissection
8  *
9  * Ronnie Sahlberg 2004
10  * Luis Ontanon 2005
11  *
12  * Wireshark - Network traffic analyzer
13  * By Gerald Combs <gerald@wireshark.org>
14  * Copyright 1998 Gerald Combs
15  *
16  * SPDX-License-Identifier: GPL-2.0-or-later
17  */
18 
19 #ifndef PACKET_H248_H
20 #define PACKET_H248_H
21 
22 #include "ws_symbol_export.h"
23 
24 #include <epan/packet.h>
25 #include <epan/expert.h>
26 #include <wsutil/nstime.h>
27 
28 /* Gateway Control Protocol -- Context Tracking */
29 
30 typedef struct _gcp_hf_ett_t {
31  struct {
32  int ctx;
33  int ctx_cmd;
34  int ctx_term;
35  int ctx_term_type;
36  int ctx_term_bir;
37  int ctx_term_nsap;
38  } hf;
39 
40  struct {
41  gint ctx;
42  gint ctx_cmds;
43  gint ctx_terms;
44  gint ctx_term;
45  } ett;
46 } gcp_hf_ett_t;
47 
48 #define NULL_CONTEXT 0
49 #define CHOOSE_CONTEXT 0xFFFFFFFE
50 #define ALL_CONTEXTS 0xFFFFFFFF
51 
52 
53 typedef enum {
54  GCP_CMD_NONE,
55  GCP_CMD_ADD_REQ,
56  GCP_CMD_MOVE_REQ,
57  GCP_CMD_MOD_REQ,
58  GCP_CMD_SUB_REQ,
59  GCP_CMD_AUDITCAP_REQ,
60  GCP_CMD_AUDITVAL_REQ,
61  GCP_CMD_NOTIFY_REQ,
62  GCP_CMD_SVCCHG_REQ,
63  GCP_CMD_TOPOLOGY_REQ,
64  GCP_CMD_CTX_ATTR_AUDIT_REQ,
65  GCP_CMD_OTHER_REQ,
66  GCP_CMD_ADD_REPLY,
67  GCP_CMD_MOVE_REPLY,
68  GCP_CMD_MOD_REPLY,
69  GCP_CMD_SUB_REPLY,
70  GCP_CMD_AUDITCAP_REPLY,
71  GCP_CMD_AUDITVAL_REPLY,
72  GCP_CMD_NOTIFY_REPLY,
73  GCP_CMD_SVCCHG_REPLY,
74  GCP_CMD_TOPOLOGY_REPLY,
75  GCP_CMD_REPLY
76 } gcp_cmd_type_t;
77 
78 typedef enum {
79  GCP_TRX_NONE,
80  GCP_TRX_REQUEST,
81  GCP_TRX_PENDING,
82  GCP_TRX_REPLY,
83  GCP_TRX_ACK
84 } gcp_trx_type_t;
85 
86 
87 typedef struct _gcp_msg_t {
88  guint32 lo_addr;
89  guint32 hi_addr;
90  guint32 framenum;
91  nstime_t frametime;
92  struct _gcp_trx_msg_t* trxs;
93  gboolean committed;
94 } gcp_msg_t;
95 
96 typedef struct _gcp_trx_msg_t {
97  struct _gcp_trx_t* trx;
98  struct _gcp_trx_msg_t* next;
99  struct _gcp_trx_msg_t* last;
100 } gcp_trx_msg_t;
101 
102 typedef struct _gcp_cmd_msg_t {
103  struct _gcp_cmd_t* cmd;
104  struct _gcp_cmd_msg_t* next;
105  struct _gcp_cmd_msg_t* last;
106 } gcp_cmd_msg_t;
107 
108 typedef struct _gcp_trx_t {
109  gcp_msg_t* initial;
110  guint32 id;
111  gcp_trx_type_t type;
112  guint pendings;
113  struct _gcp_cmd_msg_t* cmds;
114  struct _gcp_trx_ctx_t* ctxs;
115  guint error;
116 } gcp_trx_t;
117 
118 #define GCP_TERM_TYPE_UNKNOWN 0
119 #define GCP_TERM_TYPE_AAL1 1
120 #define GCP_TERM_TYPE_AAL2 2
121 #define GCP_TERM_TYPE_AAL1_STRUCT 3
122 #define GCP_TERM_TYPE_IP_RTP 4
123 #define GCP_TERM_TYPE_TDM 5
124 
125 typedef enum _gcp_wildcard_t {
126  GCP_WILDCARD_NONE,
127  GCP_WILDCARD_CHOOSE,
128  GCP_WILDCARD_ALL
129 } gcp_wildcard_t;
130 
131 typedef struct _gcp_term_t {
132  const gchar* str;
133 
134  const guint8* buffer;
135  guint len;
136 
137  guint type;
138  gchar* bir;
139  gchar* nsap;
140 
141  gcp_msg_t* start;
142 
143 } gcp_term_t;
144 
145 typedef struct _gcp_terms_t {
146  gcp_term_t* term;
147  struct _gcp_terms_t* next;
148  struct _gcp_terms_t* last;
149 } gcp_terms_t;
150 
151 typedef struct _gcp_cmd_t {
152  guint offset;
153  const gchar* str;
154  gcp_cmd_type_t type;
155  gcp_terms_t terms;
156  struct _gcp_msg_t* msg;
157  struct _gcp_trx_t* trx;
158  struct _gcp_ctx_t* ctx;
159  guint error;
160 } gcp_cmd_t;
161 
162 
163 typedef struct _gcp_ctx_t {
164  gcp_msg_t* initial;
165  guint32 id;
166  struct _gcp_cmd_msg_t* cmds;
167  struct _gcp_ctx_t* prev;
168  gcp_terms_t terms;
169 } gcp_ctx_t;
170 
171 extern gcp_msg_t* gcp_msg(packet_info* pinfo, int o, gboolean persistent);
172 extern gcp_trx_t* gcp_trx(gcp_msg_t* m ,guint32 t_id , gcp_trx_type_t type, packet_info *pinfo, gboolean persistent);
173 extern gcp_ctx_t* gcp_ctx(gcp_msg_t* m, gcp_trx_t* t, guint32 c_id, packet_info *pinfo, gboolean persistent);
174 extern gcp_cmd_t* gcp_cmd(gcp_msg_t* m, gcp_trx_t* t, gcp_ctx_t* c, gcp_cmd_type_t type, guint offset, packet_info *pinfo, gboolean persistent);
175 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, gboolean persistent);
176 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);
177 
178 #define GCP_ETT_ARR_ELEMS(gi) &(gi.ett.ctx),&(gi.ett.ctx_cmds),&(gi.ett.ctx_terms),&(gi.ett.ctx_term)
179 
180 #define GCP_HF_ARR_ELEMS(n,gi) \
181  { &(gi.hf.ctx), { "Context", n ".ctx", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, \
182  { &(gi.hf.ctx_term), { "Termination", n ".ctx.term", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
183  { &(gi.hf.ctx_term_type), { "Type", n ".ctx.term.type", FT_UINT32, BASE_HEX, VALS(gcp_term_types), 0, NULL, HFILL }}, \
184  { &(gi.hf.ctx_term_bir), { "BIR", n ".ctx.term.bir", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
185  { &(gi.hf.ctx_term_nsap), { "NSAP", n ".ctx.term.nsap", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
186  { &(gi.hf.ctx_cmd), { "Command in Frame", n ".ctx.cmd", FT_FRAMENUM, BASE_NONE, NULL, 0, NULL, HFILL }}
187 
188 WS_DLL_PUBLIC const value_string gcp_cmd_type[];
189 WS_DLL_PUBLIC const value_string gcp_term_types[];
190 
191 extern const gchar* gcp_msg_to_str(gcp_msg_t* m, wmem_allocator_t *scope, gboolean persistent);
192 
193 #define gcp_cmd_set_error(c,e) (c->error = e)
194 #define gcp_trx_set_error(t,e) (t->error = e)
195 
196 /* END Gateway Control Protocol -- Context Tracking */
197 
198 typedef struct _h248_curr_info_t h248_curr_info_t;
199 
200 typedef void (*h248_pkg_param_dissector_t)(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo _U_, int hfid, h248_curr_info_t*, void*);
201 
202 extern void h248_param_bytes_item(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
203 extern void h248_param_uint_item(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
204 WS_DLL_PUBLIC void h248_param_ber_integer(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
205 extern void h248_param_ber_octetstring(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
206 extern void h248_param_ber_boolean(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* ignored);
207 extern void external_dissector(proto_tree*, tvbuff_t*, packet_info* , int, h248_curr_info_t*,void* dissector_handle);
208 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);
209 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);
210 
211 typedef enum {
212  ADD_PKG, /* add package at registration ONLY if no matching package ID */
213  REPLACE_PKG, /* replace/add package at registration */
214  MERGE_PKG_HIGH, /* merge h248_package_t at registration favor new package */
215  MERGE_PKG_LOW /* merge h248_package_t at registration favor current package */
216 } pkg_reg_action;
217 
218 typedef struct _h248_pkg_param_t {
219  guint32 id;
220  int* hfid;
221  h248_pkg_param_dissector_t dissector;
222  void* data;
224 
225 typedef struct _h248_pkg_sig_t {
226  guint32 id;
227  int* hfid;
228  gint* ett;
229  const h248_pkg_param_t* parameters;
230  const value_string* param_names;
232 
233 typedef struct _h248_pkg_evt_t {
234  guint32 id;
235  int* hfid;
236  gint* ett;
237  const h248_pkg_param_t* parameters;
238  const value_string* param_names;
240 
241 typedef struct _h248_pkg_stat_t {
242  guint32 id;
243  int* hfid;
244  gint* ett;
245  const h248_pkg_param_t* parameters;
246  const value_string* param_names;
248 
249 typedef struct _h248_package_t {
250  guint32 id;
251  int* hfid;
252  gint* ett;
254  const value_string* signal_names;
255  const value_string* event_names;
256  const value_string* stats_names;
257  const h248_pkg_param_t* properties;
258  const h248_pkg_sig_t* signals;
259  const h248_pkg_evt_t* events;
260  const h248_pkg_stat_t* statistics;
262 
263 typedef struct _save_h248_package_t {
264  h248_package_t *pkg;
265  gboolean is_default;
267 
269  gcp_ctx_t* ctx;
270  gcp_trx_t* trx;
271  gcp_msg_t* msg;
272  gcp_term_t* term;
273  gcp_cmd_t* cmd;
274  const h248_package_t* pkg;
275  const h248_pkg_evt_t* evt;
276  const h248_pkg_sig_t* sig;
277  const h248_pkg_stat_t* stat;
278  const h248_pkg_param_t* par;
279 };
280 
281 typedef struct h248_term_info {
282  guint8 wild_card;
283  gchar *str;
285 
286 WS_DLL_PUBLIC
287 void h248_register_package(h248_package_t* pkg, pkg_reg_action reg_action);
288 
289 #endif /* PACKET_H248_H */
Definition: packet-h248.h:102
Definition: packet-h248.h:151
Definition: packet-h248.h:163
Definition: packet-h248.h:30
Definition: packet-h248.h:87
Definition: packet-h248.h:131
Definition: packet-h248.h:145
Definition: packet-h248.h:96
Definition: packet-h248.h:108
Definition: packet-h248.h:268
Definition: packet-h248.h:249
int * hfid
Definition: packet-h248.h:251
guint32 id
Definition: packet-h248.h:250
gint * ett
Definition: packet-h248.h:252
const value_string * param_names
Definition: packet-h248.h:253
Definition: packet-h248.h:233
Definition: packet-h248.h:218
Definition: packet-h248.h:225
Definition: packet-h248.h:241
Definition: packet_info.h:44
Definition: proto.h:904
Definition: packet-h248.h:263
Definition: value_string.h:26
Definition: wmem_allocator.h:27
Definition: mcast_stream.h:30
Definition: packet.c:763
Definition: expert.h:39
Definition: packet-h248.h:281
Definition: nstime.h:26
Definition: tvbuff-int.h:35