aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-aarp.c
diff options
context:
space:
mode:
authorBill Meier <wmeier@newsguy.com>2014-10-05 15:57:05 -0400
committerBill Meier <wmeier@newsguy.com>2014-10-05 20:19:02 +0000
commit0b18d6cb77022494a875e6e0d9d2ad27fb6ac6d9 (patch)
tree8cb06839ae3a921f3238c5979da986e4c0358638 /epan/dissectors/packet-aarp.c
parente2bdfa101b4a60318c9d7ba3dc3487418b5951b6 (diff)
Add editor modelines; Adjust whitespace as needed.
Change-Id: I6e70c933ae61a97377235d67b2f6a1b3d67dc155 Reviewed-on: https://code.wireshark.org/review/4484 Reviewed-by: Bill Meier <wmeier@newsguy.com>
Diffstat (limited to 'epan/dissectors/packet-aarp.c')
-rw-r--r--epan/dissectors/packet-aarp.c165
1 files changed, 89 insertions, 76 deletions
diff --git a/epan/dissectors/packet-aarp.c b/epan/dissectors/packet-aarp.c
index dd4d298a62..2c7613127a 100644
--- a/epan/dissectors/packet-aarp.c
+++ b/epan/dissectors/packet-aarp.c
@@ -52,13 +52,13 @@ static int hf_aarp_dst_proto_id = -1;
static gint ett_aarp = -1;
#ifndef AARP_REQUEST
-#define AARP_REQUEST 0x0001
+#define AARP_REQUEST 0x0001
#endif
#ifndef AARP_REPLY
-#define AARP_REPLY 0x0002
+#define AARP_REPLY 0x0002
#endif
#ifndef AARP_PROBE
-#define AARP_PROBE 0x0003
+#define AARP_PROBE 0x0003
#endif
/* The following is screwed up shit to deal with the fact that
@@ -77,8 +77,8 @@ static const value_string op_vals[] = {
{0, NULL } };
/* AARP protocol HARDWARE identifiers. */
-#define AARPHRD_ETHER 1 /* Ethernet 10Mbps */
-#define AARPHRD_TR 2 /* Token Ring */
+#define AARPHRD_ETHER 1 /* Ethernet 10Mbps */
+#define AARPHRD_TR 2 /* Token Ring */
static const value_string hrd_vals[] = {
{AARPHRD_ETHER, "Ethernet" },
@@ -91,8 +91,8 @@ static const value_string hrd_vals[] = {
* "Token Ring", and the length must be 6 bytes.
*/
#define AARP_HW_IS_ETHER(ar_hrd, ar_hln) \
- (((ar_hrd) == AARPHRD_ETHER || (ar_hrd) == AARPHRD_TR) \
- && (ar_hln) == 6)
+ (((ar_hrd) == AARPHRD_ETHER || (ar_hrd) == AARPHRD_TR) \
+ && (ar_hln) == 6)
/*
* Given the protocol address type and length, check whether an address
@@ -100,7 +100,7 @@ static const value_string hrd_vals[] = {
* and the length must be 4 bytes.
*/
#define AARP_PRO_IS_ATALK(ar_pro, ar_pln) \
- ((ar_pro) == ETHERTYPE_ATALK && (ar_pln) == 4)
+ ((ar_pro) == ETHERTYPE_ATALK && (ar_pln) == 4)
static gchar *
tvb_atalkid_to_str(tvbuff_t *tvb, gint offset)
@@ -136,12 +136,12 @@ tvb_aarpproaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type)
}
/* Offsets of fields within an AARP packet. */
-#define AR_HRD 0
-#define AR_PRO 2
-#define AR_HLN 4
-#define AR_PLN 5
-#define AR_OP 6
-#define MIN_AARP_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_AARP_HEADER_SIZE 8
static void
dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
@@ -201,57 +201,57 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (tree) {
if ((op_str = try_val_to_str(ar_op, op_vals)))
ti = proto_tree_add_protocol_format(tree, proto_aarp, tvb, 0,
- MIN_AARP_HEADER_SIZE + 2*ar_hln +
- 2*ar_pln, "AppleTalk Address Resolution Protocol (%s)", op_str);
+ MIN_AARP_HEADER_SIZE + 2*ar_hln +
+ 2*ar_pln, "AppleTalk Address Resolution Protocol (%s)", op_str);
else
ti = proto_tree_add_protocol_format(tree, proto_aarp, tvb, 0,
- MIN_AARP_HEADER_SIZE + 2*ar_hln +
- 2*ar_pln,
- "AppleTalk Address Resolution Protocol (opcode 0x%04x)", ar_op);
+ MIN_AARP_HEADER_SIZE + 2*ar_hln +
+ 2*ar_pln,
+ "AppleTalk Address Resolution Protocol (opcode 0x%04x)", ar_op);
aarp_tree = proto_item_add_subtree(ti, ett_aarp);
proto_tree_add_uint(aarp_tree, hf_aarp_hard_type, tvb, AR_HRD, 2,
- ar_hrd);
+ ar_hrd);
proto_tree_add_uint(aarp_tree, hf_aarp_proto_type, tvb, AR_PRO, 2,
- ar_pro);
+ ar_pro);
proto_tree_add_uint(aarp_tree, hf_aarp_hard_size, tvb, AR_HLN, 1,
- ar_hln);
+ ar_hln);
proto_tree_add_uint(aarp_tree, hf_aarp_proto_size, tvb, AR_PLN, 1,
- ar_pln);
+ ar_pln);
proto_tree_add_uint(aarp_tree, hf_aarp_opcode, tvb, AR_OP, 2,
- ar_op);
+ ar_op);
if (ar_hln != 0) {
proto_tree_add_item(aarp_tree,
- AARP_HW_IS_ETHER(ar_hrd, ar_hln) ? hf_aarp_src_hw_mac : hf_aarp_src_hw,
- tvb, sha_offset, ar_hln, ENC_NA);
+ AARP_HW_IS_ETHER(ar_hrd, ar_hln) ? hf_aarp_src_hw_mac : hf_aarp_src_hw,
+ tvb, sha_offset, ar_hln, ENC_NA);
}
if (ar_pln != 0) {
if (AARP_PRO_IS_ATALK(ar_pro, ar_pln)) {
proto_tree_add_bytes_format_value(aarp_tree, hf_aarp_src_proto_id, tvb,
- spa_offset, ar_pln, NULL,
- "%s", spa_str);
+ spa_offset, ar_pln, NULL,
+ "%s", spa_str);
} else {
proto_tree_add_bytes_format_value(aarp_tree, hf_aarp_src_proto, tvb,
- spa_offset, ar_pln, NULL,
- "%s", spa_str);
+ spa_offset, ar_pln, NULL,
+ "%s", spa_str);
}
}
if (ar_hln != 0) {
proto_tree_add_item(aarp_tree,
- AARP_HW_IS_ETHER(ar_hrd, ar_hln) ? hf_aarp_dst_hw_mac : hf_aarp_dst_hw,
- tvb, tha_offset, ar_hln, ENC_NA);
+ AARP_HW_IS_ETHER(ar_hrd, ar_hln) ? hf_aarp_dst_hw_mac : hf_aarp_dst_hw,
+ tvb, tha_offset, ar_hln, ENC_NA);
}
if (ar_pln != 0) {
if (AARP_PRO_IS_ATALK(ar_pro, ar_pln)) {
proto_tree_add_bytes_format_value(aarp_tree, hf_aarp_dst_proto_id, tvb,
- tpa_offset, ar_pln,
- NULL, "%s", tpa_str);
+ tpa_offset, ar_pln,
+ NULL, "%s", tpa_str);
} else {
proto_tree_add_bytes_format_value(aarp_tree, hf_aarp_dst_proto, tvb,
- tpa_offset, ar_pln,
- NULL, "%s", tpa_str);
+ tpa_offset, ar_pln,
+ NULL, "%s", tpa_str);
}
}
}
@@ -262,77 +262,77 @@ proto_register_aarp(void)
{
static hf_register_info hf[] = {
{ &hf_aarp_hard_type,
- { "Hardware type", "aarp.hard.type",
- FT_UINT16, BASE_HEX, VALS(hrd_vals), 0x0,
- NULL, HFILL }},
+ { "Hardware type", "aarp.hard.type",
+ FT_UINT16, BASE_HEX, VALS(hrd_vals), 0x0,
+ NULL, HFILL }},
{ &hf_aarp_proto_type,
- { "Protocol type", "aarp.proto.type",
- FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
- NULL, HFILL }},
+ { "Protocol type", "aarp.proto.type",
+ FT_UINT16, BASE_HEX, VALS(etype_vals), 0x0,
+ NULL, HFILL }},
{ &hf_aarp_hard_size,
- { "Hardware size", "aarp.hard.size",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Hardware size", "aarp.hard.size",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_proto_size,
- { "Protocol size", "aarp.proto.size",
- FT_UINT8, BASE_DEC, NULL, 0x0,
- NULL, HFILL }},
+ { "Protocol size", "aarp.proto.size",
+ FT_UINT8, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_opcode,
- { "Opcode", "aarp.opcode",
- FT_UINT16, BASE_DEC, VALS(op_vals), 0x0,
- NULL, HFILL }},
+ { "Opcode", "aarp.opcode",
+ FT_UINT16, BASE_DEC, VALS(op_vals), 0x0,
+ NULL, HFILL }},
{ &hf_aarp_src_hw,
- { "Sender hardware address", "aarp.src.hw",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender hardware address", "aarp.src.hw",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_src_hw_mac,
- { "Sender MAC address", "aarp.src.hw_mac",
- FT_ETHER, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender MAC address", "aarp.src.hw_mac",
+ FT_ETHER, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_src_proto,
- { "Sender protocol address", "aarp.src.proto",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender protocol address", "aarp.src.proto",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_src_proto_id,
- { "Sender ID", "aarp.src.proto_id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Sender ID", "aarp.src.proto_id",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_dst_hw,
- { "Target hardware address", "aarp.dst.hw",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target hardware address", "aarp.dst.hw",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_dst_hw_mac,
- { "Target MAC address", "aarp.dst.hw_mac",
- FT_ETHER, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target MAC address", "aarp.dst.hw_mac",
+ FT_ETHER, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_aarp_dst_proto,
- { "Target protocol address", "aarp.dst.proto",
- FT_BYTES, BASE_NONE, NULL, 0x0,
+ { "Target protocol address", "aarp.dst.proto",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }},
{ &hf_aarp_dst_proto_id,
- { "Target ID", "aarp.dst.proto_id",
- FT_BYTES, BASE_NONE, NULL, 0x0,
- NULL, HFILL }},
+ { "Target ID", "aarp.dst.proto_id",
+ FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
};
static gint *ett[] = {
&ett_aarp,
};
proto_aarp = proto_register_protocol("Appletalk Address Resolution Protocol",
- "AARP",
- "aarp");
+ "AARP",
+ "aarp");
proto_register_field_array(proto_aarp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
@@ -346,3 +346,16 @@ proto_reg_handoff_aarp(void)
dissector_add_uint("ethertype", ETHERTYPE_AARP, aarp_handle);
dissector_add_uint("chdlc.protocol", ETHERTYPE_AARP, aarp_handle);
}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local Variables:
+ * c-basic-offset: 2
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * ex: set shiftwidth=2 tabstop=8 expandtab:
+ * :indentSize=2:tabSize=8:noTabs=true:
+ */