skaclient_start_cb.c (746B)
1 /* ISC license. */ 2 3 #include <errno.h> 4 #include <string.h> 5 6 #include <skalibs/unixmessage.h> 7 #include <skalibs/skaclient.h> 8 #include <skalibs/posixishard.h> 9 #include "skaclient-internal.h" 10 11 int skaclient_start_cb (unixmessage const *m, skaclient_cbdata *blah) 12 { 13 if (m->len != blah->afterlen 14 || memcmp(m->s, blah->after, m->len) 15 || m->nfds != 1) 16 { 17 unixmessage_drop(m) ; 18 return (errno = EPROTO, 0) ; 19 } 20 blah->a->asyncin.fd = m->fds[0] ; 21 blah->a->asyncout.fd = m->fds[0] ; 22 if (!(blah->a->options & SKACLIENT_OPTION_ASYNC_ACCEPT_FDS)) 23 unixmessage_receiver_refuse_fds(&blah->a->asyncin) ; 24 if (!(blah->a->options & SKACLIENT_OPTION_SYNC_ACCEPT_FDS)) 25 unixmessage_receiver_refuse_fds(&blah->a->syncin) ; 26 return 1 ; 27 }