// // Created by epagris on 2022.12.08.. // #include "arp_packet.h" int parse_arp_packet(const uint8_t *hdr, uint32_t size, PcktProps * props) { EthernetProps * frameProps = (EthernetProps *)props; FETCH_ADVANCE(frameProps->destAddr, hdr, ETH_HW_ADDR_LEN); // copy destination address FETCH_ADVANCE(frameProps->sourceAddr, hdr, ETH_HW_ADDR_LEN); // copy destination address FETCH_WORD_H2N_ADVANCE(&frameProps->length_type, hdr); // copy length/type field // fill-in packet property header fields frameProps->validityOK = true; frameProps->containedPacketClass = frameProps->length_type <= ETH_ETHERTYPE_LENGTH_THRESHOLD ? 0 : frameProps->length_type; frameProps->headerSize = ETH_ETHERNET_HEADER_SIZE; return frameProps->containedPacketClass; }