dwm

Kris's build of dwm
git clone git clone https://git.krisyotam.com/krisyotam/dwm.git
Log | Files | Refs | README | LICENSE

IPCClient.h (1355B)


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