libsocket
libunixsocket.h
Go to the documentation of this file.
1 #ifndef LIBSOCKET_LIBUNIXSOCKET_H_61CF2FC7034E4AD982DA08144D578572
2 #define LIBSOCKET_LIBUNIXSOCKET_H_61CF2FC7034E4AD982DA08144D578572
3 
33 /* Headers (e.g. for flags) */
34 #include <sys/socket.h>
35 #include <sys/types.h>
36 
37 /* Macro definitions */
38 
39 #define LIBSOCKET_STREAM 1
40 #define LIBSOCKET_DGRAM 2
41 
42 #define LIBSOCKET_READ 1
43 #define LIBSOCKET_WRITE 2
44 
45 #ifdef __cplusplus
46 #ifdef MIXED
47 extern "C" {
48 #endif
49 #endif
50 
51 extern int create_unix_stream_socket(const char* path, int flags);
52 extern int create_unix_dgram_socket(const char* bind_path, int flags);
53 extern int connect_unix_dgram_socket(int sfd, const char* path);
54 extern int destroy_unix_socket(int sfd);
55 extern int shutdown_unix_stream_socket(int sfd, int method);
56 extern int create_unix_server_socket(const char* path, int socktype, int flags);
57 extern int accept_unix_stream_socket(int sfd, int flags);
58 extern ssize_t recvfrom_unix_dgram_socket(int sfd, void* buf, size_t size,
59  char* from, size_t from_size,
60  int recvfrom_flags);
61 extern ssize_t sendto_unix_dgram_socket(int sfd, const void* buf, size_t size,
62  const char* path, int sendto_flags);
63 
64 #ifdef __cplusplus
65 #ifdef MIXED
66 }
67 #endif
68 #endif
69 
70 #endif
int accept_unix_stream_socket(int sfd, int flags)
Accept connections on a passive UNIX socket.
int create_unix_dgram_socket(const char *bind_path, int flags)
Create a UNIX DGRAM socket.
int connect_unix_dgram_socket(int sfd, const char *path)
Connect a datagram socket.
ssize_t recvfrom_unix_dgram_socket(int sfd, void *buf, size_t size, char *from, size_t from_size, int recvfrom_flags)
Receive datagram from another UNIX socket.
int create_unix_stream_socket(const char *path, int flags)
Create and connect a new UNIX STREAM socket.
int shutdown_unix_stream_socket(int sfd, int method)
Shut a socket down.
int destroy_unix_socket(int sfd)
Close a socket.
ssize_t sendto_unix_dgram_socket(int sfd, const void *buf, size_t size, const char *path, int sendto_flags)
Send datagram to socket.
int create_unix_server_socket(const char *path, int socktype, int flags)
Create a passive UNIX socket.