5 * Routines for IDL dissection
7 * Autogenerated from idl2wrs
8 * Copyright 2001 Frank Singleton <frank.singleton@ericsson.com>
13 * Wireshark - Network traffic analyzer
15 * Copyright 1999 - 2006 Gerald Combs
20 * This program is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU General Public License
22 * as published by the Free Software Foundation; either version 2
23 * of the License, or (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 #include <epan/packet.h>
45 #include <epan/proto.h>
46 #include <epan/dissectors/packet-giop.h>
49 G_MODULE_EXPORT const gchar version[] = "0.0.1";
53 /* disable warning: "unreference local variable" */
54 #pragma warning(disable:4101)
58 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset);
62 /* Struct prototype declaration Start */
65 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
67 static void decode_CosNaming_NameComponent_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, gchar *operation _U_, gboolean stream_is_big_endian _U_);
70 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
72 static void decode_CosNaming_Binding_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, gchar *operation _U_, gboolean stream_is_big_endian _U_);
75 /* Struct prototype declaration End */
78 /* Union prototype declaration Start */
81 /* Union prototype declaration End */
85 /* Initialise the protocol and subtree pointers */
87 static int proto_cosnaming = -1;
89 static gint ett_cosnaming = -1;
92 /* Initialise the initial Alignment */
94 static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */
98 /* Initialise the Registered fields */
100 /* TODO - Use registered fields */
103 * IDL Operations Start
106 static const char CosNaming_NamingContext_bind_op[] = "bind" ;
107 static const char CosNaming_NamingContext_rebind_op[] = "rebind" ;
108 static const char CosNaming_NamingContext_bind_context_op[] = "bind_context" ;
109 static const char CosNaming_NamingContext_rebind_context_op[] = "rebind_context" ;
110 static const char CosNaming_NamingContext_resolve_op[] = "resolve" ;
111 static const char CosNaming_NamingContext_unbind_op[] = "unbind" ;
112 static const char CosNaming_NamingContext_new_context_op[] = "new_context" ;
113 static const char CosNaming_NamingContext_bind_new_context_op[] = "bind_new_context" ;
114 static const char CosNaming_NamingContext_destroy_op[] = "destroy" ;
115 static const char CosNaming_NamingContext_list_op[] = "list" ;
116 static const char CosNaming_BindingIterator_next_one_op[] = "next_one" ;
117 static const char CosNaming_BindingIterator_next_n_op[] = "next_n" ;
118 static const char CosNaming_BindingIterator_destroy_op[] = "destroy" ;
124 /* Begin Exception (containing members) String Declare */
127 static const char user_exception_CosNaming_NamingContext_NotFound[] = "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0" ;
128 static const char user_exception_CosNaming_NamingContext_CannotProceed[] = "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0" ;
130 /* End Exception (containing members) String Declare */
133 * IDL Attributes Start
146 * Enum = IDL:omg.org/CosNaming/BindingType:1.0
149 static const value_string CosNaming_BindingType[] = {
157 * Enum = IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0
160 static const value_string CosNaming_NamingContext_NotFoundReason[] = {
162 { 0, "missing_node" },
163 { 1, "not_context" },
172 /* Begin Exception Helper Functions */
175 /* Exception = IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
177 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_, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
180 /* Operation specific Variable declarations Begin */
183 guint32 u_octet4_loop_NotFound_rest_of_name;
184 guint32 i_NotFound_rest_of_name;
186 /* Operation specific Variable declarations End */
189 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
191 proto_tree_add_text(tree,tvb,*offset-4,4,"NotFound_why = %u (%s)",u_octet4,val_to_str(u_octet4,CosNaming_NamingContext_NotFoundReason,"Unknown Enum Value"));
194 u_octet4_loop_NotFound_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
196 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of NotFound_rest_of_name = %u",u_octet4_loop_NotFound_rest_of_name);
199 for (i_NotFound_rest_of_name=0; i_NotFound_rest_of_name < u_octet4_loop_NotFound_rest_of_name; i_NotFound_rest_of_name++) {
201 /* Begin struct "CosNaming_NameComponent" */
205 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
207 /* End struct "CosNaming_NameComponent" */
213 /* Exception = IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
215 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_, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
218 /* Operation specific Variable declarations Begin */
220 guint32 u_octet4_loop_CannotProceed_rest_of_name;
221 guint32 i_CannotProceed_rest_of_name;
223 /* Operation specific Variable declarations End */
225 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
228 u_octet4_loop_CannotProceed_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
230 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of CannotProceed_rest_of_name = %u",u_octet4_loop_CannotProceed_rest_of_name);
233 for (i_CannotProceed_rest_of_name=0; i_CannotProceed_rest_of_name < u_octet4_loop_CannotProceed_rest_of_name; i_CannotProceed_rest_of_name++) {
235 /* Begin struct "CosNaming_NameComponent" */
239 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
241 /* End struct "CosNaming_NameComponent" */
248 /* End Exception Helper Functions */
251 * Main delegator for exception handling
255 static gboolean decode_user_exception(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *ptree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
257 /*gboolean stream_is_big_endian _U_;*/ /* big endianess */
258 proto_tree *tree _U_;
260 if (!header->exception_id)
263 if (strcmp(header->exception_id, user_exception_CosNaming_NamingContext_NotFound) == 0) {
264 tree = start_dissecting(tvb, pinfo, ptree, offset);
265 decode_ex_CosNaming_NamingContext_NotFound(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian); /* IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
269 if (strcmp(header->exception_id, user_exception_CosNaming_NamingContext_CannotProceed) == 0) {
270 tree = start_dissecting(tvb, pinfo, ptree, offset);
271 decode_ex_CosNaming_NamingContext_CannotProceed(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian); /* IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
277 return FALSE; /* user exception not found */
281 /* Begin Attribute Helper Functions */
284 /* End Attribute Helper Functions */
287 * IDL:omg.org/CosNaming/NamingContext/bind:1.0
290 static void decode_CosNaming_NamingContext_bind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
293 /* Operation specific Variable declarations Begin */
295 guint32 u_octet4_loop_n;
298 /* Operation specific Variable declarations End */
301 switch(header->message_type) {
305 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
307 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
310 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
312 /* Begin struct "CosNaming_NameComponent" */
316 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
318 /* End struct "CosNaming_NameComponent" */
322 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
329 switch(header->rep_status) {
333 /* Function returns void */
343 /* Unknown Exception */
345 g_warning("Unknown Exception ");
350 } /* switch(header->message_type) */
356 /* Unknown GIOP Message */
358 g_warning("Unknown GIOP Message");
362 } /* switch(header->message_type) */
367 * IDL:omg.org/CosNaming/NamingContext/rebind:1.0
370 static void decode_CosNaming_NamingContext_rebind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
373 /* Operation specific Variable declarations Begin */
375 guint32 u_octet4_loop_n;
378 /* Operation specific Variable declarations End */
381 switch(header->message_type) {
385 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
387 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
390 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
392 /* Begin struct "CosNaming_NameComponent" */
396 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
398 /* End struct "CosNaming_NameComponent" */
402 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
409 switch(header->rep_status) {
413 /* Function returns void */
423 /* Unknown Exception */
425 g_warning("Unknown Exception ");
430 } /* switch(header->message_type) */
436 /* Unknown GIOP Message */
438 g_warning("Unknown GIOP Message");
442 } /* switch(header->message_type) */
447 * IDL:omg.org/CosNaming/NamingContext/bind_context:1.0
450 static void decode_CosNaming_NamingContext_bind_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
453 /* Operation specific Variable declarations Begin */
455 guint32 u_octet4_loop_n;
458 /* Operation specific Variable declarations End */
461 switch(header->message_type) {
465 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
467 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
470 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
472 /* Begin struct "CosNaming_NameComponent" */
476 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
478 /* End struct "CosNaming_NameComponent" */
482 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
489 switch(header->rep_status) {
493 /* Function returns void */
503 /* Unknown Exception */
505 g_warning("Unknown Exception ");
510 } /* switch(header->message_type) */
516 /* Unknown GIOP Message */
518 g_warning("Unknown GIOP Message");
522 } /* switch(header->message_type) */
527 * IDL:omg.org/CosNaming/NamingContext/rebind_context:1.0
530 static void decode_CosNaming_NamingContext_rebind_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
533 /* Operation specific Variable declarations Begin */
535 guint32 u_octet4_loop_n;
538 /* Operation specific Variable declarations End */
541 switch(header->message_type) {
545 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
547 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
550 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
552 /* Begin struct "CosNaming_NameComponent" */
556 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
558 /* End struct "CosNaming_NameComponent" */
562 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
569 switch(header->rep_status) {
573 /* Function returns void */
583 /* Unknown Exception */
585 g_warning("Unknown Exception ");
590 } /* switch(header->message_type) */
596 /* Unknown GIOP Message */
598 g_warning("Unknown GIOP Message");
602 } /* switch(header->message_type) */
607 * IDL:omg.org/CosNaming/NamingContext/resolve:1.0
610 static void decode_CosNaming_NamingContext_resolve(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
613 /* Operation specific Variable declarations Begin */
615 guint32 u_octet4_loop_n;
618 /* Operation specific Variable declarations End */
621 switch(header->message_type) {
625 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
627 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
630 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
632 /* Begin struct "CosNaming_NameComponent" */
636 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
638 /* End struct "CosNaming_NameComponent" */
646 switch(header->rep_status) {
650 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
661 /* Unknown Exception */
663 g_warning("Unknown Exception ");
668 } /* switch(header->message_type) */
674 /* Unknown GIOP Message */
676 g_warning("Unknown GIOP Message");
680 } /* switch(header->message_type) */
685 * IDL:omg.org/CosNaming/NamingContext/unbind:1.0
688 static void decode_CosNaming_NamingContext_unbind(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
691 /* Operation specific Variable declarations Begin */
693 guint32 u_octet4_loop_n;
696 /* Operation specific Variable declarations End */
699 switch(header->message_type) {
703 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
705 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
708 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
710 /* Begin struct "CosNaming_NameComponent" */
714 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
716 /* End struct "CosNaming_NameComponent" */
724 switch(header->rep_status) {
728 /* Function returns void */
738 /* Unknown Exception */
740 g_warning("Unknown Exception ");
745 } /* switch(header->message_type) */
751 /* Unknown GIOP Message */
753 g_warning("Unknown GIOP Message");
757 } /* switch(header->message_type) */
762 * IDL:omg.org/CosNaming/NamingContext/new_context:1.0
765 static void decode_CosNaming_NamingContext_new_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
768 /* Operation specific Variable declarations Begin */
771 /* Operation specific Variable declarations End */
774 switch(header->message_type) {
782 switch(header->rep_status) {
786 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
797 /* Unknown Exception */
799 g_warning("Unknown Exception ");
804 } /* switch(header->message_type) */
810 /* Unknown GIOP Message */
812 g_warning("Unknown GIOP Message");
816 } /* switch(header->message_type) */
821 * IDL:omg.org/CosNaming/NamingContext/bind_new_context:1.0
824 static void decode_CosNaming_NamingContext_bind_new_context(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
827 /* Operation specific Variable declarations Begin */
829 guint32 u_octet4_loop_n;
832 /* Operation specific Variable declarations End */
835 switch(header->message_type) {
839 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
841 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
844 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
846 /* Begin struct "CosNaming_NameComponent" */
850 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
852 /* End struct "CosNaming_NameComponent" */
860 switch(header->rep_status) {
864 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
875 /* Unknown Exception */
877 g_warning("Unknown Exception ");
882 } /* switch(header->message_type) */
888 /* Unknown GIOP Message */
890 g_warning("Unknown GIOP Message");
894 } /* switch(header->message_type) */
899 * IDL:omg.org/CosNaming/NamingContext/destroy:1.0
902 static void decode_CosNaming_NamingContext_destroy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
905 /* Operation specific Variable declarations Begin */
908 /* Operation specific Variable declarations End */
911 switch(header->message_type) {
919 switch(header->rep_status) {
923 /* Function returns void */
933 /* Unknown Exception */
935 g_warning("Unknown Exception ");
940 } /* switch(header->message_type) */
946 /* Unknown GIOP Message */
948 g_warning("Unknown GIOP Message");
952 } /* switch(header->message_type) */
957 * IDL:omg.org/CosNaming/NamingContext/list:1.0
960 static void decode_CosNaming_NamingContext_list(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
963 /* Operation specific Variable declarations Begin */
966 guint32 u_octet4_loop_bl;
969 /* Operation specific Variable declarations End */
972 switch(header->message_type) {
976 u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary);
978 proto_tree_add_text(tree,tvb,*offset-4,4,"how_many = %u",u_octet4);
985 switch(header->rep_status) {
989 /* Function returns void */
991 u_octet4_loop_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
993 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of bl = %u",u_octet4_loop_bl);
996 for (i_bl=0; i_bl < u_octet4_loop_bl; i_bl++) {
998 /* Begin struct "CosNaming_Binding" */
1002 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1004 /* End struct "CosNaming_Binding" */
1008 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
1013 case USER_EXCEPTION:
1019 /* Unknown Exception */
1021 g_warning("Unknown Exception ");
1026 } /* switch(header->message_type) */
1032 /* Unknown GIOP Message */
1034 g_warning("Unknown GIOP Message");
1038 } /* switch(header->message_type) */
1043 * IDL:omg.org/CosNaming/BindingIterator/next_one:1.0
1046 static void decode_CosNaming_BindingIterator_next_one(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
1049 /* Operation specific Variable declarations Begin */
1053 /* Operation specific Variable declarations End */
1056 switch(header->message_type) {
1064 switch(header->rep_status) {
1068 u_octet1 = get_CDR_boolean(tvb,offset);
1070 proto_tree_add_text(tree,tvb,*offset-1,1,"Operation_Return_Value = %u",u_octet1);
1073 /* Begin struct "CosNaming_Binding" */
1077 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1079 /* End struct "CosNaming_Binding" */
1083 case USER_EXCEPTION:
1089 /* Unknown Exception */
1091 g_warning("Unknown Exception ");
1096 } /* switch(header->message_type) */
1102 /* Unknown GIOP Message */
1104 g_warning("Unknown GIOP Message");
1108 } /* switch(header->message_type) */
1113 * IDL:omg.org/CosNaming/BindingIterator/next_n:1.0
1116 static void decode_CosNaming_BindingIterator_next_n(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
1119 /* Operation specific Variable declarations Begin */
1123 guint32 u_octet4_loop_bl;
1126 /* Operation specific Variable declarations End */
1129 switch(header->message_type) {
1133 u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary);
1135 proto_tree_add_text(tree,tvb,*offset-4,4,"how_many = %u",u_octet4);
1142 switch(header->rep_status) {
1146 u_octet1 = get_CDR_boolean(tvb,offset);
1148 proto_tree_add_text(tree,tvb,*offset-1,1,"Operation_Return_Value = %u",u_octet1);
1151 u_octet4_loop_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
1153 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of bl = %u",u_octet4_loop_bl);
1156 for (i_bl=0; i_bl < u_octet4_loop_bl; i_bl++) {
1158 /* Begin struct "CosNaming_Binding" */
1162 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1164 /* End struct "CosNaming_Binding" */
1170 case USER_EXCEPTION:
1176 /* Unknown Exception */
1178 g_warning("Unknown Exception ");
1183 } /* switch(header->message_type) */
1189 /* Unknown GIOP Message */
1191 g_warning("Unknown GIOP Message");
1195 } /* switch(header->message_type) */
1200 * IDL:omg.org/CosNaming/BindingIterator/destroy:1.0
1203 static void decode_CosNaming_BindingIterator_destroy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
1206 /* Operation specific Variable declarations Begin */
1209 /* Operation specific Variable declarations End */
1212 switch(header->message_type) {
1220 switch(header->rep_status) {
1224 /* Function returns void */
1228 case USER_EXCEPTION:
1234 /* Unknown Exception */
1236 g_warning("Unknown Exception ");
1241 } /* switch(header->message_type) */
1247 /* Unknown GIOP Message */
1249 g_warning("Unknown GIOP Message");
1253 } /* switch(header->message_type) */
1257 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
1259 static void decode_CosNaming_NameComponent_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
1262 /* Operation specific Variable declarations Begin */
1267 /* Operation specific Variable declarations End */
1269 u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary);
1271 proto_tree_add_text(tree,tvb,*offset-u_octet4,u_octet4,"NameComponent_id (%u) = %s",
1272 u_octet4, (u_octet4 > 0) ? seq : "");
1275 g_free(seq); /* free buffer */
1278 u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary);
1280 proto_tree_add_text(tree,tvb,*offset-u_octet4,u_octet4,"NameComponent_kind (%u) = %s",
1281 u_octet4, (u_octet4 > 0) ? seq : "");
1284 g_free(seq); /* free buffer */
1289 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
1291 static void decode_CosNaming_Binding_st(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, gchar *operation _U_, gboolean stream_is_big_endian _U_) {
1294 /* Operation specific Variable declarations Begin */
1296 guint32 u_octet4_loop_Binding_binding_name;
1297 guint32 i_Binding_binding_name;
1300 /* Operation specific Variable declarations End */
1302 u_octet4_loop_Binding_binding_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
1304 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of Binding_binding_name = %u",u_octet4_loop_Binding_binding_name);
1307 for (i_Binding_binding_name=0; i_Binding_binding_name < u_octet4_loop_Binding_binding_name; i_Binding_binding_name++) {
1309 /* Begin struct "CosNaming_NameComponent" */
1313 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1315 /* End struct "CosNaming_NameComponent" */
1320 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
1322 proto_tree_add_text(tree,tvb,*offset-4,4,"Binding_binding_type = %u (%s)",u_octet4,val_to_str(u_octet4,CosNaming_BindingType,"Unknown Enum Value"));
1328 * Called once we accept the packet as being for us; it sets the
1329 * Protocol and Info columns and creates the top-level protocol
1332 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset) {
1334 proto_item *ti = NULL;
1335 proto_tree *tree = NULL; /* init later, inside if(tree) */
1337 col_set_str(pinfo->cinfo, COL_PROTOCOL, "COSNAMING");
1340 * Do not clear COL_INFO, as nothing is being written there by
1341 * this dissector yet. So leave it as is from the GIOP dissector.
1342 * TODO: add something useful to COL_INFO
1343 * col_clear(pinfo->cinfo, COL_INFO);
1347 ti = proto_tree_add_item(ptree, proto_cosnaming, tvb, *offset, -1, ENC_NA);
1348 tree = proto_item_add_subtree(ti, ett_cosnaming);
1353 static gboolean dissect_cosnaming(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, gchar *operation, gchar *idlname) {
1355 gboolean stream_is_big_endian; /* big endianess */
1356 proto_tree *tree _U_;
1358 stream_is_big_endian = is_big_endian(header); /* get endianess */
1360 /* If we have a USER Exception, then decode it and return */
1362 if ((header->message_type == Reply) && (header->rep_status == USER_EXCEPTION)) {
1364 return decode_user_exception(tvb, pinfo, ptree, offset, header, operation, stream_is_big_endian);
1368 switch(header->message_type) {
1373 if (strcmp(operation, CosNaming_NamingContext_bind_op) == 0
1374 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1375 tree = start_dissecting(tvb, pinfo, ptree, offset);
1376 decode_CosNaming_NamingContext_bind(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1380 if (strcmp(operation, CosNaming_NamingContext_rebind_op) == 0
1381 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1382 tree = start_dissecting(tvb, pinfo, ptree, offset);
1383 decode_CosNaming_NamingContext_rebind(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1387 if (strcmp(operation, CosNaming_NamingContext_bind_context_op) == 0
1388 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1389 tree = start_dissecting(tvb, pinfo, ptree, offset);
1390 decode_CosNaming_NamingContext_bind_context(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1394 if (strcmp(operation, CosNaming_NamingContext_rebind_context_op) == 0
1395 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1396 tree = start_dissecting(tvb, pinfo, ptree, offset);
1397 decode_CosNaming_NamingContext_rebind_context(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1401 if (strcmp(operation, CosNaming_NamingContext_resolve_op) == 0
1402 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1403 tree = start_dissecting(tvb, pinfo, ptree, offset);
1404 decode_CosNaming_NamingContext_resolve(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1408 if (strcmp(operation, CosNaming_NamingContext_unbind_op) == 0
1409 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1410 tree = start_dissecting(tvb, pinfo, ptree, offset);
1411 decode_CosNaming_NamingContext_unbind(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1415 if (strcmp(operation, CosNaming_NamingContext_new_context_op) == 0
1416 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1417 tree = start_dissecting(tvb, pinfo, ptree, offset);
1418 decode_CosNaming_NamingContext_new_context(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1422 if (strcmp(operation, CosNaming_NamingContext_bind_new_context_op) == 0
1423 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1424 tree = start_dissecting(tvb, pinfo, ptree, offset);
1425 decode_CosNaming_NamingContext_bind_new_context(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1429 if (strcmp(operation, CosNaming_NamingContext_destroy_op) == 0
1430 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1431 tree = start_dissecting(tvb, pinfo, ptree, offset);
1432 decode_CosNaming_NamingContext_destroy(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1436 if (strcmp(operation, CosNaming_NamingContext_list_op) == 0
1437 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1438 tree = start_dissecting(tvb, pinfo, ptree, offset);
1439 decode_CosNaming_NamingContext_list(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1443 if (strcmp(operation, CosNaming_BindingIterator_next_one_op) == 0
1444 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1445 tree = start_dissecting(tvb, pinfo, ptree, offset);
1446 decode_CosNaming_BindingIterator_next_one(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1450 if (strcmp(operation, CosNaming_BindingIterator_next_n_op) == 0
1451 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1452 tree = start_dissecting(tvb, pinfo, ptree, offset);
1453 decode_CosNaming_BindingIterator_next_n(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1457 if (strcmp(operation, CosNaming_BindingIterator_destroy_op) == 0
1458 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1459 tree = start_dissecting(tvb, pinfo, ptree, offset);
1460 decode_CosNaming_BindingIterator_destroy(tvb, pinfo, tree, offset, header, operation, stream_is_big_endian);
1470 case CloseConnection:
1473 return FALSE; /* not handled yet */
1476 return FALSE; /* not handled yet */
1483 } /* End of main dissector */
1487 /* Register the protocol with Wireshark */
1489 void proto_register_giop_cosnaming(void) {
1491 /* setup list of header fields */
1494 static hf_register_info hf[] = {
1501 /* setup protocol subtree array */
1503 static gint *ett[] = {
1507 /* Register the protocol name and description */
1509 proto_cosnaming = proto_register_protocol("Cosnaming Dissector Using GIOP API" , "COSNAMING", "giop-cosnaming" );
1512 proto_register_field_array(proto_cosnaming, hf, array_length(hf));
1514 proto_register_subtree_array(ett,array_length(ett));
1519 /* register me as handler for these interfaces */
1521 void proto_register_handoff_giop_cosnaming(void) {
1525 /* Register for Explicit Dissection */
1527 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/BindingIterator", proto_cosnaming ); /* explicit dissector */
1530 /* Register for Explicit Dissection */
1532 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/NamingContext", proto_cosnaming ); /* explicit dissector */
1535 /* Register for Heuristic Dissection */
1537 register_giop_user(dissect_cosnaming, "COSNAMING" ,proto_cosnaming); /* heuristic dissector */
1543 #ifndef ENABLE_STATIC
1545 G_MODULE_EXPORT void
1546 plugin_register(void)
1548 if (proto_cosnaming == -1) {
1549 proto_register_giop_cosnaming();
1553 G_MODULE_EXPORT void
1554 plugin_reg_handoff(void){
1555 proto_register_handoff_giop_cosnaming();