SAMV71 Xplained Ultra Software Package 1.5

netbuf.c File Reference

#include "lwip/opt.h"
#include "lwip/netbuf.h"
#include "lwip/memp.h"
#include <string.h>

Go to the source code of this file.

Functions

struct netbufnetbuf_new (void)
void netbuf_delete (struct netbuf *buf)
void * netbuf_alloc (struct netbuf *buf, u16_t size)
void netbuf_free (struct netbuf *buf)
err_t netbuf_ref (struct netbuf *buf, const void *dataptr, u16_t size)
void netbuf_chain (struct netbuf *head, struct netbuf *tail)
err_t netbuf_data (struct netbuf *buf, void **dataptr, u16_t *len)
s8_t netbuf_next (struct netbuf *buf)
void netbuf_first (struct netbuf *buf)

Detailed Description

Network buffer management

Definition in file netbuf.c.


Function Documentation

void* netbuf_alloc ( struct netbuf buf,
u16_t  size 
)

Allocate memory for a packet buffer for a given netbuf.

Parameters:
buf the netbuf for which to allocate a packet buffer
size the size of the packet buffer to allocate
Returns:
pointer to the allocated memory NULL if no memory could be allocated

Definition at line 102 of file netbuf.c.

Here is the call graph for this function:

void netbuf_chain ( struct netbuf head,
struct netbuf tail 
)

Chain one netbuf to another (

See also:
pbuf_chain)
Parameters:
head the first netbuf
tail netbuf to chain after head, freed by this function, may not be reference after returning

Definition at line 169 of file netbuf.c.

Here is the call graph for this function:

err_t netbuf_data ( struct netbuf buf,
void **  dataptr,
u16_t len 
)

Get the data pointer and length of the data inside a netbuf.

Parameters:
buf netbuf to get the data from
dataptr pointer to a void pointer where to store the data pointer
len pointer to an u16_t where the length of the data is stored
Returns:
ERR_OK if the information was retreived, ERR_BUF on error.

Definition at line 188 of file netbuf.c.

void netbuf_delete ( struct netbuf buf  ) 

Deallocate a netbuf allocated by netbuf_new().

Parameters:
buf pointer to a netbuf allocated by netbuf_new()

Definition at line 82 of file netbuf.c.

Here is the call graph for this function:

void netbuf_first ( struct netbuf buf  ) 

Move the current data pointer of a packet buffer contained in a netbuf to the beginning of the packet. The packet buffer itself is not modified.

Parameters:
buf the netbuf to modify

Definition at line 234 of file netbuf.c.

void netbuf_free ( struct netbuf buf  ) 

Free the packet buffer included in a netbuf

Parameters:
buf pointer to the netbuf which contains the packet buffer to free

Definition at line 126 of file netbuf.c.

Here is the call graph for this function:

struct netbuf* netbuf_new ( void   )  [read]

Create (allocate) and initialize a new netbuf. The netbuf doesn't yet contain a packet buffer!

Returns:
a pointer to a new netbuf NULL on lack of memory

Definition at line 56 of file netbuf.c.

Here is the call graph for this function:

s8_t netbuf_next ( struct netbuf buf  ) 

Move the current data pointer of a packet buffer contained in a netbuf to the next part. The packet buffer itself is not modified.

Parameters:
buf the netbuf to modify
Returns:
-1 if there is no next part 1 if moved to the next part but now there is no next part 0 if moved to the next part and there are still more parts

Definition at line 213 of file netbuf.c.

err_t netbuf_ref ( struct netbuf buf,
const void *  dataptr,
u16_t  size 
)

Let a netbuf reference existing (non-volatile) data.

Parameters:
buf netbuf which should reference the data
dataptr pointer to the data to reference
size size of the data
Returns:
ERR_OK if data is referenced ERR_MEM if data couldn't be referenced due to lack of memory

Definition at line 145 of file netbuf.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines