Witness: add pidl output
[wireshark-wip.git] / epan / gcp.h
blob71859b49e2d97227efbe47952a2f5e0cb1b14d2b
1 /* gcp.h
2 * Gateway Control Protocol -- Context Tracking
4 * $Id$
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef __GCP_H_
25 #define __GCP_H_
27 #include <glib.h>
28 #include <epan/packet.h>
29 #include <epan/conversation.h>
30 #include <epan/strutil.h>
31 #include <epan/wmem/wmem.h>
32 #include <epan/expert.h>
33 #include <epan/prefs.h>
34 #include <epan/asn1.h>
36 #include <stdio.h>
37 #include <string.h>
39 #include <epan/dissectors/packet-ber.h>
40 #include <epan/dissectors/packet-q931.h>
41 #include <epan/dissectors/packet-mtp3.h>
42 #include <epan/dissectors/packet-alcap.h>
43 #include <epan/dissectors/packet-isup.h>
45 #include <epan/sctpppids.h>
46 #include "ws_symbol_export.h"
48 typedef struct _gcp_hf_ett_t {
49 struct {
50 int ctx;
51 int ctx_cmd;
52 int ctx_term;
53 int ctx_term_type;
54 int ctx_term_bir;
55 int ctx_term_nsap;
56 } hf;
58 struct {
59 gint ctx;
60 gint ctx_cmds;
61 gint ctx_terms;
62 gint ctx_term;
63 } ett;
64 } gcp_hf_ett_t;
66 #define NULL_CONTEXT 0
67 #define CHOOSE_CONTEXT 0xFFFFFFFE
68 #define ALL_CONTEXTS 0xFFFFFFFF
71 typedef enum {
72 GCP_CMD_NONE,
73 GCP_CMD_ADD_REQ,
74 GCP_CMD_MOVE_REQ,
75 GCP_CMD_MOD_REQ,
76 GCP_CMD_SUB_REQ,
77 GCP_CMD_AUDITCAP_REQ,
78 GCP_CMD_AUDITVAL_REQ,
79 GCP_CMD_NOTIFY_REQ,
80 GCP_CMD_SVCCHG_REQ,
81 GCP_CMD_TOPOLOGY_REQ,
82 GCP_CMD_CTX_ATTR_AUDIT_REQ,
83 GCP_CMD_OTHER_REQ,
84 GCP_CMD_ADD_REPLY,
85 GCP_CMD_MOVE_REPLY,
86 GCP_CMD_MOD_REPLY,
87 GCP_CMD_SUB_REPLY,
88 GCP_CMD_AUDITCAP_REPLY,
89 GCP_CMD_AUDITVAL_REPLY,
90 GCP_CMD_NOTIFY_REPLY,
91 GCP_CMD_SVCCHG_REPLY,
92 GCP_CMD_TOPOLOGY_REPLY,
93 GCP_CMD_REPLY
94 } gcp_cmd_type_t;
96 typedef enum {
97 GCP_TRX_NONE,
98 GCP_TRX_REQUEST,
99 GCP_TRX_PENDING,
100 GCP_TRX_REPLY,
101 GCP_TRX_ACK
102 } gcp_trx_type_t;
105 typedef struct _gcp_msg_t {
106 guint32 lo_addr;
107 guint32 hi_addr;
108 guint32 framenum;
109 nstime_t time;
110 struct _gcp_trx_msg_t* trxs;
111 gboolean commited;
112 } gcp_msg_t;
114 typedef struct _gcp_trx_msg_t {
115 struct _gcp_trx_t* trx;
116 struct _gcp_trx_msg_t* next;
117 struct _gcp_trx_msg_t* last;
118 } gcp_trx_msg_t;
120 typedef struct _gcp_cmd_msg_t {
121 struct _gcp_cmd_t* cmd;
122 struct _gcp_cmd_msg_t* next;
123 struct _gcp_cmd_msg_t* last;
124 } gcp_cmd_msg_t;
126 typedef struct _gcp_trx_t {
127 gcp_msg_t* initial;
128 guint32 id;
129 gcp_trx_type_t type;
130 guint pendings;
131 struct _gcp_cmd_msg_t* cmds;
132 struct _gcp_trx_ctx_t* ctxs;
133 guint error;
134 } gcp_trx_t;
136 #define GCP_TERM_TYPE_UNKNOWN 0
137 #define GCP_TERM_TYPE_AAL1 1
138 #define GCP_TERM_TYPE_AAL2 2
139 #define GCP_TERM_TYPE_AAL1_STRUCT 3
140 #define GCP_TERM_TYPE_IP_RTP 4
141 #define GCP_TERM_TYPE_TDM 5
143 typedef enum _gcp_wildcard_t {
144 GCP_WILDCARD_NONE,
145 GCP_WILDCARD_CHOOSE,
146 GCP_WILDCARD_ALL
147 } gcp_wildcard_t;
149 typedef struct _gcp_term_t {
150 const gchar* str;
152 const guint8* buffer;
153 guint len;
155 guint type;
156 gchar* bir;
157 gchar* nsap;
159 gcp_msg_t* start;
161 } gcp_term_t;
163 typedef struct _gcp_terms_t {
164 gcp_term_t* term;
165 struct _gcp_terms_t* next;
166 struct _gcp_terms_t* last;
167 } gcp_terms_t;
169 typedef struct _gcp_cmd_t {
170 guint offset;
171 const gchar* str;
172 gcp_cmd_type_t type;
173 gcp_terms_t terms;
174 struct _gcp_msg_t* msg;
175 struct _gcp_trx_t* trx;
176 struct _gcp_ctx_t* ctx;
177 guint error;
178 } gcp_cmd_t;
181 typedef struct _gcp_ctx_t {
182 gcp_msg_t* initial;
183 guint32 id;
184 struct _gcp_cmd_msg_t* cmds;
185 struct _gcp_ctx_t* prev;
186 gcp_terms_t terms;
187 } gcp_ctx_t;
189 WS_DLL_PUBLIC const value_string gcp_cmd_type[];
190 WS_DLL_PUBLIC const value_string gcp_term_types[];
192 extern void gcp_init(void);
193 extern gcp_msg_t* gcp_msg(packet_info* pinfo, int o, gboolean persistent);
194 extern gcp_trx_t* gcp_trx(gcp_msg_t* m ,guint32 t_id , gcp_trx_type_t type, gboolean persistent);
195 extern gcp_ctx_t* gcp_ctx(gcp_msg_t* m, gcp_trx_t* t, guint32 c_id, gboolean persistent);
196 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, gboolean persistent);
197 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, gboolean persistent);
198 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);
200 extern const gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent);
201 extern const gchar* gcp_msg_to_str(gcp_msg_t* m, gboolean persistent);
203 #define gcp_cmd_set_error(c,e) (c->error = e)
204 #define gcp_trx_set_error(t,e) (t->error = e)
206 #define GCP_ETT_ARR_ELEMS(gi) &(gi.ett.ctx),&(gi.ett.ctx_cmds),&(gi.ett.ctx_terms),&(gi.ett.ctx_term)
208 #define GCP_HF_ARR_ELEMS(n,gi) \
209 { &(gi.hf.ctx), { "Context", n ".ctx", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, \
210 { &(gi.hf.ctx_term), { "Termination", n ".ctx.term", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
211 { &(gi.hf.ctx_term_type), { "Type", n ".ctx.term.type", FT_UINT32, BASE_HEX, VALS(gcp_term_types), 0, NULL, HFILL }}, \
212 { &(gi.hf.ctx_term_bir), { "BIR", n ".ctx.term.bir", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
213 { &(gi.hf.ctx_term_nsap), { "NSAP", n ".ctx.term.nsap", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, \
214 { &(gi.hf.ctx_cmd), { "Command in Frame", n ".ctx.cmd", FT_FRAMENUM, BASE_NONE, NULL, 0, NULL, HFILL }}
216 #endif