1 2 #ifndef _IPCSOCKET_H 3 #define _IPCSOCKET_H 4 5 6 #define MAX_SOCK_NAME_LEN 64 7 8 char sock_name[MAX_SOCK_NAME_LEN]; 9 10 /* This structure is responsible for holding the IPC data 11 * data: hold the buffer fd 12 * len: just the length of 32-bit integer fd 13 */ 14 struct socketdata { 15 int data; 16 unsigned int len; 17 }; 18 19 /* This API is used to open the IPC socket connection 20 * name: implies a unique socket name in the system 21 * connecttype: implies server(0) or client(1) 22 */ 23 int opensocket(int *sockfd, const char *name, int connecttype); 24 25 /* This is the API to send socket data over IPC socket */ 26 int sendtosocket(int sockfd, struct socketdata *data); 27 28 /* This is the API to receive socket data over IPC socket */ 29 int receivefromsocket(int sockfd, struct socketdata *data); 30 31 /* This is the API to close the socket connection */ 32 int closesocket(int sockfd, char *name); 33 34 35 #endif 36