![]() |
SolarCapture C Bindings User Guide
SF-115721-CD
Issue 3
|
sc_packet: The representation of a packet or other data. More...
#include <stdlib.h>#include <stdint.h>#include <sys/uio.h>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_packet * | sc_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... | |
sc_packet: The representation of a packet or other data.
| #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.
| c_type | The struct type. |
| mbr_name | The field name to calculate the offset of. |
| #define SC_MEMBER_SIZE | ( | c_type, | |
| mbr_name | |||
| ) | (sizeof(((c_type*)0)->mbr_name)) |
Calculate the size of a field within a struct.
| c_type | The struct type. |
| mbr_name | The field to calculate the size of. |
|
inlinestatic |
Return the size of the packet data in bytes.
| p | A packet object. |
Return a packet's last fragment.
| p | A packet object. |
The result is only valid if the packet has at least one fragment.
|
inlinestatic |
Prefetch a packet for reading.
| p | A packet object. |
|
inlinestatic |
Prefetch a packet for reading and writing.
| p | A packet object. |
|
static |
Return the timestamp of the packet in timespec format.
| p | A packet object. |