vaseboot/include/VasEBoot/net/netbuff.h

32 lines
1.2 KiB
C

#ifndef VAS_EBOOT_NETBUFF_HEADER
#define VAS_EBOOT_NETBUFF_HEADER
#include <VasEBoot/misc.h>
#define NETBUFF_ALIGN 2048
#define NETBUFFMINLEN 64
struct VasEBoot_net_buff
{
/* Pointer to the start of the buffer. */
VasEBoot_uint8_t *head;
/* Pointer to the data. */
VasEBoot_uint8_t *data;
/* Pointer to the tail. */
VasEBoot_uint8_t *tail;
/* Pointer to the end of the buffer. */
VasEBoot_uint8_t *end;
};
VasEBoot_err_t VasEBoot_netbuff_put (struct VasEBoot_net_buff *net_buff, VasEBoot_size_t len);
VasEBoot_err_t VasEBoot_netbuff_unput (struct VasEBoot_net_buff *net_buff, VasEBoot_size_t len);
VasEBoot_err_t VasEBoot_netbuff_push (struct VasEBoot_net_buff *net_buff, VasEBoot_size_t len);
VasEBoot_err_t VasEBoot_netbuff_pull (struct VasEBoot_net_buff *net_buff, VasEBoot_size_t len);
VasEBoot_err_t VasEBoot_netbuff_reserve (struct VasEBoot_net_buff *net_buff, VasEBoot_size_t len);
VasEBoot_err_t VasEBoot_netbuff_clear (struct VasEBoot_net_buff *net_buff);
struct VasEBoot_net_buff * VasEBoot_netbuff_alloc (VasEBoot_size_t len);
struct VasEBoot_net_buff * VasEBoot_netbuff_make_pkt (VasEBoot_size_t len);
void VasEBoot_netbuff_free (struct VasEBoot_net_buff *net_buff);
#endif