#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 */