Paraslash Audio Streaming | |
About News Download Documentation Development |
Queuing functions for paraslash senders. More...
#include <regex.h>
#include "para.h"
#include "list.h"
#include "afh.h"
#include "string.h"
#include "error.h"
#include "chunk_queue.h"
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 *num_bytes) |
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... | |
Queuing functions for paraslash senders.
int cq_enqueue | ( | struct chunk_queue * | cq, |
const char * | buf, | ||
size_t | num_bytes | ||
) |
Add a chunk to the given queue.
cq | the queue to add the chunk to. |
buf | Pointer to the data to be queued. |
num_bytes | The size of buf. |
References alloc().
struct queued_chunk* cq_peek | ( | struct chunk_queue * | cq | ) |
Lookup the next chunk in the queue.
cq | The chunk queue. |
NULL
if there is no chunk available. Referenced by cq_dequeue(), cq_update(), and send_queued_chunks().
void cq_dequeue | ( | struct chunk_queue * | cq | ) |
Remove the current chunk from the queue.
cq | The queue to remove from. |
References cq_peek().
Referenced by send_queued_chunks().
void cq_update | ( | struct chunk_queue * | cq, |
size_t | sent | ||
) |
Change the number of bytes sent for the current queued chunk.
cq | The chunk queue. |
sent | Number of bytes successfully sent. |
References cq_peek().
Referenced by send_queued_chunks().
int cq_get | ( | struct queued_chunk * | qc, |
const char ** | buf, | ||
size_t * | num_bytes | ||
) |
Get a pointer to the given queued chunk.
qc | The queued chunk. |
buf | Result pointer. |
num_bytes | Number of bytes of buf. |
Referenced by send_queued_chunks().
struct chunk_queue* cq_new | ( | size_t | max_pending | ) |
Allocate and initialize a chunk queue.
max_pending | Maximal number of bytes that will be queued. |
References alloc().
Referenced by accept_sender_client().
void cq_destroy | ( | struct chunk_queue * | cq | ) |
Deallocate all resources of this queue.
cq | The chunk queue. |
References list_for_each_entry_safe.
Referenced by shutdown_client().