EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
sockctl.h
Go to the documentation of this file.
1 
11 #ifndef SOCKCTL_H
12 #define SOCKCTL_H
13 
14 #include <netinet/in.h>
15 #include <sys/types.h>
16 #include <sys/un.h>
17 
22 };
23 
29  union {
30  struct sockaddr_un addr_un;
31  struct sockaddr_in addr_in;
32  } caddr;
33  int len;
34  enum SOCKET_TYPE type;
35 };
36 
50 int create_domain_client(const char *path);
51 
58 int create_domain_server(const char *server_path);
59 
72 int close_domain_socket(int unix_domain_socket_fd);
73 
80 int create_udp_server(unsigned int port);
81 
92 ssize_t read_socket_data(int sock, char *data, size_t data_len,
93  struct client_address *addr, int flags);
94 
107 ssize_t read_domain_data_s(int sock, char *data, size_t data_len, char *addr,
108  int flags);
109 
119 ssize_t write_socket_data(int sock, const char *data, size_t data_len,
120  const struct client_address *addr);
121 
132 ssize_t write_domain_data_s(int sock, const char *data, size_t data_len,
133  const char *addr);
134 
147 int writeread_domain_data_str(char *socket_path, const char *write_str,
148  char **reply);
149 #endif
int create_domain_client(const char *path)
Create a unix domain client socket.
Definition: sockctl.c:108
int writeread_domain_data_str(char *socket_path, const char *write_str, char **reply)
Write and read a domain data string.
Definition: sockctl.c:396
ssize_t write_domain_data_s(int sock, const char *data, size_t data_len, const char *addr)
Write data to the domain server socket with a string address.
Definition: sockctl.c:321
ssize_t write_socket_data(int sock, const char *data, size_t data_len, const struct client_address *addr)
Write data to the server socket.
Definition: sockctl.c:373
int create_domain_server(const char *server_path)
Create a domain server object.
Definition: sockctl.c:150
ssize_t read_socket_data(int sock, char *data, size_t data_len, struct client_address *addr, int flags)
Read data from the server socket.
Definition: sockctl.c:279
SOCKET_TYPE
Definition: sockctl.h:18
@ SOCKET_TYPE_DOMAIN
Definition: sockctl.h:20
@ SOCKET_TYPE_NONE
Definition: sockctl.h:19
@ SOCKET_TYPE_UDP
Definition: sockctl.h:21
int create_udp_server(unsigned int port)
Create a udp server object.
Definition: sockctl.c:214
int close_domain_socket(int unix_domain_socket_fd)
Closes and cleans up a unix domain socket.
Definition: sockctl.c:186
ssize_t read_domain_data_s(int sock, char *data, size_t data_len, char *addr, int flags)
Read data from the domain server socket with a string address.
Definition: sockctl.c:302
Client address structure definition.
Definition: sockctl.h:28
struct sockaddr_un addr_un
Definition: sockctl.h:30
union client_address::@8 caddr
struct sockaddr_in addr_in
Definition: sockctl.h:31
enum SOCKET_TYPE type
Definition: sockctl.h:34
int len
Definition: sockctl.h:33