btnut/btnode/include/bt/bt_acl_pkt_buf.h File Reference


Detailed Description

API for dealing with ACL packet buffers.

Author:
Kevin Martin <kevmarti@tik.ee.ethz.ch>
Date:
2006/03/23
ACL packet buffers are used on the receiving side to buffer (connection-less) data packets. Each ACL packet buffer enacapsulates a single ACL packet.

This file provides the Definition of an ACL packet buffer, as well as some usefull functions helping to deal with ACL packet buffers.

Note: Applications typically make not use of the functions defined here. Instead, this API is intended for lower layer protocols.

#include <sys/types.h>
#include <bt/bt_defs.h>

Data Structures

struct  bt_acl_pkt_buf_s
 ACL Packet Buffer Definition. More...

Typedefs

typedef bt_acl_pkt_buf_s bt_acl_pkt_buf
 ACL packet buffer typedef.
typedef bt_acl_pkt_fifo_s bt_acl_pkt_fifo
 Typedef of a FIFO queue, buffering ACL packet buffers.

Functions

ACL Packet Buffer Creation & Destruction
Definition of an ACL packet buffer and API functions for creating / destroying ACL packet buffers

bt_acl_pkt_bufbt_acl_pkt_buf_create (struct btstack *stack)
 Creates a single ACL packet buffer.
void bt_acl_pkt_buf_destroy (bt_acl_pkt_buf *buf)
 Destroys the ACL packet buffer passed.
bt_acl_pkt_bufbt_acl_pkt_queue_create (struct btstack *stack, u_short nr_bufs)
 Creates a queue of ACL packet buffers.
void bt_acl_pkt_queue_destroy (bt_acl_pkt_buf *que)
 Destroys an ACL packet buffer queue.
FIFO queueing ACL packet buffers
void bt_acl_pkt_fifo_add_first (bt_acl_pkt_fifo *fifo, bt_acl_pkt_buf *buf)
 Adds the ACL packet buffer passed to the head of the FIFO queue specified.
void bt_acl_pkt_fifo_add_last (bt_acl_pkt_fifo *fifo, bt_acl_pkt_buf *buf)
 Adds the ACL packet buffer passed to the end of the FIFO queue specified.
bt_acl_pkt_fifobt_acl_pkt_fifo_create (void)
 Creates a fifo queue for queueing ACL packet buffers.
void bt_acl_pkt_fifo_destroy (bt_acl_pkt_fifo *fifo)
 Destroys a FIFO queue.
bt_acl_pkt_bufbt_acl_pkt_fifo_get_first (bt_acl_pkt_fifo *fifo)
 Gets the first ACL packet buffer from the FIFO queue passed.
bt_acl_pkt_bufbt_acl_pkt_fifo_top (bt_acl_pkt_fifo *fifo)
 Returns a pointer to the first ACL packet buffer in the queue passed.


Function Documentation

bt_acl_pkt_buf* bt_acl_pkt_buf_create ( struct btstack stack  ) 

Creates a single ACL packet buffer.

Note: The memory allocated for an ACL packet buffer is determined by the ACL packet types in use. This has to be defined during initialization. See bt_acl_init for further details.

Returns:
  • Pointer to the created buffer
  • 0 if not enough memory available
See also:
bt_acl_init
bt_acl_pkt_buf
bt_acl_pkt_buf_destroy

void bt_acl_pkt_buf_destroy ( bt_acl_pkt_buf buf  ) 

Destroys the ACL packet buffer passed.

Destroys a previousely created (using bt_acl_pkt_buf_create) ACL packet buffer.

See also:
bt_acl_pkt_buf
bt_acl_pkt_buf_create

void bt_acl_pkt_fifo_add_first ( bt_acl_pkt_fifo fifo,
bt_acl_pkt_buf buf 
)

Adds the ACL packet buffer passed to the head of the FIFO queue specified.

Parameters:
fifo Pointer to the fifo queue the buffer shall be added to
buf Pointer to the ACL packet buffer to be added
See also:
bt_acl_pkt_fifo_create
bt_acl_pkt_fifo_destroy
bt_acl_pkt_fifo_add_last
bt_acl_pkt_fifo_get_first

void bt_acl_pkt_fifo_add_last ( bt_acl_pkt_fifo fifo,
bt_acl_pkt_buf buf 
)

Adds the ACL packet buffer passed to the end of the FIFO queue specified.

Parameters:
fifo Pointer to the fifo queue the buffer shall be added to
buf Pointer to the ACL packet buffer to be added
bt_acl_pkt_fifo_create
bt_acl_pkt_fifo_destroy
bt_acl_pkt_fifo_add_first
bt_acl_pkt_fifo_get_first

bt_acl_pkt_fifo* bt_acl_pkt_fifo_create ( void   ) 

Creates a fifo queue for queueing ACL packet buffers.

Returns:
  • Pointer to the created packet queue
  • 0 if not enough memory available
See also:
bt_acl_pkt_fifo_add_first
bt_acl_pkt_fifo_add_last
bt_acl_pkt_fifo_get_first
bt_acl_pkt_fifo_destroy

void bt_acl_pkt_fifo_destroy ( bt_acl_pkt_fifo fifo  ) 

Destroys a FIFO queue.

Destroys a previousely created ACL packet buffer FIFO queue.

Parameters:
fifo Pointer to the fifo queue to destroy
See also:
bt_acl_pkt_fifo_create
bt_acl_pkt_fifo_add_first
bt_acl_pkt_fifo_add_last
bt_acl_pkt_fifo_get_first

bt_acl_pkt_buf* bt_acl_pkt_fifo_get_first ( bt_acl_pkt_fifo fifo  ) 

Gets the first ACL packet buffer from the FIFO queue passed.

Removes the first ACL packet buffer from the FIFO queue passed and returns a pointer to it.

Parameters:
fifo Pointer to the fifo queue
Returns:
Pointer to the first ACL packet buffer, or NULL if the FIFO queue is empty.
See also:
bt_acl_pkt_fifo_create
bt_acl_pkt_fifo_destroy
bt_acl_pkt_fifo_add_first
bt_acl_pkt_fifo_add_last

bt_acl_pkt_buf* bt_acl_pkt_fifo_top ( bt_acl_pkt_fifo fifo  ) 

Returns a pointer to the first ACL packet buffer in the queue passed.

Note: the ACL packet buffer won't be removed from the queue.

Parameters:
fifo Pointer to the fifo queue
Returns:
Pointer to the first ACL packet buffer, or NULL if the FIFO queue is empty.
See also:
bt_acl_pkt_fifo_add_first
bt_acl_pkt_fifo_add_last
bt_acl_pkt_fifo_get_first
bt_acl_pkt_fifo_destroy

bt_acl_pkt_buf* bt_acl_pkt_queue_create ( struct btstack stack,
u_short  nr_bufs 
)

Creates a queue of ACL packet buffers.

Creates a queue (i.e. a linked list) of ACL packet buffers of the size given.

Note: The memory allocated for a single ACL packet buffer is determined by the ACL packet types in use. This has to be defined during initialization (see bt_acl_init).

Parameters:
nr_bufs Number of buffers to create
Returns:
  • Pointer to the created queue
  • 0 if not enough memory available
See also:
bt_acl_pkt_buf
bt_acl_pkt_queue_destroy

void bt_acl_pkt_queue_destroy ( bt_acl_pkt_buf que  ) 

Destroys an ACL packet buffer queue.

Destroys the previousely created (using bt_acl_pkt_queue_create) queue of ACL packet buffers.

Parameters:
que Pointer to the first packet buf of the queue
See also:
bt_acl_pkt_buf
bt_acl_pkt_queue_create


Generated on Wed Apr 29 11:12:28 2009 for BTnut System Software by doxygen 1.5.1