1 /* packet-cosnaming.c
2 *
3 * Routines for IDL dissection
4 *
5 * Autogenerated from idl2wrs
6 * Copyright 2001 Frank Singleton <frank.singleton@ericsson.com>
7 */
8
9
10 /*
11 * Wireshark - Network traffic analyzer
12 * By Gerald Combs <gerald@wireshark.org>
13 * Copyright 1998 Gerald Combs
14 */
15
16 /*
17 * SPDX-License-Identifier: GPL-2.0-or-later
18 */
19
20
21 #include "config.h"
22
23 #include <string.h>
24 #include <epan/packet.h>
25 #include <epan/proto.h>
26 #include <epan/dissectors/packet-giop.h>
27 #include <epan/expert.h>
28
29 #include "ws_diag_control.h"
30 #include "ws_compiler_tests.h"
31
32 #ifdef _MSC_VER
33 /* disable warning: "unreference local variable" */
34 #pragma warning(disable:4101)
35 #endif
36
37 /* XXX this should be autogenerated, or the warnings fixed in the generator */
38 DIAG_OFF(unused-function)
39 DIAG_OFF(unused-variable)
40 #if WS_IS_AT_LEAST_GNUC_VERSION(6,0)
41 DIAG_OFF(unused-const-variable)
42 #endif
43
44 void proto_register_giop_cosnaming(void);
45 void proto_reg_handoff_giop_cosnaming(void);
46
47 /* Initialise the protocol and subtree pointers */
48 static int proto_cosnaming = -1;
49 static gint ett_cosnaming = -1;
50
51
52 /* Initialise the initial Alignment */
53 static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */
54
55 static int hf_operationrequest = -1;/* Request_Operation field */
56
57 /* Operation filters */
58 static int hf_CosNaming_NamingContext_bind_n_loop = -1;
59 static int hf_CosNaming_NamingContext_rebind_n_loop = -1;
60 static int hf_CosNaming_NamingContext_bind_context_n_loop = -1;
61 static int hf_CosNaming_NamingContext_rebind_context_n_loop = -1;
62 static int hf_CosNaming_NamingContext_resolve_n_loop = -1;
63 static int hf_CosNaming_NamingContext_unbind_n_loop = -1;
64 static int hf_CosNaming_NamingContext_bind_new_context_n_loop = -1;
65 static int hf_CosNaming_NamingContext_list_how_many = -1;
66 static int hf_CosNaming_NamingContext_list_bl_loop = -1;
67 static int hf_CosNaming_BindingIterator_next_one_return = -1;
68 static int hf_CosNaming_BindingIterator_next_n_return = -1;
69 static int hf_CosNaming_BindingIterator_next_n_how_many = -1;
70 static int hf_CosNaming_BindingIterator_next_n_bl_loop = -1;
71 /* Struct filters */
72 static int hf_CosNaming_NameComponent_id = -1;
73 static int hf_CosNaming_NameComponent_kind = -1;
74 static int hf_CosNaming_Binding_binding_name_loop = -1;
75 static int hf_CosNaming_Binding_binding_type = -1;
76 /* User exception filters */
77 static int hf_CosNaming_NamingContext_NotFound_why = -1;
78 static int hf_CosNaming_NamingContext_NotFound_rest_of_name_loop = -1;
79 static int hf_CosNaming_NamingContext_CannotProceed_cxt = -1;
80 static int hf_CosNaming_NamingContext_CannotProceed_rest_of_name_loop = -1;
81 /* Expert info filters */
82 static expert_field ei_cosnaming_unknown_giop_msg = EI_INIT;
83 static expert_field ei_cosnaming_unknown_exception = EI_INIT;
84 static expert_field ei_cosnaming_unknown_reply_status = EI_INIT;
85
86
87 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset);
88
89
90 /* Struct prototype declaration Start */
91
92 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
93 static void decode_CosNaming_NameComponent_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_);
94
95 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
96 static void decode_CosNaming_Binding_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_);
97
98 /* Struct prototype declaration End */
99
100 /*
101 * IDL Enums Start
102 */
103
104 /*
105 * Enum = IDL:omg.org/CosNaming/BindingType:1.0
106 */
107 static const value_string CosNaming_BindingType[] = {
108
109 { 0, "nobject" },
110 { 1, "ncontext" },
111 { 0, NULL },
112 };
113
114 /*
115 * Enum = IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0
116 */
117 static const value_string CosNaming_NamingContext_NotFoundReason[] = {
118
119 { 0, "missing_node" },
120 { 1, "not_context" },
121 { 2, "not_object" },
122 { 0, NULL },
123 };
124
125 /*
126 * IDL Enums End
127 */
128
129 /* Begin Exception Helper Functions */
130
131
132 /* Exception = IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
133 static void
decode_ex_CosNaming_NamingContext_NotFound(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,int * offset _U_,MessageHeader * header _U_,const gchar * operation _U_,gboolean stream_is_big_endian _U_)134 decode_ex_CosNaming_NamingContext_NotFound(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
135 {
136 proto_item *item = NULL;
137
138 /* Operation specific Variable declarations Begin */
139 guint32 u_octet4;
140 guint32 u_octet4_loop_CosNaming_NamingContext_NotFound_rest_of_name;
141 guint32 i_CosNaming_NamingContext_NotFound_rest_of_name;
142 /* Operation specific Variable declarations End */
143
144 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
145 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_NotFound_why, tvb, *offset-4, 4, u_octet4);
146
147 u_octet4_loop_CosNaming_NamingContext_NotFound_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
148 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_NotFound_rest_of_name_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_NotFound_rest_of_name);
149
150 for (i_CosNaming_NamingContext_NotFound_rest_of_name=0; i_CosNaming_NamingContext_NotFound_rest_of_name < u_octet4_loop_CosNaming_NamingContext_NotFound_rest_of_name; i_CosNaming_NamingContext_NotFound_rest_of_name++) {
151
152 /* Begin struct "CosNaming_NameComponent" */
153 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
154 /* End struct "CosNaming_NameComponent" */
155 }
156
157 }
158
159 /* Exception = IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
160 static void
decode_ex_CosNaming_NamingContext_CannotProceed(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,int * offset _U_,MessageHeader * header _U_,const gchar * operation _U_,gboolean stream_is_big_endian _U_)161 decode_ex_CosNaming_NamingContext_CannotProceed(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
162 {
163 proto_item *item = NULL;
164
165 /* Operation specific Variable declarations Begin */
166 guint32 u_octet4_loop_CosNaming_NamingContext_CannotProceed_rest_of_name;
167 guint32 i_CosNaming_NamingContext_CannotProceed_rest_of_name;
168 /* Operation specific Variable declarations End */
169
170 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
171
172 u_octet4_loop_CosNaming_NamingContext_CannotProceed_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
173 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_CannotProceed_rest_of_name_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_CannotProceed_rest_of_name);
174
175 for (i_CosNaming_NamingContext_CannotProceed_rest_of_name=0; i_CosNaming_NamingContext_CannotProceed_rest_of_name < u_octet4_loop_CosNaming_NamingContext_CannotProceed_rest_of_name; i_CosNaming_NamingContext_CannotProceed_rest_of_name++) {
176
177 /* Begin struct "CosNaming_NameComponent" */
178 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
179 /* End struct "CosNaming_NameComponent" */
180 }
181
182 }
183
184
185 /* End Exception Helper Functions */
186
187 /*
188 * Main delegator for exception handling
189 *
190 */
191 static gboolean
decode_user_exception(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * ptree _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)192 decode_user_exception(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *ptree _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
193 {
194 proto_tree *tree _U_;
195
196 if (!header->exception_id)
197 return FALSE;
198
199 if (strcmp(header->exception_id, "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0") == 0) {
200 tree = start_dissecting(tvb, pinfo, ptree, offset);
201 decode_ex_CosNaming_NamingContext_NotFound(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian); /* IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
202 return TRUE;
203 }
204
205 if (strcmp(header->exception_id, "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0") == 0) {
206 tree = start_dissecting(tvb, pinfo, ptree, offset);
207 decode_ex_CosNaming_NamingContext_CannotProceed(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian); /* IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
208 return TRUE;
209 }
210
211
212 return FALSE; /* user exception not found */
213 }
214
215 /*
216 * IDL:omg.org/CosNaming/NamingContext/bind:1.0
217 */
218 static void
decode_CosNaming_NamingContext_bind(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)219 decode_CosNaming_NamingContext_bind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
220 {
221 /* Operation specific Variable declarations Begin */
222 guint32 u_octet4_loop_CosNaming_NamingContext_bind_n;
223 guint32 i_CosNaming_NamingContext_bind_n;
224 /* Operation specific Variable declarations End */
225
226 switch(header->message_type) {
227 case Request:
228 u_octet4_loop_CosNaming_NamingContext_bind_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
229 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_bind_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_bind_n);
230
231 for (i_CosNaming_NamingContext_bind_n=0; i_CosNaming_NamingContext_bind_n < u_octet4_loop_CosNaming_NamingContext_bind_n; i_CosNaming_NamingContext_bind_n++) {
232
233 /* Begin struct "CosNaming_NameComponent" */
234 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
235 /* End struct "CosNaming_NameComponent" */
236 }
237
238 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
239
240 break;
241 case Reply:
242 switch(header->rep_status) {
243 case NO_EXCEPTION:
244 /* Function returns void */
245
246 break;
247 case USER_EXCEPTION:
248 break;
249 default:
250 /* Unknown Exception */
251 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
252 break;
253 } /* switch(header->rep_status) */
254
255 break;
256 default:
257 /* Unknown GIOP Message */
258 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
259 break;
260 } /* switch(header->message_type) */
261 }
262
263 /*
264 * IDL:omg.org/CosNaming/NamingContext/rebind:1.0
265 */
266 static void
decode_CosNaming_NamingContext_rebind(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)267 decode_CosNaming_NamingContext_rebind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
268 {
269 /* Operation specific Variable declarations Begin */
270 guint32 u_octet4_loop_CosNaming_NamingContext_rebind_n;
271 guint32 i_CosNaming_NamingContext_rebind_n;
272 /* Operation specific Variable declarations End */
273
274 switch(header->message_type) {
275 case Request:
276 u_octet4_loop_CosNaming_NamingContext_rebind_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
277 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_rebind_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_rebind_n);
278
279 for (i_CosNaming_NamingContext_rebind_n=0; i_CosNaming_NamingContext_rebind_n < u_octet4_loop_CosNaming_NamingContext_rebind_n; i_CosNaming_NamingContext_rebind_n++) {
280
281 /* Begin struct "CosNaming_NameComponent" */
282 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
283 /* End struct "CosNaming_NameComponent" */
284 }
285
286 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
287
288 break;
289 case Reply:
290 switch(header->rep_status) {
291 case NO_EXCEPTION:
292 /* Function returns void */
293
294 break;
295 case USER_EXCEPTION:
296 break;
297 default:
298 /* Unknown Exception */
299 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
300 break;
301 } /* switch(header->rep_status) */
302
303 break;
304 default:
305 /* Unknown GIOP Message */
306 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
307 break;
308 } /* switch(header->message_type) */
309 }
310
311 /*
312 * IDL:omg.org/CosNaming/NamingContext/bind_context:1.0
313 */
314 static void
decode_CosNaming_NamingContext_bind_context(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)315 decode_CosNaming_NamingContext_bind_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
316 {
317 /* Operation specific Variable declarations Begin */
318 guint32 u_octet4_loop_CosNaming_NamingContext_bind_context_n;
319 guint32 i_CosNaming_NamingContext_bind_context_n;
320 /* Operation specific Variable declarations End */
321
322 switch(header->message_type) {
323 case Request:
324 u_octet4_loop_CosNaming_NamingContext_bind_context_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
325 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_bind_context_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_bind_context_n);
326
327 for (i_CosNaming_NamingContext_bind_context_n=0; i_CosNaming_NamingContext_bind_context_n < u_octet4_loop_CosNaming_NamingContext_bind_context_n; i_CosNaming_NamingContext_bind_context_n++) {
328
329 /* Begin struct "CosNaming_NameComponent" */
330 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
331 /* End struct "CosNaming_NameComponent" */
332 }
333
334 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
335
336 break;
337 case Reply:
338 switch(header->rep_status) {
339 case NO_EXCEPTION:
340 /* Function returns void */
341
342 break;
343 case USER_EXCEPTION:
344 break;
345 default:
346 /* Unknown Exception */
347 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
348 break;
349 } /* switch(header->rep_status) */
350
351 break;
352 default:
353 /* Unknown GIOP Message */
354 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
355 break;
356 } /* switch(header->message_type) */
357 }
358
359 /*
360 * IDL:omg.org/CosNaming/NamingContext/rebind_context:1.0
361 */
362 static void
decode_CosNaming_NamingContext_rebind_context(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)363 decode_CosNaming_NamingContext_rebind_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
364 {
365 /* Operation specific Variable declarations Begin */
366 guint32 u_octet4_loop_CosNaming_NamingContext_rebind_context_n;
367 guint32 i_CosNaming_NamingContext_rebind_context_n;
368 /* Operation specific Variable declarations End */
369
370 switch(header->message_type) {
371 case Request:
372 u_octet4_loop_CosNaming_NamingContext_rebind_context_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
373 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_rebind_context_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_rebind_context_n);
374
375 for (i_CosNaming_NamingContext_rebind_context_n=0; i_CosNaming_NamingContext_rebind_context_n < u_octet4_loop_CosNaming_NamingContext_rebind_context_n; i_CosNaming_NamingContext_rebind_context_n++) {
376
377 /* Begin struct "CosNaming_NameComponent" */
378 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
379 /* End struct "CosNaming_NameComponent" */
380 }
381
382 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
383
384 break;
385 case Reply:
386 switch(header->rep_status) {
387 case NO_EXCEPTION:
388 /* Function returns void */
389
390 break;
391 case USER_EXCEPTION:
392 break;
393 default:
394 /* Unknown Exception */
395 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
396 break;
397 } /* switch(header->rep_status) */
398
399 break;
400 default:
401 /* Unknown GIOP Message */
402 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
403 break;
404 } /* switch(header->message_type) */
405 }
406
407 /*
408 * IDL:omg.org/CosNaming/NamingContext/resolve:1.0
409 */
410 static void
decode_CosNaming_NamingContext_resolve(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)411 decode_CosNaming_NamingContext_resolve(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
412 {
413 /* Operation specific Variable declarations Begin */
414 guint32 u_octet4_loop_CosNaming_NamingContext_resolve_n;
415 guint32 i_CosNaming_NamingContext_resolve_n;
416 /* Operation specific Variable declarations End */
417
418 switch(header->message_type) {
419 case Request:
420 u_octet4_loop_CosNaming_NamingContext_resolve_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
421 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_resolve_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_resolve_n);
422
423 for (i_CosNaming_NamingContext_resolve_n=0; i_CosNaming_NamingContext_resolve_n < u_octet4_loop_CosNaming_NamingContext_resolve_n; i_CosNaming_NamingContext_resolve_n++) {
424
425 /* Begin struct "CosNaming_NameComponent" */
426 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
427 /* End struct "CosNaming_NameComponent" */
428 }
429
430 break;
431 case Reply:
432 switch(header->rep_status) {
433 case NO_EXCEPTION:
434 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
435
436 break;
437 case USER_EXCEPTION:
438 break;
439 default:
440 /* Unknown Exception */
441 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
442 break;
443 } /* switch(header->rep_status) */
444
445 break;
446 default:
447 /* Unknown GIOP Message */
448 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
449 break;
450 } /* switch(header->message_type) */
451 }
452
453 /*
454 * IDL:omg.org/CosNaming/NamingContext/unbind:1.0
455 */
456 static void
decode_CosNaming_NamingContext_unbind(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)457 decode_CosNaming_NamingContext_unbind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
458 {
459 /* Operation specific Variable declarations Begin */
460 guint32 u_octet4_loop_CosNaming_NamingContext_unbind_n;
461 guint32 i_CosNaming_NamingContext_unbind_n;
462 /* Operation specific Variable declarations End */
463
464 switch(header->message_type) {
465 case Request:
466 u_octet4_loop_CosNaming_NamingContext_unbind_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
467 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_unbind_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_unbind_n);
468
469 for (i_CosNaming_NamingContext_unbind_n=0; i_CosNaming_NamingContext_unbind_n < u_octet4_loop_CosNaming_NamingContext_unbind_n; i_CosNaming_NamingContext_unbind_n++) {
470
471 /* Begin struct "CosNaming_NameComponent" */
472 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
473 /* End struct "CosNaming_NameComponent" */
474 }
475
476 break;
477 case Reply:
478 switch(header->rep_status) {
479 case NO_EXCEPTION:
480 /* Function returns void */
481
482 break;
483 case USER_EXCEPTION:
484 break;
485 default:
486 /* Unknown Exception */
487 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
488 break;
489 } /* switch(header->rep_status) */
490
491 break;
492 default:
493 /* Unknown GIOP Message */
494 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
495 break;
496 } /* switch(header->message_type) */
497 }
498
499 /*
500 * IDL:omg.org/CosNaming/NamingContext/new_context:1.0
501 */
502 static void
decode_CosNaming_NamingContext_new_context(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)503 decode_CosNaming_NamingContext_new_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
504 {
505 switch(header->message_type) {
506 case Request:
507 break;
508 case Reply:
509 switch(header->rep_status) {
510 case NO_EXCEPTION:
511 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
512
513 break;
514 case USER_EXCEPTION:
515 break;
516 default:
517 /* Unknown Exception */
518 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
519 break;
520 } /* switch(header->rep_status) */
521
522 break;
523 default:
524 /* Unknown GIOP Message */
525 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
526 break;
527 } /* switch(header->message_type) */
528 }
529
530 /*
531 * IDL:omg.org/CosNaming/NamingContext/bind_new_context:1.0
532 */
533 static void
decode_CosNaming_NamingContext_bind_new_context(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)534 decode_CosNaming_NamingContext_bind_new_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
535 {
536 /* Operation specific Variable declarations Begin */
537 guint32 u_octet4_loop_CosNaming_NamingContext_bind_new_context_n;
538 guint32 i_CosNaming_NamingContext_bind_new_context_n;
539 /* Operation specific Variable declarations End */
540
541 switch(header->message_type) {
542 case Request:
543 u_octet4_loop_CosNaming_NamingContext_bind_new_context_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
544 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_bind_new_context_n_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_bind_new_context_n);
545
546 for (i_CosNaming_NamingContext_bind_new_context_n=0; i_CosNaming_NamingContext_bind_new_context_n < u_octet4_loop_CosNaming_NamingContext_bind_new_context_n; i_CosNaming_NamingContext_bind_new_context_n++) {
547
548 /* Begin struct "CosNaming_NameComponent" */
549 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
550 /* End struct "CosNaming_NameComponent" */
551 }
552
553 break;
554 case Reply:
555 switch(header->rep_status) {
556 case NO_EXCEPTION:
557 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
558
559 break;
560 case USER_EXCEPTION:
561 break;
562 default:
563 /* Unknown Exception */
564 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
565 break;
566 } /* switch(header->rep_status) */
567
568 break;
569 default:
570 /* Unknown GIOP Message */
571 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
572 break;
573 } /* switch(header->message_type) */
574 }
575
576 /*
577 * IDL:omg.org/CosNaming/NamingContext/destroy:1.0
578 */
579 static void
decode_CosNaming_NamingContext_destroy(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)580 decode_CosNaming_NamingContext_destroy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
581 {
582 switch(header->message_type) {
583 case Request:
584 break;
585 case Reply:
586 switch(header->rep_status) {
587 case NO_EXCEPTION:
588 /* Function returns void */
589
590 break;
591 case USER_EXCEPTION:
592 break;
593 default:
594 /* Unknown Exception */
595 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
596 break;
597 } /* switch(header->rep_status) */
598
599 break;
600 default:
601 /* Unknown GIOP Message */
602 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
603 break;
604 } /* switch(header->message_type) */
605 }
606
607 /*
608 * IDL:omg.org/CosNaming/NamingContext/list:1.0
609 */
610 static void
decode_CosNaming_NamingContext_list(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)611 decode_CosNaming_NamingContext_list(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
612 {
613 /* Operation specific Variable declarations Begin */
614 guint32 u_octet4_loop_CosNaming_NamingContext_list_bl;
615 guint32 i_CosNaming_NamingContext_list_bl;
616 /* Operation specific Variable declarations End */
617
618 switch(header->message_type) {
619 case Request:
620 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_list_how_many, tvb, *offset-4, 4, get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary));
621
622 break;
623 case Reply:
624 switch(header->rep_status) {
625 case NO_EXCEPTION:
626 /* Function returns void */
627
628 u_octet4_loop_CosNaming_NamingContext_list_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
629 proto_tree_add_uint(tree, hf_CosNaming_NamingContext_list_bl_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_NamingContext_list_bl);
630
631 for (i_CosNaming_NamingContext_list_bl=0; i_CosNaming_NamingContext_list_bl < u_octet4_loop_CosNaming_NamingContext_list_bl; i_CosNaming_NamingContext_list_bl++) {
632
633 /* Begin struct "CosNaming_Binding" */
634 decode_CosNaming_Binding_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
635 /* End struct "CosNaming_Binding" */
636 }
637
638 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
639
640 break;
641 case USER_EXCEPTION:
642 break;
643 default:
644 /* Unknown Exception */
645 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
646 break;
647 } /* switch(header->rep_status) */
648
649 break;
650 default:
651 /* Unknown GIOP Message */
652 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
653 break;
654 } /* switch(header->message_type) */
655 }
656
657 /*
658 * IDL:omg.org/CosNaming/BindingIterator/next_one:1.0
659 */
660 static void
decode_CosNaming_BindingIterator_next_one(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)661 decode_CosNaming_BindingIterator_next_one(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
662 {
663 switch(header->message_type) {
664 case Request:
665 break;
666 case Reply:
667 switch(header->rep_status) {
668 case NO_EXCEPTION:
669 proto_tree_add_boolean(tree, hf_CosNaming_BindingIterator_next_one_return, tvb, *offset-1, 1, get_CDR_boolean(tvb,offset));
670
671 /* Begin struct "CosNaming_Binding" */
672 decode_CosNaming_Binding_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
673 /* End struct "CosNaming_Binding" */
674 break;
675 case USER_EXCEPTION:
676 break;
677 default:
678 /* Unknown Exception */
679 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
680 break;
681 } /* switch(header->rep_status) */
682
683 break;
684 default:
685 /* Unknown GIOP Message */
686 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
687 break;
688 } /* switch(header->message_type) */
689 }
690
691 /*
692 * IDL:omg.org/CosNaming/BindingIterator/next_n:1.0
693 */
694 static void
decode_CosNaming_BindingIterator_next_n(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)695 decode_CosNaming_BindingIterator_next_n(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
696 {
697 /* Operation specific Variable declarations Begin */
698 guint32 u_octet4_loop_CosNaming_BindingIterator_next_n_bl;
699 guint32 i_CosNaming_BindingIterator_next_n_bl;
700 /* Operation specific Variable declarations End */
701
702 switch(header->message_type) {
703 case Request:
704 proto_tree_add_uint(tree, hf_CosNaming_BindingIterator_next_n_how_many, tvb, *offset-4, 4, get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary));
705
706 break;
707 case Reply:
708 switch(header->rep_status) {
709 case NO_EXCEPTION:
710 proto_tree_add_boolean(tree, hf_CosNaming_BindingIterator_next_n_return, tvb, *offset-1, 1, get_CDR_boolean(tvb,offset));
711
712 u_octet4_loop_CosNaming_BindingIterator_next_n_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
713 proto_tree_add_uint(tree, hf_CosNaming_BindingIterator_next_n_bl_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_BindingIterator_next_n_bl);
714
715 for (i_CosNaming_BindingIterator_next_n_bl=0; i_CosNaming_BindingIterator_next_n_bl < u_octet4_loop_CosNaming_BindingIterator_next_n_bl; i_CosNaming_BindingIterator_next_n_bl++) {
716
717 /* Begin struct "CosNaming_Binding" */
718 decode_CosNaming_Binding_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
719 /* End struct "CosNaming_Binding" */
720 }
721
722 break;
723 case USER_EXCEPTION:
724 break;
725 default:
726 /* Unknown Exception */
727 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
728 break;
729 } /* switch(header->rep_status) */
730
731 break;
732 default:
733 /* Unknown GIOP Message */
734 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
735 break;
736 } /* switch(header->message_type) */
737 }
738
739 /*
740 * IDL:omg.org/CosNaming/BindingIterator/destroy:1.0
741 */
742 static void
decode_CosNaming_BindingIterator_destroy(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header,const gchar * operation _U_,gboolean stream_is_big_endian _U_)743 decode_CosNaming_BindingIterator_destroy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
744 {
745 switch(header->message_type) {
746 case Request:
747 break;
748 case Reply:
749 switch(header->rep_status) {
750 case NO_EXCEPTION:
751 /* Function returns void */
752
753 break;
754 case USER_EXCEPTION:
755 break;
756 default:
757 /* Unknown Exception */
758 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_exception, "Unknown exception %d", header->rep_status);
759 break;
760 } /* switch(header->rep_status) */
761
762 break;
763 default:
764 /* Unknown GIOP Message */
765 expert_add_info_format(pinfo, item, &ei_cosnaming_unknown_giop_msg, "Unknown GIOP message %d", header->message_type);
766 break;
767 } /* switch(header->message_type) */
768 }
769
770 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
771 static void
decode_CosNaming_NameComponent_st(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header _U_,const gchar * operation _U_,gboolean stream_is_big_endian _U_)772 decode_CosNaming_NameComponent_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
773 {
774
775 giop_add_CDR_string(tree, tvb, offset, stream_is_big_endian, boundary, hf_CosNaming_NameComponent_id);
776
777 giop_add_CDR_string(tree, tvb, offset, stream_is_big_endian, boundary, hf_CosNaming_NameComponent_kind);
778
779 }
780
781 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
782 static void
decode_CosNaming_Binding_st(tvbuff_t * tvb _U_,packet_info * pinfo _U_,proto_tree * tree _U_,proto_item * item _U_,int * offset _U_,MessageHeader * header _U_,const gchar * operation _U_,gboolean stream_is_big_endian _U_)783 decode_CosNaming_Binding_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
784 {
785
786 /* Operation specific Variable declarations Begin */
787 guint32 u_octet4_loop_CosNaming_Binding_binding_name;
788 guint32 i_CosNaming_Binding_binding_name;
789 guint32 u_octet4;
790 /* Operation specific Variable declarations End */
791
792 u_octet4_loop_CosNaming_Binding_binding_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
793 proto_tree_add_uint(tree, hf_CosNaming_Binding_binding_name_loop, tvb,*offset-4, 4, u_octet4_loop_CosNaming_Binding_binding_name);
794
795 for (i_CosNaming_Binding_binding_name=0; i_CosNaming_Binding_binding_name < u_octet4_loop_CosNaming_Binding_binding_name; i_CosNaming_Binding_binding_name++) {
796
797 /* Begin struct "CosNaming_NameComponent" */
798 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
799 /* End struct "CosNaming_NameComponent" */
800 }
801
802 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
803 proto_tree_add_uint(tree, hf_CosNaming_Binding_binding_type, tvb, *offset-4, 4, u_octet4);
804
805 }
806
807 /*
808 * Called once we accept the packet as being for us; it sets the
809 * Protocol and Info columns and creates the top-level protocol
810 * tree item.
811 */
812 static proto_tree *
start_dissecting(tvbuff_t * tvb,packet_info * pinfo,proto_tree * ptree,int * offset)813 start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset)
814 {
815
816 proto_item *ti = NULL;
817 proto_tree *tree = NULL; /* init later, inside if(tree) */
818
819 col_set_str(pinfo->cinfo, COL_PROTOCOL, "COSNAMING");
820
821 /*
822 * Do not clear COL_INFO, as nothing is being written there by
823 * this dissector yet. So leave it as is from the GIOP dissector.
824 * TODO: add something useful to COL_INFO
825 * col_clear(pinfo->cinfo, COL_INFO);
826 */
827
828 if (ptree) {
829 ti = proto_tree_add_item(ptree, proto_cosnaming, tvb, *offset, tvb_reported_length_remaining(tvb, *offset), ENC_NA);
830 tree = proto_item_add_subtree(ti, ett_cosnaming);
831 }
832 return tree;
833 }
834
835 static proto_item*
process_RequestOperation(tvbuff_t * tvb,packet_info * pinfo,proto_tree * ptree,MessageHeader * header,const gchar * operation)836 process_RequestOperation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, MessageHeader *header, const gchar *operation)
837 {
838 proto_item *pi;
839 if(header->message_type == Reply) {
840 /* fill-up info column */
841 col_append_fstr(pinfo->cinfo, COL_INFO, " op = %s",operation);
842 }
843 /* fill-up the field */
844 pi=proto_tree_add_string(ptree, hf_operationrequest, tvb, 0, 0, operation);
845 proto_item_set_generated(pi);
846 return pi;
847 }
848
849 static gboolean
dissect_cosnaming(tvbuff_t * tvb,packet_info * pinfo,proto_tree * ptree,int * offset,MessageHeader * header,const gchar * operation,gchar * idlname)850 dissect_cosnaming(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, const gchar *operation, gchar *idlname)
851 {
852 proto_item *item _U_;
853 proto_tree *tree _U_;
854 gboolean stream_is_big_endian = is_big_endian(header); /* get endianess */
855
856 /* If we have a USER Exception, then decode it and return */
857 if ((header->message_type == Reply) && (header->rep_status == USER_EXCEPTION)) {
858 return decode_user_exception(tvb, pinfo, ptree, offset, header, operation, stream_is_big_endian);
859 }
860
861 switch(header->message_type) {
862
863 case Request:
864 case Reply:
865
866 if (strcmp(operation, "bind") == 0
867 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
868 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
869 tree = start_dissecting(tvb, pinfo, ptree, offset);
870 decode_CosNaming_NamingContext_bind(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
871 return TRUE;
872 }
873
874 if (strcmp(operation, "rebind") == 0
875 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
876 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
877 tree = start_dissecting(tvb, pinfo, ptree, offset);
878 decode_CosNaming_NamingContext_rebind(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
879 return TRUE;
880 }
881
882 if (strcmp(operation, "bind_context") == 0
883 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
884 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
885 tree = start_dissecting(tvb, pinfo, ptree, offset);
886 decode_CosNaming_NamingContext_bind_context(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
887 return TRUE;
888 }
889
890 if (strcmp(operation, "rebind_context") == 0
891 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
892 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
893 tree = start_dissecting(tvb, pinfo, ptree, offset);
894 decode_CosNaming_NamingContext_rebind_context(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
895 return TRUE;
896 }
897
898 if (strcmp(operation, "resolve") == 0
899 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
900 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
901 tree = start_dissecting(tvb, pinfo, ptree, offset);
902 decode_CosNaming_NamingContext_resolve(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
903 return TRUE;
904 }
905
906 if (strcmp(operation, "unbind") == 0
907 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
908 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
909 tree = start_dissecting(tvb, pinfo, ptree, offset);
910 decode_CosNaming_NamingContext_unbind(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
911 return TRUE;
912 }
913
914 if (strcmp(operation, "new_context") == 0
915 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
916 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
917 tree = start_dissecting(tvb, pinfo, ptree, offset);
918 decode_CosNaming_NamingContext_new_context(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
919 return TRUE;
920 }
921
922 if (strcmp(operation, "bind_new_context") == 0
923 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
924 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
925 tree = start_dissecting(tvb, pinfo, ptree, offset);
926 decode_CosNaming_NamingContext_bind_new_context(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
927 return TRUE;
928 }
929
930 if (strcmp(operation, "destroy") == 0
931 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
932 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
933 tree = start_dissecting(tvb, pinfo, ptree, offset);
934 decode_CosNaming_NamingContext_destroy(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
935 return TRUE;
936 }
937
938 if (strcmp(operation, "list") == 0
939 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
940 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
941 tree = start_dissecting(tvb, pinfo, ptree, offset);
942 decode_CosNaming_NamingContext_list(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
943 return TRUE;
944 }
945
946 if (strcmp(operation, "next_one") == 0
947 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
948 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
949 tree = start_dissecting(tvb, pinfo, ptree, offset);
950 decode_CosNaming_BindingIterator_next_one(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
951 return TRUE;
952 }
953
954 if (strcmp(operation, "next_n") == 0
955 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
956 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
957 tree = start_dissecting(tvb, pinfo, ptree, offset);
958 decode_CosNaming_BindingIterator_next_n(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
959 return TRUE;
960 }
961
962 if (strcmp(operation, "destroy") == 0
963 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
964 item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */
965 tree = start_dissecting(tvb, pinfo, ptree, offset);
966 decode_CosNaming_BindingIterator_destroy(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
967 return TRUE;
968 }
969
970 break;
971
972 case CancelRequest:
973 case LocateRequest:
974 case LocateReply:
975 case CloseConnection:
976 case MessageError:
977 case Fragment:
978 return FALSE; /* not handled yet */
979
980 default:
981 return FALSE; /* not handled yet */
982
983 } /* switch */
984
985
986 return FALSE;
987
988 } /* End of main dissector */
989
990
991 /* Register the protocol with Wireshark */
proto_register_giop_cosnaming(void)992 void proto_register_giop_cosnaming(void)
993 {
994 /* setup list of header fields */
995 static hf_register_info hf[] = {
996 /* field that indicates the currently ongoing request/reply exchange */
997 {&hf_operationrequest, {"Request_Operation","giop-cosnaming.Request_Operation",FT_STRING,BASE_NONE,NULL,0x0,NULL,HFILL}},
998 /* Operation filters */
999 {&hf_CosNaming_NamingContext_bind_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.bind.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1000 {&hf_CosNaming_NamingContext_rebind_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.rebind.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1001 {&hf_CosNaming_NamingContext_bind_context_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.bind_context.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1002 {&hf_CosNaming_NamingContext_rebind_context_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.rebind_context.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1003 {&hf_CosNaming_NamingContext_resolve_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.resolve.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1004 {&hf_CosNaming_NamingContext_unbind_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.unbind.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1005 {&hf_CosNaming_NamingContext_bind_new_context_n_loop, {"Seq length of n","giop-cosnaming.NamingContext.bind_new_context.n.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1006 {&hf_CosNaming_NamingContext_list_how_many, {"how_many","giop-cosnaming.NamingContext.list.how_many",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1007 {&hf_CosNaming_NamingContext_list_bl_loop, {"Seq length of bl","giop-cosnaming.NamingContext.list.bl.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1008 {&hf_CosNaming_BindingIterator_next_one_return, {"Return value","giop-cosnaming.BindingIterator.next_one.return",FT_BOOLEAN,8,NULL,0x01,NULL,HFILL}},
1009 {&hf_CosNaming_BindingIterator_next_n_return, {"Return value","giop-cosnaming.BindingIterator.next_n.return",FT_BOOLEAN,8,NULL,0x01,NULL,HFILL}},
1010 {&hf_CosNaming_BindingIterator_next_n_how_many, {"how_many","giop-cosnaming.BindingIterator.next_n.how_many",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1011 {&hf_CosNaming_BindingIterator_next_n_bl_loop, {"Seq length of bl","giop-cosnaming.BindingIterator.next_n.bl.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1012 /* Attribute filters */
1013 /* Struct filters */
1014 {&hf_CosNaming_NameComponent_id, {"NameComponent_id","giop-cosnaming.NameComponent.id",FT_STRING,BASE_NONE,NULL,0x0,NULL,HFILL}},
1015 {&hf_CosNaming_NameComponent_kind, {"NameComponent_kind","giop-cosnaming.NameComponent.kind",FT_STRING,BASE_NONE,NULL,0x0,NULL,HFILL}},
1016 {&hf_CosNaming_Binding_binding_name_loop, {"Seq length of Binding_binding_name","giop-cosnaming.Binding.binding_name.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1017 {&hf_CosNaming_Binding_binding_type, {"Binding_binding_type","giop-cosnaming.Binding.binding_type",FT_UINT32,BASE_DEC,VALS(CosNaming_BindingType),0x0,NULL,HFILL}},
1018 /* User exception filters */
1019 {&hf_CosNaming_NamingContext_NotFound_why, {"NotFound_why","giop-cosnaming.NamingContext.NotFound_why",FT_UINT32,BASE_DEC,VALS(CosNaming_NamingContext_NotFoundReason),0x0,NULL,HFILL}},
1020 {&hf_CosNaming_NamingContext_NotFound_rest_of_name_loop, {"Seq length of NotFound_rest_of_name","giop-cosnaming.NamingContext.NotFound_rest_of_name.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1021 {&hf_CosNaming_NamingContext_CannotProceed_rest_of_name_loop, {"Seq length of CannotProceed_rest_of_name","giop-cosnaming.NamingContext.CannotProceed_rest_of_name.size",FT_UINT32,BASE_DEC,NULL,0x0,NULL,HFILL}},
1022 /* Union filters */
1023
1024 };
1025
1026 static ei_register_info ei[] = {
1027 { &ei_cosnaming_unknown_giop_msg, { "giop-cosnaming.unknown_giop_msg", PI_PROTOCOL, PI_WARN, "Unknown GIOP message", EXPFILL }},
1028 { &ei_cosnaming_unknown_exception, { "giop-cosnaming.unknown_exception", PI_PROTOCOL, PI_WARN, "Unknown exception", EXPFILL }},
1029 { &ei_cosnaming_unknown_reply_status, { "giop-cosnaming.unknown_reply_status", PI_PROTOCOL, PI_WARN, "Unknown reply status", EXPFILL }},
1030 };
1031
1032 /* setup protocol subtree array */
1033
1034 static gint *ett[] = {
1035 &ett_cosnaming,
1036 };
1037
1038 expert_module_t* expert_cosnaming;
1039
1040
1041 /* Register the protocol name and description */
1042 proto_cosnaming = proto_register_protocol("Cosnaming Dissector Using GIOP API" , "COSNAMING", "giop-cosnaming" );
1043 proto_register_field_array(proto_cosnaming, hf, array_length(hf));
1044 proto_register_subtree_array(ett, array_length(ett));
1045
1046 expert_cosnaming = expert_register_protocol(proto_cosnaming);
1047 expert_register_field_array(expert_cosnaming, ei, array_length(ei));
1048 }
1049
1050 /* register me as handler for these interfaces */
proto_reg_handoff_giop_cosnaming(void)1051 void proto_reg_handoff_giop_cosnaming(void)
1052 {
1053 /* Register for Explicit Dissection */
1054 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/BindingIterator", proto_cosnaming ); /* explicit dissector */
1055
1056 /* Register for Explicit Dissection */
1057 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/NamingContext", proto_cosnaming ); /* explicit dissector */
1058
1059 /* Register for Heuristic Dissection */
1060 register_giop_user(dissect_cosnaming, "COSNAMING" ,proto_cosnaming); /* heuristic dissector */
1061
1062 }
1063
1064 /*
1065 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1066 *
1067 * Local Variables:
1068 * c-basic-offset: 4
1069 * tab-width: 8
1070 * indent-tabs-mode: nil
1071 * End:
1072 *
1073 * ex: set shiftwidth=4 tabstop=8 expandtab:
1074 * :indentSize=4:tabSize=8:noTabs=true:
1075 */
1076