Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] Yet more JXTA Patches for Ethereal 14571

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Mike Duigou <ethereal@xxxxxxxxxx>
Date: Mon, 06 Jun 2005 17:34:37 -0700
Two more patches:

doc-14571.diffs : Minor corrections to README.developer and README.tapping

jxta-14571.diffs : In order to get filtering of conversations and endpoints to work from the endpoints and conversations windows I found it necessary to add a new AT_URI address type and a SAT_JXTA. This also necessitated a change to to_str.c to avoid a buffer overflow problem. Please review these changes carefully.

Also includes some changes to the jxta dissector to fix filtering on generated fields and some changes to the types used for ints/unsigned ints.

Mike
Index: doc/README.developer
===================================================================
--- doc/README.developer	(revision 14571)
+++ doc/README.developer	(working copy)
@@ -798,7 +798,7 @@
 		FT_INT64, FT_FLOAT, FT_DOUBLE, FT_ABSOLUTE_TIME,
 		FT_RELATIVE_TIME, FT_STRING, FT_STRINGZ, FT_UINT_STRING,
 		FT_ETHER, FT_BYTES, FT_IPv4, FT_IPv6, FT_IPXNET,
-		FT_FRAMENUM
+		FT_FRAMENUM, FT_PROTOCOL
 FIELDBASE	BASE_NONE, BASE_DEC, BASE_HEX, BASE_OCT
 FIELDCONVERT	VALS(x), TFS(x), NULL
 BITMASK		Usually 0x0 unless using the TFS(x) field conversion.
@@ -1219,6 +1219,9 @@
 				subtree below it containing fields for
 				the members of the array, might be an
 				FT_NONE field.
+        FT_PROTOCOL             Used for protocols which will be placing
+				themselves as top-level items in the
+                                "Packet Details" pane of the UI.
 	FT_BOOLEAN		0 means "false", any other value means
 				"true".
 	FT_FRAMENUM		A frame number; if this is used, the "Go
@@ -2328,7 +2331,7 @@
 
     /* new conversation create local data structure */
 
-    data_ptr = g_mem_chunk_alloc(my_protocol_vals);
+    data_ptr = g_mem_chunk_alloc(my_vals);
 
     /*** add your code here to setup the new data structure ***/
 
Index: doc/README.tapping
===================================================================
--- doc/README.tapping	(revision 14571)
+++ doc/README.tapping	(working copy)
@@ -144,7 +144,7 @@
 and call remove_tap_listener() when you are finished.
 
 
-WHEN DOES TAP LISTENERS GET CALLED?
+WHEN DO TAP LISTENERS GET CALLED?
 ===================================
 Tap listeners are only called when ethereal reads a new capture for
 the first time or whenever ethereal needs to rescan/redissect
Index: gtk/hostlist_jxta.c
===================================================================
--- gtk/hostlist_jxta.c	(revision 14571)
+++ gtk/hostlist_jxta.c	(working copy)
@@ -49,8 +49,8 @@
 	/* Take two "add" passes per packet, adding for each direction, ensures that all
 	packets are counted properly (even if address is sending to itself) 
 	XXX - this could probably be done more efficiently inside hostlist_table */
-	add_hostlist_table_data(hosts, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, SAT_NONE, PT_NONE);
-	add_hostlist_table_data(hosts, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, SAT_NONE, PT_NONE);
+	add_hostlist_table_data(hosts, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, SAT_JXTA, PT_NONE);
+	add_hostlist_table_data(hosts, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, SAT_JXTA, PT_NONE);
 
         hosts = jxtahdr;
 	return 1;
Index: gtk/conversations_jxta.c
===================================================================
--- gtk/conversations_jxta.c	(revision 14571)
+++ gtk/conversations_jxta.c	(working copy)
@@ -2,7 +2,7 @@
  * conversations_jxta  copyright (c) 2005 Mike Duigou <bondolo@xxxxxxxx>
  * copied from conversations_sctp.c
  * 
- * $Id$
+ * $Id:$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -53,7 +53,7 @@
 		0, 
 		1, 
 		jxtahdr->size, 
-		SAT_NONE, 
+		SAT_JXTA, 
 		PT_NONE);
 
 
@@ -93,4 +93,3 @@
 
     register_conversation_table(TRUE, "JXTA", "jxta", NULL /*filter*/, jxta_conversation_packet);
 }
-
Index: gtk/sat.h
===================================================================
--- gtk/sat.h	(revision 14571)
+++ gtk/sat.h	(working copy)
@@ -1,6 +1,6 @@
 /* sat.h
  * 2003 Ronnie Sahlberg
- * Sub-address types for MAC addresses
+ * Sub-address types for MAC/URI addresses
  *
  * $Id$
  *
@@ -33,9 +33,10 @@
 /** Address type */
 typedef enum {
     SAT_NONE,       /**< no address type */
-    SAT_ETHER,      /**< Ethernet */
-    SAT_FDDI,       /**< FDDI */
-    SAT_TOKENRING   /**< Token Ring */
+    SAT_ETHER,      /**< MAC : Ethernet */
+    SAT_FDDI,       /**< MAC : FDDI */
+    SAT_TOKENRING,  /**< MAC : Token Ring */
+    SAT_JXTA        /**< URI : JXTA */
 } SAT_E;
 
 #endif /* __GTK_SAT_H__ */
Index: gtk/conversations_table.c
===================================================================
--- gtk/conversations_table.c	(revision 14571)
+++ gtk/conversations_table.c	(working copy)
@@ -114,7 +114,10 @@
 				return "fddi.src";
 			case SAT_TOKENRING:
 				return "tr.src";
+                        default:
+                            ;
 			}
+                        break;
 		case AT_IPv4:
 			return "ip.src";
 		case AT_IPv6:
@@ -123,9 +126,18 @@
 			return "ipx.src";
 		case AT_FC:
 			return "fc.s_id";
+		case AT_URI:
+			switch(specific_addr_type){
+			case SAT_JXTA:
+				return "jxta.message.src";
+                        default:
+                            ;
+			}
+                        break;
 		default:
 			;
 		}
+                break;
 	case FN_DST_ADDRESS:
 		switch(addr->type){
 		case AT_ETHER:
@@ -136,7 +148,10 @@
 				return "fddi.dst";
 			case SAT_TOKENRING:
 				return "tr.dst";
+                        default:
+                            ;
 			}
+                        break;
 		case AT_IPv4:
 			return "ip.dst";
 		case AT_IPv6:
@@ -145,9 +160,18 @@
 			return "ipx.dst";
 		case AT_FC:
 			return "fc.d_id";
+		case AT_URI:
+			switch(specific_addr_type){
+			case SAT_JXTA:
+				return "jxta.message.dst";
+                        default:
+                            ;
+			}
+                        break;
 		default:
 			;
 		}
+                break;
 	case FN_ANY_ADDRESS:
 		switch(addr->type){
 		case AT_ETHER:
@@ -158,7 +182,10 @@
 				return "fddi.addr";
 			case SAT_TOKENRING:
 				return "tr.addr";
+                        default:
+                            break;
 			}
+                        break;
 		case AT_IPv4:
 			return "ip.addr";
 		case AT_IPv6:
@@ -167,15 +194,26 @@
 			return "ipx.addr";
 		case AT_FC:
 			return "fc.id";
+		case AT_URI:
+			switch(specific_addr_type){
+			case SAT_JXTA:
+				return "jxta.message.address";
+                        default:
+                            ;
+			}
+                        break;
 		default:
 			;
 		}
+                break;
 	case FN_SRC_PORT:
 		switch(port_type){
 		case PT_TCP:
 			return "tcp.srcport";
 		case PT_UDP:
 			return "udp.srcport";
+                default:
+                        ;
 		}
 		break;
 	case FN_DST_PORT:
@@ -184,6 +222,8 @@
 			return "tcp.dstport";
 		case PT_UDP:
 			return "udp.dstport";
+                default:
+                        ;
 		}
 		break;
 	case FN_ANY_PORT:
@@ -192,6 +232,8 @@
 			return "tcp.port";
 		case PT_UDP:
 			return "udp.port";
+                default:
+                        ;
 		}
 		break;
 	}
Index: gtk/hostlist_table.c
===================================================================
--- gtk/hostlist_table.c	(revision 14571)
+++ gtk/hostlist_table.c	(working copy)
@@ -86,7 +86,7 @@
 #define FN_ANY_ADDRESS		0
 #define FN_ANY_PORT		1
 
-/* given an address (to distinguis between ipv4 and ipv6 for tcp/udp
+/* given an address (to distinguish between ipv4 and ipv6 for tcp/udp
    a port_type and a name_type (FN_...)
    return a string for the filter name
 
@@ -108,7 +108,10 @@
 				return "fddi.addr";
 			case SAT_TOKENRING:
 				return "tr.addr";
+                        default :
+                                ;
 			}
+                        break;
 		case AT_IPv4:
 			return "ip.addr";
 		case AT_IPv6:
@@ -117,6 +120,14 @@
 			return "ipx.addr";
 		case AT_FC:
 			return "fc.id";
+		case AT_URI:
+			switch(specific_addr_type){
+			case SAT_JXTA:
+				return "jxta.message.address";
+                        default:
+                            ;
+			}
+                        break;
 		default:
 			;
 		}
Index: epan/address.h
===================================================================
--- epan/address.h	(revision 14571)
+++ epan/address.h	(working copy)
@@ -44,7 +44,8 @@
   AT_FC,		/* Fibre Channel */
   AT_SS7PC,		/* SS7 Point Code */
   AT_STRINGZ,		/* null-terminated string */
-  AT_EUI64		/* IEEE EUI-64 */
+  AT_EUI64,		/* IEEE EUI-64 */
+  AT_URI		/* URI/URL/URN */
 } address_type;
 
 typedef struct _address {
Index: epan/to_str.c
===================================================================
--- epan/to_str.c	(revision 14571)
+++ epan/to_str.c	(working copy)
@@ -827,11 +827,8 @@
 gchar*	
 address_to_str(const address *addr)
 {
-#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN 46
-#endif
   static int i=0;
-  static gchar *strp, str[16][INET6_ADDRSTRLEN];/* IPv6 is the largest one */
+  static gchar *strp, str[16][256];
 
   i++;
   if(i>=16){
@@ -891,6 +888,10 @@
             addr->data[0], addr->data[1], addr->data[2], addr->data[3],
             addr->data[4], addr->data[5], addr->data[6], addr->data[7]);
     break;
+  case AT_URI:
+    memmove(buf, addr->data, addr->len);
+    buf[addr->len] = '\0';
+    break;
   default:
     g_assert_not_reached();
   }
Index: epan/dissectors/packet-jxta.c
===================================================================
--- epan/dissectors/packet-jxta.c	(revision 14571)
+++ epan/dissectors/packet-jxta.c	(working copy)
@@ -39,11 +39,12 @@
 
 #include <glib.h>
 
+
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include <epan/strutil.h>
 #include <epan/prefs.h>
-#include <tap.h>
+#include <epan/tap.h>
 
 #include "packet-jxta.h"
 
@@ -75,7 +76,7 @@
 static int hf_jxta_framing_header_name = -1;
 static int hf_jxta_framing_header_value_length = -1;
 static int hf_jxta_framing_header_value = -1;
-static int hf_jxta_message = -1;
+static int hf_jxta_message_address = -1;
 static int hf_jxta_message_src = -1;
 static int hf_jxta_message_dst = -1;
 static int hf_jxta_message_sig = -1;
@@ -100,7 +101,7 @@
 /** our header fields */
 static hf_register_info hf[] = {
     {&hf_jxta_udp,
-     {"JXTA UDP Message", "jxta.udp", FT_PROTOCOL, BASE_NONE, NULL, 0x0,
+     {"JXTA UDP Message", "jxta.udp", FT_NONE, BASE_NONE, NULL, 0x0,
       "JXTA UDP Message", HFILL}
      },
     {&hf_jxta_udpsig,
@@ -159,9 +160,9 @@
      {"Value", "jxta.framing.header.value", FT_BYTES, BASE_HEX, NULL, 0x0,
       "JXTA Message Framing Header Value", HFILL}
      },
-    {&hf_jxta_message,
-     {"JXTA Message", "jxta.message", FT_PROTOCOL, BASE_NONE, NULL, 0x0,
-      "JXTA Message", HFILL}
+    {&hf_jxta_message_address,
+     {"Address", "jxta.message.address", FT_STRING, BASE_NONE, NULL, 0x0,
+      "JXTA Message Address (source or destination)", HFILL}
      },
     {&hf_jxta_message_src,
      {"Source", "jxta.message.source", FT_STRING, BASE_NONE, NULL, 0x0,
@@ -307,10 +308,10 @@
 
 static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address * found_addr, gboolean initiator);
 static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint64 * content_length,
-                                        char **content_type);
+                                        gchar **content_type);
 static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
-static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int ns_count,
-                                        const char **namespaces);
+static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
+                                        const gchar **namespaces);
 
 void proto_reg_handoff_jxta(void);
 void proto_reg_handoff_message_jxta(void);
@@ -375,9 +376,9 @@
 **/
 static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
 {
-    int offset = 0;
-    int available;
-    int needed = 0;
+    guint offset = 0;
+    guint available;
+    gint needed = 0;
 
     conversation_t *conversation =
         find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
@@ -396,12 +397,12 @@
 
     while (TRUE) {
         tvbuff_t *jxta_message_framing_tvb;
-        int processed = 0;
+        gint processed = 0;
         guint64 content_length = -1;
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(JXTA_UDP_SIG)) {
-            needed = available - sizeof(JXTA_UDP_SIG);
+        if (available < sizeof(JXTA_UDP_SIG)) {
+            needed = (gint) (available - sizeof(JXTA_UDP_SIG));
             break;
         }
 
@@ -428,12 +429,12 @@
         offset += processed;
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)content_length) {
-            needed = available - (int)content_length;
+        if (available < content_length) {
+            needed = (gint) (available - content_length);
             break;
         }
 
-        offset += (int)content_length;
+        offset += content_length;
 
         break;
     }
@@ -455,15 +456,15 @@
     col_set_writable(pinfo->cinfo, FALSE);
 
     if (tree) {
-        int tree_offset = 0;
+        guint tree_offset = 0;
         proto_item *jxta_udp_tree_item = proto_tree_add_item(tree, hf_jxta_udp, tvb, tree_offset, -1, FALSE);
         proto_tree *jxta_udp_tree = proto_item_add_subtree(jxta_udp_tree_item, ett_jxta_udp);
         tvbuff_t *jxta_message_framing_tvb;
         guint64 content_length = -1;
-        char *content_type = NULL;
+        gchar *content_type = NULL;
         tvbuff_t *jxta_message_tvb;
         gboolean dissected = FALSE;
-        int processed = 0;
+        gint processed = 0;
 
 
         proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, sizeof(JXTA_UDP_SIG), FALSE);
@@ -482,7 +483,7 @@
             call_dissector(data_handle, jxta_message_tvb, pinfo, jxta_udp_tree);
         }
 
-        tree_offset += (int)content_length;
+        tree_offset += content_length;
 
         proto_item_set_end(jxta_udp_tree_item, tvb, tree_offset);
 
@@ -505,9 +506,9 @@
 **/
 static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
 {
-    int offset = 0;
-    int available = 0;
-    int processed;
+    guint offset = 0;
+    guint available = 0;
+    gint processed;
     conversation_t *tpt_conversation =
         find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
     jxta_stream_conversation_data * tpt_conv_data;
@@ -529,8 +530,12 @@
         tpt_conv_data->tpt_ptype = PT_NONE;
         tpt_conv_data->initiator_welcome_frame = 0;
         tpt_conv_data->initiator_address.type = AT_NONE;
+        tpt_conv_data->initiator_address.len = 0;
+        tpt_conv_data->initiator_address.data = NULL;
         tpt_conv_data->receiver_welcome_frame = 0;
         tpt_conv_data->receiver_address.type = AT_NONE;
+        tpt_conv_data->receiver_address.len = 0;
+        tpt_conv_data->receiver_address.data = NULL;
         conversation_add_proto_data(tpt_conversation, proto_jxta, tpt_conv_data);
     }
     
@@ -577,7 +582,7 @@
         processed = dissect_jxta_welcome(tvb, pinfo, tree, welcome_addr, initiator);
     } else {
         guint64 content_length = 0;
-        char *content_type = NULL;
+        gchar *content_type = NULL;
         gboolean dissected;
         conversation_t *peer_conversation = NULL;
         address saved_src_addr;
@@ -596,6 +601,8 @@
             }
 
             conversation_set_dissector(peer_conversation, tcp_jxta_handle);
+        } else {
+            g_warning( "Uninitialized peer conversation" );
         }
 
         /* Use our source and destination addresses if we have them */
@@ -628,25 +635,25 @@
         processed = dissect_jxta_message_framing(tvb, pinfo, tree, &content_length, &content_type);
 
         if ((processed > 0) && (NULL != content_type) && (0 != content_length)) {
-            int msg_offset = offset + processed;
+            guint msg_offset = offset + processed;
 
             available = tvb_reported_length_remaining(tvb, msg_offset);
-            if (available >= (int)content_length) {
+            if (available >= content_length) {
                 tvbuff_t *jxta_message_tvb = tvb_new_subset(tvb, msg_offset, (gint)content_length, (gint)content_length);
 
                 if (check_col(pinfo->cinfo, COL_INFO)) {
                     col_set_str(pinfo->cinfo, COL_INFO, "Message");
 
-                    if ( AT_STRINGZ == pinfo->src.type ) {
-                        col_append_fstr( pinfo->cinfo, COL_INFO, " %s", pinfo->src.data );
+                    if ( AT_URI == pinfo->src.type ) {
+                        col_append_fstr( pinfo->cinfo, COL_INFO, " %*.*s", pinfo->src.len, pinfo->src.len, pinfo->src.data );
                     }
 
-                    if ((AT_STRINGZ == pinfo->dst.type) || (AT_STRINGZ == pinfo->dst.type)) {
+                    if ((AT_URI == pinfo->dst.type) || (AT_URI == pinfo->dst.type)) {
                         col_append_str( pinfo->cinfo, COL_INFO, " ->" );
                     }
 
-                    if ( AT_STRINGZ == pinfo->dst.type) {
-                        col_append_fstr( pinfo->cinfo, COL_INFO, " %s", pinfo->dst.data );
+                    if ( AT_URI == pinfo->dst.type) {
+                        col_append_fstr( pinfo->cinfo, COL_INFO, " %*.*s", pinfo->dst.len, pinfo->dst.len, pinfo->dst.data );
                     }
 
                     col_set_writable(pinfo->cinfo, FALSE);
@@ -659,9 +666,9 @@
                     call_dissector(data_handle, jxta_message_tvb, pinfo, tree);
                 }
 
-                processed += (int)content_length;
+                processed += content_length;
             } else {
-                processed = available - (int)content_length;
+                processed = available - content_length;
             }
 
             g_free(content_type);
@@ -700,13 +707,13 @@
 **/
 static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address *found_addr, gboolean initiator )
 {
-    int offset = 0;
-    int afterwelcome;
-    int first_linelen;
-    int available = tvb_reported_length_remaining(tvb, offset);
+    guint offset = 0;
+    gint afterwelcome;
+    gint first_linelen;
+    guint available = tvb_reported_length_remaining(tvb, offset);
 
-    if (available < (int)sizeof(JXTA_WELCOME_MSG_SIG)) {
-        return available - sizeof(JXTA_WELCOME_MSG_SIG);
+    if (available < sizeof(JXTA_WELCOME_MSG_SIG)) {
+        return (gint) (available - sizeof(JXTA_WELCOME_MSG_SIG));
     }
 
     if (0 != tvb_memeql(tvb, 0, JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
@@ -782,11 +789,13 @@
 
             if (check_col(pinfo->cinfo, COL_INFO)) {
                 col_append_str( pinfo->cinfo, COL_INFO, *current_token );
+                col_set_writable(pinfo->cinfo, FALSE);
             }
 
             if( NULL != found_addr ) {
-                found_addr->type = AT_STRINGZ;
-                found_addr->len = strlen( *current_token ) + 1;
+                found_addr->type = AT_URI;
+                found_addr->len = strlen( *current_token );
+                /* FIXME 20050605 bondolo THIS ALLOCATION IS A MEMORY LEAK! */
                 found_addr->data = g_strdup( *current_token );
             }
 
@@ -829,11 +838,11 @@
 *   @return number of bytes from the tvbuff_t which were processed.
 **/
 static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint64 * content_length,
-                                        char **content_type)
+                                        gchar **content_type)
 {
-    int offset = 0;
-    int available;
-    int needed = 0;
+    guint offset = 0;
+    guint available;
+    gint needed = 0;
 
     /*
      *   First go around. Make sure all of the bytes are there.
@@ -845,8 +854,8 @@
         guint16 headervalue_offset;
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint8)) {
-            needed = available - sizeof(guint8);
+        if (available < sizeof(guint8)) {
+            needed = (gint) (available - sizeof(guint8));
             break;
         } else {
             headername_len = tvb_get_guint8(tvb, offset);
@@ -855,7 +864,7 @@
 
             available = tvb_reported_length_remaining(tvb, offset);
             if (available < headername_len) {
-                needed = available - headername_len;
+                needed = (gint) (available - headername_len);
                 break;
             }
 
@@ -866,8 +875,8 @@
         }
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint16)) {
-            needed = available - sizeof(guint16);
+        if (available < sizeof(guint16)) {
+            needed = (gint) (available - sizeof(guint16));
             break;
         } else {
             headervalue_len = tvb_get_ntohs(tvb, offset);
@@ -876,7 +885,7 @@
 
             available = tvb_reported_length_remaining(tvb, offset);
             if (available < headervalue_len) {
-                needed = available - headervalue_len;
+                needed = (gint) (available - headervalue_len);
                 break;
             }
 
@@ -905,7 +914,7 @@
      *   Second (optional pass) Now that we are sure that all the bytes are there we update the protocol tree.
      */
     if (tree) {
-        int tree_offset = 0;
+        guint tree_offset = 0;
         proto_item *framing_tree_item = proto_tree_add_item(tree, hf_jxta_framing, tvb, tree_offset, -1, FALSE);
         proto_tree *framing_tree = proto_item_add_subtree(framing_tree_item, ett_jxta_framing);
 
@@ -976,15 +985,15 @@
 **/
 static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
 {
-    int offset = 0;
-    int available;
-    int needed = 0;
+    guint offset = 0;
+    guint available;
+    gint needed = 0;
 
     while (TRUE) {
         /* First pass. Make sure all of the bytes we need are available */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(JXTA_MSG_SIG)) {
-            needed = available - sizeof(JXTA_MSG_SIG);
+        if (available < sizeof(JXTA_MSG_SIG)) {
+            needed = (gint) (available - sizeof(JXTA_MSG_SIG));
             break;
         }
 
@@ -996,8 +1005,8 @@
         offset += sizeof(JXTA_MSG_SIG);
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint8)) {
-            needed = available - sizeof(guint8);
+        if (available < sizeof(guint8)) {
+            needed = (gint) (available - sizeof(guint8));
             break;
         } else {
             guint8 message_version = tvb_get_guint8(tvb, offset);
@@ -1011,12 +1020,12 @@
         }
 
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint16)) {
-            needed = available - sizeof(guint16);
+        if (available < sizeof(guint16)) {
+            needed = (gint) (available - sizeof(guint16));
             break;
         } else {
             guint16 msg_ns_count = tvb_get_ntohs(tvb, offset);
-            unsigned int each_namespace;
+            guint each_namespace;
 
             offset += sizeof(guint16);
 
@@ -1024,8 +1033,8 @@
                 guint8 namespace_len;
 
                 available = tvb_reported_length_remaining(tvb, offset);
-                if (available < (int)sizeof(guint8)) {
-                    needed = available - sizeof(guint8);
+                if (available < sizeof(guint8)) {
+                    needed = (gint) (available - sizeof(guint8));
                     break;
                 }
 
@@ -1033,7 +1042,7 @@
 
                 available = tvb_reported_length_remaining(tvb, offset + 1);
                 if (available < namespace_len) {
-                    needed = available - namespace_len;
+                    needed = (gint) (available - namespace_len);
                     break;
                 }
 
@@ -1043,12 +1052,12 @@
 
         /* parse element count */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint16)) {
-            needed = available - sizeof(guint16);
+        if (available < sizeof(guint16)) {
+            needed = (gint) (available - sizeof(guint16));
             break;
         } else {
             guint16 elem_count = tvb_get_ntohs(tvb, offset);
-            unsigned int each_elem;
+            guint each_elem;
 
             offset += sizeof(guint16);
 
@@ -1074,40 +1083,58 @@
     }
 
     if (tree) {
-        int tree_offset = 0;
+        guint tree_offset = 0;
         proto_item *jxta_msg_tree_item = NULL;
         proto_tree *jxta_msg_tree = NULL;
         guint8 message_version;
-        const char **namespaces = NULL;
+        const gchar **namespaces = NULL;
         guint16 msg_ns_count;
-        unsigned int each_namespace;
+        guint each_namespace;
         guint16 elem_count;
-        unsigned int each_elem;
+        guint each_elem;
         
-        if ((AT_STRINGZ == pinfo->src.type) && (AT_STRINGZ == pinfo->dst.type)) {
-	    jxta_msg_tree_item = proto_tree_add_protocol_format(tree, hf_jxta_message, tvb, tree_offset, -1,
-	    "JXTA Message, %s -> %s", pinfo->src.data, pinfo->dst.data );
+        if ((AT_URI == pinfo->src.type) && (AT_URI == pinfo->dst.type)) {
+	    jxta_msg_tree_item = proto_tree_add_protocol_format(tree, proto_message_jxta, tvb, tree_offset, -1,
+	    "JXTA Message, %*.*s -> %*.*s", pinfo->src.len, pinfo->src.len, pinfo->src.data, pinfo->dst.len, pinfo->dst.len, pinfo->dst.data );
         } else {
-	    jxta_msg_tree_item = proto_tree_add_item(tree, hf_jxta_message, tvb, tree_offset, -1, FALSE);
+	    jxta_msg_tree_item = proto_tree_add_item(tree, proto_message_jxta, tvb, tree_offset, -1, FALSE);
         }
 
         jxta_msg_tree = proto_item_add_subtree(jxta_msg_tree_item, ett_jxta_msg);
 
-        if ( AT_STRINGZ == pinfo->src.type ) {
-            proto_item * src_item = proto_tree_add_item(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, FALSE);
-            proto_item_append_text( src_item, "%s", pinfo->src.data );
+        proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, sizeof(JXTA_MSG_SIG), FALSE);
+        tree_offset += sizeof(JXTA_MSG_SIG);
+
+        if ( AT_URI == pinfo->src.type ) {
+            proto_item * src_item;
+            gchar *tempStr = g_malloc(pinfo->src.len + 1 );
+            memmove(tempStr, pinfo->src.data, pinfo->src.len);
+            tempStr[pinfo->src.len] = '\0';
+            
+            src_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, tempStr);
             PROTO_ITEM_SET_GENERATED(src_item);
+
+            src_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, tempStr);
+            PROTO_ITEM_SET_HIDDEN(src_item);
+            PROTO_ITEM_SET_GENERATED(src_item);
+            g_free( tempStr );
         }
 
-        if ( AT_STRINGZ == pinfo->dst.type) {
-            proto_item * dst_item = proto_tree_add_item(jxta_msg_tree, hf_jxta_message_dst, tvb, 0, 0, FALSE);
-            proto_item_append_text( dst_item, "%s", pinfo->dst.data );
+        if ( AT_URI == pinfo->dst.type) {
+            proto_item * dst_item;
+            gchar *tempStr = g_malloc(pinfo->dst.len + 1 );
+            memmove(tempStr, pinfo->dst.data, pinfo->dst.len);
+            tempStr[pinfo->dst.len] = '\0';
+            
+            dst_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_dst, tvb, 0, 0, tempStr);
             PROTO_ITEM_SET_GENERATED(dst_item);
+
+            dst_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_address, tvb, 0, 0, tempStr);
+            PROTO_ITEM_SET_HIDDEN(dst_item);
+            PROTO_ITEM_SET_GENERATED(dst_item);
+            g_free( tempStr );
         }
 
-        proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, sizeof(JXTA_MSG_SIG), FALSE);
-        tree_offset += sizeof(JXTA_MSG_SIG);
-
         message_version = tvb_get_guint8(tvb, tree_offset);
         proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, sizeof(guint8), message_version);
         tree_offset += sizeof(guint8);
@@ -1116,7 +1143,7 @@
         proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_namespaces_count, tvb, tree_offset, sizeof(guint16), msg_ns_count);
         tree_offset += sizeof(guint16);
 
-        namespaces = g_malloc((msg_ns_count + 2) * sizeof(const char *));
+        namespaces = g_malloc((msg_ns_count + 2) * sizeof(const gchar *));
         namespaces[0] = "";
         namespaces[1] = "jxta";
 
@@ -1143,17 +1170,17 @@
         }
 
         for (each_namespace = 2; each_namespace < msg_ns_count; each_namespace++) {
-            g_free((char *)namespaces[each_namespace]);
+            g_free((gchar *)namespaces[each_namespace]);
         }
 
-        g_free((char *)namespaces);
+        g_free((gchar *)namespaces);
 
         proto_item_set_end(jxta_msg_tree_item, tvb, tree_offset);
 
         g_assert(tree_offset == offset);              
     }
 
-    if ((offset > 0) && (AT_STRINGZ == pinfo->src.type) && (AT_STRINGZ == pinfo->dst.type)) {
+    if ((offset > 0) && (AT_URI == pinfo->src.type) && (AT_URI == pinfo->dst.type)) {
         jxta_tap_header * tap_header = (jxta_tap_header *) g_mem_chunk_alloc(my_tap_structs);
         
         tap_header->src_address = pinfo->src;
@@ -1174,12 +1201,12 @@
 *   @param  tree The protocol tree.
 *   @return number of bytes from the tvbuff_t which were processed.
 **/
-static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, int ns_count,
-                                        const char **namespaces)
+static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
+                                        const gchar **namespaces)
 {
-    int offset = 0;
-    int available;
-    int needed = 0;
+    guint offset = 0;
+    guint available;
+    gint needed = 0;
     guint8 flags;
 
     /* First pass. Make sure all of the bytes we need are available */
@@ -1187,8 +1214,8 @@
     /* signature field */
     while (TRUE) {
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(JXTA_MSGELEM_SIG)) {
-            needed = available - sizeof(JXTA_MSGELEM_SIG);
+        if (available < sizeof(JXTA_MSGELEM_SIG)) {
+            needed = (gint) (available - sizeof(JXTA_MSGELEM_SIG));
         }
 
         if (tvb_memeql(tvb, offset, JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) {
@@ -1200,8 +1227,8 @@
 
         /* namespace id field */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint8)) {
-            needed = available - sizeof(guint8);
+        if (available < sizeof(guint8)) {
+            needed = (gint) (available - sizeof(guint8));
             break;
         }
 
@@ -1209,8 +1236,8 @@
 
         /* flags field */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint8)) {
-            needed = available - sizeof(guint8);
+        if (available < sizeof(guint8)) {
+            needed = (gint) (available - sizeof(guint8));
             break;
         } else {
             flags = tvb_get_guint8(tvb, offset);
@@ -1219,8 +1246,8 @@
 
         /* name field */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint16)) {
-            needed = available - sizeof(guint16);
+        if (available < sizeof(guint16)) {
+            needed = (gint) (available - sizeof(guint16));
             break;
         } else {
             guint16 name_len = tvb_get_ntohs(tvb, offset);
@@ -1228,7 +1255,7 @@
 
             available = tvb_reported_length_remaining(tvb, offset);
             if (available < name_len) {
-                needed = available - name_len;
+                needed = (gint) (available - name_len);
                 break;
             }
 
@@ -1240,8 +1267,8 @@
             guint16 type_len;
 
             available = tvb_reported_length_remaining(tvb, offset);
-            if (available < (int)sizeof(guint16)) {
-                needed = available - sizeof(guint16);
+            if (available < sizeof(guint16)) {
+                needed = (gint) (available - sizeof(guint16));
                 break;
             }
 
@@ -1250,7 +1277,7 @@
 
             available = tvb_reported_length_remaining(tvb, offset);
             if (available < type_len) {
-                needed = available - type_len;
+                needed = (gint) (available - type_len);
                 break;
             }
 
@@ -1262,8 +1289,8 @@
             guint16 encoding_len;
 
             available = tvb_reported_length_remaining(tvb, offset);
-            if (available < (int)sizeof(guint16)) {
-                needed = available - sizeof(guint16);
+            if (available < sizeof(guint16)) {
+                needed = (gint) (available - sizeof(guint16));
                 break;
             }
 
@@ -1272,7 +1299,7 @@
 
             available = tvb_reported_length_remaining(tvb, offset);
             if (available < encoding_len) {
-                needed = available - encoding_len;
+                needed = (gint) (available - encoding_len);
                 break;
             }
 
@@ -1281,16 +1308,16 @@
 
         /* content field */
         available = tvb_reported_length_remaining(tvb, offset);
-        if (available < (int)sizeof(guint16)) {
-            needed = available - sizeof(guint16);
+        if (available < sizeof(guint16)) {
+            needed = (gint) (available - sizeof(guint16));
             break;
         } else {
             guint32 content_len = tvb_get_ntohl(tvb, offset);
             offset += sizeof(guint32);
 
             available = tvb_reported_length_remaining(tvb, offset);
-            if (available < (int)content_len) {
-                needed = available - content_len;
+            if (available < content_len) {
+                needed = (gint) (available - content_len);
                 break;
             }
 
@@ -1327,7 +1354,7 @@
 
     /* Second (optional) pass : build the proto tree */
     if (tree) {
-        int tree_offset = 0;
+        guint tree_offset = 0;
         proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, FALSE);
         proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem);
         guint8 namespaceID;
@@ -1485,8 +1512,8 @@
 
     jxta_tap = register_tap("jxta");
 
-    proto_message_jxta = proto_register_protocol("Media Type: application/x-jxta-msg",
-                                                 "application/x-jxta-msg", "application-x-jxta-msg");
+    proto_message_jxta = proto_register_protocol("JXTA Message",
+                                                 "application/x-jxta-msg", "jxta.message");
 
     /* Register header fields */
     proto_register_field_array(proto_jxta, hf, array_length(hf));