mbed port of tinydtls

Embed: (wiki syntax)

« Back to documentation index

Network Packet Queue

Network Packet Queue

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. More...

Typedefs

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.

Functions

int netq_insert_node (netq_t **queue, netq_t *node)
 Adds a node to the given queue, ordered by their time-stamp t.
void netq_node_free (netq_t *node)
 Destroys specified node and releases any memory that was allocated for the associated datagram.
void netq_delete_all (netq_t *queue)
 Removes all items from given queue and frees the allocated storage.
netq_t * netq_node_new ()
 Creates a new node suitable for adding to a netq_t queue.
netq_t * netq_head (netq_t **queue)
 Returns a pointer to the first item in given queue or NULL if empty.
netq_t * netq_pop_first (netq_t **queue)
 Removes the first item in given queue and returns a pointer to the removed element.

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 33 of file netq.h.


Function Documentation

void netq_delete_all ( netq_t *  queue )

Removes all items from given queue and frees the allocated storage.

Definition at line 120 of file netq.c.

netq_t* netq_head ( netq_t **  queue )

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

Definition at line 83 of file netq.c.

int netq_insert_node ( netq_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 64 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 114 of file netq.c.

netq_t* netq_node_new (  )

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

Definition at line 98 of file netq.c.

netq_t* netq_pop_first ( netq_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 90 of file netq.c.