aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/unix-domain-socket.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/unix-domain-socket.hh')
-rw-r--r--src/libutil/unix-domain-socket.hh31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libutil/unix-domain-socket.hh b/src/libutil/unix-domain-socket.hh
new file mode 100644
index 000000000..692ad2627
--- /dev/null
+++ b/src/libutil/unix-domain-socket.hh
@@ -0,0 +1,31 @@
+#pragma once
+///@file
+
+#include "file-descriptor.hh"
+#include "types.hh"
+
+#include <unistd.h>
+
+namespace nix {
+
+/**
+ * Create a Unix domain socket.
+ */
+AutoCloseFD createUnixDomainSocket();
+
+/**
+ * Create a Unix domain socket in listen mode.
+ */
+AutoCloseFD createUnixDomainSocket(const Path & path, mode_t mode);
+
+/**
+ * Bind a Unix domain socket to a path.
+ */
+void bind(int fd, const std::string & path);
+
+/**
+ * Connect to a Unix domain socket.
+ */
+void connect(int fd, const std::string & path);
+
+}