unixmessage_receiver_init.c (488B)
1 /* ISC license. */ 2 3 #include <skalibs/cbuffer.h> 4 #include <skalibs/stralloc.h> 5 #include <skalibs/unixmessage.h> 6 7 int unixmessage_receiver_init (unixmessage_receiver *b, int fd, char *mainbuf, size_t mainlen, char *auxbuf, size_t auxlen) 8 { 9 if (!cbuffer_init(&b->mainb, mainbuf, mainlen) 10 || !cbuffer_init(&b->auxb, auxbuf, auxlen)) return 0 ; 11 b->fd = fd ; 12 b->mainlen = b->auxlen = 0 ; 13 b->maindata = stralloc_zero ; 14 b->auxdata = stralloc_zero ; 15 b->fds_ok = 3 ; 16 return 1 ; 17 }