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 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.
46 #include <epan/packet.h>
47 #include <epan/proto.h>
48 #include <epan/dissectors/packet-giop.h>
51 G_MODULE_EXPORT const gchar version[] = "0.0.1";
55 /* disable warning: "unreference local variable" */
56 #pragma warning(disable:4101)
59 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset);
63 /* Struct prototype declaration Start */
68 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
70 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_);
75 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
77 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_);
81 /* Struct prototype declaration End */
85 /* Union prototype declaration Start */
89 /* Union prototype declaration End */
93 /* Initialise the protocol and subtree pointers */
95 static int proto_cosnaming = -1;
97 static gint ett_cosnaming = -1;
101 /* Initialise the initial Alignment */
103 static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */
108 /* Initialise the Registered fields */
110 /* TODO - Use registered fields */
114 * IDL Operations Start
118 static const char CosNaming_NamingContext_bind_op[] = "bind" ;
119 static const char CosNaming_NamingContext_rebind_op[] = "rebind" ;
120 static const char CosNaming_NamingContext_bind_context_op[] = "bind_context" ;
121 static const char CosNaming_NamingContext_rebind_context_op[] = "rebind_context" ;
122 static const char CosNaming_NamingContext_resolve_op[] = "resolve" ;
123 static const char CosNaming_NamingContext_unbind_op[] = "unbind" ;
124 static const char CosNaming_NamingContext_new_context_op[] = "new_context" ;
125 static const char CosNaming_NamingContext_bind_new_context_op[] = "bind_new_context" ;
126 static const char CosNaming_NamingContext_destroy_op[] = "destroy" ;
127 static const char CosNaming_NamingContext_list_op[] = "list" ;
128 static const char CosNaming_BindingIterator_next_one_op[] = "next_one" ;
129 static const char CosNaming_BindingIterator_next_n_op[] = "next_n" ;
130 static const char CosNaming_BindingIterator_destroy_op[] = "destroy" ;
137 /* Begin Exception (containing members) String Declare */
140 static const char user_exception_CosNaming_NamingContext_NotFound[] = "IDL:omg.org/CosNaming/NamingContext/NotFound:1.0" ;
141 static const char user_exception_CosNaming_NamingContext_CannotProceed[] = "IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0" ;
143 /* End Exception (containing members) String Declare */
147 * IDL Attributes Start
163 * Enum = IDL:omg.org/CosNaming/BindingType:1.0
167 static const value_string CosNaming_BindingType[] = {
176 * Enum = IDL:omg.org/CosNaming/NamingContext/NotFoundReason:1.0
180 static const value_string CosNaming_NamingContext_NotFoundReason[] = {
182 { 0, "missing_node" },
183 { 1, "not_context" },
194 /* Begin Exception Helper Functions */
198 /* Exception = IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
200 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_) {
202 gboolean stream_is_big_endian; /* big endianess */
205 /* Operation specific Variable declarations Begin */
208 guint32 u_octet4_loop_NotFound_rest_of_name;
209 guint32 i_NotFound_rest_of_name;
211 /* Operation specific Variable declarations End */
214 stream_is_big_endian = is_big_endian(header); /* get stream endianess */
218 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
220 proto_tree_add_text(tree,tvb,*offset-4,4,"Enum value = %u (%s)",u_octet4,val_to_str(u_octet4,CosNaming_NamingContext_NotFoundReason,"Unknown Enum Value"));
223 u_octet4_loop_NotFound_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
225 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of NotFound_rest_of_name = %u",u_octet4_loop_NotFound_rest_of_name);
228 for (i_NotFound_rest_of_name=0; i_NotFound_rest_of_name < u_octet4_loop_NotFound_rest_of_name; i_NotFound_rest_of_name++) {
230 /* Begin struct "CosNaming_NameComponent" */
234 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
237 /* End struct "CosNaming_NameComponent" */
244 /* Exception = IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
246 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_) {
248 gboolean stream_is_big_endian; /* big endianess */
251 /* Operation specific Variable declarations Begin */
253 guint32 u_octet4_loop_CannotProceed_rest_of_name;
254 guint32 i_CannotProceed_rest_of_name;
256 /* Operation specific Variable declarations End */
259 stream_is_big_endian = is_big_endian(header); /* get stream endianess */
262 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
265 u_octet4_loop_CannotProceed_rest_of_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
267 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of CannotProceed_rest_of_name = %u",u_octet4_loop_CannotProceed_rest_of_name);
270 for (i_CannotProceed_rest_of_name=0; i_CannotProceed_rest_of_name < u_octet4_loop_CannotProceed_rest_of_name; i_CannotProceed_rest_of_name++) {
272 /* Begin struct "CosNaming_NameComponent" */
276 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
279 /* End struct "CosNaming_NameComponent" */
286 /* End Exception Helper Functions */
291 * Main delegator for exception handling
295 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_ ) {
297 gboolean be _U_; /* big endianess */
298 proto_tree *tree _U_;
300 if (!header->exception_id)
304 if (strcmp(header->exception_id, user_exception_CosNaming_NamingContext_NotFound) == 0) {
305 tree = start_dissecting(tvb, pinfo, ptree, offset);
306 decode_ex_CosNaming_NamingContext_NotFound(tvb, pinfo, tree, offset, header, operation); /* IDL:omg.org/CosNaming/NamingContext/NotFound:1.0 */
311 if (strcmp(header->exception_id, user_exception_CosNaming_NamingContext_CannotProceed) == 0) {
312 tree = start_dissecting(tvb, pinfo, ptree, offset);
313 decode_ex_CosNaming_NamingContext_CannotProceed(tvb, pinfo, tree, offset, header, operation); /* IDL:omg.org/CosNaming/NamingContext/CannotProceed:1.0 */
320 return FALSE; /* user exception not found */
325 /* Begin Attribute Helper Functions */
329 /* End Attribute Helper Functions */
334 * IDL:omg.org/CosNaming/NamingContext/bind:1.0
338 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_) {
340 gboolean stream_is_big_endian; /* big endianess */
343 /* Operation specific Variable declarations Begin */
345 guint32 u_octet4_loop_n;
348 /* Operation specific Variable declarations End */
351 stream_is_big_endian = is_big_endian(header);
353 switch(header->message_type) {
357 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
359 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
362 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
364 /* Begin struct "CosNaming_NameComponent" */
368 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
371 /* End struct "CosNaming_NameComponent" */
375 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
382 switch(header->rep_status) {
387 /* Function returns void */
398 /* Unknown Exception */
400 g_warning("Unknown Exception ");
407 } /* switch(header->message_type) */
413 /* Unknown GIOP Message */
415 g_warning("Unknown GIOP Message");
421 } /* switch(header->message_type) */
427 * IDL:omg.org/CosNaming/NamingContext/rebind:1.0
431 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_) {
433 gboolean stream_is_big_endian; /* big endianess */
436 /* Operation specific Variable declarations Begin */
438 guint32 u_octet4_loop_n;
441 /* Operation specific Variable declarations End */
444 stream_is_big_endian = is_big_endian(header);
446 switch(header->message_type) {
450 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
452 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
455 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
457 /* Begin struct "CosNaming_NameComponent" */
461 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
464 /* End struct "CosNaming_NameComponent" */
468 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
475 switch(header->rep_status) {
480 /* Function returns void */
491 /* Unknown Exception */
493 g_warning("Unknown Exception ");
500 } /* switch(header->message_type) */
506 /* Unknown GIOP Message */
508 g_warning("Unknown GIOP Message");
514 } /* switch(header->message_type) */
520 * IDL:omg.org/CosNaming/NamingContext/bind_context:1.0
524 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_) {
526 gboolean stream_is_big_endian; /* big endianess */
529 /* Operation specific Variable declarations Begin */
531 guint32 u_octet4_loop_n;
534 /* Operation specific Variable declarations End */
537 stream_is_big_endian = is_big_endian(header);
539 switch(header->message_type) {
543 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
545 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
548 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
550 /* Begin struct "CosNaming_NameComponent" */
554 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
557 /* End struct "CosNaming_NameComponent" */
561 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
568 switch(header->rep_status) {
573 /* Function returns void */
584 /* Unknown Exception */
586 g_warning("Unknown Exception ");
593 } /* switch(header->message_type) */
599 /* Unknown GIOP Message */
601 g_warning("Unknown GIOP Message");
607 } /* switch(header->message_type) */
613 * IDL:omg.org/CosNaming/NamingContext/rebind_context:1.0
617 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_) {
619 gboolean stream_is_big_endian; /* big endianess */
622 /* Operation specific Variable declarations Begin */
624 guint32 u_octet4_loop_n;
627 /* Operation specific Variable declarations End */
630 stream_is_big_endian = is_big_endian(header);
632 switch(header->message_type) {
636 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
638 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
641 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
643 /* Begin struct "CosNaming_NameComponent" */
647 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
650 /* End struct "CosNaming_NameComponent" */
654 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
661 switch(header->rep_status) {
666 /* Function returns void */
677 /* Unknown Exception */
679 g_warning("Unknown Exception ");
686 } /* switch(header->message_type) */
692 /* Unknown GIOP Message */
694 g_warning("Unknown GIOP Message");
700 } /* switch(header->message_type) */
706 * IDL:omg.org/CosNaming/NamingContext/resolve:1.0
710 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_) {
712 gboolean stream_is_big_endian; /* big endianess */
715 /* Operation specific Variable declarations Begin */
717 guint32 u_octet4_loop_n;
720 /* Operation specific Variable declarations End */
723 stream_is_big_endian = is_big_endian(header);
725 switch(header->message_type) {
729 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
731 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
734 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
736 /* Begin struct "CosNaming_NameComponent" */
740 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
743 /* End struct "CosNaming_NameComponent" */
751 switch(header->rep_status) {
755 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
766 /* Unknown Exception */
768 g_warning("Unknown Exception ");
775 } /* switch(header->message_type) */
781 /* Unknown GIOP Message */
783 g_warning("Unknown GIOP Message");
789 } /* switch(header->message_type) */
795 * IDL:omg.org/CosNaming/NamingContext/unbind:1.0
799 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_) {
801 gboolean stream_is_big_endian; /* big endianess */
804 /* Operation specific Variable declarations Begin */
806 guint32 u_octet4_loop_n;
809 /* Operation specific Variable declarations End */
812 stream_is_big_endian = is_big_endian(header);
814 switch(header->message_type) {
818 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
820 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
823 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
825 /* Begin struct "CosNaming_NameComponent" */
829 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
832 /* End struct "CosNaming_NameComponent" */
840 switch(header->rep_status) {
845 /* Function returns void */
856 /* Unknown Exception */
858 g_warning("Unknown Exception ");
865 } /* switch(header->message_type) */
871 /* Unknown GIOP Message */
873 g_warning("Unknown GIOP Message");
879 } /* switch(header->message_type) */
885 * IDL:omg.org/CosNaming/NamingContext/new_context:1.0
889 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_) {
891 gboolean stream_is_big_endian; /* big endianess */
894 /* Operation specific Variable declarations Begin */
897 /* Operation specific Variable declarations End */
900 stream_is_big_endian = is_big_endian(header);
902 switch(header->message_type) {
910 switch(header->rep_status) {
914 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
925 /* Unknown Exception */
927 g_warning("Unknown Exception ");
934 } /* switch(header->message_type) */
940 /* Unknown GIOP Message */
942 g_warning("Unknown GIOP Message");
948 } /* switch(header->message_type) */
954 * IDL:omg.org/CosNaming/NamingContext/bind_new_context:1.0
958 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_) {
960 gboolean stream_is_big_endian; /* big endianess */
963 /* Operation specific Variable declarations Begin */
965 guint32 u_octet4_loop_n;
968 /* Operation specific Variable declarations End */
971 stream_is_big_endian = is_big_endian(header);
973 switch(header->message_type) {
977 u_octet4_loop_n = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
979 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of n = %u",u_octet4_loop_n);
982 for (i_n=0; i_n < u_octet4_loop_n; i_n++) {
984 /* Begin struct "CosNaming_NameComponent" */
988 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
991 /* End struct "CosNaming_NameComponent" */
999 switch(header->rep_status) {
1003 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
1008 case USER_EXCEPTION:
1014 /* Unknown Exception */
1016 g_warning("Unknown Exception ");
1023 } /* switch(header->message_type) */
1029 /* Unknown GIOP Message */
1031 g_warning("Unknown GIOP Message");
1037 } /* switch(header->message_type) */
1043 * IDL:omg.org/CosNaming/NamingContext/destroy:1.0
1047 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_) {
1049 gboolean stream_is_big_endian; /* big endianess */
1052 /* Operation specific Variable declarations Begin */
1055 /* Operation specific Variable declarations End */
1058 stream_is_big_endian = is_big_endian(header);
1060 switch(header->message_type) {
1068 switch(header->rep_status) {
1073 /* Function returns void */
1078 case USER_EXCEPTION:
1084 /* Unknown Exception */
1086 g_warning("Unknown Exception ");
1093 } /* switch(header->message_type) */
1099 /* Unknown GIOP Message */
1101 g_warning("Unknown GIOP Message");
1107 } /* switch(header->message_type) */
1113 * IDL:omg.org/CosNaming/NamingContext/list:1.0
1117 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_) {
1119 gboolean stream_is_big_endian; /* big endianess */
1122 /* Operation specific Variable declarations Begin */
1125 guint32 u_octet4_loop_bl;
1128 /* Operation specific Variable declarations End */
1131 stream_is_big_endian = is_big_endian(header);
1133 switch(header->message_type) {
1137 u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary);
1139 proto_tree_add_text(tree,tvb,*offset-4,4,"how_many = %u",u_octet4);
1146 switch(header->rep_status) {
1151 /* Function returns void */
1154 u_octet4_loop_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
1156 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of bl = %u",u_octet4_loop_bl);
1159 for (i_bl=0; i_bl < u_octet4_loop_bl; i_bl++) {
1161 /* Begin struct "CosNaming_Binding" */
1165 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation);
1168 /* End struct "CosNaming_Binding" */
1172 get_CDR_object(tvb, pinfo, tree, offset, stream_is_big_endian, boundary);
1177 case USER_EXCEPTION:
1183 /* Unknown Exception */
1185 g_warning("Unknown Exception ");
1192 } /* switch(header->message_type) */
1198 /* Unknown GIOP Message */
1200 g_warning("Unknown GIOP Message");
1206 } /* switch(header->message_type) */
1212 * IDL:omg.org/CosNaming/BindingIterator/next_one:1.0
1216 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_) {
1218 gboolean stream_is_big_endian; /* big endianess */
1221 /* Operation specific Variable declarations Begin */
1225 /* Operation specific Variable declarations End */
1228 stream_is_big_endian = is_big_endian(header);
1230 switch(header->message_type) {
1238 switch(header->rep_status) {
1242 u_octet1 = get_CDR_boolean(tvb,offset);
1244 proto_tree_add_text(tree,tvb,*offset-1,1,"Operation_Return_Value = %u",u_octet1);
1247 /* Begin struct "CosNaming_Binding" */
1251 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation);
1254 /* End struct "CosNaming_Binding" */
1258 case USER_EXCEPTION:
1264 /* Unknown Exception */
1266 g_warning("Unknown Exception ");
1273 } /* switch(header->message_type) */
1279 /* Unknown GIOP Message */
1281 g_warning("Unknown GIOP Message");
1287 } /* switch(header->message_type) */
1293 * IDL:omg.org/CosNaming/BindingIterator/next_n:1.0
1297 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_) {
1299 gboolean stream_is_big_endian; /* big endianess */
1302 /* Operation specific Variable declarations Begin */
1306 guint32 u_octet4_loop_bl;
1309 /* Operation specific Variable declarations End */
1312 stream_is_big_endian = is_big_endian(header);
1314 switch(header->message_type) {
1318 u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian, boundary);
1320 proto_tree_add_text(tree,tvb,*offset-4,4,"how_many = %u",u_octet4);
1327 switch(header->rep_status) {
1331 u_octet1 = get_CDR_boolean(tvb,offset);
1333 proto_tree_add_text(tree,tvb,*offset-1,1,"Operation_Return_Value = %u",u_octet1);
1336 u_octet4_loop_bl = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
1338 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of bl = %u",u_octet4_loop_bl);
1341 for (i_bl=0; i_bl < u_octet4_loop_bl; i_bl++) {
1343 /* Begin struct "CosNaming_Binding" */
1347 decode_CosNaming_Binding_st(tvb, pinfo, tree, offset, header, operation);
1350 /* End struct "CosNaming_Binding" */
1356 case USER_EXCEPTION:
1362 /* Unknown Exception */
1364 g_warning("Unknown Exception ");
1371 } /* switch(header->message_type) */
1377 /* Unknown GIOP Message */
1379 g_warning("Unknown GIOP Message");
1385 } /* switch(header->message_type) */
1391 * IDL:omg.org/CosNaming/BindingIterator/destroy:1.0
1395 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_) {
1397 gboolean stream_is_big_endian; /* big endianess */
1400 /* Operation specific Variable declarations Begin */
1403 /* Operation specific Variable declarations End */
1406 stream_is_big_endian = is_big_endian(header);
1408 switch(header->message_type) {
1416 switch(header->rep_status) {
1421 /* Function returns void */
1426 case USER_EXCEPTION:
1432 /* Unknown Exception */
1434 g_warning("Unknown Exception ");
1441 } /* switch(header->message_type) */
1447 /* Unknown GIOP Message */
1449 g_warning("Unknown GIOP Message");
1455 } /* switch(header->message_type) */
1460 /* Struct = IDL:omg.org/CosNaming/NameComponent:1.0 */
1462 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_) {
1464 gboolean stream_is_big_endian; /* big endianess */
1467 /* Operation specific Variable declarations Begin */
1472 /* Operation specific Variable declarations End */
1475 stream_is_big_endian = is_big_endian(header); /* get stream endianess */
1478 u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary);
1480 proto_tree_add_text(tree,tvb,*offset-u_octet4,u_octet4,"NameComponent_id (%u) = %s",
1481 u_octet4, (u_octet4 > 0) ? seq : "");
1484 g_free(seq); /* free buffer */
1487 u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary);
1489 proto_tree_add_text(tree,tvb,*offset-u_octet4,u_octet4,"NameComponent_kind (%u) = %s",
1490 u_octet4, (u_octet4 > 0) ? seq : "");
1493 g_free(seq); /* free buffer */
1499 /* Struct = IDL:omg.org/CosNaming/Binding:1.0 */
1501 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_) {
1503 gboolean stream_is_big_endian; /* big endianess */
1506 /* Operation specific Variable declarations Begin */
1508 guint32 u_octet4_loop_Binding_binding_name;
1509 guint32 i_Binding_binding_name;
1512 /* Operation specific Variable declarations End */
1515 stream_is_big_endian = is_big_endian(header); /* get stream endianess */
1518 u_octet4_loop_Binding_binding_name = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary);
1520 proto_tree_add_text(tree,tvb,*offset-4, 4 ,"Seq length of Binding_binding_name = %u",u_octet4_loop_Binding_binding_name);
1523 for (i_Binding_binding_name=0; i_Binding_binding_name < u_octet4_loop_Binding_binding_name; i_Binding_binding_name++) {
1525 /* Begin struct "CosNaming_NameComponent" */
1529 decode_CosNaming_NameComponent_st(tvb, pinfo, tree, offset, header, operation);
1532 /* End struct "CosNaming_NameComponent" */
1537 u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
1539 proto_tree_add_text(tree,tvb,*offset-4,4,"Enum value = %u (%s)",u_octet4,val_to_str(u_octet4,CosNaming_BindingType,"Unknown Enum Value"));
1546 * Called once we accept the packet as being for us; it sets the
1547 * Protocol and Info columns and creates the top-level protocol
1550 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset) {
1552 proto_item *ti = NULL;
1553 proto_tree *tree = NULL; /* init later, inside if(tree) */
1555 col_set_str(pinfo->cinfo, COL_PROTOCOL, "COSNAMING");
1558 * Do not clear COL_INFO, as nothing is being written there by
1559 * this dissector yet. So leave it as is from the GIOP dissector.
1560 * TODO: add something useful to COL_INFO
1561 * if (check_col(pinfo->cinfo, COL_INFO))
1562 * col_clear(pinfo->cinfo, COL_INFO);
1566 ti = proto_tree_add_item(ptree, proto_cosnaming, tvb, *offset, -1, FALSE);
1567 tree = proto_item_add_subtree(ti, ett_cosnaming);
1572 static gboolean dissect_cosnaming(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, gchar *operation, gchar *idlname) {
1574 gboolean be; /* big endianess */
1575 proto_tree *tree _U_;
1577 be = is_big_endian(header); /* get endianess - TODO use passed in stream_is_big_endian instead ? */
1579 /* If we have a USER Exception, then decode it and return */
1581 if ((header->message_type == Reply) && (header->rep_status == USER_EXCEPTION)) {
1583 return decode_user_exception(tvb, pinfo, ptree, offset, header, operation);
1589 switch(header->message_type) {
1595 if (strcmp(operation, CosNaming_NamingContext_bind_op) == 0
1596 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1597 tree = start_dissecting(tvb, pinfo, ptree, offset);
1598 decode_CosNaming_NamingContext_bind(tvb, pinfo, tree, offset, header, operation);
1602 if (strcmp(operation, CosNaming_NamingContext_rebind_op) == 0
1603 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1604 tree = start_dissecting(tvb, pinfo, ptree, offset);
1605 decode_CosNaming_NamingContext_rebind(tvb, pinfo, tree, offset, header, operation);
1609 if (strcmp(operation, CosNaming_NamingContext_bind_context_op) == 0
1610 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1611 tree = start_dissecting(tvb, pinfo, ptree, offset);
1612 decode_CosNaming_NamingContext_bind_context(tvb, pinfo, tree, offset, header, operation);
1616 if (strcmp(operation, CosNaming_NamingContext_rebind_context_op) == 0
1617 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1618 tree = start_dissecting(tvb, pinfo, ptree, offset);
1619 decode_CosNaming_NamingContext_rebind_context(tvb, pinfo, tree, offset, header, operation);
1623 if (strcmp(operation, CosNaming_NamingContext_resolve_op) == 0
1624 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1625 tree = start_dissecting(tvb, pinfo, ptree, offset);
1626 decode_CosNaming_NamingContext_resolve(tvb, pinfo, tree, offset, header, operation);
1630 if (strcmp(operation, CosNaming_NamingContext_unbind_op) == 0
1631 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1632 tree = start_dissecting(tvb, pinfo, ptree, offset);
1633 decode_CosNaming_NamingContext_unbind(tvb, pinfo, tree, offset, header, operation);
1637 if (strcmp(operation, CosNaming_NamingContext_new_context_op) == 0
1638 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1639 tree = start_dissecting(tvb, pinfo, ptree, offset);
1640 decode_CosNaming_NamingContext_new_context(tvb, pinfo, tree, offset, header, operation);
1644 if (strcmp(operation, CosNaming_NamingContext_bind_new_context_op) == 0
1645 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1646 tree = start_dissecting(tvb, pinfo, ptree, offset);
1647 decode_CosNaming_NamingContext_bind_new_context(tvb, pinfo, tree, offset, header, operation);
1651 if (strcmp(operation, CosNaming_NamingContext_destroy_op) == 0
1652 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1653 tree = start_dissecting(tvb, pinfo, ptree, offset);
1654 decode_CosNaming_NamingContext_destroy(tvb, pinfo, tree, offset, header, operation);
1658 if (strcmp(operation, CosNaming_NamingContext_list_op) == 0
1659 && (!idlname || strcmp(idlname, "CosNaming/NamingContext") == 0)) {
1660 tree = start_dissecting(tvb, pinfo, ptree, offset);
1661 decode_CosNaming_NamingContext_list(tvb, pinfo, tree, offset, header, operation);
1665 if (strcmp(operation, CosNaming_BindingIterator_next_one_op) == 0
1666 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1667 tree = start_dissecting(tvb, pinfo, ptree, offset);
1668 decode_CosNaming_BindingIterator_next_one(tvb, pinfo, tree, offset, header, operation);
1672 if (strcmp(operation, CosNaming_BindingIterator_next_n_op) == 0
1673 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1674 tree = start_dissecting(tvb, pinfo, ptree, offset);
1675 decode_CosNaming_BindingIterator_next_n(tvb, pinfo, tree, offset, header, operation);
1679 if (strcmp(operation, CosNaming_BindingIterator_destroy_op) == 0
1680 && (!idlname || strcmp(idlname, "CosNaming/BindingIterator") == 0)) {
1681 tree = start_dissecting(tvb, pinfo, ptree, offset);
1682 decode_CosNaming_BindingIterator_destroy(tvb, pinfo, tree, offset, header, operation);
1692 case CloseConnection:
1695 return FALSE; /* not handled yet */
1698 return FALSE; /* not handled yet */
1706 } /* End of main dissector */
1711 /* Register the protocol with Wireshark */
1713 void proto_register_giop_cosnaming(void) {
1715 /* setup list of header fields */
1718 static hf_register_info hf[] = {
1725 /* setup protocol subtree array */
1727 static gint *ett[] = {
1731 /* Register the protocol name and description */
1733 proto_cosnaming = proto_register_protocol("Cosnaming Dissector Using GIOP API" , "COSNAMING", "giop-cosnaming" );
1736 proto_register_field_array(proto_cosnaming, hf, array_length(hf));
1738 proto_register_subtree_array(ett,array_length(ett));
1745 /* register me as handler for these interfaces */
1747 void proto_register_handoff_giop_cosnaming(void) {
1752 /* Register for Explicit Dissection */
1754 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/BindingIterator", proto_cosnaming ); /* explicit dissector */
1760 /* Register for Explicit Dissection */
1762 register_giop_user_module(dissect_cosnaming, "COSNAMING", "CosNaming/NamingContext", proto_cosnaming ); /* explicit dissector */
1768 /* Register for Heuristic Dissection */
1770 register_giop_user(dissect_cosnaming, "COSNAMING" ,proto_cosnaming); /* heuristic dissector */
1778 #ifndef ENABLE_STATIC
1780 G_MODULE_EXPORT void
1781 plugin_register(void)
1783 if (proto_cosnaming == -1) {
1784 proto_register_giop_cosnaming();
1788 G_MODULE_EXPORT void
1789 plugin_reg_handoff(void){
1790 proto_register_handoff_giop_cosnaming();