aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2005-06-03 06:29:25 +0000
committerAnders Broman <anders.broman@ericsson.com>2005-06-03 06:29:25 +0000
commit5df33850a998edee3613fa5ae798c01ef42ebcab (patch)
tree287fd7d50b832b1df4322a0b24a6f8de3c763d2d /epan
parent7c75e42fee4743df82089a0799819b4ff816181d (diff)
From Mike Duigou:
Extends the jxta dissector to add higher level conversation tracking, improved display, tapping and fixes a bug which caused some conversations to get lost. svn path=/trunk/; revision=14534
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-jxta.c344
1 files changed, 313 insertions, 31 deletions
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 6b208f7c19..75698b8ef8 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -1,6 +1,6 @@
/* packet-jxta.c
* Routines for JXTA packet dissection
- * Copyright 2004, Mike Duigou <bondolo@jxta.org>
+ * Copyright 2004-05, Mike Duigou <bondolo@jxta.org>
* Heavily based on packet-jabber.c, which in turn is heavily based on
* on packet-acap.c, which in turn is heavily based on
* packet-imap.c, Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
@@ -35,14 +35,15 @@
#endif
#include <stdio.h>
-
#include <string.h>
+
#include <glib.h>
+
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/strutil.h>
#include <epan/prefs.h>
-#include "packet-tcp.h"
+#include <tap.h>
static const char JXTA_UDP_SIG[] = { 'J', 'X', 'T', 'A' };
static const char JXTA_MSG_SIG[] = { 'j', 'x', 'm', 'g' };
@@ -52,19 +53,28 @@ static const char JXTA_WELCOME_MSG_SIG[] = { 'J', 'X', 'T', 'A', 'H', 'E', 'L',
static int proto_jxta = -1;
static int proto_message_jxta = -1;
+static int jxta_tap = -1;
-static dissector_table_t media_type_dissector_table=NULL;
-static dissector_handle_t tcp_jxta_handle=NULL;
+static dissector_table_t media_type_dissector_table = NULL;
+static dissector_handle_t tcp_jxta_handle = NULL;
static int hf_jxta_udp = -1;
static int hf_jxta_udpsig = -1;
static int hf_jxta_welcome = -1;
+static int hf_jxta_welcome_sig = -1;
+static int hf_jxta_welcome_destAddr = -1;
+static int hf_jxta_welcome_pubAddr = -1;
+static int hf_jxta_welcome_peerid = -1;
+static int hf_jxta_welcome_noProp = -1;
+static int hf_jxta_welcome_version = -1;
static int hf_jxta_framing = -1;
static int hf_jxta_framing_header = -1;
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_src = -1;
+static int hf_jxta_message_dst = -1;
static int hf_jxta_message_sig = -1;
static int hf_jxta_message_version = -1;
static int hf_jxta_message_namespaces_count = -1;
@@ -87,7 +97,7 @@ static int hf_jxta_element_content_text = -1;
/** our header fields */
static hf_register_info hf[] = {
{&hf_jxta_udp,
- {"JXTA UDP Message", "jxta.udp", FT_NONE, BASE_NONE, NULL, 0x0,
+ {"JXTA UDP Message", "jxta.udp", FT_PROTOCOL, BASE_NONE, NULL, 0x0,
"JXTA UDP Message", HFILL}
},
{&hf_jxta_udpsig,
@@ -98,8 +108,32 @@ static hf_register_info hf[] = {
{"Welcome Message", "jxta.welcome", FT_STRING, BASE_NONE, NULL, 0x0,
"JXTA Connection Welcome Message", HFILL}
},
+ {&hf_jxta_welcome_sig,
+ {"Signature", "jxta.welcome.signature", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message Signature", HFILL}
+ },
+ {&hf_jxta_welcome_destAddr,
+ {"Destination Address", "jxta.welcome.destAddr", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message Destination Address", HFILL}
+ },
+ {&hf_jxta_welcome_pubAddr,
+ {"Public Address", "jxta.welcome.pubAddr", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message Public Address", HFILL}
+ },
+ {&hf_jxta_welcome_peerid,
+ {"PeerID", "jxta.welcome.peerid", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message PeerID", HFILL}
+ },
+ {&hf_jxta_welcome_noProp,
+ {"No Propagate Flag", "jxta.welcome.noPropFlag", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message No Propagate Flag", HFILL}
+ },
+ {&hf_jxta_welcome_version,
+ {"Version", "jxta.welcome.version", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Connection Welcome Message Version", HFILL}
+ },
{&hf_jxta_framing,
- {"JXTA Message Framing", "jxta.framing", FT_NONE, BASE_NONE, NULL, 0x0,
+ {"JXTA Message Framing", "jxta.framing", FT_PROTOCOL, BASE_NONE, NULL, 0x0,
"JXTA Message Framing Headers", HFILL}
},
{&hf_jxta_framing_header,
@@ -119,9 +153,17 @@ static hf_register_info hf[] = {
"JXTA Message Framing Header Value", HFILL}
},
{&hf_jxta_message,
- {"JXTA Message", "jxta.message", FT_NONE, BASE_NONE, NULL, 0x0,
+ {"JXTA Message", "jxta.message", FT_PROTOCOL, BASE_NONE, NULL, 0x0,
"JXTA Message", HFILL}
},
+ {&hf_jxta_message_src,
+ {"Source", "jxta.message.source", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Message Source", HFILL}
+ },
+ {&hf_jxta_message_dst,
+ {"Destination", "jxta.message.destination", FT_STRING, BASE_NONE, NULL, 0x0,
+ "JXTA Message Destination", HFILL}
+ },
{&hf_jxta_message_sig,
{"Signature", "jxta.message.signature", FT_STRING, BASE_NONE, NULL, 0x0,
"JXTA Message Signature", HFILL}
@@ -228,6 +270,23 @@ static gboolean gUDP_HEUR = FALSE;
static gboolean gTCP_HEUR = FALSE;
/**
+* Stream Conversation data
+**/
+struct jxta_stream_conversation_data {
+ port_type tpt_ptype;
+ guint32 initiator_welcome_frame;
+ address initiator_tpt_address;
+ guint32 initiator_tpt_port;
+ address initiator_address;
+ guint32 receiver_welcome_frame;
+ address receiver_tpt_address;
+ guint32 receiver_tpt_port;
+ address receiver_address;
+};
+
+typedef struct jxta_stream_conversation_data jxta_stream_conversation_data;
+
+/**
* Prototypes
**/
static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
@@ -236,7 +295,7 @@ static gboolean dissect_jxta_TCP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
-static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
+static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address * found_addr );
static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint64 * content_length,
char **content_type);
static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
@@ -419,6 +478,9 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
g_assert(offset == tree_offset);
}
+
+ /* FIXME Could be a partially filled in jxta_stream_conversation_data object */
+ tap_queue_packet(jxta_tap, pinfo, NULL );
return offset;
}
@@ -437,19 +499,32 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
int available = 0;
int processed;
gboolean first = TRUE;
- conversation_t *conversation =
+ 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;
- if (conversation == NULL) {
+ if (tpt_conversation == NULL) {
/*
* No conversation exists yet - create one.
*/
- conversation =
+ tpt_conversation =
conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
}
- conversation_set_dissector(conversation, tcp_jxta_handle);
-
+ conversation_set_dissector(tpt_conversation, tcp_jxta_handle);
+
+ tpt_conv_data = (jxta_stream_conversation_data*) conversation_get_proto_data(tpt_conversation, proto_jxta);
+
+ if( NULL == tpt_conv_data ) {
+ tpt_conv_data = g_malloc( sizeof(jxta_stream_conversation_data) );
+ 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->receiver_welcome_frame = 0;
+ tpt_conv_data->receiver_address.type = AT_NONE;
+ conversation_add_proto_data(tpt_conversation, proto_jxta, tpt_conv_data);
+ }
+
while (tvb_reported_length_remaining(tvb, offset) > 0) {
if (first) {
if (check_col(pinfo->cinfo, COL_PROTOCOL)) {
@@ -458,14 +533,89 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
}
if (0 == tvb_memeql(tvb, 0, JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
- processed = dissect_jxta_welcome(tvb, pinfo, tree);
+ address * welcome_addr;
+
+ if( 0 == tpt_conv_data->initiator_welcome_frame ) {
+ tpt_conv_data->tpt_ptype= pinfo->ptype;
+ tpt_conv_data->initiator_welcome_frame = pinfo->fd->num;
+ COPY_ADDRESS( &tpt_conv_data->initiator_tpt_address, &pinfo->src );
+ tpt_conv_data->initiator_tpt_port = pinfo->srcport;
+
+ welcome_addr = &tpt_conv_data->initiator_address;
+ } else {
+ if( tpt_conv_data->initiator_welcome_frame > pinfo->fd->num ) {
+ /* what we saw previously was the receiver welcome message */
+ tpt_conv_data->receiver_welcome_frame = tpt_conv_data->initiator_welcome_frame;
+ tpt_conv_data->receiver_tpt_address = tpt_conv_data->initiator_tpt_address;
+ tpt_conv_data->receiver_tpt_port = tpt_conv_data->initiator_tpt_port;
+ tpt_conv_data->receiver_address = tpt_conv_data->initiator_address;
+ tpt_conv_data->initiator_welcome_frame = pinfo->fd->num;
+ COPY_ADDRESS( &tpt_conv_data->initiator_tpt_address, &pinfo->src );
+ tpt_conv_data->initiator_tpt_port = pinfo->srcport;
+
+ welcome_addr = &tpt_conv_data->initiator_address;
+ } else {
+ tpt_conv_data->tpt_ptype= pinfo->ptype;
+ tpt_conv_data->receiver_welcome_frame = pinfo->fd->num;
+ COPY_ADDRESS( &tpt_conv_data->receiver_tpt_address, &pinfo->src );
+ tpt_conv_data->receiver_tpt_port = pinfo->srcport;
+
+ welcome_addr = &tpt_conv_data->receiver_address;
+ }
+ }
+
+ processed = dissect_jxta_welcome(tvb, pinfo, tree, welcome_addr);
} else {
guint64 content_length = -1;
char *content_type = NULL;
gboolean dissected;
+ conversation_t *peer_conversation = NULL;
+ address saved_src_addr;
+ guint32 saved_src_port;
+ address saved_dst_addr;
+ guint32 saved_dst_port;
+ port_type saved_port_type;
+
+ if( (AT_NONE != tpt_conv_data->initiator_address.type) && (AT_NONE != tpt_conv_data->receiver_address.type) ) {
+ peer_conversation =
+ find_conversation(pinfo->fd->num, &tpt_conv_data->initiator_address, &tpt_conv_data->receiver_address, PT_NONE, 0, 0, NO_PORT_B);
+
+ if( NULL == peer_conversation ) {
+ peer_conversation =
+ conversation_new(pinfo->fd->num, &tpt_conv_data->initiator_address, &tpt_conv_data->receiver_address, PT_NONE, 0, 0, NO_PORT_B);
+ }
- processed = dissect_jxta_message_framing(tvb, pinfo, tree, &content_length, &content_type);
+ conversation_set_dissector(peer_conversation, tcp_jxta_handle);
+ }
+ /* Use our source and destination addresses if we have them */
+ if( NULL != peer_conversation ) {
+ saved_src_addr = pinfo->src;
+ saved_src_port = pinfo->srcport;
+ saved_dst_addr = pinfo->dst;
+ saved_dst_port = pinfo->destport;
+ saved_port_type = pinfo->ptype;
+/* g_warning( "%d Tpt %s:%d -> %s:%d", pinfo->fd->num, ip_to_str(tpt_conv_data->initiator_tpt_address.data), tpt_conv_data->initiator_tpt_port, ip_to_str(tpt_conv_data->receiver_tpt_address.data), tpt_conv_data->receiver_tpt_port ); */
+ if( ADDRESSES_EQUAL( &pinfo->src, &tpt_conv_data->initiator_tpt_address ) &&
+ tpt_conv_data->initiator_tpt_port == pinfo->srcport ) {
+/* g_warning( "%d From initiator : %s -> %s ", pinfo->fd->num, tpt_conv_data->initiator_address.data, tpt_conv_data->receiver_address.data ); */
+ pinfo->src = tpt_conv_data->initiator_address;
+ pinfo->dst = tpt_conv_data->receiver_address;
+ } else if( ADDRESSES_EQUAL( &pinfo->src, &tpt_conv_data->receiver_tpt_address ) &&
+ tpt_conv_data->receiver_tpt_port == pinfo->srcport ) {
+/* g_warning( "%d From receiver : %s -> %s ", pinfo->fd->num, tpt_conv_data->receiver_address.data, tpt_conv_data->initiator_address.data ); */
+ pinfo->src = tpt_conv_data->receiver_address;
+ pinfo->dst = tpt_conv_data->initiator_address;
+ } else {
+/* g_warning( "%d Nothing matches %s:%d -> %s:%d", pinfo->fd->num, ip_to_str(pinfo->src.data), pinfo->srcport, ip_to_str(pinfo->dst.data), pinfo->destport ); */
+ }
+ /* JXTA doesn't use ports */
+ pinfo->ptype = PT_NONE;
+ pinfo->srcport = 0;
+ pinfo->destport = 0;
+ }
+
+ processed = dissect_jxta_message_framing(tvb, pinfo, tree, &content_length, &content_type);
if ((processed > 0) && (NULL != content_type) && (-1 != (gint) content_length)) {
int msg_offset = offset + processed;
@@ -476,10 +626,22 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
if (check_col(pinfo->cinfo, COL_INFO)) {
col_set_str(pinfo->cinfo, COL_INFO, "Message");
- }
- col_set_writable(pinfo->cinfo, FALSE);
+ if ( AT_STRINGZ == pinfo->src.type ) {
+ col_append_fstr( pinfo->cinfo, COL_INFO, " %s", pinfo->src.data );
+ }
+
+ if ((AT_STRINGZ == pinfo->dst.type) || (AT_STRINGZ == 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 );
+ }
+ col_set_writable(pinfo->cinfo, FALSE);
+ }
+
dissected = dissector_try_string(media_type_dissector_table, content_type, jxta_message_tvb, pinfo, tree);
if (!dissected) {
@@ -494,6 +656,15 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
g_free(content_type);
}
+
+ /* Restore the saved src and dst addresses */
+ if( NULL != peer_conversation ) {
+ pinfo->src = saved_src_addr;
+ pinfo->srcport = saved_src_port;
+ pinfo->dst = saved_dst_addr;
+ pinfo->destport = saved_dst_port;
+ pinfo->ptype = saved_port_type;
+ }
}
if (processed <= 0) {
@@ -506,6 +677,8 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
first = FALSE;
}
+
+ tap_queue_packet(jxta_tap, pinfo, tpt_conv_data);
return offset;
}
@@ -516,11 +689,12 @@ static int dissect_jxta_tcp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
* @param tvb The buffer to dissect.
* @param pinfo Packet Info.
* @param tree The protocol tree.
+* @param found_addr The address found in the welcome message.
* @return number of bytes from the tvbuff_t which were processed.
**/
-static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
+static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address *found_addr )
{
- guint offset = 0;
+ int offset = 0;
int afterwelcome;
int first_linelen;
int available = tvb_reported_length_remaining(tvb, offset);
@@ -550,11 +724,88 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
col_set_str(pinfo->cinfo, COL_INFO, "Welcome Message");
}
- if (tree) {
- /* FIXME bondolo dissect the welcome line */
- proto_tree_add_item(tree, hf_jxta_welcome, tvb, offset, afterwelcome, FALSE);
+ {
+ gchar * welcomeline = tvb_get_string( tvb, offset, first_linelen );
+ gchar** tokens = g_strsplit( welcomeline, " ", 6 );
+ gchar** current_token = tokens;
+ guint token_offset = offset;
+ proto_item *jxta_welcome_tree_item = NULL;
+ proto_tree *jxta_welcome_tree = NULL;
+
+ if (tree) {
+ jxta_welcome_tree_item = proto_tree_add_item(tree, hf_jxta_welcome, tvb, offset, afterwelcome, FALSE);
+ jxta_welcome_tree = proto_item_add_subtree(jxta_welcome_tree_item, ett_jxta_welcome);
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_sig, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_destAddr, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_pubAddr, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_peerid, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_fstr( pinfo->cinfo, COL_INFO, " [%s]", *current_token );
+ }
+
+ if( NULL != found_addr ) {
+ found_addr->type = AT_STRINGZ;
+ found_addr->len = strlen( *current_token ) + 1;
+ found_addr->data = g_strdup( *current_token );
+ }
+
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_noProp, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ if( NULL != *current_token ) {
+ if( jxta_welcome_tree ) {
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_version, tvb, token_offset, strlen( *current_token ), FALSE);
+ }
+ token_offset += strlen( *current_token ) + 1;
+ current_token++;
+ }
+
+ g_free(welcomeline);
+ g_strfreev(tokens);
}
+ col_set_writable(pinfo->cinfo, FALSE);
+
return afterwelcome;
}
@@ -754,7 +1005,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
break;
} else {
guint16 msg_ns_count = tvb_get_ntohs(tvb, offset);
- int each_namespace;
+ unsigned int each_namespace;
offset += sizeof(guint16);
@@ -786,7 +1037,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
break;
} else {
guint16 elem_count = tvb_get_ntohs(tvb, offset);
- int each_elem;
+ unsigned int each_elem;
offset += sizeof(guint16);
@@ -813,15 +1064,34 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (tree) {
int tree_offset = 0;
- proto_item *jxta_msg_tree_item = proto_tree_add_item(tree, hf_jxta_message, tvb, tree_offset, -1, FALSE);
- proto_tree *jxta_msg_tree = proto_item_add_subtree(jxta_msg_tree_item, ett_jxta_msg);
-
+ proto_item *jxta_msg_tree_item = NULL;
+ proto_tree *jxta_msg_tree = NULL;
guint8 message_version;
const char **namespaces = NULL;
guint16 msg_ns_count;
- int each_namespace;
+ unsigned int each_namespace;
guint16 elem_count;
- int each_elem;
+ unsigned int 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 );
+ }
+ else {
+ jxta_msg_tree_item = proto_tree_add_item(tree, hf_jxta_message, 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 );
+ }
+
+ 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 );
+ }
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);
@@ -1119,8 +1389,18 @@ static int dissect_jxta_message_element(tvbuff_t * tvb, packet_info * pinfo, pro
element_content_tvb = tvb_new_subset(tvb, tree_offset, content_len, content_len);
if (NULL != mediatype) {
- media_type_recognized = dissector_try_string(media_type_dissector_table,
+ if( 0 == strcmp( "application/x-jxta-tls-block", mediatype ) ) {
+ /* If we recognize it as a TLS packet then we shuffle it off to ssl dissector. */
+ dissector_handle_t ssl_handle = find_dissector("ssl");
+ if( NULL != ssl_handle ) {
+ int processed = call_dissector(ssl_handle, element_content_tvb, pinfo, jxta_elem_tree);
+ media_type_recognized = processed > 0;
+ }
+ } else {
+ media_type_recognized = dissector_try_string(media_type_dissector_table,
mediatype, element_content_tvb, pinfo, jxta_elem_tree);
+ }
+
g_free(mediatype);
}
@@ -1153,6 +1433,8 @@ void proto_register_jxta(void)
proto_jxta = proto_register_protocol("JXTA P2P", "JXTA", "jxta");
+ 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");