-/**
- * Describes one queued chunk of the chunk queue.
- *
- * The send function of the http sender checks each client fd for writing. If a
- * client fd is not ready, it tries to queue that chunk for this client until
- * the number of queued bytes exceeds \p MAX_BACKLOG.
- */
-struct queued_chunk {
- /** The number of the queued chunk, -1U means header. */
- unsigned chunk_num;
- /** The number of bytes already sent. */
- unsigned sent;
- /** Position of the chunk in the chunk queue. */
- struct list_head node;
-};
-
-/**
- * Describes one entry in the blacklist/whitelist of the http sender.
- */
-struct access_info {
- /** The address to be black/whitelisted. */
- struct in_addr addr;
- /** The netmask for this entry. */
- unsigned netmask;
- /** The position of this entry in the access_perm_list. */
- struct list_head node;
-};
-
-static int server_fd = -1, numclients;
-static struct sender *self;
-
-
-static int cq_enqueue(struct chunk_queue *cq, long unsigned chunk_num,
- size_t sent)
-{
- struct queued_chunk *qc;
- char *buf;
- size_t len;
- int ret;
-
- if (chunk_num != -1U) {
- ret = vss_get_chunk(chunk_num, &buf, &len);
- if (ret < 0)
- return ret;
- } else
- buf = vss_get_header(&len);
- if (cq->num_pending + len > cq->max_pending)
- return -E_QUEUE;
- qc = para_malloc(sizeof(struct queued_chunk));
- cq->num_pending += len;
- qc->chunk_num = chunk_num;
- qc->sent = sent;
- list_add_tail(&qc->node, &cq->q);
- PARA_DEBUG_LOG("%lu bytes queued for %p\n", cq->num_pending, &cq->q);
- return 1;
-}
-
-static struct queued_chunk *cq_peek(struct chunk_queue *cq)
-{
- if (list_empty(&cq->q))
- return NULL;
- return list_entry(cq->q.next, struct queued_chunk, node);
-}
-
-int cq_dequeue(struct chunk_queue *cq)
-{
- struct queued_chunk *qc = cq_peek(cq);
- assert(qc);
- list_del(&qc->node);
- free(qc);
- return 1;
-}