diff options
| author | Nikita Langer <nikitalanger@icloud.com> | 2026-08-06 12:12:00 +0200 |
|---|---|---|
| committer | Nikita Langer <nikitalanger@icloud.com> | 2026-08-06 12:12:00 +0200 |
| commit | 11e470ab4254304192997834e26166cfddc78f80 (patch) | |
| tree | e425d7826c5c3821e9717bdce6b833d722cf3bf7 /IPCClient.h | |
| parent | ce36d2ea39fa4883e40f06d5d61fde2847bee987 (diff) | |
| download | dwm-11e470ab4254304192997834e26166cfddc78f80.tar.gz dwm-11e470ab4254304192997834e26166cfddc78f80.tar.bz2 dwm-11e470ab4254304192997834e26166cfddc78f80.tar.xz dwm-11e470ab4254304192997834e26166cfddc78f80.zip | |
Diffstat (limited to 'IPCClient.h')
| -rw-r--r-- | IPCClient.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/IPCClient.h b/IPCClient.h new file mode 100644 index 0000000..307dfba --- /dev/null +++ b/IPCClient.h @@ -0,0 +1,61 @@ +#ifndef IPC_CLIENT_H_ +#define IPC_CLIENT_H_ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/epoll.h> + +typedef struct IPCClient IPCClient; +/** + * This structure contains the details of an IPC Client and pointers for a + * linked list + */ +struct IPCClient { + int fd; + int subscriptions; + + char *buffer; + uint32_t buffer_size; + + struct epoll_event event; + IPCClient *next; + IPCClient *prev; +}; + +typedef IPCClient *IPCClientList; + +/** + * Allocate memory for new IPCClient with the specified file descriptor and + * initialize struct. + * + * @param fd File descriptor of IPC client + * + * @return Address to allocated IPCClient struct + */ +IPCClient *ipc_client_new(int fd); + +/** + * Add an IPC Client to the specified list + * + * @param list Address of the list to add the client to + * @param nc Address of the IPCClient + */ +void ipc_list_add_client(IPCClientList *list, IPCClient *nc); + +/** + * Remove an IPCClient from the specified list + * + * @param list Address of the list to remove the client from + * @param c Address of the IPCClient + */ +void ipc_list_remove_client(IPCClientList *list, IPCClient *c); + +/** + * Get an IPCClient from the specified IPCClient list + * + * @param list List to remove the client from + * @param fd File descriptor of the IPCClient + */ +IPCClient *ipc_list_get_client(IPCClientList list, int fd); + +#endif // IPC_CLIENT_H_ |
