Use sideband also for challenge response.
[paraslash.git] / dccp_recv.c
index 41c2ee1..21c6932 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2011 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2006-2012 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
@@ -13,7 +13,6 @@
 
 #include <regex.h>
 #include <sys/types.h>
-#include <dirent.h>
 
 #include "para.h"
 #include "error.h"
 
 #include "dccp_recv.cmdline.h"
 
-/**
- * data specific to the dccp receiver
- *
- * \sa receiver receiver_node
- */
-struct private_dccp_recv_data {
-       /** the file descriptor for the dccp socket */
-       int fd;
-       struct btr_pool *btrp;
-};
-
-
 static void dccp_recv_close(struct receiver_node *rn)
 {
-
-       struct private_dccp_recv_data *pdd = rn->private_data;
-
-       if (pdd && pdd->fd > 0)
-               close(pdd->fd);
-       btr_pool_free(pdd->btrp);
-       free(rn->private_data);
-       rn->private_data = NULL;
+       if (rn->fd > 0)
+               close(rn->fd);
+       btr_pool_free(rn->btrp);
 }
 
-
 static int dccp_recv_open(struct receiver_node *rn)
 {
-       struct private_dccp_recv_data *pdd;
        struct dccp_recv_args_info *conf = rn->conf;
        struct flowopts *fo = NULL;
        uint8_t *ccids = NULL;
@@ -89,9 +69,8 @@ static int dccp_recv_open(struct receiver_node *rn)
        ret = mark_fd_nonblocking(fd);
        if (ret < 0)
                goto err;
-       rn->private_data = pdd = para_calloc(sizeof(struct private_dccp_recv_data));
-       pdd->btrp = btr_pool_new("dccp_recv", 320 * 1024);
-       pdd->fd = fd;
+       rn->btrp = btr_pool_new("dccp_recv", 320 * 1024);
+       rn->fd = fd;
        return 1;
 err:
        close(fd);
@@ -138,18 +117,16 @@ static void *dccp_recv_parse_config(int argc, char **argv)
 static void dccp_recv_pre_select(struct sched *s, struct task *t)
 {
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
-       struct private_dccp_recv_data *pdd = rn->private_data;
 
        t->error = 0;
        if (generic_recv_pre_select(s, t) <= 0)
                return;
-       para_fd_set(pdd->fd, &s->rfds, &s->max_fileno);
+       para_fd_set(rn->fd, &s->rfds, &s->max_fileno);
 }
 
 static void dccp_recv_post_select(struct sched *s, struct task *t)
 {
        struct receiver_node *rn = container_of(t, struct receiver_node, task);
-       struct private_dccp_recv_data *pdd = rn->private_data;
        struct btr_node *btrn = rn->btrn;
        struct iovec iov[2];
        int ret, iovcnt;
@@ -158,18 +135,18 @@ static void dccp_recv_post_select(struct sched *s, struct task *t)
        ret = btr_node_status(btrn, 0, BTR_NT_ROOT);
        if (ret <= 0)
                goto out;
-       iovcnt = btr_pool_get_buffers(pdd->btrp, iov);
+       iovcnt = btr_pool_get_buffers(rn->btrp, iov);
        ret = -E_DCCP_OVERRUN;
        if (iovcnt == 0)
                goto out;
-       ret = readv_nonblock(pdd->fd, iov, iovcnt, &s->rfds, &num_bytes);
+       ret = readv_nonblock(rn->fd, iov, iovcnt, &s->rfds, &num_bytes);
        if (num_bytes == 0)
                goto out;
        if (num_bytes <= iov[0].iov_len) /* only the first buffer was filled */
-               btr_add_output_pool(pdd->btrp, num_bytes, btrn);
+               btr_add_output_pool(rn->btrp, num_bytes, btrn);
        else { /* both buffers contain data */
-               btr_add_output_pool(pdd->btrp, iov[0].iov_len, btrn);
-               btr_add_output_pool(pdd->btrp, num_bytes - iov[0].iov_len, btrn);
+               btr_add_output_pool(rn->btrp, iov[0].iov_len, btrn);
+               btr_add_output_pool(rn->btrp, num_bytes - iov[0].iov_len, btrn);
        }
 out:
        if (ret >= 0)