2018-10-03 21:52:11 +02:00
|
|
|
#ifndef __IPC_USOCKET_H__
|
|
|
|
#define __IPC_USOCKET_H__
|
2016-12-17 18:00:04 +01:00
|
|
|
|
2018-11-04 09:50:17 +01:00
|
|
|
#include "ipc.h"
|
2018-11-02 21:03:54 +01:00
|
|
|
|
2016-12-18 00:54:43 +01:00
|
|
|
#define LISTEN_BACKLOG 128
|
|
|
|
|
2018-10-08 15:18:56 +02:00
|
|
|
// input: len = max buf size
|
|
|
|
// output: *sent = nb received bytes
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_send (const int32_t fd, const char *buf, size_t len, size_t * sent);
|
2018-10-08 15:18:56 +02:00
|
|
|
|
|
|
|
// allocation of *len bytes on *buf == NULL
|
|
|
|
//
|
|
|
|
// output: *len = nb sent bytes
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_recv (int32_t fd, char **buf, size_t * len);
|
2018-10-08 15:18:56 +02:00
|
|
|
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_close (int32_t fd);
|
2016-12-17 18:00:04 +01:00
|
|
|
|
|
|
|
// same as connect(2)
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_connect (int32_t * fd, const char *path);
|
2016-12-18 00:54:43 +01:00
|
|
|
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_init (int32_t * fd, const char *path);
|
2016-12-18 00:54:43 +01:00
|
|
|
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_accept (int32_t fd, int32_t * pfd);
|
2016-12-18 00:54:43 +01:00
|
|
|
|
|
|
|
// same as unlink(2)
|
2020-01-01 12:11:34 +01:00
|
|
|
struct ipc_error usock_remove (const char *path);
|
2018-10-10 23:08:58 +02:00
|
|
|
|
2016-12-17 18:00:04 +01:00
|
|
|
#endif
|