*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* 34. For complex TypeCodes need to check final offset against original offset + sequence length.
* 35. Update REQUEST/REPLY 1_2 according to IDL (eg; ServiceContextList etc).
* 36. Adding decode_ServiceContextList, incomplete.
- * 37. Helper functions should not ALWAYS rely on header to find current endianess. It should
+ * 37. Helper functions should not ALWAYS rely on header to find current endianness. It should
* be passed from user, eg Use stream_is_big_endian. [started]
* 38. Remove unwanted/unused function parameters, see decode_IOR [started]
* 40. Add sequence <IOP::TaggedComponent> components to IIOP IOR profile. Perhaps
* To quote from the ever helpful development list
*
* " When a capture file is initially loaded, all "visited" flags
- * are 0. Ethereal then makes the first pass through file,
+ * are 0. Wireshark then makes the first pass through file,
* sequentially dissecting each packet. After the packet is
* dissected the first time, "visited" is 1. (See the end of
* dissect_packet() in epan/packet.c; that's the code that
* sets "visited" to 1).
* By the time a user clicks on a packet, "visited" will already
- * be 1 because Ethereal will have already done its first pass
+ * be 1 because Wireshark will have already done its first pass
* through the packets.
* Reload acts just like a normal Close/Open, except that it
#include "isprint.h"
#include <epan/packet.h>
-#include "packet-giop.h"
+#include <epan/conversation.h>
#include <epan/emem.h>
+#include <epan/prefs.h>
+
+#include "packet-giop.h"
+#include "packet-ziop.h"
+#include "packet-tcp.h"
+#include <wsutil/file_util.h>
+
/*
* Set to 1 for DEBUG output - TODO make this a runtime option
#define DEBUG 0
-
-
/*
* ------------------------------------------------------------------------------------------+
* Private Helper function Declarations
static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- guint32 boundary, gboolean new_endianess, gchar *repobuf,
+ guint32 boundary, gboolean new_endianness, gchar *repobuf,
gboolean store_flag);
static void decode_ServiceContextList(tvbuff_t *tvb, proto_tree *tree, int *offset,
gboolean stream_is_big_endian, guint32 boundary);
static void dissect_tk_sequence_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_array_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_alias_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_except_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_value_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_value_box_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header);
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header);
static void dissect_tk_native_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary);
+ gboolean stream_is_big_endian, guint32 boundary);
static void dissect_tk_abstract_interface_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary);
+ gboolean stream_is_big_endian, guint32 boundary);
static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id );
+ gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id );
static void dissect_data_for_typecode(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header, guint32 data_type );
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header, guint32 data_type );
static int proto_giop = -1;
+static int hf_giop_message_flags = -1;
+static int hf_giop_message_flags_ziop_enabled = -1;
+static int hf_giop_message_flags_ziop_supported = -1;
+static int hf_giop_message_flags_fragment = -1;
+static int hf_giop_message_flags_little_endian = -1;
static int hf_giop_message_type = -1;
static int hf_giop_message_size = -1;
static int hf_giop_repoid = -1;
static int hf_giop_type_id = -1;
static int hf_giop_iiop_v_maj = -1;
static int hf_giop_iiop_v_min = -1;
-static int hf_giop_endianess = -1; /* esp encapsulations */
+static int hf_giop_endianness = -1; /* esp encapsulations */
+static int hf_giop_compressed = -1;
static int hf_giop_IOR_tag = -1;
static int hf_giop_IIOP_tag = -1;
static int hf_giop_reply_status = -1;
static int hf_giop_exception_id = -1;
+static int hf_giop_objekt_key = -1;
/*
* (sub)Tree declares
*/
static gint ett_giop = -1;
+static gint ett_giop_message_flags = -1;
static gint ett_giop_reply = -1;
static gint ett_giop_request = -1;
static gint ett_giop_cancel_request = -1;
static gint ett_giop_locate_reply = -1;
static gint ett_giop_fragment = -1;
-static gint ett_giop_scl = -1; /* ServiceContextList */
-static gint ett_giop_scl_st1 = -1;
-static gint ett_giop_ior = -1; /* IOR */
+static gint ett_giop_scl = -1; /* ServiceContextList */
+static gint ett_giop_scl_st1 = -1;
+static gint ett_giop_ior = -1; /* IOR */
+
+static const int *giop_message_flags[] = {
+ &hf_giop_message_flags_ziop_enabled,
+ &hf_giop_message_flags_ziop_supported,
+ &hf_giop_message_flags_fragment,
+ &hf_giop_message_flags_little_endian,
+ NULL
+};
static dissector_handle_t data_handle;
-/* GIOP endianess */
+static dissector_handle_t giop_tcp_handle;
+
+#define GIOP_MESSAGE_FLAGS_ZIOP_ENABLED 0x08
+#define GIOP_MESSAGE_FLAGS_ZIOP_SUPPORTED 0x04
+#define GIOP_MESSAGE_FLAGS_FRAGMENT 0x02
+#define GIOP_MESSAGE_FLAGS_ENDIANNESS 0x01
+
+/* GIOP endianness */
-static const value_string giop_endianess_vals[] = {
+static const value_string giop_endianness_vals[] = {
{ 0x0, "Big Endian" },
{ 0x1, "Little Endian" },
{ 0, NULL}
};
-static const value_string sync_scope[] = {
- { 0x0, "SYNC_NONE" },
- { 0x1, "SYNC_WITH_TRANSPORT"},
- { 0x2, "SYNC_WITH_SERVER"},
- { 0x3, "SYNC_WITH_TARGET"},
- { 0, NULL}
+/*
+ static const value_string sync_scope[] = {
+ { 0x0, "SYNC_NONE" },
+ { 0x1, "SYNC_WITH_TRANSPORT"},
+ { 0x2, "SYNC_WITH_SERVER"},
+ { 0x3, "SYNC_WITH_TARGET"},
+ { 0, NULL}
+ };
+Bug fix:
+https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2800
+http://ethereal.netmirror.org/lists/ethereal-users/200303/msg00135.html
+*/
+static const value_string response_flags_vals[] = {
+ { 0x0, "SyncScope NONE or WITH_TRANSPORT" },
+ { 0x1, "SyncScope WITH_SERVER"},
+ { 0x3, "SyncScope WITH_TARGET"},
+ { 0, NULL}
};
/* Profile ID's */
static const value_string profile_id_vals[] = {
- { 0x0, "TAG_INTERNET_IOP" },
- { 0x1, "TAG_MULTIPLE_COMPONENTS"},
- { 0x2, "TAG_SCCP_IOP"},
- { 0, NULL}
+ { 0x0, "TAG_INTERNET_IOP" },
+ { 0x1, "TAG_MULTIPLE_COMPONENTS"},
+ { 0x2, "TAG_SCCP_IOP"},
+ { 0x3, "TAG_UIPMC"},
+ { 0, NULL}
};
static const value_string giop_message_types[] = {
- { 0x0, "Request" },
- { 0x1, "Reply"},
- { 0x2, "CancelRequest"},
- { 0x3, "LocateRequest"},
- { 0x4, "LocateReply"},
- { 0x5, "CloseConnection"},
- { 0x6, "MessageError"},
- { 0x7, "Fragment"},
- { 0, NULL}
+ { 0x0, "Request" },
+ { 0x1, "Reply"},
+ { 0x2, "CancelRequest"},
+ { 0x3, "LocateRequest"},
+ { 0x4, "LocateReply"},
+ { 0x5, "CloseConnection"},
+ { 0x6, "MessageError"},
+ { 0x7, "Fragment"},
+ { 0, NULL}
};
static const value_string giop_locate_status_types[] = {
- { 0x0, "Unknown Object" },
- { 0x1, "Object Here"},
- { 0x2, "Object Forward"},
- { 0x3, "Object Forward Perm"},
- { 0x4, "Loc System Exception"},
- { 0x5, "Loc Needs Addressing Mode"},
- { 0, NULL }
+ { 0x0, "Unknown Object" },
+ { 0x1, "Object Here"},
+ { 0x2, "Object Forward"},
+ { 0x3, "Object Forward Perm"},
+ { 0x4, "Loc System Exception"},
+ { 0x5, "Loc Needs Addressing Mode"},
+ { 0, NULL }
};
static const value_string tckind_vals[] = {
*/
static const guint32 max_service_context_id = 0x10;
static const value_string service_context_ids[] = {
- { 0x00, "TransactionService" },
- { 0x01, "CodeSets"},
- { 0x02, "ChainBypassCheck"},
- { 0x03, "ChainBypassInfo"},
- { 0x04, "LogicalThreadId"},
- { 0x05, "BI_DIR_IIOP"},
- { 0x06, "SendingContextRunTime"},
- { 0x07, "INVOCATION_POLICIES"},
- { 0x08, "FORWARDED_IDENTITY"},
- { 0x09, "UnknownExceptionInfo"},
- { 0x0a, "RTCorbaPriority"},
- { 0x0b, "RTCorbaPriorityRange"},
- { 0x0c, "FT_GROUP_VERSION"},
- { 0x0d, "FT_REQUEST"},
- { 0x0e, "ExceptionDetailMessage"},
- { 0x0f, "SecurityAttributeService"},
- { 0x10, "ActivityService"},
- { 0, NULL }
+ { 0x00, "TransactionService" },
+ { 0x01, "CodeSets"},
+ { 0x02, "ChainBypassCheck"},
+ { 0x03, "ChainBypassInfo"},
+ { 0x04, "LogicalThreadId"},
+ { 0x05, "BI_DIR_IIOP"},
+ { 0x06, "SendingContextRunTime"},
+ { 0x07, "INVOCATION_POLICIES"},
+ { 0x08, "FORWARDED_IDENTITY"},
+ { 0x09, "UnknownExceptionInfo"},
+ { 0x0a, "RTCorbaPriority"},
+ { 0x0b, "RTCorbaPriorityRange"},
+ { 0x0c, "FT_GROUP_VERSION"},
+ { 0x0d, "FT_REQUEST"},
+ { 0x0e, "ExceptionDetailMessage"},
+ { 0x0f, "SecurityAttributeService"},
+ { 0x10, "ActivityService"},
+ { 0, NULL }
};
-#define GIOP_MAGIC "GIOP"
-
/*
* TAGS for IOR Profiles
*
static const guint GIOP_MINOR = 2;
-static const int KeyAddr = 0;
-static const int ProfileAddr = 1;
-static const int ReferenceAddr = 2;
-
-
-
static const value_string reply_status_types[] = {
- { NO_EXCEPTION, "No Exception" } ,
- { USER_EXCEPTION, "User Exception" } ,
- { SYSTEM_EXCEPTION, "System Exception" } ,
- { LOCATION_FORWARD, "Location Forward" } ,
- { LOCATION_FORWARD_PERM, "Location Forward Perm" } ,
- { NEEDS_ADDRESSING_MODE, "Needs Addressing Mode" } ,
- { 0, NULL }
+ { NO_EXCEPTION, "No Exception" } ,
+ { USER_EXCEPTION, "User Exception" } ,
+ { SYSTEM_EXCEPTION, "System Exception" } ,
+ { LOCATION_FORWARD, "Location Forward" } ,
+ { LOCATION_FORWARD_PERM, "Location Forward Perm" } ,
+ { NEEDS_ADDRESSING_MODE, "Needs Addressing Mode" } ,
+ { 0, NULL }
};
* DATA - complete_request_list
*/
-static GList *giop_complete_request_list;
+static GList *giop_complete_request_list = NULL;
struct comp_req_list_entry {
- guint32 fn; /* frame number */
- gchar * operation; /* echo echoString */
+ guint32 fn; /* frame number */
+ gchar * operation; /* echo echoString */
giop_sub_handle_t *subh; /* handle to sub dissector */
- guint32 reqid; /* request id */
- gchar * repoid; /* repository ID */
+ guint32 reqid; /* request id */
+ gchar * repoid; /* repository ID */
};
typedef struct comp_req_list_entry comp_req_list_entry_t;
*/
struct complete_reply_hash_key {
- guint32 fn; /* reply frame number */
+ guint32 fn; /* reply frame number */
};
struct complete_reply_hash_val {
- guint32 mfn; /* matching frame number (request) */
+ guint32 mfn; /* matching frame number (request) */
};
GHashTable *giop_complete_reply_hash = NULL; /* hash */
*/
-static int giop_module_init_count = 100; /* storage size for our permanent data */
- /* ie: 100 entries -- needs tweaking -- FS */
-
struct giop_module_key {
- gchar *module; /* module (interface?) name */
+ gchar *module; /* module (interface?) name */
};
struct giop_module_val {
*/
static const char giop_op_resolve[] = "resolve";
-static const char giop_op_bind_new_context[] = "bind_new_context";
-static const char giop_op_bind[] = "bind";
+static const char giop_op_bind_new_context[] _U_ = "bind_new_context";
+static const char giop_op_bind[] _U_ = "bind";
static const char giop_op_is_a[] = "_is_a";
/*
*/
enum giop_op_val {
- request_resolve_op_val, /* REQUEST (resolve) to get RepoID etc*/
+ request_resolve_op_val, /* REQUEST (resolve) to get RepoID etc*/
request_bind_new_context_op_val, /* bind_new_context */
- request_bind_op_val, /* bind */
- request_get_INIT_op_val /* finding Nameserver */
+ request_bind_op_val, /* bind */
+ request_get_INIT_op_val /* finding Nameserver */
};
*/
enum ior_src {
- req_res = 0, /* REQUEST (resolve) */
- file /* stringified IOR' in a file */
+ ior_src_req_res = 0, /* REQUEST (resolve) */
+ ior_src_file /* stringified IOR' in a file */
};
struct giop_object_key {
- guint8 *objkey; /* ptr to object key */
- guint32 objkey_len; /* length */
+ guint8 *objkey; /* ptr to object key */
+ guint32 objkey_len; /* length */
};
struct giop_object_val {
- guint8 *repo_id; /* ptr to Repository ID string */
- ior_src_t src; /* where did Iget this IOR from */
+ guint8 *repo_id; /* ptr to Repository ID string */
+ ior_src_t src; /* where did Iget this IOR from */
};
GHashTable *giop_objkey_hash = NULL; /* hash */
+gboolean giop_desegment = TRUE;
+static const char *giop_ior_file = "IOR.txt";
+
/*
* ------------------------------------------------------------------------------------------+
* Private helper functions
*/
static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, gchar * op, giop_sub_handle_t *sh ) {
- GList * newlist_start;
- comp_req_list_entry_t * entry = NULL;
- gchar * opn;
+ comp_req_list_entry_t * entry;
- entry = g_malloc(sizeof(comp_req_list_entry_t));
- opn = g_strdup(op); /* duplicate operation for storage */
+ entry = se_alloc(sizeof(comp_req_list_entry_t));
- entry->fn = fn;
+ entry->fn = fn;
entry->reqid = reqid;
- entry->subh = sh;
- entry->operation = opn;
- entry->repoid = NULL; /* dont have yet */
+ entry->subh = sh;
+ entry->operation = se_strdup(op); /* duplicate operation for storage */
+ entry->repoid = NULL; /* dont have yet */
- newlist_start = g_list_append (list, entry); /* append */
-
- return newlist_start;
+ return g_list_append (list, entry); /* append */
}
static comp_req_list_entry_t * find_fn_in_list(guint32 fn) {
- GList * element; /* entry in list */
+ GList * element; /* entry in list */
comp_req_list_entry_t * entry_ptr = NULL;
element = g_list_last(giop_complete_request_list); /* start from last */
- while(element) { /* valid list entry */
- entry_ptr = element->data; /* grab data pointer */
- if (entry_ptr->fn == fn) { /* similar FN */
+ while(element) { /* valid list entry */
+ entry_ptr = element->data; /* grab data pointer */
+ if (entry_ptr->fn == fn) { /* similar FN */
return entry_ptr;
}
element = g_list_previous(element); /* try next previous */
}
- return NULL; /* no match so return NULL */
+ return NULL; /* no match so return NULL */
}
static void add_sub_handle_repoid_to_comp_req_list(guint32 fn, giop_sub_handle_t *sh, gchar *repoid ) {
comp_req_list_entry_t * entry = NULL;
- entry = find_fn_in_list(fn); /* grab FN data entry */
+ entry = find_fn_in_list(fn); /* grab FN data entry */
if (entry) {
entry->subh = sh;
return 1;
}
- return 0; /* found differences */
+ return 0; /* found differences */
}
/* giop_complete_reply_hash "HASH" Functions */
static guint32 complete_reply_hash_fn(gconstpointer v) {
- guint32 val; /* init hash value */
+ guint32 val; /* init hash value */
const struct complete_reply_hash_key *key = (const struct complete_reply_hash_key *)v;
- val = key->fn; /* simple and unique */
+ val = key->fn; /* simple and unique */
return val;
}
val = (struct complete_reply_hash_val *)g_hash_table_lookup(giop_complete_reply_hash, &key);
if (val) {
- return; /* FN collision */
+ return; /* FN collision */
}
new_key = se_alloc(sizeof(struct complete_reply_hash_key));
- new_key->fn = fn; /* save FN */
+ new_key->fn = fn; /* save FN */
val = se_alloc(sizeof(struct complete_reply_hash_val));
- val->mfn = mfn; /* and MFN */
+ val->mfn = mfn; /* and MFN */
g_hash_table_insert(giop_complete_reply_hash, new_key, val);
struct complete_reply_hash_key key;
struct complete_reply_hash_val *val = NULL;
- guint32 mfn = fn; /* save */
+ guint32 mfn = fn; /* save */
key.fn = fn;
val = (struct complete_reply_hash_val *)g_hash_table_lookup(giop_complete_reply_hash, &key);
if (val) {
- mfn = val->mfn; /* grab it */
+ mfn = val->mfn; /* grab it */
}
- return mfn; /* mfn or fn if not found */
+ return mfn; /* mfn or fn if not found */
}
static guint32 get_mfn_from_fn_and_reqid(guint32 fn, guint32 reqid) {
- GList * element; /* last entry in list */
+ GList * element; /* last entry in list */
comp_req_list_entry_t * entry_ptr = NULL;
/* Need Some pretty snappy code */
element = g_list_last(giop_complete_request_list); /* get last */
- while(element) { /* valid list entry */
- entry_ptr = element->data; /* grab data pointer */
- if (entry_ptr->reqid == reqid) { /* similar reqid */
- return entry_ptr->fn; /* return MFN */
+ while(element) { /* valid list entry */
+ entry_ptr = element->data; /* grab data pointer */
+ if (entry_ptr->reqid == reqid) { /* similar reqid */
+ return entry_ptr->fn; /* return MFN */
}
element = g_list_previous(element); /* try next previous */
}
- return fn; /* no match so return FN */
+ return fn; /* no match so return FN */
}
return 1;
}
- return 0; /* found differences */
+ return 0; /* found differences */
}
/* Module Hash "HASH" Functions */
static guint32 giop_hash_module_hash(gconstpointer v) {
int i,len;
- guint32 val = 0; /* init hash value */
+ guint32 val = 0; /* init hash value */
const struct giop_module_key *key = (const struct giop_module_key *)v;
*
*/
- len = strlen(key->module);
+ len = (int)strlen(key->module);
for (i=0; i<len; i++) {
val += (guint8) key->module[i];
module_val = (struct giop_module_val *)g_hash_table_lookup(giop_module_hash, &module_key);
if (module_val) {
- return; /* module name collision */
+ return; /* module name collision */
}
/* So, passed module name should NOT exist in hash at this point.*/
module_val->subh = g_malloc(sizeof (giop_sub_handle_t)); /* init subh */
- module_val->subh->sub_name = name; /* save dissector name */
- module_val->subh->sub_fn = sub; /* save subdissector*/
- module_val->subh->sub_proto = find_protocol_by_id(sub_proto); /* save protocol_t for subdissector's protocol */
+ module_val->subh->sub_name = name; /* save dissector name */
+ module_val->subh->sub_fn = sub; /* save subdissector*/
+ module_val->subh->sub_proto = find_protocol_by_id(sub_proto); /* save protocol_t for subdissector's protocol */
g_hash_table_insert(giop_module_hash, new_module_key, module_val);
const struct giop_object_key *v2 = (const struct giop_object_key *)w;
if (v1->objkey_len != v2->objkey_len)
- return 0; /* no match because different length */
+ return 0; /* no match because different length */
- /* Now do a byte comaprison */
+ /* Now do a byte comparison */
if (memcmp(v1->objkey,v2->objkey, v1->objkey_len) == 0) {
- return 1; /* compares ok */
+ return 1; /* compares ok */
}
#if DEBUG
printf("giop:giop_hash_objkey_equal: Objkey's DO NOT match");
#endif
- return 0; /* found differences */
+ return 0; /* found differences */
}
/* Object Key Hash "HASH" Functions */
const struct giop_object_key *key = (const struct giop_object_key *)v;
guint32 i;
- guint32 val = 0; /* init hash value */
+ guint32 val = 0; /* init hash value */
/*
struct giop_object_val *objkey_val = NULL;
objkey_key.objkey_len = len; /* length */
- objkey_key.objkey = obj; /* object key octet sequence */
+ objkey_key.objkey = obj; /* object key octet sequence */
/* Look it up to see if it exists */
new_objkey_key = se_alloc(sizeof(struct giop_object_key));
new_objkey_key->objkey_len = len; /* save it */
- new_objkey_key->objkey = (guint8 *) g_memdup(obj,len); /* copy from object and allocate ptr */
+ new_objkey_key->objkey = (guint8 *) se_memdup(obj,len); /* copy from object and allocate ptr */
objkey_val = se_alloc(sizeof(struct giop_object_val));
- objkey_val->repo_id = g_strdup(repoid); /* duplicate and store Respository ID string */
- objkey_val->src = src; /* where IOR came from */
+ objkey_val->repo_id = se_strdup(repoid); /* duplicate and store Respository ID string */
+ objkey_val->src = src; /* where IOR came from */
#if DEBUG
return -1;
}
if (isdigit(c)) {
- retval = c - 48; /* convert digit */
+ retval = c - 48; /* convert digit */
return retval;
}
- c = toupper(c); /* convert to uppercase */
+ c = toupper(c); /* convert to uppercase */
if (c >= 'A' && c <= 'F') {
retval = c - 55;
return retval;
static guint32 string_to_IOR(guchar *in, guint32 in_len, guint8 **out){
gint8 tmpval_lsb;
gint8 tmpval_msb;
- gint8 tmpval; /* complete value */
+ gint8 tmpval; /* complete value */
guint32 i;
*out = g_new0(guint8, in_len); /* allocate buffer */
if ( isxdigit(in[i]) && isxdigit(in[i+1]) ) { /* hex ? */
if ( (tmpval_msb = hex_char_to_val(in[i])) < 0 ) {
- g_warning("giop: Invalid value in IOR %i \n", tmpval_msb);
+ g_warning("giop: Invalid value in IOR %i \n", tmpval_msb);
}
if ( (tmpval_lsb = hex_char_to_val(in[i+1])) < 0 ) {
- g_warning("giop: Invalid value in IOR %i \n", tmpval_lsb);
+ g_warning("giop: Invalid value in IOR %i \n", tmpval_lsb);
}
tmpval = tmpval_msb << 4;
}
- return (i-4)/2; /* length */
+ return (i-4)/2; /* length */
}
if (fgets(line,maxlen,fp) == NULL)
return 0;
else
- return strlen(line);
+ return (int)strlen(line);
}
*/
static void read_IOR_strings_from_file(const gchar *name, int max_iorlen) {
- guchar *buf; /* NOTE reused for every line */
+ guchar *buf; /* NOTE reused for every line */
int len;
- int ior_val_len; /* length after unstringifying. */
+ int ior_val_len; /* length after unstringifying. */
FILE *fp;
- guint8 *out; /* ptr to unstringified IOR */
- tvbuff_t *tvb; /* temp tvbuff for dissectin IORs */
+ guint8 *out; /* ptr to unstringified IOR */
+ tvbuff_t *tvb; /* temp tvbuff for dissectin IORs */
guint32 my_offset = 0;
gboolean stream_is_big_endian;
- fp = fopen(name,"r"); /* open read only */
+ fp = ws_fopen(name,"r"); /* open read only */
if (fp == NULL) {
if (errno == EACCES)
- fprintf(stderr, "Error opening file IOR.txt for reading: %s\n",strerror(errno));
+ fprintf(stderr, "Error opening file %s for reading: %s\n", name, strerror(errno));
return;
}
- buf = g_malloc0(max_iorlen+1); /* input buf */
+ buf = g_malloc0(max_iorlen+1); /* input buf */
while ((len = giop_getline(fp,buf,max_iorlen+1)) > 0) {
- my_offset = 0; /* reset for every IOR read */
+ my_offset = 0; /* reset for every IOR read */
- ior_val_len = string_to_IOR(buf,len,&out); /* convert */
+ ior_val_len = string_to_IOR(buf,len,&out); /* convert */
if(ior_val_len>0) {
}
- fclose(fp); /* be nice */
+ fclose(fp); /* be nice */
g_free(buf);
}
/*
* Create objkey/repoid hash, use my "equal" and "hash" functions.
+ * Note: keys and values are se_alloc'd so they don't need to be freed.
*
*/
giop_objkey_hash = g_hash_table_new(giop_hash_objkey_hash, giop_hash_objkey_equal);
+
/*
* Create complete_reply_hash, use my "equal" and "hash" functions.
+ * Note: keys and values are se_alloc'd so they don't need to be freed.
*
*/
if (giop_complete_reply_hash)
g_hash_table_destroy(giop_complete_reply_hash);
-
/*
* Create hash, use my "equal" and "hash" functions.
*
giop_complete_reply_hash = g_hash_table_new(complete_reply_hash_fn, complete_reply_equal_fn);
- read_IOR_strings_from_file("IOR.txt", 600); /* testing */
+ /*
+ * Free giop_complete_request_list (if necessary)
+ * Note: The data elements are se_alloc'd so only the
+ * actual list elements need to be freed.
+ */
+
+ if (giop_complete_request_list) {
+ g_list_free(giop_complete_request_list);
+ giop_complete_request_list = NULL;
+ }
+
+ read_IOR_strings_from_file(giop_ior_file, 600);
}
subh->sub_name = name;
subh->sub_fn = sub;
- subh->sub_proto = find_protocol_by_id(sub_proto); /* protocol_t for sub dissectors's proto_register_protocol() */
+ subh->sub_proto = find_protocol_by_id(sub_proto); /* protocol_t for sub dissectors's proto_register_protocol() */
giop_sub_list = g_slist_append (giop_sub_list, subh);
struct giop_object_val *objkey_val = NULL;
objkey_key.objkey_len = len; /* length */
- objkey_key.objkey = obj; /* object key octet sequence */
+ objkey_key.objkey = obj; /* object key octet sequence */
/* Look it up to see if it exists */
#if DEBUG
printf("Lookup of object key returns RepoId = %s \n",objkey_val->repo_id );
#endif
- return objkey_val->repo_id; /* found */
+ return objkey_val->repo_id; /* found */
}
#if DEBUG
printf("FAILED Lookup of object key \n" );
#endif
- return NULL; /* not found */
+ return NULL; /* not found */
}
static gchar * get_modname_from_repoid(gchar *repoid) {
gchar *modname = NULL;
- gchar *saved_repoid = NULL;
gchar c = 'a';
- guint8 stop_mod = 0; /* Index of last character of modname in Repoid */
- guint8 start_mod = 4; /* Index where Module name starts in repoid */
+ guint8 stop_mod = 0; /* Index of last character of modname in Repoid */
+ guint8 start_mod = 4; /* Index where Module name starts in repoid */
int i;
- saved_repoid = g_strdup(repoid); /* make a copy */
-
/* Must start with IDL: , otherwise I get confused */
- if (g_strncasecmp("IDL:",repoid,4))
+ if (g_ascii_strncasecmp("IDL:",repoid,4))
return NULL;
/* Looks like a RepoID to me, so get Module or interface name */
for(i=4; c != '\0'; i++) {
c = repoid[i];
- stop_mod = i; /* save */
- if (c == ':' ) /* delimiters */
+ stop_mod = i; /* save */
+ if (c == ':' ) /* delimiters */
break;
}
#if DEBUG
-
/*
* Display a "module" hash entry
*/
static void display_heuristic_user_list() {
int i;
int len;
- giop_sub_handle_t *subh; /* handle */
+ giop_sub_handle_t *subh; /* handle */
/* Get length of list */
len = g_slist_length(giop_sub_list); /* find length */
for (i=0; i<len; i++) {
entry = (comp_req_list_entry_t *) g_list_nth_data(giop_complete_request_list,i); /* grab entry */
printf("giop:Index = %8i , FN = %8i, reqid = %8u , operation = %20s , repoid = %30s \n", i, entry->fn,
- entry->reqid,entry->operation, entry->repoid);
+ entry->reqid,entry->operation, entry->repoid);
}
}
* But skip a subdissector if it has been disabled in GUI "edit protocols".
*/
-static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- MessageHeader *header, gchar *operation ) {
+static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 *offset,
+ MessageHeader *header, gchar *operation ) {
int i,len;
- gboolean res = FALSE; /* result of calling a heuristic sub dissector */
+ gboolean res = FALSE; /* result of calling a heuristic sub dissector */
giop_sub_handle_t *subh = NULL;
const char *saved_proto;
if (len == 0)
return FALSE;
+
+ {
+ guint32 message_size;
+ gboolean stream_is_big_endian = is_big_endian (header);
+
+ if (stream_is_big_endian)
+ message_size = pntohl (&header->message_size);
+ else
+ message_size = pletohl (&header->message_size);
+
+ if (*offset > header->message_size)
+ return FALSE;
+ }
saved_proto = pinfo->current_proto;
for (i=0; i<len; i++) {
if (proto_is_protocol_enabled(subh->sub_proto)) {
pinfo->current_proto =
- proto_get_protocol_short_name(subh->sub_proto);
+ proto_get_protocol_short_name(subh->sub_proto);
res = (subh->sub_fn)(tvb,pinfo,tree,offset,header,operation,NULL); /* callit TODO - replace NULL */
if (res) {
- pinfo->current_proto = saved_proto;
- return TRUE; /* found one, lets return */
+ pinfo->current_proto = saved_proto;
+ return TRUE; /* found one, lets return */
}
} /* protocol_is_enabled */
} /* loop */
- if (check_col (pinfo->cinfo, COL_PROTOCOL))
- col_set_str (pinfo->cinfo, COL_PROTOCOL, "GIOP");
+ col_set_str (pinfo->cinfo, COL_PROTOCOL, "GIOP");
pinfo->current_proto = saved_proto;
- return res; /* result */
+ return res; /* result */
}
*/
static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- MessageHeader *header, gchar *operation, gchar *repoid ) {
+ MessageHeader *header, gchar *operation, gchar *repoid ) {
giop_sub_handle_t *subdiss = NULL; /* handle */
gboolean res = FALSE;
modname = get_modname_from_repoid(repoid);
if (modname == NULL) {
- return res; /* unknown module name */
+ return res; /* unknown module name */
}
module_val = (struct giop_module_val *)g_hash_table_lookup(giop_module_hash, &module_key);
if (module_val == NULL) {
- return res; /* module not registered */
+ return res; /* module not registered */
}
subdiss = (giop_sub_handle_t *) module_val->subh; /* grab dissector handle */
if (proto_is_protocol_enabled(subdiss->sub_proto)) {
- saved_proto = pinfo->current_proto;
- pinfo->current_proto =
- proto_get_protocol_short_name(subdiss->sub_proto);
- res = (subdiss->sub_fn)(tvb,pinfo,tree,offset,header,operation, modname); /* callit, TODO replace NULL with idlname */
- pinfo->current_proto = saved_proto;
+ saved_proto = pinfo->current_proto;
+ pinfo->current_proto =
+ proto_get_protocol_short_name(subdiss->sub_proto);
+ res = (subdiss->sub_fn)(tvb,pinfo,tree,offset,header,operation, modname); /* callit, TODO replace NULL with idlname */
+ pinfo->current_proto = saved_proto;
- } /* protocol_is_enabled */
+ } /* protocol_is_enabled */
} /* offset exists */
} /* subdiss */
- return res; /* return result */
+ return res; /* return result */
}
print_string[i] = '.';
}
- return print_string; /* return ptr */
+ return print_string; /* return ptr */
}
/* Determine the byte order from the GIOP MessageHeader */
switch (header->GIOP_version.minor) {
case 2:
case 1:
- if (header->flags & 0x01)
+ if (header->flags & GIOP_MESSAGE_FLAGS_ENDIANNESS)
big_endian = FALSE;
else
big_endian = TRUE;
static void set_new_alignment(int *offset, int delta, int alignment) {
while( ( (*offset + delta) % alignment) != 0)
- ++(*offset);
+ ++(*offset);
}
*/
void get_CDR_any(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, int boundary,
- MessageHeader * header ) {
+ gboolean stream_is_big_endian, int boundary,
+ MessageHeader * header ) {
guint32 TCKind; /* TypeCode */
/* double values must be aligned on a 8 byte boundary */
while( ( (*offset + boundary) % 8) != 0)
- ++(*offset);
+ ++(*offset);
val = (stream_is_big_endian) ? tvb_get_ntohieee_double (tvb, *offset) :
tvb_get_letohieee_double (tvb, *offset);
void get_CDR_fixed(tvbuff_t *tvb, gchar **seq, gint *offset, guint32 digits, gint32 scale) {
- guint8 sign; /* 0x0c is positive, 0x0d is negative */
- guint32 i ; /* loop */
- guint32 slen; /* number of bytes to hold digits + extra 0's if scale <0 */
- /* this does not include sign, decimal point and \0 */
- guint32 sindex = 0; /* string index */
- gchar *tmpbuf; /* temp buff, holds string without scaling */
- guint8 tval; /* temp val storage */
+ guint8 sign; /* 0x0c is positive, 0x0d is negative */
+ guint32 i ; /* loop */
+ guint32 slen; /* number of bytes to hold digits + extra 0's if scale <0 */
+ /* this does not include sign, decimal point and \0 */
+ guint32 sindex = 0; /* string index */
+ gchar *tmpbuf; /* temp buff, holds string without scaling */
+ guint8 tval; /* temp val storage */
/*
* how many bytes to hold digits and scale (if scale <0)
#endif
if (scale <0) {
- slen = digits - scale; /* allow for digits + padding 0's for negative scal */
+ slen = digits - scale; /* allow for digits + padding 0's for negative scal */
} else {
- slen = digits; /* digits */
+ slen = digits; /* digits */
}
#if DEBUG
printf("giop:get_CDR_fixed(): slen = %.2x \n", slen);
#endif
- tmpbuf = g_new0(gchar, slen); /* allocate temp buffer */
-
- /*
- * Register a cleanup function in case on of our tvbuff accesses
- * throws an exception. We need to clean up tmpbuf.
- */
- CLEANUP_PUSH(g_free, tmpbuf);
+ tmpbuf = ep_alloc0(slen); /* allocate temp buffer */
/* If even , grab 1st dig */
* and sign values.
*/
- sindex = 0; /* reset */
- *seq = g_new0(gchar, slen + 3); /* allocate temp buffer , including space for sign, decimal point and
- * \0 -- TODO check slen is reasonable first */
+ sindex = 0; /* reset */
+ *seq = g_new0(gchar, slen + 3); /* allocate temp buffer , including space for sign, decimal point and
+ * \0 -- TODO check slen is reasonable first */
#if DEBUG
printf("giop:get_CDR_fixed(): sign = %.2x \n", sign);
#endif
switch(sign) {
case 0x0c:
- (*seq)[sindex] = '+'; /* put sign in first string position */
+ (*seq)[sindex] = '+'; /* put sign in first string position */
break;
case 0x0d:
(*seq)[sindex] = '-';
break;
default:
g_warning("giop: Unknown sign value in fixed type %u \n", sign);
- (*seq)[sindex] = '*'; /* flag as sign unkown */
+ (*seq)[sindex] = '*'; /* flag as sign unkown */
break;
}
if (scale>0) {
for (i=0; i<digits-scale; i++) {
- (*seq)[sindex] = tmpbuf[i]; /* digits to the left of the decimal point */
- sindex++;
+ (*seq)[sindex] = tmpbuf[i]; /* digits to the left of the decimal point */
+ sindex++;
}
(*seq)[sindex] = '.'; /* decimal point */
sindex++;
for (i=digits-scale; i<digits; i++) {
- (*seq)[sindex] = tmpbuf[i]; /* remaining digits to the right of the decimal point */
- sindex++;
+ (*seq)[sindex] = tmpbuf[i]; /* remaining digits to the right of the decimal point */
+ sindex++;
}
(*seq)[sindex] = '\0'; /* string terminator */
/* negative scale, dump digits and pad out with 0's */
for (i=0; i<digits-scale; i++) {
- if (i<digits) {
- (*seq)[sindex] = tmpbuf[i]; /* save digits */
- } else {
- (*seq)[sindex] = '0'; /* all digits used up, so pad with 0's */
- }
- sindex++;
+ if (i<digits) {
+ (*seq)[sindex] = tmpbuf[i]; /* save digits */
+ } else {
+ (*seq)[sindex] = '0'; /* all digits used up, so pad with 0's */
+ }
+ sindex++;
}
(*seq)[sindex] = '\0'; /* string terminator */
}
- /*
- * We're done with tmpbuf, so we can call the cleanup handler to free
- * it, and then pop the cleanup handler.
- */
- CLEANUP_CALL_AND_POP;
-
#if DEBUG
printf("giop:get_CDR_fixed(): value = %s \n", *seq);
#endif
*/
void get_CDR_interface(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- gboolean stream_is_big_endian, int boundary) {
+ gboolean stream_is_big_endian, int boundary) {
decode_IOR(tvb, pinfo, tree, offset, boundary, stream_is_big_endian);
/* unsigned long values must be aligned on a 4 byte boundary */
while( ( (*offset + boundary) % 4) != 0)
- ++(*offset);
+ ++(*offset);
val = (stream_is_big_endian) ? tvb_get_ntohl (tvb, *offset) :
tvb_get_letohl (tvb, *offset);
return val;
}
+/* Copy a 8 octet sequence from the tvbuff
+ * which represents a signed long long value, and convert
+ * it to an signed long long vaule, taking into account byte order.
+ * offset is first incremented so that it falls on a proper alignment
+ * boundary for long long values.
+ * offset is then incremented by 8, to indicate the 8 octets which
+ * have been processed.
+ */
+
+gint64 get_CDR_long_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary) {
+
+ gint64 val;
+
+ /* unsigned long long values must be aligned on a 8 byte boundary */
+ while( ( (*offset + boundary) % 8) != 0)
+ ++(*offset);
+
+ val = (stream_is_big_endian) ? tvb_get_ntoh64 (tvb, *offset) :
+ tvb_get_letoh64 (tvb, *offset);
+
+ *offset += 8;
+ return val;
+}
+
/*
* Decode an Object type, and display it on the tree.
*/
/* short values must be aligned on a 2 byte boundary */
while( ( (*offset + boundary) % 2) != 0)
- ++(*offset);
+ ++(*offset);
val = (stream_is_big_endian) ? tvb_get_ntohs (tvb, *offset) :
tvb_get_letohs (tvb, *offset);
guint32 get_CDR_string(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian,
- int boundary ) {
+ int boundary ) {
guint32 slength;
slength = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get length first */
#if 0
- (*offset)++; /* must step past \0 delimiter */
+ (*offset)++; /* must step past \0 delimiter */
#endif
if (slength > 0) {
get_CDR_octet_seq(tvb, seq, offset, slength);
} else {
- *seq = g_strdup(""); /* zero-length string */
+ *seq = g_strdup(""); /* zero-length string */
}
- return slength; /* return length */
+ return slength; /* return length */
}
*/
guint32 get_CDR_typeCode(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, int boundary,
- MessageHeader * header ) {
+ gboolean stream_is_big_endian, int boundary,
+ MessageHeader * header ) {
guint32 val;
gint16 s_octet2; /* signed int16 */
val = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get TCKind enum */
if (tree) {
proto_tree_add_uint(tree,hf_giop_TCKind,tvb,
- *offset-sizeof(val),4,val);
+ *offset-sizeof(val),4,val);
}
/* Grab the data according to Typecode Table - Corba Chapter 15 */
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
break;
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
break;
u_octet2 = get_CDR_ushort(tvb,offset,stream_is_big_endian,boundary); /* get digits */
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_digits,tvb,
- *offset-sizeof(u_octet2),2,u_octet2);
+ *offset-sizeof(u_octet2),2,u_octet2);
}
s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary); /* get scale */
if (tree) {
proto_tree_add_int(tree,hf_giop_typecode_scale,tvb,
- *offset-sizeof(s_octet2),2,s_octet2);
+ *offset-sizeof(s_octet2),2,s_octet2);
}
break;
/* unsigned long values must be aligned on a 4 byte boundary */
while( ( (*offset + boundary) % 4) != 0)
- ++(*offset);
+ ++(*offset);
val = (stream_is_big_endian) ? tvb_get_ntohl (tvb, *offset) :
tvb_get_letohl (tvb, *offset);
return val;
}
+/* Copy a 8 octet sequence from the tvbuff
+ * which represents an unsigned long long value, and convert
+ * it to an unsigned long long vaule, taking into account byte order.
+ * offset is first incremented so that it falls on a proper alignment
+ * boundary for unsigned long long values.
+ * offset is then incremented by 4, to indicate the 4 octets which
+ * have been processed.
+ */
+
+guint64 get_CDR_ulong_long(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary) {
+
+ guint64 val;
+
+ /* unsigned long long values must be aligned on a 8 byte boundary */
+ while( ( (*offset + boundary) % 8) != 0)
+ ++(*offset);
+
+ val = (stream_is_big_endian) ? tvb_get_ntoh64 (tvb, *offset) :
+ tvb_get_letoh64 (tvb, *offset);
+
+ *offset += 8;
+ return val;
+}
/* Copy a 2 octet sequence from the tvbuff
* which represents an unsigned short value, and convert
/* unsigned short values must be aligned on a 2 byte boundary */
while( ( (*offset + boundary) % 2) != 0)
- ++(*offset);
+ ++(*offset);
val = (stream_is_big_endian) ? tvb_get_ntohs (tvb, *offset) :
tvb_get_letohs (tvb, *offset);
if (header->GIOP_version.minor < 2)
slength = -slength;
- return slength; /* return length */
+ return slength; /* return length */
}
guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian,
- int boundary, MessageHeader * header) {
+ int boundary, MessageHeader * header) {
guint32 slength;
gchar *raw_wstring;
#ifdef DEBUG
if (slength>200) {
fprintf(stderr, "giop:get_CDR_wstring, length %u > 200, truncating to 5 \n", slength);
- slength = 5; /* better than core dumping during debug */
+ slength = 5; /* better than core dumping during debug */
}
#endif
g_free(raw_wstring);
}
- return slength; /* return length */
+ return slength; /* return length */
}
static void
dissect_target_address(tvbuff_t * tvb, packet_info *pinfo, int *offset, proto_tree * tree,
- gboolean stream_is_big_endian)
+ gboolean stream_is_big_endian, guint32 *object_key_len,
+ gchar **object_key_val)
{
- guint16 discriminant;
- gchar *object_key;
- gchar *p_object_key;
- guint32 len = 0;
- guint32 u_octet4;
-
- discriminant = get_CDR_ushort(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
- if(tree)
- {
- proto_tree_add_text (tree, tvb, *offset -2, 2,
- "TargetAddress Discriminant: %u", discriminant);
- }
-
- switch (discriminant)
- {
- case 0: /* KeyAddr */
- len = get_CDR_ulong(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
- if(tree)
- {
- proto_tree_add_text (tree, tvb, *offset -4, 4,
- "KeyAddr (object key length): %u", len);
- }
-
- if (len > 0) {
-
- get_CDR_octet_seq(tvb, &object_key, offset, len);
- p_object_key = make_printable_string( object_key, len );
-
- if(tree)
- {
- proto_tree_add_text (tree, tvb, *offset -len, len,
- "KeyAddr (object key): %s", p_object_key);
- }
- g_free( p_object_key );
- g_free( object_key );
- }
- break;
- case 1: /* ProfileAddr */
- decode_TaggedProfile(tvb, pinfo, tree, offset, GIOP_HEADER_SIZE,
- stream_is_big_endian, NULL);
- break;
- case 2: /* ReferenceAddr */
- u_octet4 = get_CDR_ulong(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
-
- if(tree)
- {
- proto_tree_add_text (tree, tvb, *offset -len -4, 4,
- "ReferenceAddr (selected_profile_index): %u", u_octet4);
- }
-
- decode_IOR(tvb, pinfo, tree, offset, GIOP_HEADER_SIZE, stream_is_big_endian);
- break;
- default:
- break;
- }
+ guint16 discriminant;
+ gchar *object_key;
+ gchar *p_object_key;
+ guint32 len = 0;
+ guint32 u_octet4;
+ const char * name;
+
+ object_key = NULL;
+ discriminant = get_CDR_ushort(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+ if(tree)
+ {
+ switch (discriminant)
+ {
+ case 0: name = "KeyAddr"; break;
+ case 1: name = "ProfileAddr"; break;
+ case 2: name = "ReferenceAddr"; break;
+ default: name = "Unknown"; break;
+ }
+
+ proto_tree_add_text (tree, tvb, *offset -2, 2, "TargetAddress: %s", name);
+ }
+
+ switch (discriminant)
+ {
+ case 0: /* KeyAddr */
+ len = get_CDR_ulong(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+ if(tree)
+ {
+ proto_tree_add_text (tree, tvb, *offset -4, 4,
+ "KeyAddr (object key length): %u", len);
+ }
+
+ if (len > 0) {
+
+ get_CDR_octet_seq(tvb, &object_key, offset, len);
+ p_object_key = make_printable_string( object_key, len );
+
+ if(tree)
+ {
+ proto_tree_add_text (tree, tvb, *offset -len, len,
+ "KeyAddr (object key): %s", p_object_key);
+ }
+ g_free( p_object_key );
+ if (object_key_len) {
+ *object_key_len = len;
+ }
+ if (object_key_val) {
+ *object_key_val = object_key;
+ } else {
+ g_free( object_key );
+ }
+ }
+ break;
+ case 1: /* ProfileAddr */
+ decode_TaggedProfile(tvb, pinfo, tree, offset, GIOP_HEADER_SIZE,
+ stream_is_big_endian, NULL);
+ break;
+ case 2: /* ReferenceAddr */
+ u_octet4 = get_CDR_ulong(tvb, offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+
+ if(tree)
+ {
+ proto_tree_add_text (tree, tvb, *offset -len -4, 4,
+ "ReferenceAddr (selected_profile_index): %u", u_octet4);
+ }
+
+ decode_IOR(tvb, pinfo, tree, offset, GIOP_HEADER_SIZE, stream_is_big_endian);
+ break;
+ default:
+ break;
+ }
}
static void
dissect_reply_body (tvbuff_t *tvb, guint offset, packet_info *pinfo,
- proto_tree *tree, gboolean stream_is_big_endian,
- guint32 reply_status, MessageHeader *header, proto_tree *clnp_tree) {
+ proto_tree *tree, gboolean stream_is_big_endian,
+ guint32 reply_status, MessageHeader *header, proto_tree *clnp_tree) {
guint sequence_length;
- gboolean exres = FALSE; /* result of trying explicit dissectors */
- gchar * repoid = NULL; /* Repositor ID looked up from objkey */
+ gboolean exres = FALSE; /* result of trying explicit dissectors */
+ gchar * repoid = NULL; /* Repositor ID looked up from objkey */
/*
* comp_req_list stuff
guint32 mfn;
switch (reply_status)
- {
- case SYSTEM_EXCEPTION:
+ {
+ case SYSTEM_EXCEPTION:
- decode_SystemExceptionReplyBody (tvb, tree, &offset, stream_is_big_endian, GIOP_HEADER_SIZE);
- break;
+ decode_SystemExceptionReplyBody (tvb, tree, &offset, stream_is_big_endian, GIOP_HEADER_SIZE);
+ break;
- case USER_EXCEPTION:
+ case USER_EXCEPTION:
- sequence_length = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+ sequence_length = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
- if (tree)
- {
- proto_tree_add_text(tree, tvb, offset-4, 4,
- "Exception length: %u", sequence_length);
- }
- if (sequence_length != 0 && sequence_length < ITEM_LABEL_LENGTH)
- {
+ if (tree)
+ {
+ proto_tree_add_text(tree, tvb, offset-4, 4,
+ "Exception length: %u", sequence_length);
+ }
+ if (sequence_length != 0 && sequence_length < ITEM_LABEL_LENGTH)
+ {
#if 1
- tvb_ensure_bytes_exist(tvb, offset, sequence_length);
- header->exception_id = g_new0(gchar,sequence_length ); /* allocate buffer */
+ tvb_ensure_bytes_exist(tvb, offset, sequence_length);
+ header->exception_id = g_new0(gchar,sequence_length ); /* allocate buffer */
- /* read exception id from buffer and store in*/
+ /* read exception id from buffer and store in*/
- tvb_get_nstringz0(tvb,offset,sequence_length, header->exception_id );
+ tvb_get_nstringz0(tvb,offset,sequence_length, header->exception_id );
- if (tree)
- {
- proto_tree_add_string(tree, hf_giop_exception_id, tvb,
- offset, sequence_length, header->exception_id);
- }
+ if (tree)
+ {
+ proto_tree_add_string(tree, hf_giop_exception_id, tvb,
+ offset, sequence_length, header->exception_id);
+ }
#endif
- offset += sequence_length;
- }
-
+ offset += sequence_length;
+ }
- /*
- * Now just fall through to the NO_EXCEPTION part
- * as this is common .
- */
+ /*
+ * Now just fall through to the NO_EXCEPTION part
+ * as this is common .
+ */
- case NO_EXCEPTION:
+ case NO_EXCEPTION:
- /* lookup MFN in hash directly */
- mfn = get_mfn_from_fn(pinfo->fd->num);
+ /* lookup MFN in hash directly */
- if (mfn == pinfo->fd->num)
- return; /* no matching frame number, what am I */
+ mfn = get_mfn_from_fn(pinfo->fd->num);
- /* get entry for this MFN */
- entry = find_fn_in_list(mfn); /* get data entry in complete_request_list */
+ if (mfn == pinfo->fd->num)
+ return; /* no matching frame number, what am I */
- if (!entry)
- return; /* no matching entry */
+ /* get entry for this MFN */
+ entry = find_fn_in_list(mfn); /* get data entry in complete_request_list */
+ if (!entry)
+ return; /* no matching entry */
- /*
- * If this packet is a REPLY to a RESOLVE(request)
- * then decode IOR.
- * TODO - make this lookup faster -- FS
- */
- if (!strcmp(giop_op_resolve,entry->operation)) {
- decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE,stream_is_big_endian);
- return; /* done */
- }
+ /*
+ * If this packet is a REPLY to a RESOLVE(request)
+ * then decode IOR.
+ * TODO - make this lookup faster -- FS
+ */
- /* TODO -- Put stuff here for other "interesting operations" */
+ if (!strcmp(giop_op_resolve,entry->operation)) {
+ decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE,stream_is_big_endian);
+ return; /* done */
+ }
- /*
- *
- * Call sub dissector.
- * First try an find a explicit sub_dissector, then if that
- * fails, try the heuristic method.
- */
+ /* TODO -- Put stuff here for other "interesting operations" */
+ /*
+ *
+ * Call sub dissector.
+ * First try an find a explicit sub_dissector, then if that
+ * fails, try the heuristic method.
+ */
- if(entry->repoid) {
- exres = try_explicit_giop_dissector(tvb,pinfo,clnp_tree, &offset, header, entry->operation, entry->repoid );
- }
- /* Only call heuristic if no explicit dissector was found */
+ if(entry->repoid) {
+ exres = try_explicit_giop_dissector(tvb,pinfo,clnp_tree, &offset, header, entry->operation, entry->repoid );
+ }
- if(! exres) {
- exres = try_heuristic_giop_dissector(tvb,pinfo,clnp_tree,&offset,header,entry->operation);
- }
+ /* Only call heuristic if no explicit dissector was found */
- if (!exres && !strcmp(giop_op_is_a, entry->operation) && tree) {
- proto_tree_add_text(tree, tvb, offset - 1, 1, "Type Id%s matched",
- get_CDR_boolean(tvb, &offset) ? "" : " not");
- }
+ if(! exres) {
+ exres = try_heuristic_giop_dissector(tvb,pinfo,clnp_tree,&offset,header,entry->operation);
+ }
- if(! exres) {
- gint stub_length = tvb_reported_length_remaining(tvb, offset);
- if (stub_length >0)
- proto_tree_add_text(tree, tvb, offset, -1,
- "Stub data (%d byte%s)", stub_length,
- plurality(stub_length, "", "s"));
- }
+ if (!exres && !strcmp(giop_op_is_a, entry->operation) && tree) {
+ proto_tree_add_text(tree, tvb, offset - 1, 1, "Type Id%s matched",
+ get_CDR_boolean(tvb, &offset) ? "" : " not");
+ }
- break;
+ if(! exres) {
+ gint stub_length = tvb_reported_length_remaining(tvb, offset);
+ if (stub_length >0)
+ proto_tree_add_text(tree, tvb, offset, -1,
+ "Stub data (%d byte%s)", stub_length,
+ plurality(stub_length, "", "s"));
+ }
- case LOCATION_FORWARD:
- decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE, stream_is_big_endian);
+ break;
- break;
+ case LOCATION_FORWARD:
+ decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE, stream_is_big_endian);
- case LOCATION_FORWARD_PERM:
- decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE, stream_is_big_endian);
+ break;
- break;
+ case LOCATION_FORWARD_PERM:
+ decode_IOR(tvb, pinfo, tree, &offset, GIOP_HEADER_SIZE, stream_is_big_endian);
- case NEEDS_ADDRESSING_MODE: {
- guint16 addr_disp;
- addr_disp = get_CDR_ushort(tvb, &offset, stream_is_big_endian, GIOP_HEADER_SIZE);
- if(tree) {
- proto_tree_add_text (tree, tvb, offset -2, 2,
- "AddressingDisposition: %u", addr_disp);
- }
+ break;
- break;
+ case NEEDS_ADDRESSING_MODE: {
+ guint16 addr_disp;
+ addr_disp = get_CDR_ushort(tvb, &offset, stream_is_big_endian, GIOP_HEADER_SIZE);
+ if(tree) {
+ proto_tree_add_text (tree, tvb, offset -2, 2,
+ "AddressingDisposition: %u", addr_disp);
}
- default:
+ break;
+ }
- g_warning("giop: Unknown reply status %i request_id = %u\n",reply_status, header->req_id);
+ default:
- break;
+ g_warning("giop: Unknown reply status %i request_id = %u\n",reply_status, header->req_id);
+
+ break;
- } /* switch */
+ } /* switch */
- g_free(repoid); /* free resource */
+ g_free(repoid); /* free resource */
- return; /* done */
+ return; /* done */
}
*/
static void dissect_giop_reply (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
- MessageHeader * header,
- gboolean stream_is_big_endian) {
+ MessageHeader * header,
+ gboolean stream_is_big_endian) {
guint32 offset = 0;
guint32 request_id;
guint32 reply_status;
proto_tree *reply_tree = NULL;
proto_item *tf;
- guint32 mfn; /* matching frame number */
+ guint32 mfn; /* matching frame number */
if (tree) {
tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Protocol Reply");
+ "General Inter-ORB Protocol Reply");
if (reply_tree == NULL)
{
- reply_tree = proto_item_add_subtree (tf, ett_giop_reply);
+ reply_tree = proto_item_add_subtree (tf, ett_giop_reply);
}
}
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id );
}
if (tree) {
*/
if (! pinfo->fd->flags.visited) {
- mfn = get_mfn_from_fn_and_reqid(pinfo->fd->num,request_id); /* find MFN for this FN */
+ mfn = get_mfn_from_fn_and_reqid(pinfo->fd->num,request_id); /* find MFN for this FN */
if (mfn != pinfo->fd->num) { /* if mfn is not fn, good */
insert_in_complete_reply_hash(pinfo->fd->num, mfn);
}
}
- header->req_id = request_id; /* save for sub dissector */
+ header->req_id = request_id; /* save for sub dissector */
header->rep_status = reply_status; /* save for sub dissector */
- dissect_reply_body(tvb, offset, pinfo, reply_tree, stream_is_big_endian,
- reply_status, header,tree);
+ /* Do we have a body */
+ if (tvb_reported_length_remaining(tvb, offset))
+ dissect_reply_body(tvb, offset, pinfo, reply_tree, stream_is_big_endian,
+ reply_status, header,tree);
}
*/
static void dissect_giop_reply_1_2 (tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree,
- MessageHeader * header,
- gboolean stream_is_big_endian) {
+ proto_tree * tree,
+ MessageHeader * header,
+ gboolean stream_is_big_endian) {
guint offset = 0;
guint32 request_id;
guint32 reply_status;
proto_tree *reply_tree = NULL;
proto_item *tf;
- guint32 mfn; /* matching frame number */
+ guint32 mfn; /* matching frame number */
if (tree) {
tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Protocol Reply");
+ "General Inter-ORB Protocol Reply");
reply_tree = proto_item_add_subtree (tf, ett_giop_reply);
}
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
}
if (tree) {
*/
if (! pinfo->fd->flags.visited) {
- mfn = get_mfn_from_fn_and_reqid(pinfo->fd->num,request_id); /* find MFN for this FN */
+ mfn = get_mfn_from_fn_and_reqid(pinfo->fd->num,request_id); /* find MFN for this FN */
if (mfn != pinfo->fd->num) { /* if mfn is not fn, good */
insert_in_complete_reply_hash(pinfo->fd->num, mfn);
}
* Add header to argument list so sub dissector can get header info.
*/
- header->req_id = request_id; /* save for sub dissector */
+ header->req_id = request_id; /* save for sub dissector */
header->rep_status = reply_status; /* save for sub dissector */
dissect_reply_body(tvb, offset, pinfo, reply_tree, stream_is_big_endian,
- reply_status,header,tree);
+ reply_status,header,tree);
}
static void dissect_giop_cancel_request (tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree,
- gboolean stream_is_big_endian) {
+ proto_tree * tree,
+ gboolean stream_is_big_endian) {
guint offset = 0;
guint32 request_id;
if (tree) {
tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Protocol CancelRequest");
+ "General Inter-ORB Protocol CancelRequest");
cancel_request_tree = proto_item_add_subtree (tf, ett_giop_cancel_request);
}
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO)) {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
}
if (tree) {
*/
static void
dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree,
- MessageHeader * header, gboolean stream_is_big_endian)
+ proto_tree * tree,
+ MessageHeader * header, gboolean stream_is_big_endian)
{
guint32 offset = 0;
guint32 request_id;
guint32 len = 0;
- guint32 objkey_len = 0; /* object key length */
- gchar *objkey = NULL; /* object key sequence */
- gchar *print_objkey; /* printable object key sequence */
- gboolean exres = FALSE; /* result of trying explicit dissectors */
+ guint32 objkey_len = 0; /* object key length */
+ gchar *objkey = NULL; /* object key sequence */
+ gboolean exres = FALSE; /* result of trying explicit dissectors */
gchar *operation;
gchar *requesting_principal;
gchar *print_requesting_principal;
guint8 response_expected;
gchar *reserved;
+ gchar miop[4];
proto_tree *request_tree = NULL;
proto_item *tf;
- gchar *repoid = NULL; /* from object key lookup in objkey hash */
+ gchar *repoid = NULL; /* from object key lookup in objkey hash */
if (tree)
+ {
+ tf = proto_tree_add_text (tree, tvb, offset, -1,
+ "General Inter-ORB Protocol Request");
+ if (request_tree == NULL)
{
- tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Protocol Request");
- if (request_tree == NULL)
- {
- request_tree = proto_item_add_subtree (tf, ett_giop_request);
+ request_tree = proto_item_add_subtree (tf, ett_giop_request);
- }
}
+ }
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
- }
+ {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
+ }
if (tree)
- {
- proto_tree_add_uint (request_tree,hf_giop_req_id, tvb, offset-4, 4, request_id);
- }
+ {
+ proto_tree_add_uint (request_tree,hf_giop_req_id, tvb, offset-4, 4, request_id);
+ }
response_expected = tvb_get_guint8( tvb, offset );
offset += 1;
if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
- response_expected ? "two-way" : "one-way");
- }
+ {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
+ response_expected ? "two-way" : "one-way");
+ }
if (tree)
- {
- proto_tree_add_text (request_tree, tvb, offset-1, 1,
- "Response expected: %u", response_expected);
- }
+ {
+ proto_tree_add_text (request_tree, tvb, offset-1, 1,
+ "Response expected: %u", response_expected);
+ }
if( header->GIOP_version.minor > 0)
{
- get_CDR_octet_seq( tvb, &reserved, &offset, 3);
- if (tree)
- {
- proto_tree_add_text (request_tree, tvb, offset-3, 3,
- "Reserved: %x %x %x", reserved[0], reserved[1], reserved[2]);
- }
- g_free(reserved);
+ get_CDR_octet_seq( tvb, &reserved, &offset, 3);
+ if (tree)
+ {
+ proto_tree_add_text (request_tree, tvb, offset-3, 3,
+ "Reserved: %x %x %x", reserved[0], reserved[1], reserved[2]);
+ }
+ g_free(reserved);
}
+ /* Prior to GIOP 1.2, MIOP profile address prefixed with 'MIOP' */
+ miop[0] = get_CDR_octet (tvb, &offset);
+ miop[1] = get_CDR_octet (tvb, &offset);
+ miop[2] = get_CDR_octet (tvb, &offset);
+ miop[3] = get_CDR_octet (tvb, &offset);
- /* Length of object_key sequence */
- objkey_len = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
-
-
- if(tree)
+ if (miop[0] == 'M' && miop[1] == 'I' && miop[2] == 'O' && miop[3] == 'P')
{
- proto_tree_add_text (request_tree, tvb, offset-4, 4,
- /**/ "Object Key length: %u", objkey_len);
- }
+ if (tree)
+ {
+ proto_tree_add_text (request_tree, tvb, offset - 4, 4,
+ "Magic number: %s", MIOP_MAGIC);
+ }
- if (objkey_len > 0)
+ decode_TaggedProfile (tvb, pinfo, request_tree, &offset, GIOP_HEADER_SIZE,
+ stream_is_big_endian, NULL);
+ }
+ else
{
- get_CDR_octet_seq(tvb, &objkey, &offset, objkey_len);
+ /* Wind back if not MIOP profile */
- print_objkey = make_printable_string(objkey, objkey_len);
+ offset -= 4;
- if(tree)
- {
- proto_tree_add_text (request_tree, tvb, offset - objkey_len, objkey_len,
- /**/ "Object Key: %s", print_objkey);
+ /* Length of object_key sequence */
- }
+ objkey_len = get_CDR_ulong (tvb, &offset, stream_is_big_endian,
+ GIOP_HEADER_SIZE);
- g_free( print_objkey );
+ if (tree)
+ {
+ proto_tree_add_text (request_tree, tvb, offset-4, 4,
+ "Object Key length: %u", objkey_len);
+ }
+
+ if (objkey_len > 0)
+ {
+ get_CDR_octet_seq(tvb, &objkey, &offset, objkey_len);
+
+ if(tree)
+ {
+ proto_tree_add_item (request_tree, hf_giop_objekt_key, tvb,
+ offset - objkey_len, objkey_len, FALSE);
+ }
+ }
}
/*
* Register a cleanup function in case on of our tvbuff accesses
* throws an exception. We need to clean up objkey.
*/
- CLEANUP_PUSH(g_free, objkey);
+ CLEANUP_PUSH (g_free, objkey);
- /* length of operation string and string */
- len = get_CDR_string(tvb, &operation, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+ {
+ /* XXX: Get operation string, create a copy in ep memory and then g_free
+ the string returned from get_CDR_string(). This is a hack so that
+ a lexically nested CLEANUP_PUSH & etc is not req'd below.
+ [The nested CLEANUP_PUSH causes a gcc -Wshadow warning :( ] */
+ gchar *tmp;
+ /* length of operation string and string */
+ len = get_CDR_string(tvb, &tmp, &offset, stream_is_big_endian, GIOP_HEADER_SIZE);
+ operation = ep_strdup(tmp);
+ g_free(tmp);
+ }
if(tree)
{
- proto_tree_add_text (request_tree, tvb, offset - 4 - len, 4,
- /**/ "Operation length: %u", len);
+ proto_tree_add_text (request_tree, tvb, offset - 4 - len, 4,
+ /**/ "Operation length: %u", len);
}
if( len > 0)
{
- if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", operation);
- }
- if(tree)
- {
- proto_tree_add_string (request_tree, hf_giop_req_operation,tvb, offset - len, len, operation);
+ if (check_col(pinfo->cinfo, COL_INFO))
+ {
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": op=%s", operation);
+ }
+ if(tree)
+ {
+ proto_tree_add_string (request_tree, hf_giop_req_operation,tvb, offset - len, len, operation);
- }
+ }
}
+#if 0 /* See comment above re hack ... */
/*
* Register a cleanup function in case on of our tvbuff accesses
* throws an exception. We need to clean up operation.
*/
CLEANUP_PUSH(g_free, operation);
+#endif
/* length of requesting_principal string */
len = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if(tree)
{
- proto_tree_add_text (request_tree, tvb, offset-4, 4,
- /**/ "Requesting Principal Length: %u", len);
+ proto_tree_add_text (request_tree, tvb, offset-4, 4,
+ /**/ "Requesting Principal Length: %u", len);
}
if( len > 0)
{
- get_CDR_octet_seq(tvb, &requesting_principal, &offset, len);
+ get_CDR_octet_seq(tvb, &requesting_principal, &offset, len);
- print_requesting_principal = make_printable_string(requesting_principal, len);
+ print_requesting_principal = make_printable_string(requesting_principal, len);
- if(tree)
- {
- proto_tree_add_text (request_tree, tvb, offset - len, len,
- /**/ "Requesting Principal: %s", print_requesting_principal);
+ if(tree)
+ {
+ proto_tree_add_text (request_tree, tvb, offset - len, len,
+ /**/ "Requesting Principal: %s", print_requesting_principal);
- }
+ }
- g_free( print_requesting_principal );
- g_free( requesting_principal );
+ g_free( print_requesting_principal );
+ g_free( requesting_principal );
}
if (! pinfo->fd->flags.visited)
giop_complete_request_list = insert_in_comp_req_list(giop_complete_request_list,pinfo->fd->num,
- request_id,operation,NULL);
+ request_id,operation,NULL);
/*
*/
- header->req_id = request_id; /* save for sub dissector */
+ header->req_id = request_id; /* save for sub dissector */
repoid = get_repoid_from_objkey(giop_objkey_hash,objkey,objkey_len);
gchar *type_id;
len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0);
proto_tree_add_text(request_tree, tvb, offset - len - 4, 4,
- "Type Id length: %d", len);
+ "Type Id length: %d", len);
proto_tree_add_text(request_tree, tvb, offset - len, len,
- "Type Id: %s", type_id);
+ "Type Id: %s", type_id);
+ g_free(type_id);
}
if(! exres) {
gint stub_length = tvb_reported_length_remaining(tvb, offset);
- if (stub_length >0)
- proto_tree_add_text(request_tree, tvb, offset, -1,
- "Stub data (%d byte%s)", stub_length,
- plurality(stub_length, "", "s"));
+ if (stub_length >0)
+ proto_tree_add_text(request_tree, tvb, offset, -1,
+ "Stub data (%d byte%s)", stub_length,
+ plurality(stub_length, "", "s"));
}
+#if 0 /* See comment above re hack ... */
/*
* We're done with operation, so we can call the cleanup handler to free
* it, and then pop the cleanup handler.
*/
CLEANUP_CALL_AND_POP;
+#endif
/*
* We're done with objkey, so we can call the cleanup handler to free
*/
static void
dissect_giop_request_1_2 (tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree,
- MessageHeader * header, gboolean stream_is_big_endian)
+ proto_tree * tree,
+ MessageHeader * header, gboolean stream_is_big_endian)
{
guint32 offset = 0;
guint32 request_id;
gchar *operation = NULL;
proto_tree *request_tree = NULL;
proto_item *tf;
- gboolean exres = FALSE; /* result of trying explicit dissectors */
-
- gchar *repoid = NULL;
+ gboolean exres = FALSE; /* result of trying explicit dissectors */
+ guint32 objkey_len = 0; /* object key length */
+ gchar *objkey = NULL; /* object key sequence */
+ gchar *repoid = NULL; /* from object key lookup in objkey hash */
if (tree)
{
tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Protocol Request");
+ "General Inter-ORB Protocol Request");
request_tree = proto_item_add_subtree (tf, ett_giop_reply);
}
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO))
{
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
}
if (request_tree)
{
if (request_tree)
{
proto_tree_add_text (request_tree, tvb, offset-1, 1,
- "Response flags: %s (%u)",
- match_strval(response_flags, sync_scope),
- response_flags);
+ "Response flags: %s (%u)",
+ val_to_str(response_flags, response_flags_vals, "(0x%x)"),
+ response_flags);
}
get_CDR_octet_seq( tvb, &reserved, &offset, 3);
if (request_tree)
- {
- proto_tree_add_text (request_tree, tvb, offset-3, 3,
- "Reserved: %x %x %x", reserved[0], reserved[1], reserved[2]);
- }
+ {
+ proto_tree_add_text (request_tree, tvb, offset-3, 3,
+ "Reserved: %x %x %x", reserved[0], reserved[1], reserved[2]);
+ }
g_free(reserved);
- dissect_target_address(tvb, pinfo, &offset, request_tree, stream_is_big_endian);
+ dissect_target_address(tvb, pinfo, &offset, request_tree, stream_is_big_endian,
+ &objkey_len, &objkey);
+ if (objkey) {
+ repoid = get_repoid_from_objkey(giop_objkey_hash, objkey, objkey_len);
+ g_free(objkey);
+ }
/* length of operation string */
len = get_CDR_string(tvb, &operation, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if(tree)
{
- proto_tree_add_text (request_tree, tvb, offset - len - 4, 4,
- /**/ "Operation length: %u", len);
+ proto_tree_add_text (request_tree, tvb, offset - len - 4, 4,
+ /**/ "Operation length: %u", len);
}
if( len > 0)
{
if (check_col(pinfo->cinfo, COL_INFO))
{
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", operation);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": op=%s", operation);
}
if(request_tree)
{
* GIOP octet stream start.
*/
- set_new_alignment(&offset, GIOP_HEADER_SIZE, 8);
+ if (tvb_reported_length_remaining(tvb, offset) > 0)
+ {
+ set_new_alignment(&offset, GIOP_HEADER_SIZE, 8);
+ }
/*
* Save FN,reqid,and operation for later. Add sub_handle later.
if (! pinfo->fd->flags.visited)
giop_complete_request_list = insert_in_comp_req_list(giop_complete_request_list,pinfo->fd->num,
- request_id,operation,NULL);
+ request_id,operation,NULL);
/*
*
* fails, try the heuristic method.
*/
-
if(repoid) {
exres = try_explicit_giop_dissector(tvb,pinfo,tree,&offset,header,operation,repoid);
}
gchar *type_id;
len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0);
proto_tree_add_text(request_tree, tvb, offset - len - 4, 4,
- "Type Id length: %d", len);
+ "Type Id length: %d", len);
proto_tree_add_text(request_tree, tvb, offset - len, len,
- "Type Id: %s", type_id);
+ "Type Id: %s", type_id);
+ g_free(type_id);
}
if(! exres) {
gint stub_length = tvb_reported_length_remaining(tvb, offset);
- if (stub_length >0)
- proto_tree_add_text(request_tree, tvb, offset, -1,
- "Stub data (%d byte%s)", stub_length,
- plurality(stub_length, "", "s"));
+ if (stub_length >0)
+ proto_tree_add_text(request_tree, tvb, offset, -1,
+ "Stub data (%d byte%s)", stub_length,
+ plurality(stub_length, "", "s"));
}
/*
static void
dissect_giop_locate_request( tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree, MessageHeader * header,
- gboolean stream_is_big_endian)
+ proto_tree * tree, MessageHeader * header,
+ gboolean stream_is_big_endian)
{
guint32 offset = 0;
guint32 request_id;
guint32 len = 0;
- gchar *object_key;
- gchar *p_object_key;
proto_tree *locate_request_tree = NULL;
proto_item *tf;
if (tree)
+ {
+ tf = proto_tree_add_text (tree, tvb, offset, -1,
+ "General Inter-ORB Locate Request");
+ if (locate_request_tree == NULL)
{
- tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Locate Request");
- if (locate_request_tree == NULL)
- {
- locate_request_tree = proto_item_add_subtree (tf, ett_giop_locate_request);
+ locate_request_tree = proto_item_add_subtree (tf, ett_giop_locate_request);
- }
}
+ }
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
- }
+ {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u op=LocateRequest", request_id);
+ }
if (locate_request_tree)
- {
- proto_tree_add_text (locate_request_tree, tvb, offset-4, 4,
- "Request id: %u", request_id);
- }
+ {
+ proto_tree_add_text (locate_request_tree, tvb, offset-4, 4,
+ "Request id: %u", request_id);
+ }
if(header->GIOP_version.minor < 2)
{
- len = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
- if (locate_request_tree)
- {
- proto_tree_add_text (locate_request_tree, tvb, offset-4, 4,
- "Object Key length: %u", len);
- }
-
- if (len > 0) {
- get_CDR_octet_seq(tvb, &object_key, &offset, len);
+ len = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
+ if (locate_request_tree)
+ {
+ proto_tree_add_text (locate_request_tree, tvb, offset-4, 4,
+ "Object Key length: %u", len);
+ }
- p_object_key = make_printable_string(object_key, len);
+ if (len > 0) {
- if(locate_request_tree)
- {
+ if(locate_request_tree)
+ {
- proto_tree_add_text (locate_request_tree, tvb, offset-len, len,
- "Object Key: %s", p_object_key);
- }
+ proto_tree_add_item(locate_request_tree, hf_giop_objekt_key, tvb, offset-len, len, FALSE);
+ }
- g_free(p_object_key);
- g_free(object_key);
- }
+ }
}
else /* GIOP 1.2 and higher */
{
- dissect_target_address(tvb, pinfo, &offset, locate_request_tree,
- stream_is_big_endian);
-
+ dissect_target_address(tvb, pinfo, &offset, locate_request_tree,
+ stream_is_big_endian, NULL, NULL);
}
}
static void
dissect_giop_locate_reply( tvbuff_t * tvb, packet_info * pinfo,
- proto_tree * tree, MessageHeader * header,
- gboolean stream_is_big_endian)
+ proto_tree * tree, MessageHeader * header,
+ gboolean stream_is_big_endian)
{
guint32 offset = 0;
guint32 request_id;
if (tree)
{
tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Locate Reply");
+ "General Inter-ORB Locate Reply");
if (locate_reply_tree == NULL)
- {
- locate_reply_tree = proto_item_add_subtree (tf, ett_giop_locate_reply);
+ {
+ locate_reply_tree = proto_item_add_subtree (tf, ett_giop_locate_reply);
- }
+ }
}
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO))
{
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
}
if (locate_reply_tree)
{
proto_tree_add_text (locate_reply_tree, tvb, offset-4, 4,
- "Request id: %u", request_id);
+ "Request id: %u", request_id);
}
locate_status = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (locate_reply_tree)
{
proto_tree_add_text (locate_reply_tree, tvb, offset-4, 4,
- "Locate status: %s",
- match_strval(locate_status, giop_locate_status_types)
- );
+ "Locate status: %s",
+ val_to_str(locate_status, giop_locate_status_types, "(0x%x)")
+ );
}
/* Decode the LocateReply body.
addr_disp = get_CDR_ushort(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if(locate_reply_tree) {
proto_tree_add_text (tree, tvb, offset -2, 2,
- "AddressingDisposition: %u", addr_disp);
+ "AddressingDisposition: %u", addr_disp);
}
break;
default: /* others have no reply body */
static void
dissect_giop_fragment( tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
- gboolean stream_is_big_endian)
+ gboolean stream_is_big_endian)
{
guint32 offset = 0;
guint32 request_id;
proto_item *tf;
if (tree)
+ {
+ tf = proto_tree_add_text (tree, tvb, offset, -1,
+ "General Inter-ORB Fragment");
+ if (fragment_tree == NULL)
{
- tf = proto_tree_add_text (tree, tvb, offset, -1,
- "General Inter-ORB Fragment");
- if (fragment_tree == NULL)
- {
- fragment_tree = proto_item_add_subtree (tf, ett_giop_fragment);
+ fragment_tree = proto_item_add_subtree (tf, ett_giop_fragment);
- }
}
+ }
request_id = get_CDR_ulong(tvb, &offset, stream_is_big_endian,GIOP_HEADER_SIZE);
if (check_col(pinfo->cinfo, COL_INFO))
- {
- col_append_fstr(pinfo->cinfo, COL_INFO, " %u", request_id);
- }
+ {
+ col_append_fstr(pinfo->cinfo, COL_INFO, " id=%u", request_id);
+ }
if (fragment_tree )
- {
- proto_tree_add_uint (fragment_tree, hf_giop_req_id, tvb, offset-4, 4,request_id);
- }
+ {
+ proto_tree_add_uint (fragment_tree, hf_giop_req_id, tvb, offset-4, 4,request_id);
+ }
}
/* Main entry point */
-gboolean dissect_giop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+static void dissect_giop_common (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
guint offset = 0;
MessageHeader header;
tvbuff_t *giop_header_tvb;
guint message_size;
guint minor_version;
gboolean stream_is_big_endian;
- guint tot_len;
+ const char *gMessageType;
+
/* DEBUG */
header.exception_id = NULL;
- /* check magic number and version */
-
-
- /*define END_OF_GIOP_MESSAGE (offset - first_offset - GIOP_HEADER_SIZE) */
-
- tot_len = tvb_length_remaining(tvb, 0);
-
- if (tot_len < GIOP_HEADER_SIZE)
- {
- /* Not enough data captured to hold the GIOP header; don't try
- to interpret it as GIOP. */
- return FALSE;
- }
-
giop_header_tvb = tvb_new_subset (tvb, 0, GIOP_HEADER_SIZE, -1);
- payload_tvb = tvb_new_subset (tvb, GIOP_HEADER_SIZE, -1, -1);
/*
* because I have added extra elements in MessageHeader struct
tvb_memcpy (giop_header_tvb, (guint8 *)&header, 0, GIOP_HEADER_SIZE );
- if (memcmp (header.magic, GIOP_MAGIC, sizeof (header.magic)) != 0)
- {
- /* Not a GIOP message. */
- return FALSE;
- }
-
- if (check_col (pinfo->cinfo, COL_PROTOCOL))
- {
- col_set_str (pinfo->cinfo, COL_PROTOCOL, "GIOP");
- }
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "GIOP");
if (header.GIOP_version.major != GIOP_MAJOR ||
((minor_version = header.GIOP_version.minor) > GIOP_MINOR))
+ {
+ /* Bad version number; should we note that and dissect the rest
+ as data, or should this be done outside dissect_giop_common()
+ (which is called as the PDU dissector for GIOP-over-TCP,
+ so it can't return anything), with the test returning FALSE
+ on the theory that it might have been some other packet that
+ happened to begin with "GIOP"? We do the former, for now.
+ If we should return FALSE, we should do so *without* setting
+ the "Info" column, *without* setting the "Protocol" column,
+ and *without* adding anything to the protocol tree. */
+
+ if (check_col (pinfo->cinfo, COL_INFO))
{
- /* Bad version number; should we note that and dissect the rest
- as data, or should we return FALSE on the theory that it
- might have been some other packet that happened to begin with
- "GIOP"? We shouldn't do *both*, so we return TRUE, for now.
- If we should return FALSE, we should do so *without* setting
- the "Info" column, *without* setting the "Protocol" column,
- and *without* adding anything to the protocol tree. */
-
- if (check_col (pinfo->cinfo, COL_INFO))
- {
- col_add_fstr (pinfo->cinfo, COL_INFO, "Version %u.%u",
- header.GIOP_version.major, header.GIOP_version.minor);
- }
- if (tree)
- {
- ti = proto_tree_add_item (tree, proto_giop, tvb, 0, tot_len, FALSE);
- clnp_tree = proto_item_add_subtree (ti, ett_giop);
- proto_tree_add_text (clnp_tree, giop_header_tvb, 0, -1,
- "Version %u.%u not supported",
- header.GIOP_version.major,
- header.GIOP_version.minor);
- }
- call_dissector(data_handle,payload_tvb, pinfo, tree);
- return TRUE;
+ col_add_fstr (pinfo->cinfo, COL_INFO, "Version %u.%u",
+ header.GIOP_version.major, header.GIOP_version.minor);
}
+ if (tree)
+ {
+ ti = proto_tree_add_item (tree, proto_giop, tvb, 0, -1, FALSE);
+ clnp_tree = proto_item_add_subtree (ti, ett_giop);
+ proto_tree_add_text (clnp_tree, giop_header_tvb, 0, -1,
+ "Version %u.%u not supported",
+ header.GIOP_version.major,
+ header.GIOP_version.minor);
+ }
+ payload_tvb = tvb_new_subset_remaining (tvb, GIOP_HEADER_SIZE);
+ call_dissector(data_handle,payload_tvb, pinfo, tree);
+ return;
+ }
if (check_col (pinfo->cinfo, COL_INFO))
{
- col_add_fstr (pinfo->cinfo, COL_INFO, "GIOP %u.%u %s",
- header.GIOP_version.major, header.GIOP_version.minor,
- val_to_str(header.message_type, giop_message_types,
- "Unknown message type (0x%02x)"));
+ col_add_fstr (pinfo->cinfo, COL_INFO, "GIOP %u.%u %s",
+ header.GIOP_version.major, header.GIOP_version.minor,
+ val_to_str(header.message_type, giop_message_types,
+ "Unknown message type (0x%02x)"));
}
stream_is_big_endian = is_big_endian (&header);
else
message_size = pletohl (&header.message_size);
+ if (check_col (pinfo->cinfo, COL_INFO))
+ {
+ gMessageType = val_to_str(header.message_type, giop_message_types, "Unknown message type (0x%02x)");
+ col_add_fstr (pinfo->cinfo, COL_INFO, "GIOP %u.%u %s s=%u",
+ header.GIOP_version.major, header.GIOP_version.minor, gMessageType, message_size );
+ }
+
if (tree)
+ {
+ ti = proto_tree_add_item (tree, proto_giop, tvb, 0, -1, FALSE);
+ clnp_tree = proto_item_add_subtree (ti, ett_giop);
+ proto_tree_add_text (clnp_tree, giop_header_tvb, offset, 4,
+ "Magic number: %s", GIOP_MAGIC);
+ proto_tree_add_text (clnp_tree, giop_header_tvb, 4, 2,
+ "Version: %u.%u",
+ header.GIOP_version.major,
+ header.GIOP_version.minor);
+ switch (minor_version)
{
- ti = proto_tree_add_item (tree, proto_giop, tvb, 0, tot_len, FALSE);
- clnp_tree = proto_item_add_subtree (ti, ett_giop);
- proto_tree_add_text (clnp_tree, giop_header_tvb, offset, 4,
- "Magic number: %s", GIOP_MAGIC);
- proto_tree_add_text (clnp_tree, giop_header_tvb, 4, 2,
- "Version: %u.%u",
- header.GIOP_version.major,
- header.GIOP_version.minor);
- switch (minor_version)
- {
- case 2:
- case 1:
- proto_tree_add_text (clnp_tree, giop_header_tvb, 6, 1,
- "Flags: 0x%02x (%s %s)",
- header.flags,
- (stream_is_big_endian) ? "big-endian" : "little-endian",
- (header.flags & 0x02) ? " fragment" : "");
- break;
- case 0:
- proto_tree_add_text (clnp_tree, giop_header_tvb, 6, 1,
- "Byte ordering: %s-endian",
- (stream_is_big_endian) ? "big" : "little");
- break;
- default:
- break;
- } /* minor_version */
-
- proto_tree_add_uint_format (clnp_tree,
- hf_giop_message_type,
- giop_header_tvb, 7, 1,
- header.message_type,
- "Message type: %s", match_strval(header.message_type, giop_message_types));
-
- proto_tree_add_uint (clnp_tree,
- hf_giop_message_size,
- giop_header_tvb, 8, 4, message_size);
-
- } /* tree */
+ case 2:
+ case 1:
+ ti = proto_tree_add_bitmask(clnp_tree, giop_header_tvb, 6,
+ hf_giop_message_flags, ett_giop_message_flags,
+ giop_message_flags, FALSE);
+ if ((header.flags & GIOP_MESSAGE_FLAGS_ENDIANNESS) == 0)
+ proto_item_append_text(ti, ", (Big Endian)"); /* hack to show "Big Endian" when endianness flag == 0 */
+ break;
+ case 0:
+ proto_tree_add_text (clnp_tree, giop_header_tvb, 6, 1,
+ "Byte ordering: %s-endian",
+ (stream_is_big_endian) ? "big" : "little");
+ break;
+ default:
+ break;
+ } /* minor_version */
+
+ gMessageType = val_to_str(header.message_type, giop_message_types, "(0x%02x)" );
+
+ proto_tree_add_uint_format (clnp_tree,
+ hf_giop_message_type,
+ giop_header_tvb, 7, 1,
+ header.message_type,
+ "Message type: %s", gMessageType );
+
+ proto_tree_add_uint (clnp_tree,
+ hf_giop_message_size,
+ giop_header_tvb, 8, 4, message_size);
+
+ } /* tree */
#if 0
if (check_col (pinfo->cinfo, COL_INFO))
{
- col_add_fstr (pinfo->cinfo, COL_INFO, "GIOP %u.%u %s",
- header.GIOP_version.major, header.GIOP_version.minor,
- match_strval(header.message_type, giop_message_types));
+ col_add_fstr (pinfo->cinfo, COL_INFO, "GIOP %u.%u %s",
+ header.GIOP_version.major, header.GIOP_version.minor,
+ val_to_str(header.message_type, giop_message_types, "(0x%x)"));
}
#endif
+ if (header.flags & GIOP_MESSAGE_FLAGS_ZIOP_ENABLED)
+ {
+ payload_tvb = tvb_child_uncompress(tvb, tvb, GIOP_HEADER_SIZE, tvb_length_remaining(tvb, GIOP_HEADER_SIZE ) );
+ if (payload_tvb) {
+ add_new_data_source (pinfo, payload_tvb, "decompressed Content");
+ } else {
+ /* Decompression failed. */
+ /* XXX: Consider: add expert item ? do data dissection ? */
+ return;
+ }
+ } else {
+ payload_tvb = tvb_new_subset_remaining (tvb, GIOP_HEADER_SIZE);
+ }
+
switch (header.message_type)
+ {
+
+ case Request:
+ if(header.GIOP_version.minor < 2)
{
-
- case Request:
- if(header.GIOP_version.minor < 2)
- {
- dissect_giop_request_1_1 (payload_tvb, pinfo, tree,
- &header, stream_is_big_endian);
- }
- else
- {
- dissect_giop_request_1_2 (payload_tvb, pinfo, tree,
- &header, stream_is_big_endian);
- }
-
- break;
-
-
- case Reply:
- if(header.GIOP_version.minor < 2)
- {
- dissect_giop_reply (payload_tvb, pinfo, tree, &header,
- stream_is_big_endian);
- }
- else
- {
- dissect_giop_reply_1_2 (payload_tvb, pinfo, tree,
- &header, stream_is_big_endian);
- }
- break;
- case CancelRequest:
- dissect_giop_cancel_request(payload_tvb, pinfo, tree,
- stream_is_big_endian);
- break;
- case LocateRequest:
- dissect_giop_locate_request(payload_tvb, pinfo, tree, &header,
- stream_is_big_endian);
- break;
- case LocateReply:
- dissect_giop_locate_reply(payload_tvb, pinfo, tree, &header,
- stream_is_big_endian);
- break;
- case Fragment:
- dissect_giop_fragment(payload_tvb, pinfo, tree,
- stream_is_big_endian);
- break;
- default:
- break;
-
- } /* switch message_type */
+ dissect_giop_request_1_1 (payload_tvb, pinfo, tree,
+ &header, stream_is_big_endian);
+ }
+ else
+ {
+ dissect_giop_request_1_2 (payload_tvb, pinfo, tree,
+ &header, stream_is_big_endian);
+ }
+
+ break;
+
+
+ case Reply:
+ if(header.GIOP_version.minor < 2)
+ {
+ dissect_giop_reply (payload_tvb, pinfo, tree, &header,
+ stream_is_big_endian);
+ }
+ else
+ {
+ dissect_giop_reply_1_2 (payload_tvb, pinfo, tree,
+ &header, stream_is_big_endian);
+ }
+ break;
+ case CancelRequest:
+ dissect_giop_cancel_request(payload_tvb, pinfo, tree,
+ stream_is_big_endian);
+ break;
+ case LocateRequest:
+ dissect_giop_locate_request(payload_tvb, pinfo, tree, &header,
+ stream_is_big_endian);
+ break;
+ case LocateReply:
+ dissect_giop_locate_reply(payload_tvb, pinfo, tree, &header,
+ stream_is_big_endian);
+ break;
+ case Fragment:
+ dissect_giop_fragment(payload_tvb, pinfo, tree,
+ stream_is_big_endian);
+ break;
+ default:
+ break;
+
+ } /* switch message_type */
/*
*/
if (header.exception_id != NULL)
g_free(header.exception_id);
+}
+
+static guint
+get_giop_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset)
+{
+
+ MessageHeader header;
+ guint message_size;
+ gboolean stream_is_big_endian;
+
+ if ( tvb_memeql(tvb, 0, GIOP_MAGIC ,4) != 0)
+ return 0;
+
+ tvb_memcpy (tvb, (guint8 *)&header, offset, GIOP_HEADER_SIZE );
+
+ stream_is_big_endian = is_big_endian (&header);
+
+ if (stream_is_big_endian)
+ message_size = pntohl (&header.message_size);
+ else
+ message_size = pletohl (&header.message_size);
+
+
+ return message_size + GIOP_HEADER_SIZE;
+}
+
+static gboolean
+dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
+
+
+gboolean dissect_giop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
+ return dissect_giop_heur(tvb, pinfo, tree);
+}
+
+
+static void
+dissect_giop_tcp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+
+ if ( tvb_memeql(tvb, 0, GIOP_MAGIC ,4) != 0) {
+
+ if ( tvb_memeql(tvb, 0, ZIOP_MAGIC ,4) == 0)
+ dissect_ziop_heur(tvb, pinfo, tree);
+
+ return;
+ }
+
+ tcp_dissect_pdus(tvb, pinfo, tree, giop_desegment, GIOP_HEADER_SIZE,
+ get_giop_pdu_len, dissect_giop_common);
+}
+
+static gboolean
+dissect_giop_heur (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+
+ guint tot_len;
+
+ conversation_t *conversation;
+ /* check magic number and version */
+
+
+ /*define END_OF_GIOP_MESSAGE (offset - first_offset - GIOP_HEADER_SIZE) */
+
+ tot_len = tvb_length(tvb);
+
+ if (tot_len < GIOP_HEADER_SIZE) /* tot_len < 12 */
+ {
+ /* Not enough data captured to hold the GIOP header; don't try
+ to interpret it as GIOP. */
+ return FALSE;
+ }
+ if ( tvb_memeql(tvb, 0, GIOP_MAGIC ,4) != 0)
+ return FALSE;
+
+ if ( pinfo->ptype == PT_TCP )
+ {
+ /*
+ * Make the GIOP dissector the dissector for this conversation.
+ *
+ * If this isn't the first time this packet has been processed,
+ * we've already done this work, so we don't need to do it
+ * again.
+ */
+ if (!pinfo->fd->flags.visited)
+ {
+ conversation = find_conversation(pinfo->fd->num, &pinfo->src,
+ &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
+ if (conversation == NULL)
+ {
+ conversation = conversation_new(pinfo->fd->num, &pinfo->src,
+ &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
+ }
+ /* Set dissector */
+ conversation_set_dissector(conversation, giop_tcp_handle);
+ }
+ dissect_giop_tcp (tvb, pinfo, tree);
+ }
+ else
+ {
+ dissect_giop_common (tvb, pinfo, tree);
+ }
return TRUE;
+
}
void
proto_register_giop (void)
{
static hf_register_info hf[] = {
+ { &hf_giop_message_flags,
+ { "Message Flags", "giop.flags",
+ FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL }
+ },
+
+ { &hf_giop_message_flags_ziop_enabled,
+ { "ZIOP Enabled", "giop.flags.ziop_enabled",
+ FT_BOOLEAN, 8, NULL, GIOP_MESSAGE_FLAGS_ZIOP_ENABLED, NULL, HFILL }
+ },
+
+ { &hf_giop_message_flags_ziop_supported,
+ { "ZIOP Supported", "giop.flags.ziop_supported",
+ FT_BOOLEAN, 8, NULL, GIOP_MESSAGE_FLAGS_ZIOP_SUPPORTED, NULL, HFILL }
+ },
+
+ { &hf_giop_message_flags_fragment,
+ { "Fragment", "giop.flags.fragment",
+ FT_BOOLEAN, 8, NULL, GIOP_MESSAGE_FLAGS_FRAGMENT, NULL, HFILL }
+ },
+
+ { &hf_giop_message_flags_little_endian,
+ { "Little Endian", "giop.flags.little_endian",
+ FT_BOOLEAN, 8, NULL, GIOP_MESSAGE_FLAGS_ENDIANNESS, NULL, HFILL }
+ },
+
{ &hf_giop_message_type,
- { "Message type", "giop.type",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Message type", "giop.type",
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_message_size,
{ "Message size", "giop.len",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_repoid,
- { "Repository ID", "giop.repoid",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Repository ID", "giop.repoid",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_string_length,
- { "String Length", "giop.strlen",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "String Length", "giop.strlen",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_sequence_length,
- { "Sequence Length", "giop.seqlen",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Sequence Length", "giop.seqlen",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_profile_id,
- { "Profile ID", "giop.profid",
- FT_UINT32, BASE_DEC, VALS(profile_id_vals), 0x0, "", HFILL }
+ { "Profile ID", "giop.profid",
+ FT_UINT32, BASE_DEC, VALS(profile_id_vals), 0x0, NULL, HFILL }
},
{ &hf_giop_type_id,
- { "IOR::type_id", "giop.typeid",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "IOR::type_id", "giop.typeid",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_iiop_v_maj,
- { "IIOP Major Version", "giop.iiop_vmaj",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "IIOP Major Version", "giop.iiop_vmaj",
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
}
,
{ &hf_giop_iiop_v_min,
- { "IIOP Minor Version", "giop.iiop_vmin",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "IIOP Minor Version", "giop.iiop_vmin",
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
- { &hf_giop_endianess,
- { "Endianess", "giop.endianess",
- FT_UINT8, BASE_DEC, VALS(giop_endianess_vals), 0x0, "", HFILL }
+ { &hf_giop_compressed,
+ { "ZIOP", "giop.compressed",
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
+ },
+
+ { &hf_giop_endianness,
+ { "Endianness", "giop.endianness",
+ FT_UINT8, BASE_DEC, VALS(giop_endianness_vals), 0x0, NULL, HFILL }
},
{ &hf_giop_IIOP_tag,
- { "IIOP Component TAG", "giop.iioptag",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "IIOP Component TAG", "giop.iioptag",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_IOR_tag,
- { "IOR Profile TAG", "giop.iortag",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "IOR Profile TAG", "giop.iortag",
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_TCKind,
- { "TypeCode enum", "giop.TCKind",
- FT_UINT32, BASE_DEC, VALS(tckind_vals), 0x0, "", HFILL }
+ { "TypeCode enum", "giop.TCKind",
+ FT_UINT32, BASE_DEC, VALS(tckind_vals), 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_count,
- { "TypeCode count", "giop.tccount",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode count", "giop.tccount",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_default_used,
- { "default_used", "giop.tcdefault_used",
- FT_INT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "default_used", "giop.tcdefault_used",
+ FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_digits,
- { "Digits", "giop.tcdigits",
- FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Digits", "giop.tcdigits",
+ FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_length,
- { "Length", "giop.tclength",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Length", "giop.tclength",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_max_length,
- { "Maximum length", "giop.tcmaxlen",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Maximum length", "giop.tcmaxlen",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_member_name,
- { "TypeCode member name", "giop.tcmemname",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode member name", "giop.tcmemname",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_name,
- { "TypeCode name", "giop.tcname",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode name", "giop.tcname",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_scale,
- { "Scale", "giop.tcscale",
- FT_INT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Scale", "giop.tcscale",
+ FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_ValueModifier,
- { "ValueModifier", "giop.tcValueModifier",
- FT_INT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "ValueModifier", "giop.tcValueModifier",
+ FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_typecode_Visibility,
- { "Visibility", "giop.tcVisibility",
- FT_INT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "Visibility", "giop.tcVisibility",
+ FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_boolean,
{ "TypeCode boolean data", "giop.tcboolean",
- FT_BOOLEAN, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_char,
{ "TypeCode char data", "giop.tcchar",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_double,
{ "TypeCode double data", "giop.tcdouble",
- FT_DOUBLE, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_enum,
- { "TypeCode enum data", "giop.tcenumdata",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode enum data", "giop.tcenumdata",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
/*
{ &hf_giop_type_float,
{ "TypeCode float data", "giop.tcfloat",
- FT_DOUBLE, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_DOUBLE, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_long,
- { "TypeCode long data", "giop.tclongdata",
- FT_INT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode long data", "giop.tclongdata",
+ FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_octet,
{ "TypeCode octet data", "giop.tcoctet",
- FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_short,
- { "TypeCode short data", "giop.tcshortdata",
- FT_INT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode short data", "giop.tcshortdata",
+ FT_INT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_string,
{ "TypeCode string data", "giop.tcstring",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_ulong,
- { "TypeCode ulong data", "giop.tculongdata",
- FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode ulong data", "giop.tculongdata",
+ FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
{ &hf_giop_type_ushort,
- { "TypeCode ushort data", "giop.tcushortdata",
- FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
+ { "TypeCode ushort data", "giop.tcushortdata",
+ FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
},
/*
*/
{ &hf_giop_iiop_host,
- { "IIOP::Profile_host", "giop.iiop.host",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
- }
- ,
+ { "IIOP::Profile_host", "giop.iiop.host",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+ },
{ &hf_giop_iiop_port,
- { "IIOP::Profile_port", "giop.iiop.port",
- FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }
- }
- ,
+ { "IIOP::Profile_port", "giop.iiop.port",
+ FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }
+ },
/*
* IIOP ServiceContext
*/
{ &hf_giop_iop_vscid,
- { "VSCID", "giop.iiop.vscid",
- FT_UINT32, BASE_HEX, NULL, 0xffffff00, "", HFILL }
- }
- ,
+ { "VSCID", "giop.iiop.vscid",
+ FT_UINT32, BASE_HEX, NULL, 0xffffff00, NULL, HFILL }
+ },
{ &hf_giop_iop_scid,
- { "SCID", "giop.iiop.scid",
- FT_UINT32, BASE_HEX, NULL, 0x000000ff, "", HFILL }
- }
- ,
+ { "SCID", "giop.iiop.scid",
+ FT_UINT32, BASE_HEX, NULL, 0x000000ff, NULL, HFILL }
+ },
+
+ { &hf_giop_req_id,
+ { "Request id", "giop.request_id",
+ FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }
+ },
+
+ { &hf_giop_req_operation,
+ { "Request operation", "giop.request_op",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+ },
+
+ { &hf_giop_reply_status,
+ { "Reply status", "giop.replystatus",
+ FT_UINT32, BASE_DEC, VALS(reply_status_types), 0x0, NULL, HFILL }
+ },
+
+ { &hf_giop_exception_id,
+ { "Exception id", "giop.exceptionid",
+ FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }
+ },
+
+ { &hf_giop_objekt_key,
+ { "Object Key", "giop.objektkey",
+ FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }
+ },
- { &hf_giop_req_id,
- { "Request id", "giop.request_id",
- FT_UINT32, BASE_DEC, NULL, 0, "", HFILL }
- },
-
- { &hf_giop_req_operation,
- { "Request operation", "giop.request_op",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
- },
- { &hf_giop_reply_status,
- { "Reply status", "giop.replystatus",
- FT_UINT32, BASE_DEC, VALS(reply_status_types), 0x0, "", HFILL }
- },
- { &hf_giop_exception_id,
- { "Exception id", "giop.exceptionid",
- FT_STRING, BASE_DEC, NULL, 0x0, "", HFILL }
- },
};
-
-
-
+
+
+
static gint *ett[] = {
&ett_giop,
+ &ett_giop_message_flags,
&ett_giop_reply,
&ett_giop_request,
&ett_giop_cancel_request,
&ett_giop_ior
};
+ module_t *giop_module;
+
proto_giop = proto_register_protocol("General Inter-ORB Protocol", "GIOP",
- "giop");
+ "giop");
proto_register_field_array (proto_giop, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
register_init_routine( &giop_init); /* any init stuff */
+ /* register preferences */
+ giop_module = prefs_register_protocol(proto_giop, NULL);
+ prefs_register_bool_preference(giop_module, "desegment_giop_messages",
+ "Reassemble GIOP messages spanning multiple TCP segments",
+ "Whether the GIOP dissector should reassemble messages spanning multiple TCP segments."
+ " To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
+ &giop_desegment);
+ prefs_register_string_preference(giop_module, "ior_txt", "Stringified IORs",
+ "File containing stringified IORs, one per line.", &giop_ior_file);
+
/*
* Init the giop user module hash tables here, as giop users
* will populate it via register_giop_user_module BEFORE my
void proto_reg_handoff_giop (void) {
data_handle = find_dissector("data");
- heur_dissector_add("tcp", dissect_giop, proto_giop);
+ giop_tcp_handle = create_dissector_handle(dissect_giop_tcp, proto_giop);
+ heur_dissector_add("tcp", dissect_giop_heur, proto_giop);
/* Support DIOP (GIOP/UDP) */
- heur_dissector_add("udp", dissect_giop, proto_giop);
+ heur_dissector_add("udp", dissect_giop_heur, proto_giop);
+ dissector_add_handle("tcp.port", giop_tcp_handle); /* for "decode-as" */
}
*/
void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset,
- guint32 boundary, gboolean stream_is_big_endian) {
+ guint32 boundary, gboolean stream_is_big_endian) {
- guint32 seqlen_p; /* sequence length of profiles */
+ guint32 seqlen_p; /* sequence length of profiles */
guint32 u_octet4;
- proto_tree *tree = NULL; /* IOR tree */
+ proto_tree *tree = NULL; /* IOR tree */
proto_item *tf;
- gchar *repobuf; /* for repository ID */
+ gchar *repobuf; /* for repository ID */
guint32 i;
if (tree) {
proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
+ *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
if (u_octet4 > 0) {
proto_tree_add_string(tree,hf_giop_type_id,tvb,
- *offset-u_octet4,u_octet4,repobuf);
+ *offset-u_octet4,u_octet4,repobuf);
}
}
seqlen_p = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen_p),4,seqlen_p);
+ *offset-sizeof(seqlen_p),4,seqlen_p);
}
}
static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf) {
+ guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf) {
- guint32 seqlen_pd; /* sequence length of profile data */
+ guint32 seqlen_pd; /* sequence length of profile data */
- guint32 pidtag; /* profile ID TAG */
+ guint32 pidtag; /* profile ID TAG */
- gchar *profile_data; /* profile_data pointer */
- gchar *p_profile_data; /* printable profile_data pointer */
+ gchar *profile_data; /* profile_data pointer */
+ gchar *p_profile_data; /* printable profile_data pointer */
- guint32 new_boundary; /* for encapsulations encountered */
- gboolean new_big_endianess; /* for encapsulations encountered */
+ guint32 new_boundary; /* for encapsulations encountered */
+ gboolean new_big_endianness; /* for encapsulations encountered */
/* Get ProfileId tag */
if (tree) {
proto_tree_add_uint(tree,hf_giop_profile_id,tvb,
- *offset-sizeof(pidtag),4,pidtag);
+ *offset-sizeof(pidtag),4,pidtag);
}
/* get sequence length, new endianness and boundary for encapsulation */
seqlen_pd = get_CDR_encap_info(tvb, tree, offset,
- stream_is_big_endian, boundary,
- &new_big_endianess, &new_boundary);
+ stream_is_big_endian, boundary,
+ &new_big_endianness, &new_boundary);
/* return if zero length sequence */
switch(pidtag) {
case IOP_TAG_INTERNET_IOP:
- decode_IIOP_IOR_profile(tvb, pinfo, tree, offset, new_boundary, new_big_endianess, repobuf, TRUE);
+ decode_IIOP_IOR_profile(tvb, pinfo, tree, offset, new_boundary, new_big_endianness, repobuf, TRUE);
break;
default:
- /* fetch all octets in this sequence , but skip endianess */
+ /* fetch all octets in this sequence , but skip endianness */
get_CDR_octet_seq(tvb, &profile_data, offset, seqlen_pd -1);
if(tree) {
proto_tree_add_text (tree, tvb, *offset -seqlen_pd + 1, seqlen_pd - 1,
- "Profile Data: %s", p_profile_data);
+ "Profile Data: %s", p_profile_data);
}
g_free(p_profile_data);
static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset,
- guint32 boundary, gboolean stream_is_big_endian, gchar *repo_id_buf,
- gboolean store_flag) {
+ guint32 boundary, gboolean stream_is_big_endian, gchar *repo_id_buf,
+ gboolean store_flag) {
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
- guint8 v_major,v_minor; /* IIOP version */
+ guint8 v_major,v_minor; /* IIOP version */
gchar *buf;
- guint32 u_octet4; /* u long */
- guint16 u_octet2; /* u short */
- guint32 seqlen; /* generic sequence length */
- guint32 seqlen1; /* generic sequence length */
- gchar *objkey; /* object key pointer */
- gchar *p_chars; /* printable characters pointer */
+ guint32 u_octet4; /* u long */
+ guint16 u_octet2; /* u short */
+ guint32 seqlen; /* generic sequence length */
+ guint32 seqlen1; /* generic sequence length */
+ gchar *objkey; /* object key pointer */
+ gchar *p_chars; /* printable characters pointer */
/* Get major/minor version */
if (tree) {
proto_tree_add_uint(tree,hf_giop_iiop_v_maj,tvb,
- *offset-sizeof(v_minor)-sizeof(v_major),1,v_major );
+ *offset-sizeof(v_minor)-sizeof(v_major),1,v_major );
proto_tree_add_uint(tree,hf_giop_iiop_v_min,tvb,
- *offset-sizeof(v_minor),1,v_minor );
+ *offset-sizeof(v_minor),1,v_minor );
}
if (tree) {
proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
+ *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
if (u_octet4 > 0) {
proto_tree_add_string(tree,hf_giop_iiop_host,tvb,
- *offset-u_octet4,u_octet4,buf);
+ *offset-u_octet4,u_octet4,buf);
}
}
- g_free(buf); /* dont forget */
+ g_free(buf); /* dont forget */
/* Port */
if (tree) {
proto_tree_add_uint(tree,hf_giop_iiop_port,tvb,
- *offset-sizeof(u_octet2),2,u_octet2);
+ *offset-sizeof(u_octet2),2,u_octet2);
}
if (tree) {
proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen),4,seqlen);
+ *offset-sizeof(seqlen),4,seqlen);
}
if (seqlen > 0) {
if (repo_id_buf) {
if (pinfo) {
- if(!pinfo->fd->flags.visited)
- insert_in_objkey_hash(giop_objkey_hash,objkey,seqlen,repo_id_buf,req_res);
+ if(!pinfo->fd->flags.visited)
+ insert_in_objkey_hash(giop_objkey_hash,objkey,seqlen,repo_id_buf,ior_src_req_res);
}
else {
- /*
- * No pinfo, but store anyway if flag set. eg: IOR read from file
- */
+ /*
+ * No pinfo, but store anyway if flag set. eg: IOR read from file
+ */
- if (store_flag)
- insert_in_objkey_hash(giop_objkey_hash,objkey,seqlen,repo_id_buf,file);
+ if (store_flag)
+ insert_in_objkey_hash(giop_objkey_hash,objkey,seqlen,repo_id_buf,ior_src_file);
}
}
- /* Make a printable string */
-
- p_chars = make_printable_string( objkey, seqlen );
-
if(tree) {
- proto_tree_add_text (tree, tvb, *offset -seqlen, seqlen,
- "Object Key: %s", p_chars);
+ proto_tree_add_item(tree, hf_giop_objekt_key, tvb, *offset -seqlen, seqlen, FALSE);
}
-
- g_free(p_chars);
g_free(objkey);
}
if (tree) {
proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen),4,seqlen);
+ *offset-sizeof(seqlen),4,seqlen);
}
for (i=0; i< seqlen; i++) {
/* get tag */
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
- proto_tree_add_uint(tree,hf_giop_IIOP_tag,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ proto_tree_add_uint(tree,hf_giop_IIOP_tag,tvb,
+ *offset-sizeof(u_octet4),4,u_octet4);
}
/* get component_data */
seqlen1 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
- proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen1),4,seqlen1);
+ proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
+ *offset-sizeof(seqlen1),4,seqlen1);
}
if (seqlen1 > 0) {
- get_CDR_octet_seq(tvb, &buf, offset, seqlen1);
+ get_CDR_octet_seq(tvb, &buf, offset, seqlen1);
- if (tree) {
- /* Make a printable string of data */
+ if (tree) {
+ /* Make a printable string of data */
- p_chars = make_printable_string(buf, seqlen1);
+ p_chars = make_printable_string(buf, seqlen1);
- proto_tree_add_text (tree, tvb, *offset -seqlen1, seqlen1,
- "component_data: %s", p_chars);
+ proto_tree_add_text (tree, tvb, *offset -seqlen1, seqlen1,
+ "component_data: %s", p_chars);
- g_free(p_chars);
- }
+ g_free(p_chars);
+ }
- g_free(buf);
+ g_free(buf);
}
}
* CodeSetId char_data;
* CodeSetId wchar_data;
* };
- * };
- *
+ * };
+ *
* Code sets are identified by a 32-bit integer id from OSF.
* See: ftp://ftp.opengroup.org/pub/code_set_registry
*/
+static const value_string giop_code_set_vals[] = {
+ { 0x00010001, "ISO_8859_1" },
+ { 0x00010002, "ISO_8859_2" },
+ { 0x00010003, "ISO_8859_3" },
+ { 0x00010004, "ISO_8859_4" },
+ { 0x00010005, "ISO_8859_5" },
+ { 0x00010006, "ISO_8859_6" },
+ { 0x00010007, "ISO_8859_7" },
+ { 0x00010008, "ISO_8859_8" },
+ { 0x00010009, "ISO_8859_9" },
+ { 0x0001000A, "ISO_8859_10" },
+ { 0x0001000F, "ISO_8859_15" },
+ { 0x00010020, "ISO_646" },
+ { 0x00010100, "ISO_UCS_2_LEVEL_1" },
+ { 0x00010101, "ISO_UCS_2_LEVEL_2" },
+ { 0x00010102, "ISO_UCS_2_LEVEL_3" },
+ { 0x00010104, "ISO_UCS_4_LEVEL_1" },
+ { 0x00010105, "ISO_UCS_4_LEVEL_2" },
+ { 0x00010106, "ISO_UCS_4_LEVEL_3" },
+ { 0x00010108, "ISO_UTF_8" },
+ { 0x00010109, "ISO_UTF_16" },
+ { 0x00030001, "JIS_X0201" },
+ { 0x00030004, "JIS_X0208_1978" },
+ { 0x00030005, "JIS_X0208_1983" },
+ { 0x00030006, "JIS_X0208_1990" },
+ { 0x0003000A, "JIS_X0212" },
+ { 0x00030010, "JIS_EUCJP" },
+ { 0x00040001, "KS_C5601" },
+ { 0x00040002, "KS_C5657" },
+ { 0x0004000A, "KS_EUCKR" },
+ { 0x00050001, "CNS_11643_1986" },
+ { 0x00050002, "CNS_11643_1992" },
+ { 0x0005000A, "CNS_EUCTW_1991" },
+ { 0x00050010, "CNS_EUCTW_1993" },
+ { 0x000B0001, "TIS_620_2529" },
+ { 0x000D0001, "TTB_CCDC" },
+ { 0x05000010, "OSF_JAPANESE_UJIS" },
+ { 0x05000011, "OSF_JAPANESE_SJIS_1" },
+ { 0x05000012, "OSF_JAPANESE_SJIS_2" },
+ { 0x05010001, "XOPEN_UTF_8" },
+ { 0x05020001, "JVC_EUCJP" },
+ { 0x05020002, "JVC_SJIS" },
+ { 0x10000001, "DEC_KANJI" },
+ { 0x10000002, "SUPER_DEC_KANJI" },
+ { 0x10000003, "DEC_SHIFT_JIS" },
+ { 0x10010001, "HP_ROMAN8" },
+ { 0x10010002, "HP_KANA8" },
+ { 0x10010003, "HP_ARABIC8" },
+ { 0x10010004, "HP_GREEK8" },
+ { 0x10010005, "HP_HEBREW8" },
+ { 0x10010006, "HP_TURKISH8" },
+ { 0x10010007, "HP15CN" },
+ { 0x10010008, "HP_BIG5" },
+ { 0x10010009, "HP_JAPANESE15__SJIS_" },
+ { 0x1001000A, "HP_SJISHI" },
+ { 0x1001000B, "HP_SJISPC" },
+ { 0x1001000C, "HP_UJIS" },
+ { 0x10020025, "IBM_037" },
+ { 0x10020111, "IBM_273" },
+ { 0x10020115, "IBM_277" },
+ { 0x10020116, "IBM_278" },
+ { 0x10020118, "IBM_280" },
+ { 0x1002011A, "IBM_282" },
+ { 0x1002011C, "IBM_284" },
+ { 0x1002011D, "IBM_285" },
+ { 0x10020122, "IBM_290" },
+ { 0x10020129, "IBM_297" },
+ { 0x1002012C, "IBM_300" },
+ { 0x1002012D, "IBM_301" },
+ { 0x100201A4, "IBM_420" },
+ { 0x100201A8, "IBM_424" },
+ { 0x100201B5, "IBM_437" },
+ { 0x100201F4, "IBM_500" },
+ { 0x10020341, "IBM_833" },
+ { 0x10020342, "IBM_834" },
+ { 0x10020343, "IBM_835" },
+ { 0x10020344, "IBM_836" },
+ { 0x10020345, "IBM_837" },
+ { 0x10020346, "IBM_838" },
+ { 0x10020347, "IBM_839" },
+ { 0x10020352, "IBM_850" },
+ { 0x10020354, "IBM_852" },
+ { 0x10020357, "IBM_855" },
+ { 0x10020358, "IBM_856" },
+ { 0x10020359, "IBM_857" },
+ { 0x1002035D, "IBM_861" },
+ { 0x1002035E, "IBM_862" },
+ { 0x1002035F, "IBM_863" },
+ { 0x10020360, "IBM_864" },
+ { 0x10020362, "IBM_866" },
+ { 0x10020364, "IBM_868" },
+ { 0x10020365, "IBM_869" },
+ { 0x10020366, "IBM_870" },
+ { 0x10020367, "IBM_871" },
+ { 0x1002036A, "IBM_874" },
+ { 0x1002036B, "IBM_875" },
+ { 0x10020370, "IBM_880" },
+ { 0x1002037B, "IBM_891" },
+ { 0x10020380, "IBM_896" },
+ { 0x10020381, "IBM_897" },
+ { 0x10020387, "IBM_903" },
+ { 0x10020388, "IBM_904" },
+ { 0x10020396, "IBM_918" },
+ { 0x10020399, "IBM_921" },
+ { 0x1002039A, "IBM_922" },
+ { 0x1002039E, "IBM_926" },
+ { 0x1002039F, "IBM_927" },
+ { 0x100203A0, "IBM_928" },
+ { 0x100203A1, "IBM_929" },
+ { 0x100203A2, "IBM_930" },
+ { 0x100203A4, "IBM_932" },
+ { 0x100203A5, "IBM_933" },
+ { 0x100203A6, "IBM_934" },
+ { 0x100203A7, "IBM_935" },
+ { 0x100203A8, "IBM_936" },
+ { 0x100203A9, "IBM_937" },
+ { 0x100203AA, "IBM_938" },
+ { 0x100203AB, "IBM_939" },
+ { 0x100203AD, "IBM_941" },
+ { 0x100203AE, "IBM_942" },
+ { 0x100203AF, "IBM_943" },
+ { 0x100203B2, "IBM_946" },
+ { 0x100203B3, "IBM_947" },
+ { 0x100203B4, "IBM_948" },
+ { 0x100203B5, "IBM_949" },
+ { 0x100203B6, "IBM_950" },
+ { 0x100203B7, "IBM_951" },
+ { 0x100203BB, "IBM_955" },
+ { 0x100203C4, "IBM_964" },
+ { 0x100203CA, "IBM_970" },
+ { 0x100203EE, "IBM_1006" },
+ { 0x10020401, "IBM_1025" },
+ { 0x10020402, "IBM_1026" },
+ { 0x10020403, "IBM_1027" },
+ { 0x10020410, "IBM_1040" },
+ { 0x10020411, "IBM_1041" },
+ { 0x10020413, "IBM_1043" },
+ { 0x10020416, "IBM_1046" },
+ { 0x10020417, "IBM_1047" },
+ { 0x10020440, "IBM_1088" },
+ { 0x10020449, "IBM_1097" },
+ { 0x1002044A, "IBM_1098" },
+ { 0x10020458, "IBM_1112" },
+ { 0x1002045A, "IBM_1114" },
+ { 0x1002045B, "IBM_1115" },
+ { 0x10020462, "IBM_1122" },
+ { 0x100204E2, "IBM_1250" },
+ { 0x100204E3, "IBM_1251" },
+ { 0x100204E4, "IBM_1252" },
+ { 0x100204E5, "IBM_1253" },
+ { 0x100204E6, "IBM_1254" },
+ { 0x100204E7, "IBM_1255" },
+ { 0x100204E8, "IBM_1256" },
+ { 0x100204E9, "IBM_1257" },
+ { 0x10020564, "IBM_1380" },
+ { 0x10020565, "IBM_1381" },
+ { 0x10020567, "IBM_1383" },
+ { 0x1002112C, "IBM_4396" },
+ { 0x10021352, "IBM_4946" },
+ { 0x10021354, "IBM_4948" },
+ { 0x10021357, "IBM_4951" },
+ { 0x10021358, "IBM_4952" },
+ { 0x10021359, "IBM_4953" },
+ { 0x10021360, "IBM_4960" },
+ { 0x10021364, "IBM_4964" },
+ { 0x10021365, "IBM_4965" },
+ { 0x100213A2, "IBM_5026" },
+ { 0x100213A7, "IBM_5031" },
+ { 0x100213AB, "IBM_5035" },
+ { 0x100213B8, "IBM_5048" },
+ { 0x100213B9, "IBM_5049" },
+ { 0x100213CB, "IBM_5067" },
+ { 0x100221A4, "IBM_8612" },
+ { 0x10022341, "IBM_9025" },
+ { 0x10022342, "IBM_9026" },
+ { 0x10022346, "IBM_9030" },
+ { 0x10022360, "IBM_9056" },
+ { 0x1002236A, "IBM_9066" },
+ { 0x100223A5, "IBM_9125" },
+ { 0x10026352, "IBM_25426" },
+ { 0x10026358, "IBM_25432" },
+ { 0x10026412, "IBM_1042" },
+ { 0x10027025, "IBM_28709" },
+ { 0x10028358, "IBM_33624" },
+ { 0x100283BA, "IBM_33722" },
+ { 0x10030001, "HTCSJIS" },
+ { 0x10030002, "HTCUJIS" },
+ { 0x10040001, "FUJITSU_U90" },
+ { 0x10040002, "FUJITSU_S90" },
+ { 0x10040003, "FUJITSU_R90" },
+ { 0x10040004, "EBCDIC_ASCII_AND_JEF" },
+ { 0x10040005, "EBCDIC_KATAKANA_AND_JEF" },
+ { 0x10040006, "EBCDIC_JAPANESE_ENGLISH_AND_JEF" },
+ { 0, NULL }
+};
+
static void decode_CodeSets(tvbuff_t *tvb, proto_tree *tree, int *offset,
gboolean stream_is_be, guint32 boundary) {
- /* The boundary being passed in is the offset where the context_data
+ /* The boundary being passed in is the offset where the context_data
* sequence begins. */
-
+
guint32 code_set_id;
if(tree) {
/* We pass in -boundary, because the alignment is calculated relative to
the beginning of the context_data sequence.
- Inside get_CDR_ulong(), the calculation will be (offset +(- boundary)) % 4
+ Inside get_CDR_ulong(), the calculation will be (offset +(- boundary)) % 4
to determine the correct alignment of the short. */
code_set_id = get_CDR_ulong(tvb, offset, stream_is_be, -((gint32) boundary) );
proto_tree_add_text (tree, tvb, *offset - 4, 4,
- "char_data: 0x%08x", code_set_id);
+ "char_data: 0x%08x %s", code_set_id, val_to_str(code_set_id, giop_code_set_vals, "Unknown (%u)") );
code_set_id = get_CDR_ulong(tvb, offset, stream_is_be, -((gint32) boundary) );
proto_tree_add_text (tree, tvb, *offset - 4, 4,
- "wchar_data: 0x%08x", code_set_id);
+ "wchar_data: 0x%08x %s", code_set_id, val_to_str(code_set_id, giop_code_set_vals, "Unknown (%u)") );
+
}
}
*
* The RT-CORBA priority is a CDR encoded short value in a sequence<octet>
* buffer.
- */
-static void decode_RTCorbaPriority(tvbuff_t *tvb, proto_tree *tree, int *offset,
- gboolean stream_is_be, guint32 boundary) {
+ */
+static void decode_RTCorbaPriority(tvbuff_t *tvb, proto_tree *tree, int *offset,
+ gboolean stream_is_be, guint32 boundary) {
- /* The boundary being passed in is the offset where the context_data
+ /* The boundary being passed in is the offset where the context_data
* sequence begins. */
-
+
gint16 rtpriority;
/* RTCorbaPriority is stored as a CDR encoded short */
rtpriority = get_CDR_short(tvb, offset, stream_is_be, -((gint32) boundary) );
if(tree) {
- /* Highlight all of context_data except for the first endian byte */
+ /* Highlight all of context_data except for the first endian byte */
proto_tree_add_text (tree, tvb, *offset - 2, 2,
"RTCorbaPriority: %d", rtpriority);
}
}
static void decode_UnknownServiceContext(tvbuff_t *tvb, proto_tree *tree, int *offset,
- gboolean stream_is_be, guint32 boundary) {
+ gboolean stream_is_be, guint32 boundary) {
guint32 context_data_len;
gchar *p_context_data;
gchar *context_data;
- /* get sequence length, and NO encapsulation */
+ /* get sequence length, and NO encapsulation */
context_data_len = get_CDR_ulong(tvb, offset, stream_is_be,boundary);
if(tree) {
proto_tree_add_text (tree, tvb, *offset - context_data_len , context_data_len,
- "context_data: %s", p_context_data);
+ "context_data: %s", p_context_data);
}
g_free(context_data);
*/
void decode_ServiceContextList(tvbuff_t *tvb, proto_tree *ptree, int *offset,
- gboolean stream_is_be, guint32 boundary) {
+ gboolean stream_is_be, guint32 boundary) {
- guint32 seqlen; /* sequence length */
- guint32 context_data_len; /* context data sequence length */
+ guint32 seqlen; /* sequence length */
+ guint32 context_data_len; /* context data sequence length */
- proto_tree *tree = NULL; /* ServiceContext tree */
+ proto_tree *tree = NULL; /* ServiceContext tree */
proto_tree *sub_tree1 = NULL;
proto_item *tf = NULL, *tf_st1;
guint32 context_id;
guint32 i;
- guint32 vscid; /* Vendor Service context id */
+ guint32 vscid; /* Vendor Service context id */
guint32 scid;
const gchar *service_context_name;
gboolean encapsulation_is_be;
if (tree) {
proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen),4,seqlen);
+ *offset-sizeof(seqlen),4,seqlen);
}
/* return if zero length sequence */
scid = context_id & 0x000000ff; /* standard service info, lower 8 bits */
if (tree) {
- proto_tree_add_uint(tree,hf_giop_iop_vscid,tvb,
- *offset-sizeof(guint32),4,vscid);
+ proto_tree_add_uint(tree,hf_giop_iop_vscid,tvb,
+ *offset-sizeof(guint32),4,vscid);
- proto_tree_add_uint(tree,hf_giop_iop_scid,tvb,
- *offset-sizeof(guint32),4,scid);
+ proto_tree_add_uint(tree,hf_giop_iop_scid,tvb,
+ *offset-sizeof(guint32),4,scid);
- }
+ }
if( vscid == 0) { /* OMG specified */
- service_context_name = match_strval(scid, service_context_ids);
+ service_context_name = val_to_str(scid, service_context_ids, "(0x%x)");
} else { /* Proprietary vscid */
- service_context_name = NULL;
- }
-
- if ( service_context_name == NULL ) {
- service_context_name = "Unknown";
+ service_context_name = "Unknown";
}
if(tree) {
proto_tree_add_text (tree, tvb, *offset -sizeof(context_id), 4,
- "Service Context ID: %s (%u)", service_context_name,
- context_id);
+ "Service Context ID: %s (%u)", service_context_name,
+ context_id);
}
temp_offset1 = *offset;
/* The OMG has vscid of 0 reserved */
if( vscid != 0 || scid > max_service_context_id ) {
- decode_UnknownServiceContext(tvb, tree, offset, stream_is_be, boundary);
- continue;
+ decode_UnknownServiceContext(tvb, tree, offset, stream_is_be, boundary);
+ continue;
}
temp_offset = *offset;
/* get sequence length, new endianness and boundary for encapsulation */
context_data_len = get_CDR_encap_info(tvb, sub_tree1, offset,
- stream_is_be, boundary,
- &encapsulation_is_be , &encapsulation_boundary);
+ stream_is_be, boundary,
+ &encapsulation_is_be , &encapsulation_boundary);
if (tree) {
- tf_st1 = proto_tree_add_text (tree, tvb, temp_offset, sizeof(context_data_len) + context_data_len , service_context_name);
+ tf_st1 = proto_tree_add_text (tree, tvb, temp_offset, sizeof(context_data_len) + context_data_len , "%s", service_context_name);
sub_tree1 = proto_item_add_subtree (tf_st1, ett_giop_scl_st1);
}
if (context_data_len == 0)
- continue;
+ continue;
/* See CORBA 3.0.2 standard, section Section 15.3.3 "Encapsulation",
* for how CDR types can be marshalled into a sequence<octet>.
switch(scid)
{
- case 0x01: /* Codesets */
- decode_CodeSets(tvb, sub_tree1, offset,
- encapsulation_is_be, encapsulation_boundary);
- break;
- case 0x0a: /* RTCorbaPriority */
- decode_RTCorbaPriority(tvb, sub_tree1, offset,
- encapsulation_is_be, encapsulation_boundary);
- break;
- default:
-
- /* Need to fill these in as we learn them */
- *offset = temp_offset1;
- decode_UnknownServiceContext(tvb, sub_tree1, offset, stream_is_be,
- boundary);
- break;
+ case 0x01: /* Codesets */
+ decode_CodeSets(tvb, sub_tree1, offset,
+ encapsulation_is_be, encapsulation_boundary);
+ break;
+ case 0x0a: /* RTCorbaPriority */
+ decode_RTCorbaPriority(tvb, sub_tree1, offset,
+ encapsulation_is_be, encapsulation_boundary);
+ break;
+ default:
+
+ /* Need to fill these in as we learn them */
+ *offset = temp_offset1;
+ decode_UnknownServiceContext(tvb, sub_tree1, offset, stream_is_be,
+ boundary);
+ break;
}
/* Set the offset to the end of the context_data sequence */
- *offset = temp_offset1 + sizeof(context_data_len) + context_data_len;
+ *offset = temp_offset1 + sizeof(context_data_len) + context_data_len;
} /* for seqlen */
*/
static void decode_SystemExceptionReplyBody (tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian,
- guint32 boundary) {
+ gboolean stream_is_big_endian,
+ guint32 boundary) {
guint32 length; /* string length */
guint32 minor_code_value;
if (tree) {
proto_tree_add_text(tree, tvb, *offset-4, 4,
- "Exception length: %u", length);
+ "Exception length: %u", length);
if (length > 0) {
proto_tree_add_text(tree, tvb, *offset - length, length,
- "Exception id: %s", buf );
+ "Exception id: %s", buf );
}
}
g_free(buf);
if (tree) {
proto_tree_add_text(tree, tvb, *offset-8, 4,
- "Minor code value: %u", minor_code_value);
+ "Minor code value: %u", minor_code_value);
proto_tree_add_text(tree, tvb, *offset-4, 4,
- "Completion Status: %u", completion_status);
+ "Completion Status: %u", completion_status);
}
}
*/
static void dissect_tk_objref_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary) {
+ gboolean stream_is_big_endian, guint32 boundary) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
guint32 count; /* parameter count (of tuples) */
guint32 seqlen; /* sequence length */
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
/* get sequence lengt,h new endianness and boundary for encapsulation */
seqlen = get_CDR_encap_info(tvb, tree, offset,
count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_count,tvb,
- *offset-sizeof(count),4,count);
+ *offset-sizeof(count),4,count);
}
/* get all tuples */
static void dissect_tk_union_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
guint32 count; /* parameter count (of tuples) */
guint32 seqlen; /* sequence length */
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
/* get sequence legnth, new endianness and boundary for encapsulation */
seqlen = get_CDR_encap_info(tvb, tree, offset,
s_octet4 = get_CDR_long(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_int(tree,hf_giop_typecode_default_used,tvb,
- *offset-sizeof(s_octet4),4,s_octet4);
+ *offset-sizeof(s_octet4),4,s_octet4);
}
/* get count of tuples */
count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_count,tvb,
- *offset-sizeof(count),4,count);
+ *offset-sizeof(count),4,count);
}
/* get all tuples */
static void dissect_tk_enum_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary) {
+ gboolean stream_is_big_endian, guint32 boundary) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
guint32 count; /* parameter count (of tuples) */
guint32 seqlen; /* sequence length */
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
/* get sequence length, new endianness and boundary for encapsulation */
seqlen = get_CDR_encap_info(tvb, tree, offset,
count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_count,tvb,
- *offset-sizeof(count),4,count);
+ *offset-sizeof(count),4,count);
}
/* get all tuples */
static void dissect_tk_sequence_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
}
static void dissect_tk_array_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_length,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
}
static void dissect_tk_alias_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
static void dissect_tk_except_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
guint32 count; /* parameter count (of tuples) */
guint32 seqlen; /* sequence length */
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
/* get sequence length, new endianness and boundary for encapsulation */
seqlen = get_CDR_encap_info(tvb, tree, offset,
count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_count,tvb,
- *offset-sizeof(count),4,count);
+ *offset-sizeof(count),4,count);
}
/* get all tuples */
static void dissect_tk_value_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
guint32 count; /* parameter count (of tuples) */
guint32 seqlen; /* sequence length */
- guint32 i; /* loop index */
+ guint32 i; /* loop index */
/* get sequence length, new endianness and boundary for encapsulation */
seqlen = get_CDR_encap_info(tvb, tree, offset,
s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_int(tree,hf_giop_typecode_ValueModifier,tvb,
- *offset-sizeof(s_octet2),2,s_octet2);
+ *offset-sizeof(s_octet2),2,s_octet2);
}
/* get conrete base */
count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_typecode_count,tvb,
- *offset-sizeof(count),4,count);
+ *offset-sizeof(count),4,count);
}
/* get all tuples */
s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_int(tree,hf_giop_typecode_Visibility,tvb,
- *offset-sizeof(s_octet2),2,s_octet2);
+ *offset-sizeof(s_octet2),2,s_octet2);
}
}
static void dissect_tk_value_box_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
static void dissect_tk_native_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary) {
+ gboolean stream_is_big_endian, guint32 boundary) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
static void dissect_tk_abstract_interface_params(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary) {
+ gboolean stream_is_big_endian, guint32 boundary) {
guint32 new_boundary; /* new boundary for encapsulation */
gboolean new_stream_is_big_endian; /* new endianness for encapsulation */
* we come across, useful helper function
*
* Also, should return immediately if seqlen == 0.
- * ie: Forget about trying to grab endianess for
+ * ie: Forget about trying to grab endianness for
* zero length sequence.
*
* Caller must always check seqlen == 0, and not assume its value
*/
guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean old_stream_is_big_endian, guint32 old_boundary,
- gboolean *new_stream_is_big_endian_ptr, guint32 *new_boundary_ptr ) {
+ gboolean old_stream_is_big_endian, guint32 old_boundary,
+ gboolean *new_stream_is_big_endian_ptr, guint32 *new_boundary_ptr ) {
guint32 seqlen; /* sequence length */
- guint8 giop_endianess;
+ guint8 giop_endianness;
/* Get sequence length of parameter list */
seqlen = get_CDR_ulong(tvb,offset,old_stream_is_big_endian,old_boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_sequence_length,tvb,
- *offset-sizeof(seqlen),4,seqlen);
+ *offset-sizeof(seqlen),4,seqlen);
}
/*
- * seqlen == 0, implies no endianess and no data
+ * seqlen == 0, implies no endianness and no data
* so just return. Populate new_boundary_ptr and
* new_stream_is_big_endian_ptr with current (old)
* values, just to keep everyone happy. -- FS
}
/* Start of encapsulation of parameter list */
- *new_boundary_ptr = *offset; /* remember */
- giop_endianess = get_CDR_octet(tvb,offset);
+ *new_boundary_ptr = *offset; /* remember */
+ giop_endianness = get_CDR_octet(tvb,offset);
- *new_stream_is_big_endian_ptr = ! giop_endianess;
+ *new_stream_is_big_endian_ptr = ! giop_endianness;
/*
* Glib: typedef gint gboolean;
if (tree) {
- proto_tree_add_uint(tree,hf_giop_endianess,tvb,
- *offset-1,1,giop_endianess);
+ proto_tree_add_uint(tree,hf_giop_endianness,tvb,
+ *offset-1,1,giop_endianness);
}
*/
static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id ) {
+ gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id ) {
guint32 u_octet4; /* unsigned int32 */
gchar *buf; /* ptr to string buffer */
if (tree) {
proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
+ *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
if (u_octet4 > 0) {
proto_tree_add_string(tree,hf_id,tvb,*offset-u_octet4,u_octet4,buf);
}
}
- g_free(buf); /* dont forget */
+ g_free(buf); /* dont forget */
}
*/
static void dissect_data_for_typecode(tvbuff_t *tvb, proto_tree *tree, gint *offset,
- gboolean stream_is_big_endian, guint32 boundary,
- MessageHeader * header, guint32 data_type ) {
+ gboolean stream_is_big_endian, guint32 boundary,
+ MessageHeader * header, guint32 data_type ) {
gboolean my_boolean; /* boolean */
s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_int(tree,hf_giop_type_short,tvb,
- *offset-sizeof(s_octet2),2,s_octet2);
+ *offset-sizeof(s_octet2),2,s_octet2);
}
break;
case tk_long:
s_octet4 = get_CDR_long(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_int(tree,hf_giop_type_long,tvb,
- *offset-sizeof(s_octet4),4,s_octet4);
+ *offset-sizeof(s_octet4),4,s_octet4);
}
break;
case tk_ushort:
u_octet2 = get_CDR_ushort(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_type_ushort,tvb,
- *offset-sizeof(u_octet2),2,u_octet2);
+ *offset-sizeof(u_octet2),2,u_octet2);
}
break;
case tk_ulong:
u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_type_ulong,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
break;
case tk_float:
my_float = get_CDR_float(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_double(tree,hf_giop_type_float,tvb,
- *offset-sizeof(my_float),4,my_float);
+ *offset-sizeof(my_float),4,my_float);
}
break;
case tk_double:
my_double = get_CDR_double(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_double(tree,hf_giop_type_double,tvb,
- *offset-sizeof(my_double),8,my_double);
+ *offset-sizeof(my_double),8,my_double);
}
break;
case tk_boolean:
my_boolean = get_CDR_boolean(tvb,offset);
if (tree) {
proto_tree_add_boolean(tree,hf_giop_type_boolean,tvb,
- *offset-1,1,my_boolean);
+ *offset-1,1,my_boolean);
}
break;
case tk_char:
u_octet1 = get_CDR_char(tvb,offset);
if (tree) {
proto_tree_add_uint(tree,hf_giop_type_char,tvb,
- *offset-sizeof(u_octet1),1,u_octet1);
+ *offset-sizeof(u_octet1),1,u_octet1);
}
break;
case tk_octet:
u_octet1 = get_CDR_octet(tvb,offset);
if (tree) {
proto_tree_add_uint(tree,hf_giop_type_octet,tvb,
- *offset-sizeof(u_octet1),1,u_octet1);
+ *offset-sizeof(u_octet1),1,u_octet1);
}
break;
case tk_any:
u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_type_enum,tvb,
- *offset-sizeof(u_octet4),4,u_octet4);
+ *offset-sizeof(u_octet4),4,u_octet4);
}
break;
case tk_string:
u_octet4 = get_CDR_string(tvb,&buf,offset,stream_is_big_endian,boundary);
if (tree) {
proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
+ *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
if (u_octet4 > 0) {
- proto_tree_add_string(tree,hf_giop_type_string,tvb,
- *offset-u_octet4,u_octet4,buf);
+ proto_tree_add_string(tree,hf_giop_type_string,tvb,
+ *offset-u_octet4,u_octet4,buf);
}
}
- g_free(buf); /* dont forget */
+ g_free(buf); /* dont forget */
break;
case tk_sequence:
break;
* If so, we need to catch the exception and free "buf".
*/
if (s_octet1 < 0) { /* no size to add to tree */
- proto_tree_add_string(tree,hf_giop_type_string,tvb,
- *offset+s_octet1,(-s_octet1),buf);
+ proto_tree_add_string(tree,hf_giop_type_string,tvb,
+ *offset+s_octet1,(-s_octet1),buf);
} else {
- proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-s_octet1-sizeof(s_octet1),1,s_octet1);
- proto_tree_add_string(tree,hf_giop_type_string,tvb,
- *offset-s_octet1,s_octet1,buf);
+ proto_tree_add_uint(tree,hf_giop_string_length,tvb,
+ *offset-s_octet1-sizeof(s_octet1),1,s_octet1);
+ proto_tree_add_string(tree,hf_giop_type_string,tvb,
+ *offset-s_octet1,s_octet1,buf);
}
}
* If so, we need to catch the exception and free "buf".
*/
proto_tree_add_uint(tree,hf_giop_string_length,tvb,
- *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
+ *offset-u_octet4-sizeof(u_octet4),4,u_octet4);
proto_tree_add_string(tree,hf_giop_type_string,tvb,
- *offset-u_octet4,u_octet4,buf);
+ *offset-u_octet4,u_octet4,buf);
}
g_free(buf); /* dont forget */
} /* data_type */
}
+
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=2 tabstop=8 expandtab
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */