diff options
Diffstat (limited to 'epan/dissectors/packet-aarp.c')
-rw-r--r-- | epan/dissectors/packet-aarp.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/epan/dissectors/packet-aarp.c b/epan/dissectors/packet-aarp.c index 0206ba5e3e..0f593beba0 100644 --- a/epan/dissectors/packet-aarp.c +++ b/epan/dissectors/packet-aarp.c @@ -21,24 +21,24 @@ void proto_register_aarp(void); void proto_reg_handoff_aarp(void); -static int proto_aarp = -1; -static int hf_aarp_hard_type = -1; -static int hf_aarp_proto_type = -1; -static int hf_aarp_hard_size = -1; -static int hf_aarp_proto_size = -1; -static int hf_aarp_opcode = -1; -static int hf_aarp_src_hw = -1; -static int hf_aarp_src_hw_mac = -1; -static int hf_aarp_src_proto = -1; -static int hf_aarp_src_proto_id = -1; -static int hf_aarp_dst_hw = -1; -static int hf_aarp_dst_hw_mac = -1; -static int hf_aarp_dst_proto = -1; -static int hf_aarp_dst_proto_id = -1; - -static gint ett_aarp = -1; - -static expert_field ei_aarp_length_invalid = EI_INIT; +static int proto_aarp; +static int hf_aarp_hard_type; +static int hf_aarp_proto_type; +static int hf_aarp_hard_size; +static int hf_aarp_proto_size; +static int hf_aarp_opcode; +static int hf_aarp_src_hw; +static int hf_aarp_src_hw_mac; +static int hf_aarp_src_proto; +static int hf_aarp_src_proto_id; +static int hf_aarp_dst_hw; +static int hf_aarp_dst_hw_mac; +static int hf_aarp_dst_proto; +static int hf_aarp_dst_proto_id; + +static gint ett_aarp; + +static expert_field ei_aarp_length_invalid; #ifndef AARP_REQUEST #define AARP_REQUEST 0x0001 @@ -92,36 +92,36 @@ static const value_string hrd_vals[] = { ((ar_pro) == ETHERTYPE_ATALK && (ar_pln) == 4) static gchar * -tvb_atalkid_to_str(tvbuff_t *tvb, gint offset) +tvb_atalkid_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset) { gint node; gchar *cur; - cur=(gchar *)wmem_alloc(wmem_packet_scope(), 16); + cur=(gchar *)wmem_alloc(scope, 16); node=tvb_get_guint8(tvb, offset+1)<<8|tvb_get_guint8(tvb, offset+2); - g_snprintf(cur, 16, "%d.%d",node,tvb_get_guint8(tvb, offset+3)); + snprintf(cur, 16, "%d.%d",node,tvb_get_guint8(tvb, offset+3)); return cur; } static const gchar * -tvb_aarphrdaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) +tvb_aarphrdaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { if (AARP_HW_IS_ETHER(type, ad_len)) { /* Ethernet address (or Token Ring address, which is the same type of address). */ - return tvb_ether_to_str(wmem_packet_scope(), tvb, offset); + return tvb_ether_to_str(scope, tvb, offset); } - return tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, ad_len); + return tvb_bytes_to_str(scope, tvb, offset, ad_len); } static gchar * -tvb_aarpproaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) +tvb_aarpproaddr_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { if (AARP_PRO_IS_ATALK(type, ad_len)) { /* Appletalk address. */ - return tvb_atalkid_to_str(tvb, offset); + return tvb_atalkid_to_str(scope, tvb, offset); } - return tvb_bytes_to_str(wmem_packet_scope(), tvb, offset, ad_len); + return tvb_bytes_to_str(scope, tvb, offset, ad_len); } /* Offsets of fields within an AARP packet. */ @@ -170,10 +170,10 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ tha_str = "Unknown"; #endif } else { - sha_str = tvb_aarphrdaddr_to_str(tvb, sha_offset, ar_hln, ar_hrd); + sha_str = tvb_aarphrdaddr_to_str(pinfo->pool, tvb, sha_offset, ar_hln, ar_hrd); #if 0 /* TODO: tha_str is currently not shown nor parsed */ - tha_str = tvb_aarphrdaddr_to_str(tvb, tha_offset, ar_hln, ar_hrd); + tha_str = tvb_aarphrdaddr_to_str(pinfo->pool, tvb, tha_offset, ar_hln, ar_hrd); #endif } @@ -183,8 +183,8 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ spa_str = "Unknown"; tpa_str = "Unknown"; } else { - spa_str = tvb_aarpproaddr_to_str(tvb, spa_offset, ar_pln, ar_pro); - tpa_str = tvb_aarpproaddr_to_str(tvb, tpa_offset, ar_pln, ar_pro); + spa_str = tvb_aarpproaddr_to_str(pinfo->pool, tvb, spa_offset, ar_pln, ar_pro); + tpa_str = tvb_aarpproaddr_to_str(pinfo->pool, tvb, tpa_offset, ar_pln, ar_pro); } switch (ar_op) { @@ -345,6 +345,7 @@ proto_register_aarp(void) proto_aarp = proto_register_protocol("Appletalk Address Resolution Protocol", "AARP", "aarp"); + register_dissector("aarp", dissect_aarp, proto_aarp); proto_register_field_array(proto_aarp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -356,9 +357,8 @@ proto_register_aarp(void) void proto_reg_handoff_aarp(void) { - dissector_handle_t aarp_handle; + dissector_handle_t aarp_handle = find_dissector("aarp"); - aarp_handle = create_dissector_handle(dissect_aarp, proto_aarp); dissector_add_uint("ethertype", ETHERTYPE_AARP, aarp_handle); dissector_add_uint("chdlc.protocol", ETHERTYPE_AARP, aarp_handle); } |