summaryrefslogtreecommitdiff
path: root/src/libunixonacid/skaclient_init.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-09-18 18:55:44 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-09-18 18:55:44 +0000
commit3534b428629be185e096be99e3bd5fdfe32d5544 (patch)
tree210ef3198ed66bc7f7b7bf6a85e4579f455e5a36 /src/libunixonacid/skaclient_init.c
downloadskalibs-3534b428629be185e096be99e3bd5fdfe32d5544.tar.xz
initial commit with rc for skalibs-2.0.0.0
Diffstat (limited to 'src/libunixonacid/skaclient_init.c')
-rw-r--r--src/libunixonacid/skaclient_init.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/libunixonacid/skaclient_init.c b/src/libunixonacid/skaclient_init.c
new file mode 100644
index 0000000..89ed59c
--- /dev/null
+++ b/src/libunixonacid/skaclient_init.c
@@ -0,0 +1,32 @@
+/* ISC license. */
+
+#include <skalibs/kolbak.h>
+#include <skalibs/skaclient.h>
+#include <skalibs/unixmessage.h>
+#include "skaclient-internal.h"
+
+int skaclient_init (
+ skaclient_t *a,
+ int fd,
+ char *bufss,
+ unsigned int bufsn,
+ char *auxbufss,
+ unsigned int auxbufsn,
+ char *bufas,
+ unsigned int bufan,
+ char *auxbufas,
+ unsigned int auxbufan,
+ kolbak_closure_t *q,
+ unsigned int qlen,
+ char const *before,
+ unsigned int beforelen)
+{
+ unixmessage_t msg = { .s = (char *)before, .len = beforelen, .fds = 0, .nfds = 0 } ;
+ if (!unixmessage_receiver_init(&a->syncin, fd, bufss, bufsn, auxbufss, auxbufsn)
+ || !unixmessage_receiver_init(&a->asyncin, -1, bufas, bufan, auxbufas, auxbufan)
+ || !kolbak_queue_init(&a->kq, q, qlen)) return 0 ;
+ unixmessage_sender_init(&a->syncout, fd) ;
+ unixmessage_sender_init(&a->asyncout, -1) ;
+ if (!unixmessage_put(&a->syncout, &msg)) return 0 ;
+ return 1 ;
+}