EtherLib/packet.h

36 lines
1.0 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.
uint32_t time_s; ///> Timestamp seconds field
uint32_t time_ns; ///> Timestamp nanoseconds field
} 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.
const 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