46 lines
1001 B
C
46 lines
1001 B
C
//
|
|
// Created by epagris on 2022.12.08..
|
|
//
|
|
|
|
#ifndef ETHERLIB_TEST_ARP_PACKET_H
|
|
#define ETHERLIB_TEST_ARP_PACKET_H
|
|
|
|
#include <stdint.h>
|
|
#include "ipv4_types.h"
|
|
|
|
#include "../../packet_registry.h"
|
|
#include "../../packet_sieve.h"
|
|
|
|
#define ETH_ARP_PACKET_CLASS (0x0806)
|
|
|
|
/**
|
|
* Arp operations
|
|
*/
|
|
typedef enum {
|
|
ARPOP_REQ = 1, ///< ARP Request
|
|
ARPOP_REP = 2 ///< ARP Reply
|
|
} ArpOp;
|
|
|
|
typedef enum {
|
|
ARP_HWTYPE_ETHERNET = 1
|
|
} ArpHwType;
|
|
|
|
/**
|
|
* ARP properties.
|
|
*/
|
|
typedef struct {
|
|
uint16_t HTYPE; ///< Hardware type (Ethernet: 1)
|
|
uint16_t PTYPE; ///< Protocol type (IP: 0x0800)
|
|
uint8_t HLEN; ///< Hardware address length
|
|
uint8_t PLEN; ///< Protocol address length
|
|
uint16_t OPER; ///< Operation
|
|
uint8_t SHA[6]; ///< Array of addresses (SHA, SPA, THA, TPA)
|
|
ip4_addr SPA;
|
|
uint8_t THA[6];
|
|
ip4_addr TPA;
|
|
} ArpProps;
|
|
|
|
int parse_arp(const uint8_t *hdr, uint32_t size, PcktHeaderElement *pcktHdrLe, struct EthInterface_ *intf);
|
|
|
|
#endif //ETHERLIB_TEST_ARP_PACKET_H
|