|
@@ -0,0 +1,49 @@
|
|
|
|
|
+/**
|
|
|
|
|
+ * @file arp_proto.h
|
|
|
|
|
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
|
|
|
|
|
+ *
|
|
|
|
|
+ * @section LICENSE
|
|
|
|
|
+ *
|
|
|
|
|
+ * This file is part of BadVPN.
|
|
|
|
|
+ *
|
|
|
|
|
+ * BadVPN is free software: you can redistribute it and/or modify
|
|
|
|
|
+ * it under the terms of the GNU General Public License version 2
|
|
|
|
|
+ * as published by the Free Software Foundation.
|
|
|
|
|
+ *
|
|
|
|
|
+ * BadVPN is distributed in the hope that it will be useful,
|
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
+ * GNU General Public License for more details.
|
|
|
|
|
+ *
|
|
|
|
|
+ * You should have received a copy of the GNU General Public License along
|
|
|
|
|
+ * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @section DESCRIPTION
|
|
|
|
|
+ *
|
|
|
|
|
+ * Definitions for the ARP protocol.
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+#ifndef BADVPN_ARP_PROTO_H
|
|
|
|
|
+#define BADVPN_ARP_PROTO_H
|
|
|
|
|
+
|
|
|
|
|
+#include <stdint.h>
|
|
|
|
|
+
|
|
|
|
|
+#define ARP_HARDWARE_TYPE_ETHERNET 1
|
|
|
|
|
+
|
|
|
|
|
+#define ARP_OPCODE_REQUEST 1
|
|
|
|
|
+#define ARP_OPCODE_REPLY 2
|
|
|
|
|
+
|
|
|
|
|
+struct arp_packet {
|
|
|
|
|
+ uint16_t hardware_type;
|
|
|
|
|
+ uint16_t protocol_type;
|
|
|
|
|
+ uint8_t hardware_size;
|
|
|
|
|
+ uint8_t protocol_size;
|
|
|
|
|
+ uint16_t opcode;
|
|
|
|
|
+ uint8_t sender_mac[6];
|
|
|
|
|
+ uint32_t sender_ip;
|
|
|
|
|
+ uint8_t target_mac[6];
|
|
|
|
|
+ uint32_t target_ip;
|
|
|
|
|
+} __attribute__((packed));
|
|
|
|
|
+
|
|
|
|
|
+#endif
|