Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

  1. #ifndef IPC_CLIENT_H_
  2. #define IPC_CLIENT_H_
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <sys/epoll.h>
  6. typedef struct IPCClient IPCClient;
  7. /**
  8. * This structure contains the details of an IPC Client and pointers for a
  9. * linked list
  10. */
  11. struct IPCClient {
  12. int fd;
  13. int subscriptions;
  14. char *buffer;
  15. uint32_t buffer_size;
  16. struct epoll_event event;
  17. IPCClient *next;
  18. IPCClient *prev;
  19. };
  20. typedef IPCClient *IPCClientList;
  21. /**
  22. * Allocate memory for new IPCClient with the specified file descriptor and
  23. * initialize struct.
  24. *
  25. * @param fd File descriptor of IPC client
  26. *
  27. * @return Address to allocated IPCClient struct
  28. */
  29. IPCClient *ipc_client_new(int fd);
  30. /**
  31. * Add an IPC Client to the specified list
  32. *
  33. * @param list Address of the list to add the client to
  34. * @param nc Address of the IPCClient
  35. */
  36. void ipc_list_add_client(IPCClientList *list, IPCClient *nc);
  37. /**
  38. * Remove an IPCClient from the specified list
  39. *
  40. * @param list Address of the list to remove the client from
  41. * @param c Address of the IPCClient
  42. */
  43. void ipc_list_remove_client(IPCClientList *list, IPCClient *c);
  44. /**
  45. * Get an IPCClient from the specified IPCClient list
  46. *
  47. * @param list List to remove the client from
  48. * @param fd File descriptor of the IPCClient
  49. */
  50. IPCClient *ipc_list_get_client(IPCClientList list, int fd);
  51. #endif // IPC_CLIENT_H_