18c2ecf20Sopenharmony_ci
28c2ecf20Sopenharmony_ci#ifndef _IPCSOCKET_H
38c2ecf20Sopenharmony_ci#define _IPCSOCKET_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#define MAX_SOCK_NAME_LEN	64
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_cichar sock_name[MAX_SOCK_NAME_LEN];
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* This structure is responsible for holding the IPC data
118c2ecf20Sopenharmony_ci * data: hold the buffer fd
128c2ecf20Sopenharmony_ci * len: just the length of 32-bit integer fd
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_cistruct socketdata {
158c2ecf20Sopenharmony_ci	int data;
168c2ecf20Sopenharmony_ci	unsigned int len;
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* This API is used to open the IPC socket connection
208c2ecf20Sopenharmony_ci * name: implies a unique socket name in the system
218c2ecf20Sopenharmony_ci * connecttype: implies server(0) or client(1)
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ciint opensocket(int *sockfd, const char *name, int connecttype);
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* This is the API to send socket data over IPC socket */
268c2ecf20Sopenharmony_ciint sendtosocket(int sockfd, struct socketdata *data);
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* This is the API to receive socket data over IPC socket */
298c2ecf20Sopenharmony_ciint receivefromsocket(int sockfd, struct socketdata *data);
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* This is the API to close the socket connection */
328c2ecf20Sopenharmony_ciint closesocket(int sockfd, char *name);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#endif
36