1 /* packet-coseventcomm.c
2 * Routines for IDL dissection
4 * Autogenerated from idl2eth
5 * Copyright 2001 Frank Singleton <frank.singleton@ericsson.com>
10 * Wireshark - Network traffic analyzer
12 * Copyright 1999 - 2006 Gerald Combs
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
43 #include <epan/packet.h>
44 #include <epan/proto.h>
45 #include <epan/dissectors/packet-giop.h>
48 G_MODULE_EXPORT const gchar version[] = "0.0.1";
53 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset);
57 /* Struct prototype declaration Start */
60 /* Struct prototype declaration End */
63 /* Union prototype declaration Start */
66 /* Union prototype declaration End */
70 /* Initialise the protocol and subtree pointers */
72 static int proto_coseventcomm = -1;
74 static gint ett_coseventcomm = -1;
77 /* Initialise the initial Alignment */
79 static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */
83 /* Initialise the Registered fields */
85 /* TODO - Use registered fields */
88 * IDL Operations Start
91 static const char CosEventComm_PushConsumer_push_op[] = "push" ;
92 static const char CosEventComm_PushConsumer_disconnect_push_consumer_op[] = "disconnect_push_consumer" ;
93 static const char CosEventComm_PushSupplier_disconnect_push_supplier_op[] = "disconnect_push_supplier" ;
94 static const char CosEventComm_PullSupplier_pull_op[] = "pull" ;
95 static const char CosEventComm_PullSupplier_try_pull_op[] = "try_pull" ;
96 static const char CosEventComm_PullSupplier_disconnect_pull_supplier_op[] = "disconnect_pull_supplier" ;
97 static const char CosEventComm_PullConsumer_disconnect_pull_consumer_op[] = "disconnect_pull_consumer" ;
103 /* Begin Exception (containing members) String Declare */
107 /* End Exception (containing members) String Declare */
110 * IDL Attributes Start
126 /* Begin Exception Helper Functions */
130 /* End Exception Helper Functions */
133 * Main delegator for exception handling
137 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_ ) {
139 gboolean be _U_; /* big endianess */
140 proto_tree *tree _U_;
142 if (!header->exception_id)
147 return FALSE; /* user exception not found */
151 /* Begin Attribute Helper Functions */
154 /* End Attribute Helper Functions */
157 * IDL:omg.org/CosEventComm/PushConsumer/push:1.0
160 static void decode_CosEventComm_PushConsumer_push(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
162 gboolean stream_is_big_endian; /* big endianess */
165 /* Operation specific Variable declarations Begin */
168 /* Operation specific Variable declarations End */
170 stream_is_big_endian = is_big_endian(header);
172 switch(header->message_type) {
176 get_CDR_any(tvb,tree,offset,stream_is_big_endian, boundary, header);
182 switch(header->rep_status) {
186 /* Function returns void */
196 /* Unknown Exception */
198 g_warning("Unknown Exception ");
203 } /* switch(header->message_type) */
209 /* Unknown GIOP Message */
211 g_warning("Unknown GIOP Message");
215 } /* switch(header->message_type) */
220 * IDL:omg.org/CosEventComm/PushConsumer/disconnect_push_consumer:1.0
223 static void decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
225 gboolean stream_is_big_endian; /* big endianess */
228 /* Operation specific Variable declarations Begin */
231 /* Operation specific Variable declarations End */
233 stream_is_big_endian = is_big_endian(header);
235 switch(header->message_type) {
243 switch(header->rep_status) {
247 /* Function returns void */
257 /* Unknown Exception */
259 g_warning("Unknown Exception ");
264 } /* switch(header->message_type) */
270 /* Unknown GIOP Message */
272 g_warning("Unknown GIOP Message");
276 } /* switch(header->message_type) */
281 * IDL:omg.org/CosEventComm/PushSupplier/disconnect_push_supplier:1.0
284 static void decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
286 gboolean stream_is_big_endian; /* big endianess */
289 /* Operation specific Variable declarations Begin */
292 /* Operation specific Variable declarations End */
294 stream_is_big_endian = is_big_endian(header);
296 switch(header->message_type) {
304 switch(header->rep_status) {
308 /* Function returns void */
318 /* Unknown Exception */
320 g_warning("Unknown Exception ");
325 } /* switch(header->message_type) */
331 /* Unknown GIOP Message */
333 g_warning("Unknown GIOP Message");
337 } /* switch(header->message_type) */
342 * IDL:omg.org/CosEventComm/PullSupplier/pull:1.0
345 static void decode_CosEventComm_PullSupplier_pull(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
347 gboolean stream_is_big_endian; /* big endianess */
350 /* Operation specific Variable declarations Begin */
353 /* Operation specific Variable declarations End */
355 stream_is_big_endian = is_big_endian(header);
357 switch(header->message_type) {
365 switch(header->rep_status) {
369 get_CDR_any(tvb,tree,offset,stream_is_big_endian, boundary, header);
379 /* Unknown Exception */
381 g_warning("Unknown Exception ");
386 } /* switch(header->message_type) */
392 /* Unknown GIOP Message */
394 g_warning("Unknown GIOP Message");
398 } /* switch(header->message_type) */
403 * IDL:omg.org/CosEventComm/PullSupplier/try_pull:1.0
406 static void decode_CosEventComm_PullSupplier_try_pull(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
408 gboolean stream_is_big_endian; /* big endianess */
411 /* Operation specific Variable declarations Begin */
415 /* Operation specific Variable declarations End */
417 stream_is_big_endian = is_big_endian(header);
419 switch(header->message_type) {
427 switch(header->rep_status) {
431 get_CDR_any(tvb,tree,offset,stream_is_big_endian, boundary, header);
433 u_octet1 = get_CDR_boolean(tvb,offset);
435 proto_tree_add_text(tree,tvb,*offset-1,1,"has_event = %u",u_octet1);
446 /* Unknown Exception */
448 g_warning("Unknown Exception ");
453 } /* switch(header->message_type) */
459 /* Unknown GIOP Message */
461 g_warning("Unknown GIOP Message");
465 } /* switch(header->message_type) */
470 * IDL:omg.org/CosEventComm/PullSupplier/disconnect_pull_supplier:1.0
473 static void decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
475 gboolean stream_is_big_endian; /* big endianess */
478 /* Operation specific Variable declarations Begin */
481 /* Operation specific Variable declarations End */
483 stream_is_big_endian = is_big_endian(header);
485 switch(header->message_type) {
493 switch(header->rep_status) {
497 /* Function returns void */
507 /* Unknown Exception */
509 g_warning("Unknown Exception ");
514 } /* switch(header->message_type) */
520 /* Unknown GIOP Message */
522 g_warning("Unknown GIOP Message");
526 } /* switch(header->message_type) */
531 * IDL:omg.org/CosEventComm/PullConsumer/disconnect_pull_consumer:1.0
534 static void decode_CosEventComm_PullConsumer_disconnect_pull_consumer(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header, gchar *operation _U_) {
536 gboolean stream_is_big_endian; /* big endianess */
539 /* Operation specific Variable declarations Begin */
542 /* Operation specific Variable declarations End */
544 stream_is_big_endian = is_big_endian(header);
546 switch(header->message_type) {
554 switch(header->rep_status) {
558 /* Function returns void */
568 /* Unknown Exception */
570 g_warning("Unknown Exception ");
575 } /* switch(header->message_type) */
581 /* Unknown GIOP Message */
583 g_warning("Unknown GIOP Message");
587 } /* switch(header->message_type) */
592 * Called once we accept the packet as being for us; it sets the
593 * Protocol and Info columns and creates the top-level protocol
596 static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset) {
598 proto_item *ti = NULL;
599 proto_tree *tree = NULL; /* init later, inside if(tree) */
601 if (check_col(pinfo->cinfo, COL_PROTOCOL))
602 col_set_str(pinfo->cinfo, COL_PROTOCOL, "COSEVENTCOMM");
605 * Do not clear COL_INFO, as nothing is being written there by
606 * this dissector yet. So leave it as is from the GIOP dissector.
607 * TODO: add something useful to COL_INFO
608 * if (check_col(pinfo->cinfo, COL_INFO))
609 * col_clear(pinfo->cinfo, COL_INFO);
613 ti = proto_tree_add_item(ptree, proto_coseventcomm, tvb, *offset, -1, FALSE);
614 tree = proto_item_add_subtree(ti, ett_coseventcomm);
619 static gboolean dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, gchar *operation, gchar *idlname) {
621 gboolean be; /* big endianess */
622 proto_tree *tree _U_;
624 be = is_big_endian(header); /* get endianess - TODO use passed in stream_is_big_endian instead ? */
626 /* If we have a USER Exception, then decode it and return */
628 if ((header->message_type == Reply) && (header->rep_status == USER_EXCEPTION)) {
630 return decode_user_exception(tvb, pinfo, ptree, offset, header, operation);
634 switch(header->message_type) {
639 if (strcmp(operation, CosEventComm_PushConsumer_push_op) == 0
640 && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) {
641 tree = start_dissecting(tvb, pinfo, ptree, offset);
642 decode_CosEventComm_PushConsumer_push(tvb, pinfo, tree, offset, header, operation);
646 if (strcmp(operation, CosEventComm_PushConsumer_disconnect_push_consumer_op) == 0
647 && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) {
648 tree = start_dissecting(tvb, pinfo, ptree, offset);
649 decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvb, pinfo, tree, offset, header, operation);
653 if (strcmp(operation, CosEventComm_PushSupplier_disconnect_push_supplier_op) == 0
654 && (!idlname || strcmp(idlname, "CosEventComm/PushSupplier") == 0)) {
655 tree = start_dissecting(tvb, pinfo, ptree, offset);
656 decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvb, pinfo, tree, offset, header, operation);
660 if (strcmp(operation, CosEventComm_PullSupplier_pull_op) == 0
661 && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) {
662 tree = start_dissecting(tvb, pinfo, ptree, offset);
663 decode_CosEventComm_PullSupplier_pull(tvb, pinfo, tree, offset, header, operation);
667 if (strcmp(operation, CosEventComm_PullSupplier_try_pull_op) == 0
668 && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) {
669 tree = start_dissecting(tvb, pinfo, ptree, offset);
670 decode_CosEventComm_PullSupplier_try_pull(tvb, pinfo, tree, offset, header, operation);
674 if (strcmp(operation, CosEventComm_PullSupplier_disconnect_pull_supplier_op) == 0
675 && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) {
676 tree = start_dissecting(tvb, pinfo, ptree, offset);
677 decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvb, pinfo, tree, offset, header, operation);
681 if (strcmp(operation, CosEventComm_PullConsumer_disconnect_pull_consumer_op) == 0
682 && (!idlname || strcmp(idlname, "CosEventComm/PullConsumer") == 0)) {
683 tree = start_dissecting(tvb, pinfo, ptree, offset);
684 decode_CosEventComm_PullConsumer_disconnect_pull_consumer(tvb, pinfo, tree, offset, header, operation);
694 case CloseConnection:
697 return FALSE; /* not handled yet */
700 return FALSE; /* not handled yet */
707 } /* End of main dissector */
711 /* Register the protocol with Wireshark */
713 void proto_register_giop_coseventcomm(void) {
715 /* setup list of header fields */
718 static hf_register_info hf[] = {
725 /* setup protocol subtree array */
727 static gint *ett[] = {
731 /* Register the protocol name and description */
733 proto_coseventcomm = proto_register_protocol("Coseventcomm Dissector Using GIOP API" , "COSEVENTCOMM", "giop-coseventcomm" );
736 proto_register_field_array(proto_coseventcomm, hf, array_length(hf));
738 proto_register_subtree_array(ett,array_length(ett));
743 /* register me as handler for these interfaces */
745 void proto_register_handoff_giop_coseventcomm(void) {
749 /* Register for Explicit Dissection */
751 register_giop_user_module(dissect_coseventcomm, "COSEVENTCOMM", "CosEventComm/PullConsumer", proto_coseventcomm ); /* explicit dissector */
754 /* Register for Explicit Dissection */
756 register_giop_user_module(dissect_coseventcomm, "COSEVENTCOMM", "CosEventComm/PullSupplier", proto_coseventcomm ); /* explicit dissector */
759 /* Register for Explicit Dissection */
761 register_giop_user_module(dissect_coseventcomm, "COSEVENTCOMM", "CosEventComm/PushConsumer", proto_coseventcomm ); /* explicit dissector */
764 /* Register for Explicit Dissection */
766 register_giop_user_module(dissect_coseventcomm, "COSEVENTCOMM", "CosEventComm/PushSupplier", proto_coseventcomm ); /* explicit dissector */
769 /* Register for Heuristic Dissection */
771 register_giop_user(dissect_coseventcomm, "COSEVENTCOMM" ,proto_coseventcomm); /* heuristic dissector */
777 #ifndef ENABLE_STATIC
780 plugin_register(void)
782 if (proto_coseventcomm == -1) {
783 proto_register_giop_coseventcomm();
788 plugin_reg_handoff(void){
789 proto_register_handoff_giop_coseventcomm();