ipcsocket.h 861 B

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