diff options
Diffstat (limited to 'epan/dissectors/packet-coseventcomm.c')
-rw-r--r-- | epan/dissectors/packet-coseventcomm.c | 139 |
1 files changed, 74 insertions, 65 deletions
diff --git a/epan/dissectors/packet-coseventcomm.c b/epan/dissectors/packet-coseventcomm.c index e7ad24a9..1b97602b 100644 --- a/epan/dissectors/packet-coseventcomm.c +++ b/epan/dissectors/packet-coseventcomm.c @@ -25,6 +25,7 @@ #include <epan/proto.h> #include "packet-giop.h" #include <epan/expert.h> +#include <wsutil/array.h> #include "ws_diag_control.h" #include "ws_compiler_tests.h" @@ -45,22 +46,26 @@ void proto_register_giop_coseventcomm(void); void proto_reg_handoff_giop_coseventcomm(void); /* Initialise the protocol and subtree pointers */ -static int proto_coseventcomm = -1; -static gint ett_coseventcomm = -1; +static int proto_coseventcomm; +static int ett_coseventcomm; +static int ett_giop_struct; +static int ett_giop_sequence; +static int ett_giop_array; +static int ett_giop_union; /* Initialise the initial Alignment */ -static guint32 boundary = GIOP_HEADER_SIZE; /* initial value */ +static uint32_t boundary = GIOP_HEADER_SIZE; /* initial value */ -static int hf_operationrequest = -1;/* Request_Operation field */ +static int hf_operationrequest;/* Request_Operation field */ /* Operation filters */ -static int hf_CosEventComm_PullSupplier_try_pull_has_event = -1; +static int hf_CosEventComm_PullSupplier_try_pull_has_event; /* User exception filters */ /* Expert info filters */ -static expert_field ei_coseventcomm_unknown_giop_msg = EI_INIT; -static expert_field ei_coseventcomm_unknown_exception = EI_INIT; -static expert_field ei_coseventcomm_unknown_reply_status = EI_INIT; +static expert_field ei_coseventcomm_unknown_giop_msg; +static expert_field ei_coseventcomm_unknown_exception; +static expert_field ei_coseventcomm_unknown_reply_status; static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset); @@ -76,28 +81,26 @@ static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tre * Main delegator for exception handling * */ -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_) +static bool +decode_user_exception(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *ptree _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { proto_tree *tree _U_; if (!header->exception_id) - return FALSE; + return false; - return FALSE; /* user exception not found */ + return false; /* user exception not found */ } /* - * IDL:omg.org/CosEventComm/PushConsumer/push:1.0 + * IDL:omg.org/CosEventComm/PullConsumer/disconnect_pull_consumer:1.0 */ static void -decode_CosEventComm_PushConsumer_push(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_) +decode_CosEventComm_PullConsumer_disconnect_pull_consumer(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: - get_CDR_any(tvb, pinfo, tree, item, offset, stream_is_big_endian, boundary, header); - break; case Reply: switch(header->rep_status) { @@ -122,10 +125,10 @@ decode_CosEventComm_PushConsumer_push(tvbuff_t *tvb _U_, packet_info *pinfo _U_, } /* - * IDL:omg.org/CosEventComm/PushConsumer/disconnect_push_consumer:1.0 + * IDL:omg.org/CosEventComm/PullSupplier/disconnect_pull_supplier:1.0 */ static void -decode_CosEventComm_PushConsumer_disconnect_push_consumer(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_) +decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: @@ -153,10 +156,10 @@ decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvbuff_t *tvb _U_, pac } /* - * IDL:omg.org/CosEventComm/PushSupplier/disconnect_push_supplier:1.0 + * IDL:omg.org/CosEventComm/PullSupplier/try_pull:1.0 */ static void -decode_CosEventComm_PushSupplier_disconnect_push_supplier(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_) +decode_CosEventComm_PullSupplier_try_pull(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: @@ -164,7 +167,9 @@ decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvbuff_t *tvb _U_, pac case Reply: switch(header->rep_status) { case NO_EXCEPTION: - /* Function returns void */ + get_CDR_any(tvb, pinfo, tree, item, offset, stream_is_big_endian, boundary, header); + + proto_tree_add_boolean(tree, hf_CosEventComm_PullSupplier_try_pull_has_event, tvb, *offset-1, 1, get_CDR_boolean(tvb,offset)); break; case USER_EXCEPTION: @@ -187,7 +192,7 @@ decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvbuff_t *tvb _U_, pac * IDL:omg.org/CosEventComm/PullSupplier/pull:1.0 */ static void -decode_CosEventComm_PullSupplier_pull(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_) +decode_CosEventComm_PullSupplier_pull(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: @@ -215,10 +220,10 @@ decode_CosEventComm_PullSupplier_pull(tvbuff_t *tvb _U_, packet_info *pinfo _U_, } /* - * IDL:omg.org/CosEventComm/PullSupplier/try_pull:1.0 + * IDL:omg.org/CosEventComm/PushSupplier/disconnect_push_supplier:1.0 */ static void -decode_CosEventComm_PullSupplier_try_pull(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_) +decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: @@ -226,9 +231,7 @@ decode_CosEventComm_PullSupplier_try_pull(tvbuff_t *tvb _U_, packet_info *pinfo case Reply: switch(header->rep_status) { case NO_EXCEPTION: - get_CDR_any(tvb, pinfo, tree, item, offset, stream_is_big_endian, boundary, header); - - proto_tree_add_boolean(tree, hf_CosEventComm_PullSupplier_try_pull_has_event, tvb, *offset-1, 1, get_CDR_boolean(tvb,offset)); + /* Function returns void */ break; case USER_EXCEPTION: @@ -248,10 +251,10 @@ decode_CosEventComm_PullSupplier_try_pull(tvbuff_t *tvb _U_, packet_info *pinfo } /* - * IDL:omg.org/CosEventComm/PullSupplier/disconnect_pull_supplier:1.0 + * IDL:omg.org/CosEventComm/PushConsumer/disconnect_push_consumer:1.0 */ static void -decode_CosEventComm_PullSupplier_disconnect_pull_supplier(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_) +decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: @@ -279,13 +282,15 @@ decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvbuff_t *tvb _U_, pac } /* - * IDL:omg.org/CosEventComm/PullConsumer/disconnect_pull_consumer:1.0 + * IDL:omg.org/CosEventComm/PushConsumer/push:1.0 */ static void -decode_CosEventComm_PullConsumer_disconnect_pull_consumer(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_) +decode_CosEventComm_PushConsumer_push(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, proto_item *item _U_, int *offset _U_, MessageHeader *header, const char *operation _U_, bool stream_is_big_endian _U_) { switch(header->message_type) { case Request: + get_CDR_any(tvb, pinfo, tree, item, offset, stream_is_big_endian, boundary, header); + break; case Reply: switch(header->rep_status) { @@ -338,7 +343,7 @@ start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offs } static proto_item* -process_RequestOperation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, MessageHeader *header, const gchar *operation) +process_RequestOperation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, MessageHeader *header, const char *operation) { proto_item *pi; if(header->message_type == Reply) { @@ -351,12 +356,12 @@ process_RequestOperation(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, M return pi; } -static gboolean -dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, const gchar *operation, gchar *idlname) +static bool +dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset, MessageHeader *header, const char *operation, char *idlname) { proto_item *item _U_; proto_tree *tree _U_; - gboolean stream_is_big_endian = is_big_endian(header); /* get endianess */ + bool stream_is_big_endian = is_big_endian(header); /* get endianess */ /* If we have a USER Exception, then decode it and return */ if ((header->message_type == Reply) && (header->rep_status == USER_EXCEPTION)) { @@ -368,28 +373,28 @@ dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int * case Request: case Reply: - if (strcmp(operation, "push") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) { + if (strcmp(operation, "disconnect_pull_consumer") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PullConsumer") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PushConsumer_push(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PullConsumer_disconnect_pull_consumer(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } - if (strcmp(operation, "disconnect_push_consumer") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) { + if (strcmp(operation, "disconnect_pull_supplier") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } - if (strcmp(operation, "disconnect_push_supplier") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PushSupplier") == 0)) { + if (strcmp(operation, "try_pull") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PullSupplier_try_pull(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } if (strcmp(operation, "pull") == 0 @@ -397,31 +402,31 @@ dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int * item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); decode_CosEventComm_PullSupplier_pull(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + return true; } - if (strcmp(operation, "try_pull") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) { + if (strcmp(operation, "disconnect_push_supplier") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PushSupplier") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PullSupplier_try_pull(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PushSupplier_disconnect_push_supplier(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } - if (strcmp(operation, "disconnect_pull_supplier") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PullSupplier") == 0)) { + if (strcmp(operation, "disconnect_push_consumer") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PullSupplier_disconnect_pull_supplier(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PushConsumer_disconnect_push_consumer(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } - if (strcmp(operation, "disconnect_pull_consumer") == 0 - && (!idlname || strcmp(idlname, "CosEventComm/PullConsumer") == 0)) { + if (strcmp(operation, "push") == 0 + && (!idlname || strcmp(idlname, "CosEventComm/PushConsumer") == 0)) { item = process_RequestOperation(tvb, pinfo, ptree, header, operation); /* fill-up Request_Operation field & info column */ tree = start_dissecting(tvb, pinfo, ptree, offset); - decode_CosEventComm_PullConsumer_disconnect_pull_consumer(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); - return TRUE; + decode_CosEventComm_PushConsumer_push(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian); + return true; } break; @@ -432,15 +437,15 @@ dissect_coseventcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int * case CloseConnection: case MessageError: case Fragment: - return FALSE; /* not handled yet */ + return false; /* not handled yet */ default: - return FALSE; /* not handled yet */ + return false; /* not handled yet */ } /* switch */ - return FALSE; + return false; } /* End of main dissector */ @@ -469,15 +474,19 @@ void proto_register_giop_coseventcomm(void) /* setup protocol subtree array */ - static gint *ett[] = { + static int *ett[] = { &ett_coseventcomm, + &ett_giop_struct, + &ett_giop_sequence, + &ett_giop_array, + &ett_giop_union, }; expert_module_t* expert_coseventcomm; /* Register the protocol name and description */ - proto_coseventcomm = proto_register_protocol("Coseventcomm Dissector Using GIOP API" , "COSEVENTCOMM", "giop-coseventcomm" ); + proto_coseventcomm = proto_register_protocol("Coseventcomm Dissector Using GIOP API" , "GIOP/COSEVENTCOMM", "giop-coseventcomm" ); proto_register_field_array(proto_coseventcomm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); |