#ifndef ETHERLIB_UDP_PACKET_H #define ETHERLIB_UDP_PACKET_H #include #include "../../packet_registry.h" #include "../../packet_sieve.h" #define ETH_UDP_PACKET_CLASS (17) #define ETH_UDP_HEADER_SIZE (8) /** * @struct UdpProps * UDP packet properties. */ typedef struct { PcktPropsHeader uint16_t SourcePort; ///> source port uint16_t DestinationPort; ///> destination port uint16_t Length; ///> packet size uint16_t Checksum; ///> UDP checksum } UdpProps; struct EthInterface_; /** * Parse raw UDP packets. * @param hdr pointer to the UDP packet header * @param size total packet size * @param pcktHdrLe pointer to property storage * @return 0 on success or -1 on failure */ int parse_udp(const uint8_t *hdr, uint32_t size, PcktHeaderElement *pcktHdrLe, struct EthInterface_ *intf, PcktProcFnPassbackData *pb); /** * Insert UDP header. * @param hdr space where the header is to be inserted * @param headers linked list of header, top is always relevant */ void insert_udp_header(uint8_t * hdr, const PcktHeaderElement * headers); #endif //ETHERLIB_UDP_PACKET_H