hdf_netbuf.h

Overview

Related Modules:

WLAN

Description:

Declares network data buffers and provides APIs for operating buffer queues.

This file describes the following network data operations for network device driver development: Applying for, releasing, and moving a network data buffer Initializing a network data buffer queue, placing a network data buffer to a queue, and removing a network data buffer from a queue

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

NetBuf

Records and saves a network data buffer.

NetBufQueue

Indicates the queues for storing network data.

Macros

Macro Name and Value

Description

MAX_NETBUF_RESEVER_SIZE   68

Defines the reserved field of a network data buffer used to store private information.

Enumerations

Enumeration Name

Description

{ E_HEAD_BUF, E_DATA_BUF, E_TAIL_BUF, MAX_BUF_NUM }

Enumerates the segments of a network data buffer.

Functions

Function Name

Description

NetBufQueueInit (struct NetBufQueue q)

static void 

Initializes a network data buffer queue.

NetBufQueueSize (const struct NetBufQueue q)

static uint32_t 

Obtains the size of a network data buffer queue.

NetBufQueueIsEmpty (const struct NetBufQueue q)

static bool 

Checks whether the network data buffer queue is empty.

NetBufQueueEnqueue (struct NetBufQueue q, struct NetBuf nb)

void 

Adds a network data buffer to the tail of a queue.

NetBufQueueEnqueueHead (struct NetBufQueue q, struct NetBuf nb)

void 

Adds a network data buffer to the header of a queue.

NetBufQueueDequeue (struct NetBufQueue q)

struct NetBuf  

Obtains a network data buffer from the header of a queue and deletes it from the queue.

NetBufQueueDequeueTail (struct NetBufQueue q)

struct NetBuf  

Obtains a network data buffer from the tail of a queue and deletes it from the queue.

NetBufQueueAtHead (const struct NetBufQueue q)

static struct NetBuf  

Obtains the network data buffer from the header of a queue, without deleting it from the queue.

NetBufQueueAtTail (const struct NetBufQueue q)

static struct NetBuf  

Obtains the network data buffer from the tail of a queue, without deleting it from the queue.

NetBufQueueClear (struct NetBufQueue q)

void 

Clears a network data buffer queue and releases the network data buffer in the queue.

NetBufQueueConcat (struct NetBufQueue q, struct NetBufQueue add)

void 

Moves all network data buffers from one queue to another and clears the source queue.

NetBufAlloc (uint32_t size)

struct NetBuf  

Applies for a network data buffer.

NetBufFree (struct NetBuf nb)

void 

Releases a network data buffer.

NetBufDevAlloc (const struct NetDevice dev, uint32_t size)

struct NetBuf  

Applies for a network data buffer based on the reserved space and requested size set by a network device.

NetBufPush (struct NetBuf nb, uint32_t id, uint32_t len)

void  

Performs operations based on the segment ID of a network data buffer. The function is opposite to that of NetBufPop.

NetBufPop (struct NetBuf nb, uint32_t id, uint32_t len)

void  

Performs operations based on the segment ID of a network data buffer. The function is opposite to that of NetBufPush.

NetBufGetAddress (const struct NetBuf nb, uint32_t id)

static uint8_t  

Obtains the address of a specified buffer segment in a network data buffer.

NetBufGetRoom (const struct NetBuf nb, uint32_t id)

static uint32_t 

Obtains the size of a specified buffer segment space in a network data buffer.

NetBufGetDataLen (const struct NetBuf nb)

static uint32_t 

Obtains the actual data length of the data segment of a network data buffer.

NetBufResizeRoom (struct NetBuf nb, uint32_t head, uint32_t tail)

int32_t 

Adjusts the size of a network data buffer space.

NetBufConcat (struct NetBuf nb, struct NetBuf cnb)

uint32_t 

Copies data in a network data buffer to another network data buffer.

Pbuf2NetBuf (const struct NetDevice netdev, struct pbuf lwipBuf)

struct NetBuf  

Converts the pbuf structure of Lightweight TCP/IP Stack (lwIP) to a network data buffer.

NetBuf2Pbuf (const struct NetBuf nb)

struct pbuf  

Converts a network data buffer to the pbuf structure of Lightweight TCP/IP Stack (lwIP).