From 9dafc75bb51c0f350330277a2e96b04f5a1c73b3 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 10 Jan 2020 10:35:55 +0000 Subject: Add pub library and daemon --- src/libskabus/skabus_pub_send_cb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/libskabus/skabus_pub_send_cb.c (limited to 'src/libskabus/skabus_pub_send_cb.c') diff --git a/src/libskabus/skabus_pub_send_cb.c b/src/libskabus/skabus_pub_send_cb.c new file mode 100644 index 0000000..e95ab6c --- /dev/null +++ b/src/libskabus/skabus_pub_send_cb.c @@ -0,0 +1,25 @@ +/* ISC license. */ + +#include + +#include +#include +#include + +#include + +int skabus_pub_send_cb (unixmessage_t const *m, void *p) +{ + skabus_pub_send_result_t *r = p ; + if (!m->len || m->nfds) return (errno = EPROTO, 0) ; + if (m->s[0]) + { + r->u = 0 ; + r->err = m->s[0] ; + return 1 ; + } + if (m->len != 9) return (errno = EPROTO, 0) ; + uint64_unpack_big(m->s + 1, &r->u) ; + r->err = 0 ; + return 1 ; +} -- cgit v1.2.3