From 275183baefa08dc91f094c1e59bd43a77684662d Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 22 Dec 2017 16:07:12 +0000 Subject: Port skadns to textclient, prepare for 2.3.0.0 --- src/skadns/skadns_update.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/skadns/skadns_update.c') diff --git a/src/skadns/skadns_update.c b/src/skadns/skadns_update.c index 39b1dd0..e26ead0 100644 --- a/src/skadns/skadns_update.c +++ b/src/skadns/skadns_update.c @@ -5,6 +5,7 @@ #define _BSD_SOURCE #endif +#include #include #include #include @@ -13,17 +14,17 @@ #include #include #include -#include -#include +#include #include -static int msghandler (unixmessage_t const *m, void *context) +static int msghandler (struct iovec const *v, void *context) { skadns_t *a = (skadns_t *)context ; + char const *s = v->iov_base ; skadnsanswer_t *p ; uint16_t id ; - if (m->len < 3 || m->nfds) return (errno = EPROTO, 0) ; - uint16_unpack_big(m->s, &id) ; + if (v->iov_len < 3) return (errno = EPROTO, 0) ; + uint16_unpack_big(s, &id) ; p = GENSETDYN_P(skadnsanswer_t, &a->q, id) ; if (p->status == ECANCELED) { @@ -32,14 +33,14 @@ static int msghandler (unixmessage_t const *m, void *context) } if (!error_isagain(p->status)) return (errno = EINVAL, 0) ; if (!genalloc_readyplus(uint16_t, &a->list, 1)) return 0 ; - if (!m->s[2]) + if (!s[2]) { - p->data = alloc(m->len-3) ; + p->data = alloc(v->iov_len-3) ; if (!p->data) return 0 ; - memcpy(p->data, m->s+3, m->len-3) ; - p->len = m->len-3 ; + memcpy(p->data, s+3, v->iov_len-3) ; + p->len = v->iov_len-3 ; } - p->status = m->s[2] ; + p->status = s[2] ; genalloc_append(uint16_t, &a->list, &id) ; return 1 ; } @@ -47,5 +48,5 @@ static int msghandler (unixmessage_t const *m, void *context) int skadns_update (skadns_t *a) { genalloc_setlen(uint16_t, &a->list, 0) ; - return skaclient_update(&a->connection, &msghandler, a) ; + return textclient_update(&a->connection, &msghandler, a) ; } -- cgit v1.2.3