summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-jxta.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-jxta.c')
-rw-r--r--epan/dissectors/packet-jxta.c634
1 files changed, 317 insertions, 317 deletions
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index a6b44d70..056b0dd9 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -36,16 +36,16 @@
void proto_register_jxta(void);
void proto_reg_handoff_jxta(void);
-static const gchar JXTA_UDP_SIG[] = { 'J', 'X', 'T', 'A' };
-static const gchar JXTA_MSG_SIG[] = { 'j', 'x', 'm', 'g' };
-static const gchar JXTA_MSGELEM_SIG[] = { 'j', 'x', 'e', 'l' };
+static const char JXTA_UDP_SIG[] = { 'J', 'X', 'T', 'A' };
+static const char JXTA_MSG_SIG[] = { 'j', 'x', 'm', 'g' };
+static const char JXTA_MSGELEM_SIG[] = { 'j', 'x', 'e', 'l' };
-static const gchar JXTA_WELCOME_MSG_SIG[] = { 'J', 'X', 'T', 'A', 'H', 'E', 'L', 'L', 'O', ' ' };
+static const char JXTA_WELCOME_MSG_SIG[] = { 'J', 'X', 'T', 'A', 'H', 'E', 'L', 'L', 'O', ' ' };
-static const gchar* JXTA_WELCOME_MSG_VERSION_1_1 = "1.1";
-static const gchar* JXTA_WELCOME_MSG_VERSION_3_0 = "3.0";
+static const char* JXTA_WELCOME_MSG_VERSION_1_1 = "1.1";
+static const char* JXTA_WELCOME_MSG_VERSION_3_0 = "3.0";
-static const int JXTA_MSG_VERSION_1 = 0;
+static const int JXTA_MSG_VERSION_1;
static const int JXTA_MSG_VERSION_2 = 1;
static const int JXTAMSG1_ELMFLAG_TYPE = 1 << 0;
@@ -58,93 +58,93 @@ static const int JXTAMSG2_ELMFLAG_TYPE = 1 << 2;
static const int JXTAMSG2_ELMFLAG_SIGNATURE = 1 << 3;
static const int JXTAMSG2_ELMFLAG_ENCODINGS = 1 << 4;
-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 media_handle = NULL;
-static dissector_handle_t stream_jxta_handle = NULL;
-static dissector_handle_t tls_handle = NULL;
-
-static int hf_uri_addr = -1;
-static int hf_uri_src = -1;
-static int hf_uri_dst = -1;
-static int hf_jxta_udp = -1;
-static int hf_jxta_udpsig = -1;
-static int hf_jxta_welcome = -1;
-static int hf_jxta_welcome_initiator = -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_msgVers = -1;
-static int hf_jxta_welcome_variable = -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_address = -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_flags = -1;
-static int hf_jxta_message_flag_utf16be = -1;
-static int hf_jxta_message_flag_ucs32be = -1;
-static int hf_jxta_message_names_count = -1;
-static int hf_jxta_message_names_name = -1;
-static int hf_jxta_message_element_count = -1;
-static int hf_jxta_element = -1;
-static int hf_jxta_element_sig = -1;
-static int hf_jxta_element1_namespaceid = -1;
-static int hf_jxta_element2_namespaceid = -1;
-static int hf_jxta_element2_nameid = -1;
-static int hf_jxta_element2_mimeid = -1;
-static int hf_jxta_element2_encodingid = -1;
-static int hf_jxta_element_flags = -1;
-static int hf_jxta_element1_flag_hasType = -1;
-static int hf_jxta_element1_flag_hasEncoding = -1;
-static int hf_jxta_element1_flag_hasSignature = -1;
-static int hf_jxta_element2_flag_64bitlens = -1;
-static int hf_jxta_element2_flag_nameLiteral = -1;
-static int hf_jxta_element2_flag_hasType = -1;
-static int hf_jxta_element2_flag_hasSignature = -1;
-static int hf_jxta_element2_flag_hasEncoding = -1;
-static int hf_jxta_element2_flag_sigOfEncoded = -1;
-static int hf_jxta_element_name = -1;
-static int hf_jxta_element_type = -1;
-static int hf_jxta_element_encoding = -1;
-static int hf_jxta_element_content_len = -1;
-static int hf_jxta_element_content_len64 = -1;
-/* static int hf_jxta_element_content = -1; */
+static int proto_jxta;
+static int proto_message_jxta;
+static int jxta_tap;
+
+static dissector_table_t media_type_dissector_table;
+static dissector_handle_t media_handle;
+static dissector_handle_t stream_jxta_handle;
+static dissector_handle_t tls_handle;
+
+static int hf_uri_addr;
+static int hf_uri_src;
+static int hf_uri_dst;
+static int hf_jxta_udp;
+static int hf_jxta_udpsig;
+static int hf_jxta_welcome;
+static int hf_jxta_welcome_initiator;
+static int hf_jxta_welcome_sig;
+static int hf_jxta_welcome_destAddr;
+static int hf_jxta_welcome_pubAddr;
+static int hf_jxta_welcome_peerid;
+static int hf_jxta_welcome_noProp;
+static int hf_jxta_welcome_msgVers;
+static int hf_jxta_welcome_variable;
+static int hf_jxta_welcome_version;
+static int hf_jxta_framing;
+static int hf_jxta_framing_header;
+static int hf_jxta_framing_header_name;
+static int hf_jxta_framing_header_value_length;
+static int hf_jxta_framing_header_value;
+static int hf_jxta_message_address;
+static int hf_jxta_message_src;
+static int hf_jxta_message_dst;
+static int hf_jxta_message_sig;
+static int hf_jxta_message_version;
+static int hf_jxta_message_flags;
+static int hf_jxta_message_flag_utf16be;
+static int hf_jxta_message_flag_ucs32be;
+static int hf_jxta_message_names_count;
+static int hf_jxta_message_names_name;
+static int hf_jxta_message_element_count;
+static int hf_jxta_element;
+static int hf_jxta_element_sig;
+static int hf_jxta_element1_namespaceid;
+static int hf_jxta_element2_namespaceid;
+static int hf_jxta_element2_nameid;
+static int hf_jxta_element2_mimeid;
+static int hf_jxta_element2_encodingid;
+static int hf_jxta_element_flags;
+static int hf_jxta_element1_flag_hasType;
+static int hf_jxta_element1_flag_hasEncoding;
+static int hf_jxta_element1_flag_hasSignature;
+static int hf_jxta_element2_flag_64bitlens;
+static int hf_jxta_element2_flag_nameLiteral;
+static int hf_jxta_element2_flag_hasType;
+static int hf_jxta_element2_flag_hasSignature;
+static int hf_jxta_element2_flag_hasEncoding;
+static int hf_jxta_element2_flag_sigOfEncoded;
+static int hf_jxta_element_name;
+static int hf_jxta_element_type;
+static int hf_jxta_element_encoding;
+static int hf_jxta_element_content_len;
+static int hf_jxta_element_content_len64;
+/* static int hf_jxta_element_content; */
/**
* JXTA Protocol subtree handles
**/
-static gint ett_jxta = -1;
-static gint ett_jxta_welcome = -1;
-static gint ett_jxta_udp = -1;
-static gint ett_jxta_framing = -1;
-static gint ett_jxta_framing_header = -1;
-static gint ett_jxta_msg = -1;
-static gint ett_jxta_msg_flags = -1;
-static gint ett_jxta_elem = -1;
-static gint ett_jxta_elem_1_flags = -1;
-static gint ett_jxta_elem_2_flags = -1;
-
-static expert_field ei_media_too_short = EI_INIT;
+static int ett_jxta;
+static int ett_jxta_welcome;
+static int ett_jxta_udp;
+static int ett_jxta_framing;
+static int ett_jxta_framing_header;
+static int ett_jxta_msg;
+static int ett_jxta_msg_flags;
+static int ett_jxta_elem;
+static int ett_jxta_elem_1_flags;
+static int ett_jxta_elem_2_flags;
+
+static expert_field ei_media_too_short;
static int uri_address_type = -1;
/**
* global preferences
**/
-static gboolean gDESEGMENT = TRUE;
-static gboolean gMSG_MEDIA = TRUE;
+static bool gDESEGMENT = true;
+static bool gMSG_MEDIA = true;
static dissector_handle_t jxta_udp_handle;
@@ -155,13 +155,13 @@ struct jxta_stream_conversation_data {
port_type tpt_ptype;
address initiator_tpt_address;
- guint32 initiator_tpt_port;
- guint32 initiator_welcome_frame;
+ uint32_t initiator_tpt_port;
+ uint32_t initiator_welcome_frame;
address initiator_address;
address receiver_tpt_address;
- guint32 receiver_tpt_port;
- guint32 receiver_welcome_frame;
+ uint32_t receiver_tpt_port;
+ uint32_t receiver_welcome_frame;
address receiver_address;
};
@@ -218,12 +218,12 @@ jxta_endpoint_packet(void *pit, packet_info *pinfo _U_, epan_dissect_t *edt _U_,
/* 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 endpoint_table */
- add_endpoint_table_data(hash, &jxtahdr->src_address, 0, TRUE, 1, jxtahdr->size, &jxta_endpoint_dissector_info, ENDPOINT_NONE);
- add_endpoint_table_data(hash, &jxtahdr->dest_address, 0, FALSE, 1, jxtahdr->size, &jxta_endpoint_dissector_info, ENDPOINT_NONE);
+ add_endpoint_table_data(hash, &jxtahdr->src_address, 0, true, 1, jxtahdr->size, &jxta_endpoint_dissector_info, ENDPOINT_NONE);
+ add_endpoint_table_data(hash, &jxtahdr->dest_address, 0, false, 1, jxtahdr->size, &jxta_endpoint_dissector_info, ENDPOINT_NONE);
return TAP_PACKET_REDRAW;
}
-static int uri_to_str(const address* addr, gchar *buf, int buf_len)
+static int uri_to_str(const address* addr, char *buf, int buf_len)
{
int copy_len = addr->len < (buf_len - 1) ? addr->len : (buf_len - 1);
memcpy(buf, addr->data, copy_len );
@@ -236,7 +236,7 @@ static int uri_str_len(const address* addr)
return addr->len+1;
}
-static const char* uri_col_filter_str(const address* addr _U_, gboolean is_src)
+static const char* uri_col_filter_str(const address* addr _U_, bool is_src)
{
if (is_src)
return "uri.src";
@@ -250,17 +250,17 @@ static const char* uri_col_filter_str(const address* addr _U_, gboolean is_src)
static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data);
static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data);
static jxta_stream_conversation_data *get_tpt_conversation(packet_info * pinfo);
-static conversation_t *get_peer_conversation(packet_info * pinfo, jxta_stream_conversation_data* tpt_conv_data, gboolean create);
+static conversation_t *get_peer_conversation(packet_info * pinfo, jxta_stream_conversation_data* tpt_conv_data, bool create);
-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,
- gchar ** content_type);
+static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address * found_addr, bool initiator);
+static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, uint64_t * content_length,
+ char ** content_type);
static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data);
-static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
- const gchar ** namespaces);
-static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
- const gchar ** namespaces);
-static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
+static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, unsigned ns_count,
+ const char ** namespaces);
+static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, unsigned ns_count,
+ const char ** namespaces);
+static int dissect_media( const char* fullmediatype, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
/**
* Heuristically dissect a tvbuff containing a JXTA UDP Message
@@ -268,21 +268,21 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
* @param tvb The buffer to dissect.
* @param pinfo Packet Info.
* @param tree The protocol tree.
-* @return TRUE if the tvb contained JXTA data which was dissected otherwise FALSE
+* @return true if the tvb contained JXTA data which was dissected otherwise false
**/
-static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
+static bool dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
/* This is a heuristic dissector, which means we get all the UDP
* traffic not sent to a known dissector and not claimed by
* a heuristic dissector called before us!
*/
int save_desegment_offset;
- guint32 save_desegment_len;
+ uint32_t save_desegment_len;
int ret;
if (tvb_strneql(tvb, 0, JXTA_UDP_SIG, sizeof (JXTA_UDP_SIG)) != 0) {
/* Not a JXTA UDP packet (or not enough bytes to check for the sig) */
- return FALSE;
+ return false;
}
save_desegment_offset = pinfo->desegment_offset;
@@ -301,19 +301,19 @@ static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else if (ret == 0) {
/*
* A clear rejection.
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else {
/*
* A clear acceptance.
*/
- return TRUE;
+ return true;
}
}
@@ -323,16 +323,16 @@ static gboolean dissect_jxta_UDP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
* @param tvb The buffer to dissect.
* @param pinfo Packet Info.
* @param tree The protocol tree.
-* @return TRUE if the tvb contained JXTA data which was dissected otherwise FALSE
+* @return true if the tvb contained JXTA data which was dissected otherwise false
**/
-static gboolean dissect_jxta_TCP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
+static bool dissect_jxta_TCP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
/* This is a heuristic dissector, which means we get all the TCP
* traffic not sent to a known dissector and not claimed by
* a heuristic dissector called before us!
*/
int save_desegment_offset;
- guint32 save_desegment_len;
+ uint32_t save_desegment_len;
int ret;
save_desegment_offset = pinfo->desegment_offset;
@@ -357,23 +357,23 @@ static gboolean dissect_jxta_TCP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
* more data, in the hopes that we'll eventually be able to
* determine whether the packet is a JXTA packet or not - we
* should, in this case, leave pinfo->desegment_offset and
- * pinfo->desegment_len alone, and return TRUE, *NOT* FALSE.
+ * pinfo->desegment_len alone, and return true, *NOT* false.
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else if (ret == 0) {
/*
* A clear rejection.
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else {
/*
* A clear acceptance.
*/
- return TRUE;
+ return true;
}
}
@@ -383,16 +383,16 @@ static gboolean dissect_jxta_TCP_heur(tvbuff_t * tvb, packet_info * pinfo, proto
* @param tvb The buffer to dissect.
* @param pinfo Packet Info.
* @param tree The protocol tree.
-* @return TRUE if the tvb contained JXTA data which was dissected otherwise FALSE
+* @return true if the tvb contained JXTA data which was dissected otherwise false
**/
-static gboolean dissect_jxta_SCTP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
+static bool dissect_jxta_SCTP_heur(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
/* This is a heuristic dissector, which means we get all the SCTP
* traffic not sent to a known dissector and not claimed by
* a heuristic dissector called before us!
*/
int save_desegment_offset;
- guint32 save_desegment_len;
+ uint32_t save_desegment_len;
int ret;
save_desegment_offset = pinfo->desegment_offset;
@@ -417,19 +417,19 @@ static gboolean dissect_jxta_SCTP_heur(tvbuff_t * tvb, packet_info * pinfo, prot
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else if (ret == 0) {
/*
* A clear rejection.
*/
pinfo->desegment_offset = save_desegment_offset;
pinfo->desegment_len = save_desegment_len;
- return FALSE;
+ return false;
} else {
/*
* A clear acceptance.
*/
- return TRUE;
+ return true;
}
}
@@ -445,27 +445,27 @@ static gboolean dissect_jxta_SCTP_heur(tvbuff_t * tvb, packet_info * pinfo, prot
**/
static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
- guint offset = 0;
- guint available;
- gint needed = 0;
+ unsigned offset = 0;
+ unsigned available;
+ int needed = 0;
conversation_t *conversation = find_or_create_conversation(pinfo);
conversation_set_dissector(conversation, jxta_udp_handle);
- while (TRUE) {
+ while (true) {
tvbuff_t *jxta_message_framing_tvb;
- gint processed = 0;
- guint64 content_length = -1;
- gchar *content_type = NULL;
+ int processed = 0;
+ uint64_t content_length = -1;
+ char *content_type = NULL;
available = tvb_reported_length_remaining(tvb, offset);
if (available < sizeof(JXTA_UDP_SIG)) {
- needed = (gint) (sizeof(JXTA_UDP_SIG) - available);
+ needed = (int) (sizeof(JXTA_UDP_SIG) - available);
break;
}
- if (tvb_memeql(tvb, offset, (const guint8*)JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) {
+ if (tvb_memeql(tvb, offset, (const uint8_t*)JXTA_UDP_SIG, sizeof(JXTA_UDP_SIG)) != 0) {
/* not ours */
return 0;
}
@@ -489,11 +489,11 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
available = tvb_reported_length_remaining(tvb, offset);
if (available < content_length) {
- needed = (gint) (content_length - available);
+ needed = (int) (content_length - available);
break;
}
- offset += (guint) content_length;
+ offset += (unsigned) content_length;
break;
}
@@ -507,7 +507,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
col_set_str(pinfo->cinfo, COL_PROTOCOL, "JXTA");
- guint tree_offset = 0;
+ unsigned tree_offset = 0;
proto_item *jxta_tree_item =
proto_tree_add_protocol_format(tree, proto_jxta, tvb, tree_offset, -1, "JXTA" );
proto_tree *jxta_tree = proto_item_add_subtree(jxta_tree_item, ett_jxta);
@@ -515,8 +515,8 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
proto_tree_add_none_format(jxta_tree, hf_jxta_udp, tvb, tree_offset, -1, "JXTA UDP Message");
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;
- gchar *content_type = NULL;
+ uint64_t content_length = -1;
+ char *content_type = NULL;
tvbuff_t *jxta_message_tvb;
proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, (int)sizeof(JXTA_UDP_SIG), ENC_ASCII);
@@ -526,7 +526,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
tree_offset += dissect_jxta_message_framing(jxta_message_framing_tvb, pinfo, jxta_tree, &content_length, &content_type);
- jxta_message_tvb = tvb_new_subset_length(tvb, tree_offset, (gint) content_length);
+ jxta_message_tvb = tvb_new_subset_length(tvb, tree_offset, (int) content_length);
tree_offset += dissect_media(content_type, jxta_message_tvb, pinfo, tree);
@@ -556,10 +556,10 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr
**/
static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
- guint offset = 0;
- guint available = tvb_reported_length_remaining(tvb, offset);
- gint processed = 0;
- gint needed = 0;
+ unsigned offset = 0;
+ unsigned available = tvb_reported_length_remaining(tvb, offset);
+ int processed = 0;
+ int needed = 0;
jxta_stream_conversation_data *tpt_conv_data = NULL;
proto_item *jxta_tree_item = NULL;
proto_tree *jxta_tree = NULL;
@@ -567,14 +567,14 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
/* ws_message("Dissecting%s : %d", (NULL != tree) ? " for display" : "", pinfo->num ); */
if (available < sizeof(JXTA_WELCOME_MSG_SIG)) {
- needed = (gint) (sizeof(JXTA_WELCOME_MSG_SIG) - available);
+ needed = (int) (sizeof(JXTA_WELCOME_MSG_SIG) - available);
goto Common_Exit;
}
- if (0 == tvb_memeql(tvb, 0, (const guint8*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
+ if (0 == tvb_memeql(tvb, 0, (const uint8_t*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
/* The beginning of a JXTA stream connection */
address *welcome_addr;
- gboolean initiator = FALSE;
+ bool initiator = false;
tpt_conv_data = get_tpt_conversation(pinfo);
@@ -586,7 +586,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
tpt_conv_data->initiator_tpt_port = pinfo->srcport;
welcome_addr = &tpt_conv_data->initiator_address;
- initiator = TRUE;
+ initiator = true;
} else {
if (tpt_conv_data->initiator_welcome_frame >= pinfo->num) {
/* what we saw previously was the receiver welcome message */
@@ -599,7 +599,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
tpt_conv_data->initiator_tpt_port = pinfo->srcport;
welcome_addr = &tpt_conv_data->initiator_address;
- initiator = TRUE;
+ initiator = true;
} else {
/* The receiver welcome frame */
tpt_conv_data->tpt_ptype = pinfo->ptype;
@@ -608,7 +608,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
tpt_conv_data->receiver_tpt_port = pinfo->srcport;
welcome_addr = &tpt_conv_data->receiver_address;
- initiator = FALSE;
+ initiator = false;
}
}
@@ -626,9 +626,9 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
processed = dissect_jxta_welcome(tvb, pinfo, jxta_tree, welcome_addr, initiator);
} else {
/* Somewhere in the middle of a JXTA stream connection */
- gint64 content_length = G_GINT64_CONSTANT(-1);
- gchar *content_type = NULL;
- gint headers_len = dissect_jxta_message_framing(tvb, pinfo, NULL, (guint64*) &content_length, &content_type);
+ int64_t content_length = INT64_C(-1);
+ char *content_type = NULL;
+ int headers_len = dissect_jxta_message_framing(tvb, pinfo, NULL, (uint64_t*) &content_length, &content_type);
if ((0 == headers_len) || (NULL == content_type) || (content_length <= 0) || (content_length > UINT_MAX)) {
/** Buffer did not begin with valid framing headers */
@@ -639,7 +639,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
address_to_str(pinfo->pool, &pinfo->src), pinfo->srcport,
address_to_str(pinfo->pool, &pinfo->dst), pinfo->destport,
tvb_reported_length_remaining(tvb, 0),
- content_type ? content_type : "[unknown content type]", (gint) content_length); */
+ content_type ? content_type : "[unknown content type]", (int) content_length); */
if (headers_len < 0) {
/* negative headers_len means we need more bytes */
@@ -649,7 +649,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
available = tvb_reported_length_remaining(tvb, offset + headers_len);
if (available >= content_length) {
- tvbuff_t *jxta_message_tvb = tvb_new_subset_length(tvb, offset + headers_len, (gint) content_length);
+ tvbuff_t *jxta_message_tvb = tvb_new_subset_length(tvb, offset + headers_len, (int) content_length);
conversation_t *peer_conversation = NULL;
jxta_tree_item = proto_tree_add_protocol_format(tree, proto_jxta, tvb, offset, -1, "JXTA" );
@@ -659,7 +659,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
headers_len = dissect_jxta_message_framing(tvb, pinfo, jxta_tree, &content_length, &content_type);
tpt_conv_data = get_tpt_conversation(pinfo);
- peer_conversation = get_peer_conversation(pinfo, tpt_conv_data, TRUE);
+ peer_conversation = get_peer_conversation(pinfo, tpt_conv_data, true);
/* Use our source and destination addresses if we have them */
if (NULL != peer_conversation) {
@@ -699,7 +699,7 @@ static int dissect_jxta_stream(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
processed += dissect_media(content_type, jxta_message_tvb, pinfo, tree);
} else {
/* we need more bytes before we can process message body. */
- needed = (gint) ((guint) content_length - available);
+ needed = (int) ((unsigned) content_length - available);
goto Common_Exit;
}
}
@@ -757,9 +757,9 @@ static jxta_stream_conversation_data *get_tpt_conversation(packet_info * pinfo)
* which is associated with the packet info.
*
* @param tpt_conv_data The transport conversation from which we will locate the peer conversation.
-* @param create If TRUE then create a new conversation object if necessary.
+* @param create If true then create a new conversation object if necessary.
**/
-static conversation_t *get_peer_conversation(packet_info * pinfo, jxta_stream_conversation_data* tpt_conv_data, gboolean create)
+static conversation_t *get_peer_conversation(packet_info * pinfo, jxta_stream_conversation_data* tpt_conv_data, bool create)
{
conversation_t * peer_conversation = NULL;
@@ -785,24 +785,24 @@ static conversation_t *get_peer_conversation(packet_info * pinfo, jxta_stream_co
* @param pinfo Packet Info.
* @param tree The protocol tree.
* @param found_addr The address found in the welcome message.
-* @param initiator If TRUE then we believe this welcome message to be the initiator's.
+* @param initiator If true then we believe this welcome message to be the initiator's.
* @return Number of bytes from the tvbuff_t which were processed, 0 (zero) if
* the packet was not recognized as a JXTA packet and negative if the
* dissector needs more bytes in order to process a PDU.
**/
-static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address * found_addr, gboolean initiator)
+static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, address * found_addr, bool initiator)
{
- guint offset = 0;
- gint afterwelcome;
- gint first_linelen;
- guint available = tvb_reported_length_remaining(tvb, offset);
- gchar **tokens = NULL;
+ unsigned offset = 0;
+ int afterwelcome;
+ int first_linelen;
+ unsigned available = tvb_reported_length_remaining(tvb, offset);
+ char **tokens = NULL;
if (available < sizeof(JXTA_WELCOME_MSG_SIG)) {
- return (gint) (available - sizeof(JXTA_WELCOME_MSG_SIG));
+ return (int) (available - sizeof(JXTA_WELCOME_MSG_SIG));
}
- if (0 != tvb_memeql(tvb, 0, (const guint8*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
+ if (0 != tvb_memeql(tvb, 0, (const uint8_t*)JXTA_WELCOME_MSG_SIG, sizeof(JXTA_WELCOME_MSG_SIG))) {
/* not ours! */
return 0;
}
@@ -826,9 +826,9 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
col_set_str(pinfo->cinfo, COL_INFO, "Welcome");
{
- gchar *welcomeline = tvb_get_string_enc(pinfo->pool, tvb, offset, first_linelen, ENC_ASCII);
- gchar **current_token;
- guint token_offset = offset;
+ char *welcomeline = tvb_get_string_enc(pinfo->pool, tvb, offset, first_linelen, ENC_ASCII);
+ char **current_token;
+ unsigned token_offset = offset;
proto_item *jxta_welcome_tree_item = NULL;
proto_tree *jxta_welcome_tree = NULL;
@@ -849,9 +849,9 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
}
if (NULL != *current_token) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_sig, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_sig, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
} else {
/* invalid welcome message */
@@ -861,11 +861,11 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (NULL != *current_token) {
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_destAddr, tvb, token_offset, (gint) strlen(*current_token),
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_destAddr, tvb, token_offset, (int) strlen(*current_token),
ENC_ASCII);
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
} else {
/* invalid welcome message */
@@ -875,10 +875,10 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (NULL != *current_token) {
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_pubAddr, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_pubAddr, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
} else {
/* invalid welcome message */
@@ -888,7 +888,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (NULL != *current_token) {
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_peerid, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_peerid, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
col_append_str(pinfo->cinfo, COL_INFO, (initiator ? " -> " : " <- ") );
@@ -898,7 +898,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
set_address(found_addr, uri_address_type, (int)strlen(*current_token) + 1, wmem_strdup(wmem_file_scope(), *current_token));
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
} else {
/* invalid welcome message */
@@ -908,7 +908,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (NULL != *current_token) {
int variable_tokens = 0;
- gchar **variable_token = current_token;
+ char **variable_token = current_token;
while(NULL != *variable_token) {
variable_tokens++;
@@ -923,32 +923,32 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if( (2 == variable_tokens) && (0 == strcmp(JXTA_WELCOME_MSG_VERSION_1_1, current_token[variable_tokens -1])) ) {
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_noProp, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_noProp, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_version, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_version, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
} else if( (3 == variable_tokens) && (0 == strcmp(JXTA_WELCOME_MSG_VERSION_3_0, current_token[variable_tokens -1])) ) {
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_noProp, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_noProp, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_msgVers, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_msgVers, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
if (jxta_welcome_tree) {
- proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_version, tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII);
+ proto_tree_add_item(jxta_welcome_tree, hf_jxta_welcome_version, tvb, token_offset, (int) strlen(*current_token), ENC_ASCII);
}
} else {
/* Unrecognized Welcome Version */
@@ -958,12 +958,12 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
if (jxta_welcome_tree) {
jxta_welcome_tree_item = proto_tree_add_item(jxta_welcome_tree,
(each_variable_token < (variable_tokens -1) ? hf_jxta_welcome_variable : hf_jxta_welcome_version),
- tvb, token_offset, (gint) strlen(*current_token), ENC_ASCII|ENC_NA);
+ tvb, token_offset, (int) strlen(*current_token), ENC_ASCII|ENC_NA);
proto_item_append_text(jxta_welcome_tree_item, " (UNRECOGNIZED)");
}
- token_offset += (guint) strlen(*current_token) + 1;
+ token_offset += (unsigned) strlen(*current_token) + 1;
current_token++;
}
}
@@ -975,7 +975,7 @@ static int dissect_jxta_welcome(tvbuff_t * tvb, packet_info * pinfo, proto_tree
}
Common_Exit:
- col_set_writable(pinfo->cinfo, -1, FALSE);
+ col_set_writable(pinfo->cinfo, -1, false);
return afterwelcome;
}
@@ -994,34 +994,34 @@ Common_Exit:
* the packet was not recognized as a JXTA packet and negative if the
* dissector needs more bytes in order to process a PDU.
**/
-static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint64 * content_length,
- gchar ** content_type)
+static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, uint64_t * content_length,
+ char ** content_type)
{
- guint offset = 0;
- guint available;
- gint needed = 0;
+ unsigned offset = 0;
+ unsigned available;
+ int needed = 0;
/*
* First go around. Make sure all of the bytes are there.
*/
do {
- guint8 headername_len;
- guint8 headername_offset;
- guint16 headervalue_len;
- guint16 headervalue_offset;
+ uint8_t headername_len;
+ uint8_t headername_offset;
+ uint16_t headervalue_len;
+ uint16_t headervalue_offset;
available = tvb_reported_length_remaining(tvb, offset);
if (available < 1) {
needed = 1;
break;
} else {
- headername_len = tvb_get_guint8(tvb, offset);
+ headername_len = tvb_get_uint8(tvb, offset);
offset++;
headername_offset = offset;
available = tvb_reported_length_remaining(tvb, offset);
if (available < headername_len) {
- needed = (gint) (headername_len - available);
+ needed = (int) (headername_len - available);
break;
}
@@ -1033,7 +1033,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
headervalue_len = tvb_get_ntohs(tvb, offset);
@@ -1042,7 +1042,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
available = tvb_reported_length_remaining(tvb, offset);
if (available < headervalue_len) {
- needed = (gint) (headervalue_len - available);
+ needed = (int) (headervalue_len - available);
break;
}
@@ -1056,12 +1056,12 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
}
- if (content_length && (sizeof(guint64) == headervalue_len) && ((sizeof("content-length") - 1) == headername_len)) {
+ if (content_length && (sizeof(uint64_t) == headervalue_len) && ((sizeof("content-length") - 1) == headername_len)) {
if (0 == tvb_strncaseeql(tvb, headername_offset, "content-length", sizeof("content-length") - 1)) {
*content_length = tvb_get_ntoh64(tvb, headervalue_offset);
}
}
- } while (TRUE);
+ } while (true);
if ((needed > 0) && gDESEGMENT && pinfo->can_desegment) {
/* ws_message( "Framing requesting %d more bytes", needed ); */
@@ -1074,7 +1074,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
* Second (optional pass) Now that we are sure that all the bytes are there we update the protocol tree.
*/
if (tree) {
- guint tree_offset = 0;
+ unsigned tree_offset = 0;
proto_item *framing_tree_item;
proto_tree *framing_tree;
@@ -1084,7 +1084,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
/* parse framing headers */
do {
- guint8 headernamelen = tvb_get_guint8(tvb, tree_offset);
+ uint8_t headernamelen = tvb_get_uint8(tvb, tree_offset);
proto_item *framing_header_tree_item =
proto_tree_add_item(framing_tree, hf_jxta_framing_header, tvb, tree_offset, -1, ENC_NA);
proto_tree *framing_header_tree = proto_item_add_subtree(framing_header_tree_item, ett_jxta_framing_header);
@@ -1092,7 +1092,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
/*
* Put header name into the protocol tree
*/
- proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, (int)sizeof(gint8), ENC_ASCII|ENC_BIG_ENDIAN);
+ proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, (int)sizeof(int8_t), ENC_ASCII|ENC_BIG_ENDIAN);
/*
* Append header name into the header protocol item. It's a nice hint so you don't have to reveal all headers.
@@ -1105,7 +1105,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
tree_offset += 1 + headernamelen;
if (headernamelen > 0) {
- guint16 headervaluelen = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t headervaluelen = tvb_get_ntohs(tvb, tree_offset);
if (tree) {
proto_tree_add_uint(framing_header_tree, hf_jxta_framing_header_value_length, tvb, tree_offset,
@@ -1128,7 +1128,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
if (0 == headernamelen) {
break;
}
- } while (TRUE);
+ } while (true);
proto_item_set_end(framing_tree_item, tvb, tree_offset);
@@ -1151,17 +1151,17 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro
**/
static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void * data _U_)
{
- gint complete_messages = 0;
- guint offset = 0;
- guint tree_offset = 0;
- guint available;
- gint needed = 0;
+ int complete_messages = 0;
+ unsigned offset = 0;
+ unsigned tree_offset = 0;
+ unsigned available;
+ int needed = 0;
wmem_strbuf_t* src_addr;
wmem_strbuf_t* dst_addr;
- while (TRUE) {
- guint8 message_version;
- guint message_start_offset = offset;
+ while (true) {
+ uint8_t message_version;
+ unsigned message_start_offset = offset;
/* First pass. Make sure all of the bytes we need are available */
available = tvb_reported_length_remaining(tvb, offset);
@@ -1172,11 +1172,11 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
}
if (available < sizeof(JXTA_MSG_SIG)) {
- needed = (gint) (sizeof(JXTA_MSG_SIG) - available);
+ needed = (int) (sizeof(JXTA_MSG_SIG) - available);
break;
}
- if (tvb_memeql(tvb, offset, (const guint8*)JXTA_MSG_SIG, sizeof(JXTA_MSG_SIG)) != 0) {
+ if (tvb_memeql(tvb, offset, (const uint8_t*)JXTA_MSG_SIG, sizeof(JXTA_MSG_SIG)) != 0) {
/* It is not one of ours */
return 0;
}
@@ -1188,7 +1188,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
needed = 1;
break;
} else {
- message_version = tvb_get_guint8(tvb, offset);
+ message_version = tvb_get_uint8(tvb, offset);
offset++;
@@ -1212,20 +1212,20 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
/* Read names table */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
- guint16 msg_names_count = tvb_get_ntohs(tvb, offset);
- guint each_name;
+ uint16_t msg_names_count = tvb_get_ntohs(tvb, offset);
+ unsigned each_name;
offset += 2;
for (each_name = 0; each_name < msg_names_count; each_name++) {
- guint16 name_len;
+ uint16_t name_len;
available = tvb_reported_length_remaining(tvb, offset);
if (available < sizeof(name_len)) {
- needed = (gint) (sizeof(name_len) - available);
+ needed = (int) (sizeof(name_len) - available);
break;
}
@@ -1233,7 +1233,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
available = tvb_reported_length_remaining(tvb, offset + (int)sizeof(name_len));
if (available < name_len) {
- needed = (gint) (name_len - available);
+ needed = (int) (name_len - available);
break;
}
@@ -1244,11 +1244,11 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
/* parse element count */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
- guint16 elem_count = tvb_get_ntohs(tvb, offset);
- guint each_elem;
+ uint16_t elem_count = tvb_get_ntohs(tvb, offset);
+ unsigned each_elem;
offset += 2;
@@ -1329,17 +1329,17 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
wmem_strbuf_get_str(src_addr), wmem_strbuf_get_str(dst_addr));
}
- col_set_writable(pinfo->cinfo, -1, FALSE);
+ col_set_writable(pinfo->cinfo, -1, false);
while( tree && (complete_messages > 0) ) {
proto_item *jxta_msg_tree_item = NULL;
proto_tree *jxta_msg_tree = NULL;
- guint8 message_version;
- const gchar **names_table = NULL;
- guint16 msg_names_count;
- guint each_name;
- guint16 elem_count;
- guint each_elem;
+ uint8_t message_version;
+ const char **names_table = NULL;
+ uint16_t msg_names_count;
+ unsigned each_name;
+ uint16_t elem_count;
+ unsigned each_elem;
proto_item *tree_item;
jxta_msg_tree_item = proto_tree_add_protocol_format(tree, proto_message_jxta, tvb, tree_offset, -1,
@@ -1383,7 +1383,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
proto_item_set_generated(tree_item);
}
- message_version = tvb_get_guint8(tvb, tree_offset);
+ message_version = tvb_get_uint8(tvb, tree_offset);
proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, 1, message_version);
tree_offset += 1;
@@ -1402,13 +1402,13 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, 2, msg_names_count);
tree_offset += 2;
- names_table = (const gchar **)wmem_alloc(pinfo->pool, (msg_names_count + 2) * sizeof(const gchar *));
+ names_table = (const char **)wmem_alloc(pinfo->pool, (msg_names_count + 2) * sizeof(const char *));
names_table[0] = "";
names_table[1] = "jxta";
/* parse names */
for (each_name = 0; each_name < msg_names_count; each_name++) {
- guint16 name_len = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t name_len = tvb_get_ntohs(tvb, tree_offset);
names_table[2 + each_name] = tvb_get_string_enc(pinfo->pool, tvb, tree_offset + 2, name_len, ENC_ASCII);
proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
@@ -1462,24 +1462,24 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
* dissector needs more bytes in order to process a PDU.
**/
// NOLINTNEXTLINE(misc-no-recursion)
-static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
- const gchar ** names_table)
+static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, unsigned ns_count,
+ const char ** names_table)
{
- guint offset = 0;
- guint available;
- gint needed = 0;
- guint8 flags;
+ unsigned offset = 0;
+ unsigned available;
+ int needed = 0;
+ uint8_t flags;
/* First pass. Make sure all of the bytes we need are available */
- while (TRUE) {
+ while (true) {
/* signature field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < sizeof(JXTA_MSGELEM_SIG)) {
- needed = (gint) (sizeof(JXTA_MSGELEM_SIG) - available);
+ needed = (int) (sizeof(JXTA_MSGELEM_SIG) - available);
}
- if (tvb_memeql(tvb, offset, (const guint8*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) {
+ if (tvb_memeql(tvb, offset, (const uint8_t*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) {
/* It is not one of ours */
return 0;
}
@@ -1501,22 +1501,22 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
needed = 1;
break;
} else {
- flags = tvb_get_guint8(tvb, offset);
+ flags = tvb_get_uint8(tvb, offset);
offset++;
}
/* name field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
- guint16 name_len = tvb_get_ntohs(tvb, offset);
+ uint16_t name_len = tvb_get_ntohs(tvb, offset);
offset += 2;
available = tvb_reported_length_remaining(tvb, offset);
if (available < name_len) {
- needed = (gint) (name_len - available);
+ needed = (int) (name_len - available);
break;
}
@@ -1525,11 +1525,11 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
/* type field */
if ((flags & JXTAMSG1_ELMFLAG_TYPE) != 0) {
- guint16 type_len;
+ uint16_t type_len;
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1538,7 +1538,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
available = tvb_reported_length_remaining(tvb, offset);
if (available < type_len) {
- needed = (gint) (type_len - available);
+ needed = (int) (type_len - available);
break;
}
@@ -1547,11 +1547,11 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
/* encoding field */
if ((flags & JXTAMSG1_ELMFLAG_ENCODING) != 0) {
- guint16 encoding_len;
+ uint16_t encoding_len;
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1560,7 +1560,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
available = tvb_reported_length_remaining(tvb, offset);
if (available < encoding_len) {
- needed = (gint) (encoding_len - available);
+ needed = (int) (encoding_len - available);
break;
}
@@ -1570,15 +1570,15 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
/* content field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
- guint32 content_len = tvb_get_ntohl(tvb, offset);
+ uint32_t content_len = tvb_get_ntohl(tvb, offset);
offset += 4;
available = tvb_reported_length_remaining(tvb, offset);
if (available < content_len) {
- needed = (gint) (content_len - available);
+ needed = (int) (content_len - available);
break;
}
@@ -1619,14 +1619,14 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
}
/* Second pass : build the proto tree */
- guint tree_offset = 0;
+ unsigned tree_offset = 0;
proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, ENC_NA);
proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem);
- guint8 namespaceID;
+ uint8_t namespaceID;
proto_item *namespace_ti;
- guint16 name_len;
- guint32 content_len;
- gchar *mediatype = NULL;
+ uint16_t name_len;
+ uint32_t content_len;
+ char *mediatype = NULL;
tvbuff_t *element_content_tvb;
static int * const element_flags[] = {
&hf_jxta_element1_flag_hasType,
@@ -1638,7 +1638,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII);
tree_offset += (int)sizeof(JXTA_MSGELEM_SIG);
- namespaceID = tvb_get_guint8(tvb, tree_offset);
+ namespaceID = tvb_get_uint8(tvb, tree_offset);
namespace_ti =
proto_tree_add_uint(jxta_elem_tree, hf_jxta_element1_namespaceid, tvb, tree_offset, 1, namespaceID);
if (namespaceID < ns_count) {
@@ -1648,7 +1648,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
}
tree_offset += 1;
- flags = tvb_get_guint8(tvb, tree_offset);
+ flags = tvb_get_uint8(tvb, tree_offset);
proto_tree_add_bitmask(jxta_elem_tree, tvb, tree_offset, hf_jxta_element_flags, ett_jxta_elem_1_flags, element_flags, ENC_NA);
tree_offset += 1;
@@ -1659,7 +1659,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
/* process type */
if ((flags & JXTAMSG1_ELMFLAG_TYPE) != 0) {
- guint16 type_len = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t type_len = tvb_get_ntohs(tvb, tree_offset);
proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
tree_offset += 2;
@@ -1670,7 +1670,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
/* process encoding */
if ((flags & JXTAMSG1_ELMFLAG_ENCODING) != 0) {
- guint16 encoding_len = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t encoding_len = tvb_get_ntohs(tvb, tree_offset);
proto_tree_add_item(jxta_elem_tree, hf_jxta_element_encoding, tvb, tree_offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
tree_offset += 2 + encoding_len;
}
@@ -1715,24 +1715,24 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
* dissector needs more bytes in order to process a PDU.
**/
// NOLINTNEXTLINE(misc-no-recursion)
-static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint names_count,
- const gchar ** names_table)
+static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, unsigned names_count,
+ const char ** names_table)
{
- guint offset = 0;
- guint available;
- gint needed = 0;
- guint8 flags;
+ unsigned offset = 0;
+ unsigned available;
+ int needed = 0;
+ uint8_t flags;
/* First pass. Make sure all of the bytes we need are available */
- while (TRUE) {
+ while (true) {
/* signature field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < sizeof(JXTA_MSGELEM_SIG)) {
- needed = (gint) (sizeof(JXTA_MSGELEM_SIG) - available);
+ needed = (int) (sizeof(JXTA_MSGELEM_SIG) - available);
}
- if (tvb_memeql(tvb, offset, (const guint8*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) {
+ if (tvb_memeql(tvb, offset, (const uint8_t*)JXTA_MSGELEM_SIG, sizeof(JXTA_MSGELEM_SIG)) != 0) {
/* It is not one of ours */
return 0;
}
@@ -1745,14 +1745,14 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
needed = 1;
break;
} else {
- flags = tvb_get_guint8(tvb, offset);
+ flags = tvb_get_uint8(tvb, offset);
offset++;
}
/* namespace id field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1762,7 +1762,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
if ((flags & JXTAMSG2_ELMFLAG_NAME_LITERAL) == 0) {
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1771,15 +1771,15 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
/* literal name field */
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
} else {
- guint16 name_len = tvb_get_ntohs(tvb, offset);
+ uint16_t name_len = tvb_get_ntohs(tvb, offset);
offset += 2;
available = tvb_reported_length_remaining(tvb, offset);
if (available < name_len) {
- needed = (gint) (name_len - available);
+ needed = (int) (name_len - available);
break;
}
@@ -1791,7 +1791,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
if ((flags & JXTAMSG2_ELMFLAG_TYPE) != 0) {
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1802,7 +1802,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
if ((flags & JXTAMSG2_ELMFLAG_ENCODINGS) != 0) {
available = tvb_reported_length_remaining(tvb, offset);
if (available < 2) {
- needed = (gint) (2 - available);
+ needed = (int) (2 - available);
break;
}
@@ -1813,37 +1813,37 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
/* content field */
if ((flags & JXTAMSG2_ELMFLAG_UINT64_LENS) != 0) {
available = tvb_reported_length_remaining(tvb, offset);
- if (available < sizeof(guint64)) {
- needed = (gint) (sizeof(guint64) - available);
+ if (available < sizeof(uint64_t)) {
+ needed = (int) (sizeof(uint64_t) - available);
break;
} else {
- guint64 content_len = tvb_get_ntoh64(tvb, offset);
- offset += (int)sizeof(guint64);
+ uint64_t content_len = tvb_get_ntoh64(tvb, offset);
+ offset += (int)sizeof(uint64_t);
available = tvb_reported_length_remaining(tvb, offset);
if (available < content_len) {
- needed = (gint) (content_len - available);
+ needed = (int) (content_len - available);
break;
}
- offset += (guint) content_len;
+ offset += (unsigned) content_len;
}
} else {
available = tvb_reported_length_remaining(tvb, offset);
if (available < 4) {
- needed = (gint) (4 - available);
+ needed = (int) (4 - available);
break;
} else {
- guint64 content_len = tvb_get_ntohl(tvb, offset);
+ uint64_t content_len = tvb_get_ntohl(tvb, offset);
offset += 4;
available = tvb_reported_length_remaining(tvb, offset);
if (available < content_len) {
- needed = (gint) (content_len - available);
+ needed = (int) (content_len - available);
break;
}
- offset += (guint) content_len;
+ offset += (unsigned) content_len;
}
}
@@ -1881,15 +1881,15 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
}
/* Second (optional) pass : build the proto tree */
- guint tree_offset = 0;
+ unsigned tree_offset = 0;
proto_item *jxta_elem_tree_item = proto_tree_add_item(tree, hf_jxta_element, tvb, tree_offset, -1, ENC_NA);
proto_tree *jxta_elem_tree = proto_item_add_subtree(jxta_elem_tree_item, ett_jxta_elem);
- guint16 namespaceID;
+ uint16_t namespaceID;
proto_item *namespace_ti;
- guint16 nameID;
+ uint16_t nameID;
proto_item *name_ti;
- guint64 content_len;
- const gchar *mediatype = NULL;
+ uint64_t content_len;
+ const char *mediatype = NULL;
tvbuff_t *element_content_tvb;
static int * const element_flags[] = {
&hf_jxta_element2_flag_64bitlens,
@@ -1904,7 +1904,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII);
tree_offset += (int)sizeof(JXTA_MSGELEM_SIG);
- flags = tvb_get_guint8(tvb, tree_offset);
+ flags = tvb_get_uint8(tvb, tree_offset);
proto_tree_add_bitmask(jxta_elem_tree, tvb, tree_offset, hf_jxta_element_flags, ett_jxta_elem_2_flags, element_flags, ENC_NA);
tree_offset += 1;
@@ -1932,7 +1932,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
tree_offset += 2;
} else {
/* literal name */
- guint16 name_len = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t name_len = tvb_get_ntohs(tvb, tree_offset);
proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(pinfo->pool, tvb, tree_offset + 2, name_len));
proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, 2, ENC_ASCII|ENC_BIG_ENDIAN);
tree_offset += 2 + name_len;
@@ -1940,7 +1940,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
/* process type */
if ((flags & JXTAMSG2_ELMFLAG_TYPE) != 0) {
- guint16 mimeID = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t mimeID = tvb_get_ntohs(tvb, tree_offset);
proto_item *mime_ti =
proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_mimeid, tvb, tree_offset, 2, mimeID);
@@ -1958,7 +1958,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
/* process encoding */
if ((flags & JXTAMSG2_ELMFLAG_ENCODINGS) != 0) {
- guint16 encodingID = tvb_get_ntohs(tvb, tree_offset);
+ uint16_t encodingID = tvb_get_ntohs(tvb, tree_offset);
proto_item *encoding_ti =
proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_encodingid, tvb, tree_offset, 2, encodingID);
@@ -1983,7 +1983,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
}
/* content */
- element_content_tvb = tvb_new_subset_length(tvb, tree_offset, (gint)content_len);
+ element_content_tvb = tvb_new_subset_length(tvb, tree_offset, (int)content_len);
tree_offset += dissect_media(mediatype, element_content_tvb, pinfo, jxta_elem_tree);
@@ -2023,12 +2023,12 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
* more bytes in order to process a PDU.
**/
// NOLINTNEXTLINE(misc-no-recursion)
-static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
+static int dissect_media( const char* fullmediatype, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
int dissected = 0;
if (fullmediatype) {
- gchar *mediatype = wmem_strdup(pinfo->pool, fullmediatype);
- gchar *parms_at = strchr(mediatype, ';');
+ char *mediatype = wmem_strdup(pinfo->pool, fullmediatype);
+ char *parms_at = strchr(mediatype, ';');
const char *save_match_string = pinfo->match_string;
media_content_info_t content_info = { MEDIA_CONTAINER_OTHER, NULL, NULL, NULL };
@@ -2050,7 +2050,7 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
dissected = call_dissector(tls_handle, tvb, pinfo, tree);
}
} else if (0 == strcmp("application/gzip", mediatype)) {
- tvbuff_t *uncomp_tvb = tvb_child_uncompress(tvb, tvb, 0, tvb_captured_length(tvb));
+ tvbuff_t *uncomp_tvb = tvb_child_uncompress_zlib(tvb, tvb, 0, tvb_captured_length(tvb));
if( NULL != uncomp_tvb ) {
add_new_data_source(pinfo, uncomp_tvb, "Uncompressed Element Content");
@@ -2267,7 +2267,7 @@ void proto_register_jxta(void)
"JXTA Message Element Flag -- nameLiteral", HFILL}
},
{&hf_jxta_element2_flag_hasType,
- {"hasEncoding", "jxta.message.element.flags.hasType", FT_BOOLEAN, 6, TFS(&tfs_set_notset), 0x04,
+ {"hasType", "jxta.message.element.flags.hasType", FT_BOOLEAN, 6, TFS(&tfs_set_notset), 0x04,
"JXTA Message Element Flag -- hasType", HFILL}
},
{&hf_jxta_element2_flag_hasSignature,
@@ -2329,7 +2329,7 @@ void proto_register_jxta(void)
/**
* JXTA Protocol subtree array
**/
- static gint *ett[] = {
+ static int *ett[] = {
&ett_jxta,
&ett_jxta_welcome,
&ett_jxta_udp,
@@ -2380,7 +2380,7 @@ void proto_register_jxta(void)
prefs_register_obsolete_preference(jxta_module, "tcp.heuristic");
prefs_register_obsolete_preference(jxta_module, "sctp.heuristic");
- register_conversation_table(proto_jxta, TRUE, jxta_conversation_packet, jxta_endpoint_packet);
+ register_conversation_table(proto_jxta, true, jxta_conversation_packet, jxta_endpoint_packet);
}
@@ -2389,10 +2389,10 @@ void proto_register_jxta(void)
**/
void proto_reg_handoff_jxta(void)
{
- static gboolean init_done = FALSE;
+ static bool init_done = false;
static dissector_handle_t message_jxta_handle;
- static gboolean msg_media_register_done = FALSE;
+ static bool msg_media_register_done = false;
if(!init_done) {
message_jxta_handle = create_dissector_handle(dissect_jxta_message, proto_message_jxta);
@@ -2406,20 +2406,20 @@ void proto_reg_handoff_jxta(void)
heur_dissector_add("tcp", dissect_jxta_TCP_heur, "JXTA over TCP", "jxta_tcp", proto_jxta, HEURISTIC_ENABLE);
heur_dissector_add("sctp", dissect_jxta_SCTP_heur, "JXTA over SCTP", "jxta_sctp", proto_jxta, HEURISTIC_ENABLE);
- init_done = TRUE;
+ init_done = true;
}
if( gMSG_MEDIA ) {
if( !msg_media_register_done ) {
/* ws_message( "Registering JXTA Message media type" ); */
dissector_add_string("media_type", "application/x-jxta-msg", message_jxta_handle);
- msg_media_register_done = TRUE;
+ msg_media_register_done = true;
}
} else {
if( msg_media_register_done ) {
/* ws_message( "Deregistering JXTA Message media type" ); */
dissector_delete_string("media_type", "application/x-jxta-msg", message_jxta_handle);
- msg_media_register_done = FALSE;
+ msg_media_register_done = false;
}
}
}