ipc.h (877B)
1 #ifndef __LINKD_IPC_H__ 2 #define __LINKD_IPC_H__ 3 4 #include <poll.h> 5 6 // RESP server. Speaks the Redis wire protocol over any number of unix and tcp 7 // listeners, as configured by `listen` in /etc/linkd.cnf. 8 9 #define IPC_ROLE_NONE 0 // connected, not authenticated 10 #define IPC_ROLE_READONLY 1 // IFQUERY, INFO, COMMAND, PING 11 #define IPC_ROLE_FULL 2 // + IFUP, IFDOWN, IFRELOAD 12 13 // Upper bound on fds this module contributes to the poll set. 14 #define IPC_MAX_LISTENERS 8 15 #define IPC_MAX_CONNS 64 16 #define IPC_MAX_POLLFDS (IPC_MAX_LISTENERS + IPC_MAX_CONNS) 17 18 int ipc_init(void); 19 void ipc_fini(void); 20 21 // Fill `pfds` with listeners and live connections. Returns the count. 22 int ipc_pollfds(struct pollfd *pfds, int max); 23 24 // Service whatever `ipc_pollfds` filled in, after poll() has run. 25 void ipc_dispatch(struct pollfd *pfds, int n); 26 27 #endif // __LINKD_IPC_H__