aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-arp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2012-04-23 17:50:02 +0000
committerBill Meier <wmeier@newsguy.com>2012-04-23 17:50:02 +0000
commit72bf183742d430f6fbcc5f3c3168a962f7611f7d (patch)
tree9c9f46fe19afbcac4e37f163114a00e9647ae52a /epan/dissectors/packet-arp.c
parent159901cd1596b29a113272e1765a9c400fa62ad6 (diff)
Do indentation cleanup (e.g., 4-space tabs => spaces)
Reformat a few long lines. svn path=/trunk/; revision=42213
Diffstat (limited to 'epan/dissectors/packet-arp.c')
-rw-r--r--epan/dissectors/packet-arp.c281
1 files changed, 144 insertions, 137 deletions
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c
index 39c3e60e91..052bb44671 100644
--- a/epan/dissectors/packet-arp.c
+++ b/epan/dissectors/packet-arp.c
@@ -115,8 +115,8 @@ typedef struct address_hash_value {
static GHashTable *duplicate_result_hash_table = NULL;
typedef struct duplicate_result_key {
- guint32 frame_number;
- guint32 ip_address;
+ guint32 frame_number;
+ guint32 ip_address;
} duplicate_result_key;
@@ -175,8 +175,8 @@ static const value_string atmop_vals[] = {
{ATMARPOP_NAK, "nak" },
{0, NULL } };
-#define ATMARP_IS_E164 0x40 /* bit in type/length for E.164 format */
-#define ATMARP_LEN_MASK 0x3F /* length of {sub}address in type/length */
+#define ATMARP_IS_E164 0x40 /* bit in type/length for E.164 format */
+#define ATMARP_LEN_MASK 0x3F /* length of {sub}address in type/length */
/*
* Given the hardware address type and length, check whether an address
@@ -220,7 +220,7 @@ arpproaddr_to_str(const guint8 *ad, int ad_len, guint16 type)
return bytes_to_str(ad, ad_len);
}
-#define MAX_E164_STR_LEN 20
+#define MAX_E164_STR_LEN 20
static const gchar *
atmarpnum_to_str(const guint8 *ad, int ad_tl)
@@ -323,24 +323,24 @@ arphrdtype_to_str(guint16 hwtype, const char *fmt) {
}
/* Offsets of fields within an ARP packet. */
-#define AR_HRD 0
-#define AR_PRO 2
-#define AR_HLN 4
-#define AR_PLN 5
-#define AR_OP 6
-#define MIN_ARP_HEADER_SIZE 8
+#define AR_HRD 0
+#define AR_PRO 2
+#define AR_HLN 4
+#define AR_PLN 5
+#define AR_OP 6
+#define MIN_ARP_HEADER_SIZE 8
/* Offsets of fields within an ATMARP packet. */
-#define ATM_AR_HRD 0
-#define ATM_AR_PRO 2
-#define ATM_AR_SHTL 4
-#define ATM_AR_SSTL 5
-#define ATM_AR_OP 6
-#define ATM_AR_SPLN 8
-#define ATM_AR_THTL 9
-#define ATM_AR_TSTL 10
-#define ATM_AR_TPLN 11
-#define MIN_ATMARP_HEADER_SIZE 12
+#define ATM_AR_HRD 0
+#define ATM_AR_PRO 2
+#define ATM_AR_SHTL 4
+#define ATM_AR_SSTL 5
+#define ATM_AR_OP 6
+#define ATM_AR_SPLN 8
+#define ATM_AR_THTL 9
+#define ATM_AR_TSTL 10
+#define ATM_AR_TPLN 11
+#define MIN_ATMARP_HEADER_SIZE 12
static void
dissect_atm_number(tvbuff_t *tvb, int offset, int tl, int hf_e164,
@@ -374,8 +374,8 @@ dissect_atm_nsap(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
afi = tvb_get_guint8(tvb, offset);
switch (afi) {
- case 0x39: /* DCC ATM format */
- case 0xBD: /* DCC ATM group format */
+ case 0x39: /* DCC ATM format */
+ case 0xBD: /* DCC ATM group format */
proto_tree_add_text(tree, tvb, offset + 0, 3,
"Data Country Code%s: 0x%04X",
(afi == 0xBD) ? " (group)" : "",
@@ -390,8 +390,8 @@ dissect_atm_nsap(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
"Selector: 0x%02X", tvb_get_guint8(tvb, offset + 19));
break;
- case 0x47: /* ICD ATM format */
- case 0xC5: /* ICD ATM group format */
+ case 0x47: /* ICD ATM format */
+ case 0xC5: /* ICD ATM group format */
proto_tree_add_text(tree, tvb, offset + 0, 3,
"International Code Designator%s: 0x%04X",
(afi == 0xC5) ? " (group)" : "",
@@ -406,8 +406,8 @@ dissect_atm_nsap(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
"Selector: 0x%02X", tvb_get_guint8(tvb, offset + 19));
break;
- case 0x45: /* E.164 ATM format */
- case 0xC3: /* E.164 ATM group format */
+ case 0x45: /* E.164 ATM format */
+ case 0xC3: /* E.164 ATM group format */
proto_tree_add_text(tree, tvb, offset + 0, 9,
"E.164 ISDN%s: %s",
(afi == 0xC3) ? " (group)" : "",
@@ -433,24 +433,28 @@ dissect_atm_nsap(tvbuff_t *tvb, int offset, int len, proto_tree *tree)
}
/* l.s. 32 bits are ipv4 address */
-static guint address_hash_func(gconstpointer v)
+static guint
+address_hash_func(gconstpointer v)
{
return GPOINTER_TO_UINT(v);
}
/* Compare 2 ipv4 addresses */
-static gint address_equal_func(gconstpointer v, gconstpointer v2)
+static gint
+address_equal_func(gconstpointer v, gconstpointer v2)
{
return v == v2;
}
-static guint duplicate_result_hash_func(gconstpointer v)
+static guint
+duplicate_result_hash_func(gconstpointer v)
{
duplicate_result_key *key = (duplicate_result_key*)v;
return (key->frame_number + key->ip_address);
}
-static gint duplicate_result_equal_func(gconstpointer v, gconstpointer v2)
+static gint
+duplicate_result_equal_func(gconstpointer v, gconstpointer v2)
{
duplicate_result_key *key1 = (duplicate_result_key*)v;
duplicate_result_key *key2 = (duplicate_result_key*)v2;
@@ -463,7 +467,8 @@ static gint duplicate_result_equal_func(gconstpointer v, gconstpointer v2)
/* Check to see if this mac & ip pair represent 2 devices trying to share
the same IP address - report if found (+ return TRUE and set out param) */
-static gboolean check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree,
+static gboolean
+check_for_duplicate_addresses(packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb,
const guint8 *mac, guint32 ip,
guint32 *duplicate_ip)
@@ -586,7 +591,8 @@ arp_init_protocol(void)
/* Take note that a request has been seen */
-static void request_seen(packet_info *pinfo)
+static void
+request_seen(packet_info *pinfo)
{
/* Don't count frame again after already recording first time around. */
if (p_get_proto_data(pinfo->fd, proto_arp) == 0)
@@ -596,7 +602,8 @@ static void request_seen(packet_info *pinfo)
}
/* Has storm request rate been exceeded with this request? */
-static void check_for_storm_count(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
+static void
+check_for_storm_count(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gboolean report_storm = FALSE;
@@ -764,18 +771,18 @@ dissect_atmarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case ARPOP_REPLY:
case ATMARPOP_NAK:
default:
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATMARP");
- break;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATMARP");
+ break;
case ARPOP_RREQUEST:
case ARPOP_RREPLY:
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATMRARP");
- break;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "ATMRARP");
+ break;
case ARPOP_IREQUEST:
case ARPOP_IREPLY:
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "Inverse ATMARP");
- break;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "Inverse ATMARP");
+ break;
}
switch (ar_op) {
@@ -1165,173 +1172,173 @@ proto_register_arp(void)
static hf_register_info hf[] = {
{ &hf_arp_hard_type,
- { "Hardware type", "arp.hw.type",
- FT_UINT16, BASE_DEC, VALS(hrd_vals), 0x0,
- NULL, HFILL }},
+ { "Hardware type", "arp.hw.type",
+ FT_UINT16, BASE_DEC, VALS(hrd_vals), 0x0,
+ NULL, HFILL }},
{ &hf_arp_proto_type,
- { "Protocol type", "arp.proto.type",
- FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
- NULL, HFILL }},
+ { "Protocol type", "arp.proto.type",
+ FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
+ NULL, HFILL }},
{ &hf_arp_hard_size,
- { "Hardware size", "arp.hw.size",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Hardware size", "arp.hw.size",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_sht,
- { "Sender ATM number type", "arp.src.htype",
- FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
- NULL, HFILL }},
+ { "Sender ATM number type", "arp.src.htype",
+ FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
+ NULL, HFILL }},
{ &hf_atmarp_shl,
- { "Sender ATM number length", "arp.src.hlen",
- FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
- NULL, HFILL }},
+ { "Sender ATM number length", "arp.src.hlen",
+ FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
+ NULL, HFILL }},
{ &hf_atmarp_sst,
- { "Sender ATM subaddress type", "arp.src.stype",
- FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
- NULL, HFILL }},
+ { "Sender ATM subaddress type", "arp.src.stype",
+ FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
+ NULL, HFILL }},
{ &hf_atmarp_ssl,
- { "Sender ATM subaddress length", "arp.src.slen",
- FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
- NULL, HFILL }},
+ { "Sender ATM subaddress length", "arp.src.slen",
+ FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
+ NULL, HFILL }},
{ &hf_arp_proto_size,
- { "Protocol size", "arp.proto.size",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Protocol size", "arp.proto.size",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_opcode,
- { "Opcode", "arp.opcode",
- FT_UINT16, BASE_DEC, VALS(op_vals), 0x0,
- NULL, HFILL }},
+ { "Opcode", "arp.opcode",
+ FT_UINT16, BASE_DEC, VALS(op_vals), 0x0,
+ NULL, HFILL }},
{ &hf_arp_isgratuitous,
- { "Is gratuitous", "arp.isgratuitous",
- FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0x0,
- NULL, HFILL }},
+ { "Is gratuitous", "arp.isgratuitous",
+ FT_BOOLEAN, BASE_NONE, TFS(&tfs_true_false), 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_spln,
- { "Sender protocol size", "arp.src.pln",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender protocol size", "arp.src.pln",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_tht,
- { "Target ATM number type", "arp.dst.htype",
- FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
- NULL, HFILL }},
+ { "Target ATM number type", "arp.dst.htype",
+ FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
+ NULL, HFILL }},
{ &hf_atmarp_thl,
- { "Target ATM number length", "arp.dst.hlen",
- FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
- NULL, HFILL }},
+ { "Target ATM number length", "arp.dst.hlen",
+ FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
+ NULL, HFILL }},
{ &hf_atmarp_tst,
- { "Target ATM subaddress type", "arp.dst.stype",
- FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
- NULL, HFILL }},
+ { "Target ATM subaddress type", "arp.dst.stype",
+ FT_BOOLEAN, 8, TFS(&tfs_type_bit), ATMARP_IS_E164,
+ NULL, HFILL }},
{ &hf_atmarp_tsl,
- { "Target ATM subaddress length", "arp.dst.slen",
- FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
- NULL, HFILL }},
+ { "Target ATM subaddress length", "arp.dst.slen",
+ FT_UINT8, BASE_DEC, NULL, ATMARP_LEN_MASK,
+ NULL, HFILL }},
{ &hf_atmarp_tpln,
- { "Target protocol size", "arp.dst.pln",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Target protocol size", "arp.dst.pln",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_src_hw,
- { "Sender hardware address", "arp.src.hw",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender hardware address", "arp.src.hw",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_src_hw_mac,
- { "Sender MAC address", "arp.src.hw_mac",
- FT_ETHER, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender MAC address", "arp.src.hw_mac",
+ FT_ETHER, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_src_atm_num_e164,
- { "Sender ATM number (E.164)", "arp.src.atm_num_e164",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender ATM number (E.164)", "arp.src.atm_num_e164",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_src_atm_num_nsap,
- { "Sender ATM number (NSAP)", "arp.src.atm_num_nsap",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender ATM number (NSAP)", "arp.src.atm_num_nsap",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_src_atm_subaddr,
- { "Sender ATM subaddress", "arp.src.atm_subaddr",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender ATM subaddress", "arp.src.atm_subaddr",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_src_proto,
- { "Sender protocol address", "arp.src.proto",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender protocol address", "arp.src.proto",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_src_proto_ipv4,
- { "Sender IP address", "arp.src.proto_ipv4",
- FT_IPv4, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender IP address", "arp.src.proto_ipv4",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_dst_hw,
- { "Target hardware address", "arp.dst.hw",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target hardware address", "arp.dst.hw",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_dst_hw_mac,
- { "Target MAC address", "arp.dst.hw_mac",
- FT_ETHER, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target MAC address", "arp.dst.hw_mac",
+ FT_ETHER, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_dst_atm_num_e164,
- { "Target ATM number (E.164)", "arp.dst.atm_num_e164",
- FT_STRING, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target ATM number (E.164)", "arp.dst.atm_num_e164",
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_dst_atm_num_nsap,
- { "Target ATM number (NSAP)", "arp.dst.atm_num_nsap",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target ATM number (NSAP)", "arp.dst.atm_num_nsap",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_atmarp_dst_atm_subaddr,
- { "Target ATM subaddress", "arp.dst.atm_subaddr",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target ATM subaddress", "arp.dst.atm_subaddr",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_arp_dst_proto,
- { "Target protocol address", "arp.dst.proto",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ { "Target protocol address", "arp.dst.proto",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_arp_dst_proto_ipv4,
- { "Target IP address", "arp.dst.proto_ipv4",
- FT_IPv4, BASE_NONE, NULL, 0x0,
+ { "Target IP address", "arp.dst.proto_ipv4",
+ FT_IPv4, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_arp_packet_storm,
- { "Packet storm detected", "arp.packet-storm-detected",
- FT_NONE, BASE_NONE, NULL, 0x0,
+ { "Packet storm detected", "arp.packet-storm-detected",
+ FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_arp_duplicate_ip_address,
- { "Duplicate IP address detected", "arp.duplicate-address-detected",
- FT_NONE, BASE_NONE, NULL, 0x0,
+ { "Duplicate IP address detected", "arp.duplicate-address-detected",
+ FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_arp_duplicate_ip_address_earlier_frame,
- { "Frame showing earlier use of IP address", "arp.duplicate-address-frame",
- FT_FRAMENUM, BASE_NONE, NULL, 0x0,
+ { "Frame showing earlier use of IP address", "arp.duplicate-address-frame",
+ FT_FRAMENUM, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_arp_duplicate_ip_address_seconds_since_earlier_frame,
- { "Seconds since earlier frame seen", "arp.seconds-since-duplicate-address-frame",
- FT_UINT32, BASE_DEC, NULL, 0x0,
+ { "Seconds since earlier frame seen", "arp.seconds-since-duplicate-address-frame",
+ FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }},
};
@@ -1346,7 +1353,7 @@ proto_register_arp(void)
module_t *arp_module;
proto_arp = proto_register_protocol("Address Resolution Protocol",
- "ARP/RARP", "arp");
+ "ARP/RARP", "arp");
proto_register_field_array(proto_arp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));