My Kernel v0.1.0

A network packet. More...

#include <packet.h>

Data Fields

size_t allocated_size
 Size allocated for the packet.
 
size_t packet_size
 Size of the contained packet.
 
size_t popped
 Number of popped bytes.
 
struct ethernet_devicenetdev
 The internet device this packet went/is going through.
 
union {
l2
 The packet's link layer header.
 
union {
l3
 The packet's network layer header.
 
void * payload
 Start of the packet's content (L4 and beyond)
 
node_t rx_this
 

Detailed Description

The packet structure does not contain the packet directly, it just holds metadata and information about it and its usage. Instead, the packet is located right after it, in a pre-allocated memory buffer, whose size is specified by the caller during the struct's allocation.

The user should NEVER interact with the packet's buffer directly, and should always use the packet_put_data function to add new data to the packet. This way, adding data to the packet can only be done incrementally, layer after layer, which corresponds to the network API's philosophy.

Field Documentation

◆ rx_this

node_t packet::rx_this

Used by socket to list received packets


The documentation for this struct was generated from the following file: