summaryrefslogtreecommitdiff
path: root/src/libwpactrl/wpactrl_querysa.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-07-06 21:42:01 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-07-06 21:42:01 +0000
commit330f54ac7f780872223f9cac62347393ffb4ef86 (patch)
tree1de817bd4b556e487b93884ac21561e1e5779635 /src/libwpactrl/wpactrl_querysa.c
downloadbcnm-330f54ac7f780872223f9cac62347393ffb4ef86.tar.xz
Initial commit
Diffstat (limited to 'src/libwpactrl/wpactrl_querysa.c')
-rw-r--r--src/libwpactrl/wpactrl_querysa.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libwpactrl/wpactrl_querysa.c b/src/libwpactrl/wpactrl_querysa.c
new file mode 100644
index 0000000..fe06202
--- /dev/null
+++ b/src/libwpactrl/wpactrl_querysa.c
@@ -0,0 +1,15 @@
+/* ISC license. */
+
+#include <errno.h>
+#include <skalibs/stralloc.h>
+#include <bcnm/wpactrl.h>
+#include "wpactrl-internal.h"
+
+int wpactrl_querysa (wpactrl_t *a, char const *s, size_t len, stralloc *sa, tain_t const *deadline, tain_t *stamp)
+{
+ char buf[WPACTRL_PACKET_MAX] ;
+ ssize_t r = wpactrl_query(a, s, len, buf, WPACTRL_PACKET_MAX, deadline, stamp) ;
+ if (r < 0) return 0 ;
+ if (!r) return (errno = EPIPE, 0) ;
+ return stralloc_catb(sa, buf, r) ;
+}