32 lines
934 B
C
32 lines
934 B
C
#ifndef ETHERLIB_COMMON_TYPES_H
|
|
#define ETHERLIB_COMMON_TYPES_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.
|
|
} RawPckt;
|
|
|
|
/**
|
|
* \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.
|
|
uint8_t * header; ///< Pointer to packet header. Points to the outmost header (e.g. Ethernet-header in case of a UDP-packet)
|
|
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_COMMON_TYPES_H
|