summary refs log tree commit diff
path: root/src/libunixonacid
diff options
context:
space:
mode:
Diffstat (limited to 'src/libunixonacid')
-rw-r--r--src/libunixonacid/unixconnection_free.c11
-rw-r--r--src/libunixonacid/unixconnection_init.c10
-rw-r--r--src/libunixonacid/unixconnection_zero.c5
3 files changed, 26 insertions, 0 deletions
diff --git a/src/libunixonacid/unixconnection_free.c b/src/libunixonacid/unixconnection_free.c
new file mode 100644
index 0000000..52f9027
--- /dev/null
+++ b/src/libunixonacid/unixconnection_free.c
@@ -0,0 +1,11 @@
+ /* ISC license. */
+
+#include <skalibs/unixmessage.h>
+#include <skalibs/unixconnection.h>
+
+void unixconnection_free (unixconnection_t *io)
+{
+  unixmessage_sender_free(&io->out) ;
+  unixmessage_receiver_free(&io->in) ;
+  *io = unixconnection_zero ;
+}
diff --git a/src/libunixonacid/unixconnection_init.c b/src/libunixonacid/unixconnection_init.c
new file mode 100644
index 0000000..7831d6a
--- /dev/null
+++ b/src/libunixonacid/unixconnection_init.c
@@ -0,0 +1,10 @@
+ /* ISC license. */
+
+#include <skalibs/unixmessage.h>
+#include <skalibs/unixconnection.h>
+
+void unixconnection_init (unixconnection_t *io, int fdin, int fdout)
+{
+  unixmessage_receiver_init(&io->in, fdin, io->mainbuf, UNIXMESSAGE_BUFSIZE, io->auxbuf, UNIXMESSAGE_AUXBUFSIZE) ;
+  unixmessage_sender_init(&io->out, fdout) ;
+}
diff --git a/src/libunixonacid/unixconnection_zero.c b/src/libunixonacid/unixconnection_zero.c
new file mode 100644
index 0000000..9100cac
--- /dev/null
+++ b/src/libunixonacid/unixconnection_zero.c
@@ -0,0 +1,5 @@
+ /* ISC license. */
+
+#include <skalibs/unixconnection.h>
+
+unixconnection_t const unixconnection_zero = UNIXCONNECTION_ZERO ;