summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-roofnet.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--epan/dissectors/packet-roofnet.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/epan/dissectors/packet-roofnet.c b/epan/dissectors/packet-roofnet.c
index 9630969f..75a4a187 100644
--- a/epan/dissectors/packet-roofnet.c
+++ b/epan/dissectors/packet-roofnet.c
@@ -64,30 +64,30 @@ void proto_reg_handoff_roofnet(void);
static dissector_handle_t roofnet_handle;
static dissector_handle_t ip_handle;
static dissector_handle_t eth_withoutfcs_handle;
-static int proto_roofnet = -1;
+static int proto_roofnet;
/* hf fields for the header of roofnet */
-static int hf_roofnet_version = -1;
-static int hf_roofnet_type = -1;
-static int hf_roofnet_nlinks = -1;
-static int hf_roofnet_next = -1;
-static int hf_roofnet_ttl = -1;
-static int hf_roofnet_cksum = -1;
-static int hf_roofnet_flags = -1;
-static int hf_roofnet_flags_error = -1;
-static int hf_roofnet_flags_update = -1;
-static int hf_roofnet_flags_layer2 = -1;
-static int hf_roofnet_flags_reserved = -1;
-static int hf_roofnet_data_length = -1;
-static int hf_roofnet_query_dst = -1;
-static int hf_roofnet_seq = -1;
-/* static int hf_roofnet_links = -1; */
-static int hf_roofnet_link_src = -1;
-static int hf_roofnet_link_forward = -1;
-static int hf_roofnet_link_rev = -1;
-static int hf_roofnet_link_seq = -1;
-static int hf_roofnet_link_age = -1;
-static int hf_roofnet_link_dst = -1;
+static int hf_roofnet_version;
+static int hf_roofnet_type;
+static int hf_roofnet_nlinks;
+static int hf_roofnet_next;
+static int hf_roofnet_ttl;
+static int hf_roofnet_cksum;
+static int hf_roofnet_flags;
+static int hf_roofnet_flags_error;
+static int hf_roofnet_flags_update;
+static int hf_roofnet_flags_layer2;
+static int hf_roofnet_flags_reserved;
+static int hf_roofnet_data_length;
+static int hf_roofnet_query_dst;
+static int hf_roofnet_seq;
+/* static int hf_roofnet_links; */
+static int hf_roofnet_link_src;
+static int hf_roofnet_link_forward;
+static int hf_roofnet_link_rev;
+static int hf_roofnet_link_seq;
+static int hf_roofnet_link_age;
+static int hf_roofnet_link_dst;
static int * const flag_list[] = {
&hf_roofnet_flags_error,
@@ -98,20 +98,20 @@ static int * const flag_list[] = {
};
-static gint ett_roofnet = -1;
-static gint ett_roofnet_flags = -1;
-static gint ett_roofnet_link = -1;
+static int ett_roofnet;
+static int ett_roofnet_flags;
+static int ett_roofnet_link;
-static expert_field ei_roofnet_too_many_links = EI_INIT;
-static expert_field ei_roofnet_too_much_data = EI_INIT;
+static expert_field ei_roofnet_too_many_links;
+static expert_field ei_roofnet_too_much_data;
/*
* dissect the header of roofnet
*/
-static guint16 dissect_roofnet_header(proto_tree *tree, tvbuff_t *tvb, guint *offset)
+static uint16_t dissect_roofnet_header(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, unsigned *offset)
{
- guint16 flags;
- ptvcursor_t *cursor = ptvcursor_new(wmem_packet_scope(), tree, tvb, *offset);
+ uint16_t flags;
+ ptvcursor_t *cursor = ptvcursor_new(pinfo->pool, tree, tvb, *offset);
ptvcursor_add(cursor, hf_roofnet_version, 1, ENC_BIG_ENDIAN);
ptvcursor_add(cursor, hf_roofnet_type, 1, ENC_BIG_ENDIAN);
@@ -138,14 +138,14 @@ static guint16 dissect_roofnet_header(proto_tree *tree, tvbuff_t *tvb, guint *of
/*
* dissect the description of link in roofnet
*/
-static void dissect_roofnet_link(proto_tree *tree, tvbuff_t *tvb, guint *offset, guint link)
+static void dissect_roofnet_link(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, unsigned *offset, unsigned link)
{
proto_tree *subtree = NULL;
ptvcursor_t *cursor = NULL;
- guint32 addr_src = 0;
- guint32 addr_dst = 0;
+ uint32_t addr_src = 0;
+ uint32_t addr_dst = 0;
addr_src = tvb_get_ipv4(tvb, *offset + ROOFNET_LINK_OFFSET_SRC);
addr_dst = tvb_get_ipv4(tvb, *offset + ROOFNET_LINK_OFFSET_DST);
@@ -159,7 +159,7 @@ static void dissect_roofnet_link(proto_tree *tree, tvbuff_t *tvb, guint *offset,
proto_tree_add_ipv4(subtree, hf_roofnet_link_src, tvb, *offset, 4, addr_src);
*offset += 4;
- cursor = ptvcursor_new(wmem_packet_scope(), subtree, tvb, *offset);
+ cursor = ptvcursor_new(pinfo->pool, subtree, tvb, *offset);
ptvcursor_add(cursor, hf_roofnet_link_forward, 4, ENC_BIG_ENDIAN);
ptvcursor_add(cursor, hf_roofnet_link_rev, 4, ENC_BIG_ENDIAN);
@@ -176,10 +176,10 @@ static void dissect_roofnet_link(proto_tree *tree, tvbuff_t *tvb, guint *offset,
/*
* dissect the data in roofnet
*/
-static void dissect_roofnet_data(proto_tree *tree, tvbuff_t *tvb, packet_info * pinfo, gint offset, guint16 flags)
+static void dissect_roofnet_data(proto_tree *tree, tvbuff_t *tvb, packet_info * pinfo, int offset, uint16_t flags)
{
- guint16 roofnet_datalen = 0;
- guint16 remaining_datalen = 0;
+ uint16_t roofnet_datalen = 0;
+ uint16_t remaining_datalen = 0;
roofnet_datalen = tvb_get_ntohs(tvb, ROOFNET_OFFSET_DATA_LENGTH);
remaining_datalen = tvb_reported_length_remaining(tvb, offset);
@@ -211,16 +211,16 @@ static int dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
proto_item * it;
proto_tree * roofnet_tree;
- guint offset = 0;
+ unsigned offset = 0;
- guint8 roofnet_msg_type = 0;
- guint8 roofnet_nlinks = 0;
- guint8 nlink = 1;
- guint16 flags;
+ uint8_t roofnet_msg_type = 0;
+ uint8_t roofnet_nlinks = 0;
+ uint8_t nlink = 1;
+ uint16_t flags;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Roofnet");
- roofnet_msg_type = tvb_get_guint8(tvb, ROOFNET_OFFSET_TYPE);
+ roofnet_msg_type = tvb_get_uint8(tvb, ROOFNET_OFFSET_TYPE);
/* Clear out stuff in the info column */
col_add_fstr(pinfo->cinfo, COL_INFO, "Message Type: %s",
val_to_str(roofnet_msg_type, roofnet_pt_vals, "Unknown (%d)"));
@@ -228,9 +228,9 @@ static int dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
it = proto_tree_add_item(tree, proto_roofnet, tvb, offset, -1, ENC_NA);
roofnet_tree = proto_item_add_subtree(it, ett_roofnet);
- flags = dissect_roofnet_header(roofnet_tree, tvb, &offset);
+ flags = dissect_roofnet_header(roofnet_tree, pinfo, tvb, &offset);
- roofnet_nlinks = tvb_get_guint8(tvb, ROOFNET_OFFSET_NLINKS);
+ roofnet_nlinks = tvb_get_uint8(tvb, ROOFNET_OFFSET_NLINKS);
/* Check that we do not have a malformed roofnet packet */
if ((roofnet_nlinks*6*4)+ROOFNET_HEADER_LENGTH > ROOFNET_MAX_LENGTH) {
expert_add_info_format(pinfo, it, &ei_roofnet_too_many_links, "Too many links (%u)", roofnet_nlinks);
@@ -241,7 +241,7 @@ static int dissect_roofnet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Do we have enough buffer to decode the next link ? */
if (tvb_reported_length_remaining(tvb, offset) < ROOFNET_LINK_DESCRIPTION_LENGTH)
return offset;
- dissect_roofnet_link(roofnet_tree, tvb, &offset, nlink++);
+ dissect_roofnet_link(roofnet_tree, pinfo, tvb, &offset, nlink++);
}
dissect_roofnet_data(tree, tvb, pinfo, offset+4, flags);
@@ -361,7 +361,7 @@ void proto_register_roofnet(void)
};
/* setup protocol subtree array */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_roofnet,
&ett_roofnet_flags,
&ett_roofnet_link