32 lines
733 B
C
32 lines
733 B
C
#ifndef ETHERLIB_UDP_PACKET_H
|
|
#define ETHERLIB_UDP_PACKET_H
|
|
|
|
#include <stdint.h>
|
|
#include "etherlib/packet_registry.h"
|
|
|
|
#define ETH_UDP_PACKET_CLASS (17)
|
|
|
|
/**
|
|
* @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;
|
|
|
|
/**
|
|
* Parse raw UDP packets.
|
|
* @param hdr pointer to the UDP packet header
|
|
* @param size total packet size
|
|
* @param props pointer to property storage
|
|
* @return 0 on success or -1 on failure
|
|
*/
|
|
int parse_udp(const uint8_t *hdr, uint32_t size, PcktProps * props);
|
|
|
|
#endif //ETHERLIB_UDP_PACKET_H
|