queue.h File Reference

Go to the source code of this file.

Classes

struct  queue_t

Defines

#define _SPANDSP_QUEUE_H_
#define QUEUE_READ_ATOMIC   0x0001
#define QUEUE_WRITE_ATOMIC   0x0002

Functions

int queue_empty (queue_t *p)
 Check if a queue is empty.
int queue_free_space (queue_t *p)
 Check available free space.
int queue_contents (queue_t *p)
 Check the contents of a queue.
void queue_flush (queue_t *p)
 Flush the contents of a queue.
int queue_view (queue_t *p, uint8_t *buf, int len)
 Copy bytes from a queue.
int queue_read (queue_t *p, uint8_t *buf, int len)
 Read bytes from a queue.
int queue_write (queue_t *p, const uint8_t *buf, int len)
 Write bytes to a queue.
int queue_test_msg (queue_t *p)
 Test message length.
int queue_read_msg (queue_t *p, uint8_t *buf, int len)
 Read a message from a queue.
int queue_write_msg (queue_t *p, const uint8_t *buf, int len)
 Write a message to a queue.
int queue_create (queue_t *p, int len, int flags)
 Create a queue.
int queue_delete (queue_t *p)
 Delete a queue.


Detailed Description


Function Documentation

int queue_contents queue_t *  p  ) 
 

Check the contents of a queue.

Check the contents of a queue.

Parameters:
p The queue context.
Returns:
The number of bytes in the queue.

int queue_create queue_t *  p,
int  len,
int  flags
 

Create a queue.

Create a queue.

Parameters:
p The queue context.
len The length of the queue's buffer.
flags Flags controlling the operation of the queue. Valid flags are QUEUE_READ_ATOMIC and QUEUE_WRITE_ATOMIC.
Returns:
0 if created OK, else -1.

int queue_delete queue_t *  p  ) 
 

Delete a queue.

Delete a queue.

Parameters:
p The queue context.
Returns:
0 if deleted OK, else -1.

int queue_empty queue_t *  p  ) 
 

Check if a queue is empty.

Check if a queue is empty.

Parameters:
p The queue context.
Returns:
TRUE if empty, else FALSE.

void queue_flush queue_t *  p  ) 
 

Flush the contents of a queue.

Flush the contents of a queue.

Parameters:
p The queue context.

int queue_free_space queue_t *  p  ) 
 

Check available free space.

Check the available free space in a queue's buffer.

Parameters:
p The queue context.
Returns:
The number of bytes of free space.

int queue_read queue_t *  p,
uint8_t *  buf,
int  len
 

Read bytes from a queue.

Read bytes from a queue.

Parameters:
p The queue context.
buf The buffer into which the bytes will be read.
len The length of the buffer.
Returns:
the number of bytes returned.

int queue_read_msg queue_t *  p,
uint8_t *  buf,
int  len
 

Read a message from a queue.

Read a message from a queue. If the message is longer than the buffer provided, only the first len bytes of the message will be returned. The remainder of the message will be discarded.

Parameters:
p The queue context.
buf The buffer into which the message will be read.
len The length of the buffer.
Returns:
The number of bytes returned. If there are no messages in the queue, -1 is returned.

int queue_test_msg queue_t *  p  ) 
 

Test message length.

Test the length of the message at the head of a queue.

Parameters:
p The queue context.
Returns:
The length of the next message, in byte. If there are no messages in the queue, -1 is returned.

int queue_view queue_t *  p,
uint8_t *  buf,
int  len
 

Copy bytes from a queue.

Copy bytes from a queue. This is similar to queue_read, but the data remains in the queue.

Parameters:
p The queue context.
buf The buffer into which the bytes will be read.
len The length of the buffer.
Returns:
the number of bytes returned.

int queue_write queue_t *  p,
const uint8_t *  buf,
int  len
 

Write bytes to a queue.

Write bytes to a queue.

Parameters:
p The queue context.
buf The buffer containing the bytes to be written.
len The length of the buffer.
Returns:
the number of bytes actually written.

int queue_write_msg queue_t *  p,
const uint8_t *  buf,
int  len
 

Write a message to a queue.

Write a message to a queue.

Parameters:
p The queue context.
buf The buffer from which the message will be written.
len The length of the message.
Returns:
The number of bytes actually written.


Generated on Fri Apr 13 13:24:02 2007 for libspandsp by  doxygen 1.4.6