SolarCapture C Bindings
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
Data Structures | Macros | Functions
ext_packet.h File Reference

sc_packet: The representation of a packet or other data. More...

#include <stdlib.h>
#include <stdint.h>
#include <sys/uio.h>

Go to the source code of this file.

Data Structures

struct  sc_packet
 Representation of a packet. More...
 

Macros

#define SC_MEMBER_OFFSET(c_type, mbr_name)   ((uint32_t) (uintptr_t)(&((c_type*)0)->mbr_name))
 Calculate memory offset of a field within a struct. More...
 
#define SC_MEMBER_SIZE(c_type, mbr_name)   (sizeof(((c_type*)0)->mbr_name))
 Calculate the size of a field within a struct. More...
 
#define SC_FRAME_LEN_LARGE   UINT16_MAX
 struct sc_packet.frame_len holds this special value to indicate that the frame is "large". (Meaning it would overflow sc_packet.frame_len).
 
#define SC_CSUM_ERROR   (1 << 0)
 struct sc_packet.flags will have this set if the packet has a checksum error
 
#define SC_CRC_ERROR   (1 << 1)
 struct sc_packet.flags will have this set if the packet has a crc error
 
#define SC_TRUNCATED   (1 << 2)
 struct sc_packet.flags will have this set if the packet has been truncated
 
#define SC_MCAST_MISMATCH   (1 << 3)
 struct sc_packet.flags will have this set if the packet is for a multicast group the host hasn't joined
 
#define SC_UCAST_MISMATCH   (1 << 4)
 struct sc_packet.flags will have this set if the packet is for a unicast address not matching the host's
 

Functions

static int sc_packet_bytes (struct sc_packet *p)
 Return the size of the packet data in bytes. More...
 
static struct sc_packetsc_packet_frags_tail (struct sc_packet *p)
 Return a packet's last fragment. More...
 
static void sc_packet_prefetch_r (struct sc_packet *p)
 Prefetch a packet for reading. More...
 
static void sc_packet_prefetch_rw (struct sc_packet *p)
 Prefetch a packet for reading and writing. More...
 
static struct timespec sc_packet_timespec (const struct sc_packet *p)
 Return the timestamp of the packet in timespec format. More...
 

Detailed Description

sc_packet: The representation of a packet or other data.