Move UNIX domain socket creation to utils.c

The network socket code is now completely inside utils.c.
This commit is contained in:
Markus Mäkelä
2017-03-13 18:10:58 +02:00
parent 573615889b
commit 9952676052
3 changed files with 74 additions and 61 deletions

View File

@ -69,6 +69,23 @@ void utils_end();
int open_network_socket(enum mxs_socket_type type, struct sockaddr_storage *addr,
const char *host, uint16_t port);
/**
* @brief Create a UNIX domain socket
*
* This opens and prepares a UNIX domain socket for use. The @c addr parameter
* can be given to the bind() function to bind the socket.
*
* @param type Type of the socket, either MXS_SOCKET_LISTENER for a listener
* socket or MXS_SOCKET_NETWORK for a network connection socket
* @param addr Pointer to a struct sockaddr_un where the socket configuration
* is stored
* @param path Path to the socket
*
* @return The opened socket or -1 on failure
*/
int open_unix_socket(enum mxs_socket_type type, struct sockaddr_un *addr,
const char *path);
int setnonblocking(int fd);
char *gw_strend(register const char *s);
static char gw_randomchar();