summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-reload-framing.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/dissectors/packet-reload-framing.c')
-rw-r--r--epan/dissectors/packet-reload-framing.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c
index eac1744c..0d03784b 100644
--- a/epan/dissectors/packet-reload-framing.c
+++ b/epan/dissectors/packet-reload-framing.c
@@ -27,31 +27,31 @@ void proto_register_reload_framing(void);
void proto_reg_handoff_reload_framing(void);
/* Initialize the protocol and registered fields */
-static int proto_reload_framing = -1;
-
-static int hf_reload_framing_type = -1;
-static int hf_reload_framing_sequence = -1;
-static int hf_reload_framing_ack_sequence = -1;
-static int hf_reload_framing_message = -1;
-static int hf_reload_framing_message_length = -1;
-static int hf_reload_framing_message_data = -1;
-static int hf_reload_framing_received = -1;
-static int hf_reload_framing_parsed_received = -1;
-static int hf_reload_framing_duplicate = -1;
-static int hf_reload_framing_response_in = -1;
-static int hf_reload_framing_response_to = -1;
-static int hf_reload_framing_time = -1;
+static int proto_reload_framing;
+
+static int hf_reload_framing_type;
+static int hf_reload_framing_sequence;
+static int hf_reload_framing_ack_sequence;
+static int hf_reload_framing_message;
+static int hf_reload_framing_message_length;
+static int hf_reload_framing_message_data;
+static int hf_reload_framing_received;
+static int hf_reload_framing_parsed_received;
+static int hf_reload_framing_duplicate;
+static int hf_reload_framing_response_in;
+static int hf_reload_framing_response_to;
+static int hf_reload_framing_time;
static dissector_handle_t reload_handle;
static dissector_handle_t reload_framing_tcp_handle;
static dissector_handle_t reload_framing_udp_handle;
-static gint exported_pdu_tap = -1;
+static int exported_pdu_tap = -1;
/* Structure containing transaction specific information */
typedef struct _reload_frame_t {
- guint32 data_frame;
- guint32 ack_frame;
+ uint32_t data_frame;
+ uint32_t ack_frame;
nstime_t req_time;
} reload_frame_t;
@@ -67,11 +67,11 @@ typedef struct _reload_frame_conv_info_t {
/* Initialize the subtree pointers */
-static gint ett_reload_framing = -1;
-static gint ett_reload_framing_message = -1;
-static gint ett_reload_framing_received = -1;
+static int ett_reload_framing;
+static int ett_reload_framing_message;
+static int ett_reload_framing_received;
-static expert_field ei_reload_no_dissector = EI_INIT;
+static expert_field ei_reload_no_dissector;
#define UDP_PORT_RELOAD 6084
#define TCP_PORT_RELOAD 6084
@@ -87,15 +87,15 @@ static const value_string types[] = {
{0x00, NULL}
};
-static guint
+static unsigned
get_reload_framing_message_length(packet_info *pinfo _U_, tvbuff_t *tvb,
int offset, void *data _U_)
{
/* Get the type */
- guint32 length = 9;
+ uint32_t length = 9;
- if (tvb_get_guint8(tvb, offset) == DATA) {
+ if (tvb_get_uint8(tvb, offset) == DATA) {
length = 1 + 4 + 3 + tvb_get_ntoh24(tvb, 1 + 4);
}
@@ -104,21 +104,21 @@ get_reload_framing_message_length(packet_info *pinfo _U_, tvbuff_t *tvb,
static int
-dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean from_dtls)
+dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool from_dtls)
{
proto_item *ti;
proto_tree *reload_framing_tree;
- guint32 relo_token;
- guint32 message_length = 0;
+ uint32_t relo_token;
+ uint32_t message_length = 0;
wmem_tree_key_t transaction_id_key[4];
- guint32 *key_save, len_save;
- guint32 sequence;
- guint effective_length;
- guint16 offset;
+ uint32_t *key_save, len_save;
+ uint32_t sequence;
+ unsigned effective_length;
+ uint16_t offset;
conversation_t *conversation;
reload_conv_info_t *reload_framing_info = NULL;
reload_frame_t * reload_frame;
- guint8 type;
+ uint8_t type;
offset = 0;
effective_length = tvb_captured_length(tvb);
@@ -135,7 +135,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
* https://tools.ietf.org/html/draft-ietf-p2psip-base-12
* 5.6.2. Framing Header
*/
- type = tvb_get_guint8(tvb, 0);
+ type = tvb_get_uint8(tvb, 0);
switch(type) {
case DATA:
@@ -186,22 +186,22 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
transaction_id_key[0].key = &sequence; /* sequence number */
/* When the wmem_tree_* functions iterate through the keys, they
- * perform pointer arithmetic with guint32s, so we have to divide
+ * perform pointer arithmetic with uint32_t, so we have to divide
* our length fields by that to make things work, but we still want
* to g_malloc and memcpy the entire amounts, since those both operate
* in raw bytes. */
if (type==DATA) {
transaction_id_key[1].length = 1;
transaction_id_key[1].key = &pinfo->srcport;
- transaction_id_key[2].length = (pinfo->src.len) / (guint)sizeof(guint32);
- transaction_id_key[2].key = (guint32 *)g_malloc(pinfo->src.len);
+ transaction_id_key[2].length = (pinfo->src.len) / (unsigned)sizeof(uint32_t);
+ transaction_id_key[2].key = (uint32_t *)g_malloc(pinfo->src.len);
memcpy(transaction_id_key[2].key, pinfo->src.data, pinfo->src.len);
}
else {
transaction_id_key[1].length = 1;
transaction_id_key[1].key = &pinfo->destport;
- transaction_id_key[2].length = (pinfo->dst.len) / (guint)sizeof(guint32);
- transaction_id_key[2].key = (guint32 *)g_malloc(pinfo->dst.len);
+ transaction_id_key[2].length = (pinfo->dst.len) / (unsigned)sizeof(uint32_t);
+ transaction_id_key[2].key = (uint32_t *)g_malloc(pinfo->dst.len);
memcpy(transaction_id_key[2].key, pinfo->dst.data, pinfo->dst.len);
}
transaction_id_key[3].length=0;
@@ -276,7 +276,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
reload_framing_tree = proto_item_add_subtree(ti, ett_reload_framing);
- col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, types, "Unknown"));
+ col_set_str(pinfo->cinfo, COL_INFO, val_to_str_const(type, types, "Unknown"));
proto_item_append_text(ti, ": %s", val_to_str_const(type, types, "Unknown"));
/* Retransmission control */
@@ -352,7 +352,7 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
ti_received = proto_tree_add_item(reload_framing_tree, hf_reload_framing_received, tvb, offset , 4, ENC_BIG_ENDIAN);
{
- guint32 received;
+ uint32_t received;
int last_received = -1;
unsigned int indx = 0;
proto_tree *received_tree;
@@ -435,14 +435,14 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
static int
dissect_reload_framing(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- return dissect_reload_framing_message(tvb, pinfo, tree, FALSE);
+ return dissect_reload_framing_message(tvb, pinfo, tree, false);
}
static int
dissect_reload_framing_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
{
/* XXX: Check if we have a valid RELOAD Frame Type ? */
- tcp_dissect_pdus(tvb, pinfo, tree, TRUE, MIN_HDR_LENGTH,
+ tcp_dissect_pdus(tvb, pinfo, tree, true, MIN_HDR_LENGTH,
get_reload_framing_message_length, dissect_reload_framing, data);
return tvb_captured_length(tvb);
}
@@ -452,30 +452,30 @@ dissect_reload_framing_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* done for a TCP connection identified as reload-framing because of
* the TCP port used).
*/
-static gboolean
+static bool
dissect_reload_framing_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- if (dissect_reload_framing_message(tvb, pinfo, tree, FALSE) == 0) {
+ if (dissect_reload_framing_message(tvb, pinfo, tree, false) == 0) {
/*
* It wasn't a valid RELOAD message, and wasn't
* dissected as such.
*/
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-static gboolean
+static bool
dissect_reload_framing_heur_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
- if (dissect_reload_framing_message(tvb, pinfo, tree, TRUE) == 0) {
+ if (dissect_reload_framing_message(tvb, pinfo, tree, true) == 0) {
/*
* It wasn't a valid RELOAD message, and wasn't
* dissected as such.
*/
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void
@@ -546,7 +546,7 @@ proto_register_reload_framing(void)
};
/* Setup protocol subtree array */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_reload_framing,
&ett_reload_framing_message,
&ett_reload_framing_received,