- Timestamping management added - Errors due to reading uninitialized data in ARP fixed - EthInterface reworked, incoming packet notification and payload readout separated (through which fixing concurrent access problems) - RX and TX offloads added - Capability to add a packet sieve layer without prior registration of specific packet class added (this makes it possible to register arbitrary EtherType connection blocks, for example)
44 lines
1.3 KiB
C
44 lines
1.3 KiB
C
#ifndef ETHERLIB_PACKET_H
|
|
#define ETHERLIB_PACKET_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/**
|
|
* \struct RawPckt
|
|
* \brief Raw packet received on wire
|
|
*/
|
|
typedef struct {
|
|
uint8_t * payload; ///> Pointer to raw packet payload.
|
|
uint32_t size; ///> Raw packet size.
|
|
union {
|
|
struct {
|
|
uint32_t time_s; ///> Timestamp seconds field
|
|
uint32_t time_ns; ///> Timestamp nanoseconds field
|
|
} rx;
|
|
struct {
|
|
void(*txTsCb)(uint32_t ts_s, uint32_t ts_ns, uint32_t tag); ///> Transmit timestamp callback pointer
|
|
uint32_t arg; ///> User-defined argument
|
|
} tx;
|
|
} ext; ///> Extensions
|
|
} RawPckt;
|
|
|
|
struct PcktHeaderElement_;
|
|
|
|
/**
|
|
* @struct Pckt
|
|
* @brief Generic packet
|
|
*
|
|
* Fields have been reordered so that fields are aligned.
|
|
*/
|
|
typedef struct {
|
|
uint64_t time_s; ///< Timestamp seconds part
|
|
uint32_t time_ns; ///< Timestamp nanoseconds part.
|
|
struct PcktHeaderElement_ * header; ///< Pointer to packet header. Points to the innermost header
|
|
uint8_t * payload; ///< Pointer to (innermost) payload.
|
|
uint16_t headerSize; ///< Packet header size in bytes.
|
|
uint16_t payloadSize; ///< Payload size in bytes.
|
|
//uint16_t type; ///< Packet class indicator (e.g. UDP, TCP, IPv4 etc.)
|
|
} Pckt;
|
|
|
|
#endif //ETHERLIB_PACKET_H
|