tinydtls  0.8.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Data Structures | Typedefs | Functions
Network Packet Queue

Data Structures

struct  netq_t
 

Typedefs

typedef unsigned char netq_packet_t [DTLS_MAX_BUF]
 
typedef struct netq_t netq_t
 

Functions

static void netq_init ()
 
int netq_insert_node (list_t queue, netq_t *node)
 
void netq_node_free (netq_t *node)
 
void netq_delete_all (list_t queue)
 
netq_tnetq_node_new (size_t size)
 
netq_tnetq_head (list_t queue)
 
netq_tnetq_next (netq_t *p)
 
void netq_remove (list_t queue, netq_t *p)
 
netq_tnetq_pop_first (list_t queue)
 

Detailed Description

The netq utility functions implement an ordered queue of data packets to send over the network and can also be used to queue received packets from the network.

Typedef Documentation

typedef unsigned char netq_packet_t[DTLS_MAX_BUF]

Datagrams in the netq_t structure have a fixed maximum size of DTLS_MAX_BUF to simplify memory management on constrained nodes.

Definition at line 36 of file netq.h.

typedef struct netq_t netq_t

Function Documentation

void netq_delete_all ( list_t  queue)

Removes all items from given queue and frees the allocated storage

Definition at line 133 of file netq.c.

netq_t* netq_head ( list_t  queue)

Returns a pointer to the first item in given queue or NULL if empty.

Definition at line 80 of file netq.c.

static void netq_init ( )
inlinestatic

Definition at line 58 of file netq.h.

int netq_insert_node ( list_t  queue,
netq_t node 
)

Adds a node to the given queue, ordered by their time-stamp t. This function returns 0 on error, or non-zero if node has been added successfully.

Parameters
queueA pointer to the queue head where node will be added.
nodeThe new item to add.
Returns
0 on error, or non-zero if the new item was added.

Definition at line 61 of file netq.c.

netq_t* netq_next ( netq_t p)

Definition at line 88 of file netq.c.

void netq_node_free ( netq_t node)

Destroys specified node and releases any memory that was allocated for the associated datagram.

Definition at line 127 of file netq.c.

netq_t* netq_node_new ( size_t  size)

Creates a new node suitable for adding to a netq_t queue.

Definition at line 111 of file netq.c.

netq_t* netq_pop_first ( list_t  queue)

Removes the first item in given queue and returns a pointer to the removed element. If queue is empty when netq_pop_first() is called, this function returns NULL.

Definition at line 103 of file netq.c.

void netq_remove ( list_t  queue,
netq_t p 
)

Definition at line 96 of file netq.c.