summaryrefslogtreecommitdiff
path: root/src/client.h
diff options
context:
space:
mode:
authorauric <auric@japegames.com>2026-02-21 11:08:36 -0600
committerauric <auric@japegames.com>2026-02-21 11:08:36 -0600
commit0d706ae72ceefd74053ad6cb0900ecce6cf1f085 (patch)
tree6faf7d3919182b8838a6ae69ad1a2a0fac468740 /src/client.h
Add Umbrella 0.1.5
Diffstat (limited to 'src/client.h')
-rw-r--r--src/client.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/client.h b/src/client.h
new file mode 100644
index 0000000..fa607e1
--- /dev/null
+++ b/src/client.h
@@ -0,0 +1,42 @@
+#ifndef UMBRELLA_CLIENT_H
+#define UMBRELLA_CLIENT_H
+
+#include "umbrella.h"
+
+/*
+ * client_listen: create and bind the Unix domain socket.
+ * Returns the listening fd, or -1 on error.
+ */
+int client_listen(void);
+
+/*
+ * client_accept: accept a new client connection from listen_fd.
+ * Adds the client to g.clients and registers it with epoll.
+ * Returns 0 on success, -1 on error.
+ */
+int client_accept(int listen_fd);
+
+/*
+ * client_handle: read and dispatch one message from a client fd.
+ * Returns 0 to keep the connection, -1 to close it.
+ */
+int client_handle(int fd);
+
+/*
+ * client_remove: close a client connection and remove from g.clients.
+ */
+void client_remove(int fd);
+
+/*
+ * client_find: find a Client by fd.
+ * Returns pointer into g.clients, or NULL.
+ */
+Client *client_find(int fd);
+
+/*
+ * client_broadcast_output: send output to all clients attached to unit_name.
+ */
+void client_broadcast_output(const char *unit_name,
+ const char *data, int history);
+
+#endif /* UMBRELLA_CLIENT_H */