From 416ef5e2bf59bb2e45066a1d5d91ac677c0f48e5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 10 Dec 2014 03:05:47 +0000 Subject: Initial commit --- src/libs6dns/s6dns_debug_dumpdt_post_send.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/libs6dns/s6dns_debug_dumpdt_post_send.c (limited to 'src/libs6dns/s6dns_debug_dumpdt_post_send.c') diff --git a/src/libs6dns/s6dns_debug_dumpdt_post_send.c b/src/libs6dns/s6dns_debug_dumpdt_post_send.c new file mode 100644 index 0000000..e41d595 --- /dev/null +++ b/src/libs6dns/s6dns_debug_dumpdt_post_send.c @@ -0,0 +1,30 @@ +/* ISC license */ + +#include +#include +#include +#include +#include + +int s6dns_debug_dumpdt_post_send (s6dns_engine_t const *dt, void *data) +{ + genwrite_t *gp = data ; + char buf[LOCALTMN_FMT] ; + unsigned int len ; + if ((*gp->put)(gp->target, "Sent query ", 11) < 11) return 0 ; + { + uint16 id ; + uint16_unpack_big(dt->sa.s + 2, &id) ; + len = uint16_fmt(buf, id) ; + } + if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ; + if ((*gp->put)(gp->target, " - next recv deadline is ", 25) < 25) return 0 ; + { + localtmn_t l ; + if (!localtmn_from_tain(&l, &dt->localdeadline, 0)) return 0 ; + len = localtmn_fmt(buf, &l) ; + } + if ((*gp->put)(gp->target, buf, len) < (int)len) return 0 ; + if ((*gp->put)(gp->target, "\n\n", 2) < 2) return 0 ; + return (*gp->flush)(gp->target) ; +} -- cgit v1.2.3