skaclient_init.c (846B)
1 /* ISC license. */ 2 3 #include <skalibs/unixmessage.h> 4 #include <skalibs/skaclient.h> 5 #include "skaclient-internal.h" 6 7 int skaclient_init ( 8 skaclient *a, 9 int fd, 10 char *bufss, 11 size_t bufsn, 12 char *auxbufss, 13 size_t auxbufsn, 14 char *bufas, 15 size_t bufan, 16 char *auxbufas, 17 size_t auxbufan, 18 kolbak_closure *q, 19 size_t qlen, 20 char const *before, 21 size_t beforelen) 22 { 23 unixmessage msg = { .s = (char *)before, .len = beforelen, .fds = 0, .nfds = 0 } ; 24 if (!unixmessage_receiver_init(&a->syncin, fd, bufss, bufsn, auxbufss, auxbufsn) 25 || !unixmessage_receiver_init(&a->asyncin, -1, bufas, bufan, auxbufas, auxbufan) 26 || !kolbak_queue_init(&a->kq, q, qlen)) return 0 ; 27 unixmessage_sender_init(&a->syncout, fd) ; 28 unixmessage_sender_init(&a->asyncout, -1) ; 29 if (!unixmessage_put(&a->syncout, &msg)) return 0 ; 30 return 1 ; 31 }