paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions
chunk_queue.h File Reference

Exported symbols from chunk_queue.c. More...

Functions

int cq_enqueue (struct chunk_queue *cq, const char *buf, size_t num_bytes)
 Add a chunk to the given queue. More...
 
struct queued_chunk * cq_peek (struct chunk_queue *cq)
 Lookup the next chunk in the queue. More...
 
void cq_dequeue (struct chunk_queue *cq)
 Remove the current chunk from the queue. More...
 
void cq_update (struct chunk_queue *cq, size_t sent)
 Change the number of bytes sent for the current queued chunk. More...
 
int cq_get (struct queued_chunk *qc, const char **buf, size_t *len)
 Get a pointer to the given queued chunk. More...
 
struct chunk_queue * cq_new (size_t max_pending)
 Allocate and initialize a chunk queue. More...
 
void cq_destroy (struct chunk_queue *cq)
 Deallocate all resources of this queue. More...
 

Detailed Description

Exported symbols from chunk_queue.c.

Function Documentation

◆ cq_enqueue()

int cq_enqueue ( struct chunk_queue *  cq,
const char *  buf,
size_t  num_bytes 
)

Add a chunk to the given queue.

Parameters
cqthe queue to add the chunk to.
bufPointer to the data to be queued.
num_bytesThe size of buf.
Returns
Standard.

References alloc().

◆ cq_peek()

struct queued_chunk* cq_peek ( struct chunk_queue *  cq)

Lookup the next chunk in the queue.

Parameters
cqThe chunk queue.
Returns
The next queued chunk, or NULL if there is no chunk available.

Referenced by cq_dequeue(), cq_update(), and send_queued_chunks().

◆ cq_dequeue()

void cq_dequeue ( struct chunk_queue *  cq)

Remove the current chunk from the queue.

Parameters
cqThe queue to remove from.

References cq_peek().

Referenced by send_queued_chunks().

◆ cq_update()

void cq_update ( struct chunk_queue *  cq,
size_t  sent 
)

Change the number of bytes sent for the current queued chunk.

Parameters
cqThe chunk queue.
sentNumber of bytes successfully sent.

References cq_peek().

Referenced by send_queued_chunks().

◆ cq_get()

int cq_get ( struct queued_chunk *  qc,
const char **  buf,
size_t *  num_bytes 
)

Get a pointer to the given queued chunk.

Parameters
qcThe queued chunk.
bufResult pointer.
num_bytesNumber of bytes of buf.
Returns
Positive on success, negative on errors.

Referenced by send_queued_chunks().

◆ cq_new()

struct chunk_queue* cq_new ( size_t  max_pending)

Allocate and initialize a chunk queue.

Parameters
max_pendingMaximal number of bytes that will be queued.
Returns
A pointer to the new queue.

References alloc().

Referenced by accept_sender_client().

◆ cq_destroy()

void cq_destroy ( struct chunk_queue *  cq)

Deallocate all resources of this queue.

Parameters
cqThe chunk queue.

References list_for_each_entry_safe.

Referenced by shutdown_client().