blob: fa607e1263859fa52004b9bb8632bf8bcdc9ef27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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 */
|