summaryrefslogtreecommitdiff
path: root/src/skadns/skadns_send.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-12-22 16:07:12 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-12-22 16:07:12 +0000
commit275183baefa08dc91f094c1e59bd43a77684662d (patch)
tree2aeeb04d0c650afd05ad42de8f4f1f708527aa2e /src/skadns/skadns_send.c
parent6f2f670455a24032face2d8ee4684d051ae0e907 (diff)
downloads6-dns-275183baefa08dc91f094c1e59bd43a77684662d.tar.xz
Port skadns to textclient, prepare for 2.3.0.0
Diffstat (limited to 'src/skadns/skadns_send.c')
-rw-r--r--src/skadns/skadns_send.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/skadns/skadns_send.c b/src/skadns/skadns_send.c
index 9df39f0..69f533f 100644
--- a/src/skadns/skadns_send.c
+++ b/src/skadns/skadns_send.c
@@ -6,16 +6,15 @@
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/gensetdyn.h>
-#include <skalibs/skaclient.h>
+#include <skalibs/textclient.h>
#include <s6-dns/skadns.h>
-static skadnsanswer_t const skadnsanswer_initial = { .status = EAGAIN, .data = 0, .len = 0 } ;
int skadns_send (skadns_t *a, uint16_t *u, s6dns_domain_t const *d, uint16_t qtype, tain_t const *limit, tain_t const *deadline, tain_t *stamp)
{
+ static skadnsanswer_t const skadnsanswer_initial = { .status = EAGAIN, .data = 0, .len = 0 } ;
uint32_t i ;
char tmp[17] = "--Q" ;
- char err ;
struct iovec v[2] = { { .iov_base = tmp, .iov_len = 17 }, { .iov_base = (void *)d->s, .iov_len = d->len } } ;
if (!gensetdyn_new(&a->q, &i)) return 0 ;
if (i > UINT16_MAX)
@@ -26,18 +25,13 @@ int skadns_send (skadns_t *a, uint16_t *u, s6dns_domain_t const *d, uint16_t qty
uint16_pack_big(tmp, (uint16_t)i) ;
uint16_pack_big(tmp + 3, qtype) ;
if (limit) tain_pack(tmp + 5, limit) ; else memset(tmp + 5, 0, 12) ;
- if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp))
+ if (!textclient_commandv(&a->connection, v, 2, deadline, stamp))
{
int e = errno ;
gensetdyn_delete(&a->q, i) ;
errno = e ;
return 0 ;
}
- if (err)
- {
- gensetdyn_delete(&a->q, i) ;
- return (errno = err, 0) ;
- }
*GENSETDYN_P(skadnsanswer_t, &a->q, i) = skadnsanswer_initial ;
*u = i ;
return 1 ;