src/server_socket.h File Reference
#include <stdbool.h>
#include <glib.h>
Go to the source code of this file.
Typedefs |
typedef void(* | server_socket_callback_t )(int fd, const struct sockaddr *address, size_t address_length, int uid, void *ctx) |
Functions |
struct server_socket * | server_socket_new (server_socket_callback_t callback, void *callback_ctx) |
void | server_socket_free (struct server_socket *ss) |
bool | server_socket_open (struct server_socket *ss, GError **error_r) |
void | server_socket_close (struct server_socket *ss) |
bool | server_socket_add_fd (struct server_socket *ss, int fd, GError **error_r) |
| Add a socket descriptor that is accepting connections.
|
bool | server_socket_add_port (struct server_socket *ss, unsigned port, GError **error_r) |
| Add a listener on a port on all interfaces.
|
bool | server_socket_add_host (struct server_socket *ss, const char *hostname, unsigned port, GError **error_r) |
| Resolves a host name, and adds listeners on all addresses in the result set.
|
bool | server_socket_add_path (struct server_socket *ss, const char *path, GError **error_r) |
| Add a listener on a Unix domain socket.
|
Typedef Documentation
Function Documentation
bool server_socket_add_fd |
( |
struct server_socket * |
ss, |
|
|
int |
fd, |
|
|
GError ** |
error_r | |
|
) |
| | |
Add a socket descriptor that is accepting connections.
After this has been called, don't call server_socket_open(), because the socket is already open.
bool server_socket_add_host |
( |
struct server_socket * |
ss, |
|
|
const char * |
hostname, |
|
|
unsigned |
port, |
|
|
GError ** |
error_r | |
|
) |
| | |
Resolves a host name, and adds listeners on all addresses in the result set.
- Parameters:
-
| hostname | the host name to be resolved |
| port | the TCP port |
| error_r | location to store the error occurring, or NULL to ignore errors |
- Returns:
- true on success
bool server_socket_add_path |
( |
struct server_socket * |
ss, |
|
|
const char * |
path, |
|
|
GError ** |
error_r | |
|
) |
| | |
Add a listener on a Unix domain socket.
- Parameters:
-
| path | the absolute socket path |
| error_r | location to store the error occurring, or NULL to ignore errors |
- Returns:
- true on success
bool server_socket_add_port |
( |
struct server_socket * |
ss, |
|
|
unsigned |
port, |
|
|
GError ** |
error_r | |
|
) |
| | |
Add a listener on a port on all interfaces.
- Parameters:
-
| port | the TCP port |
| error_r | location to store the error occurring, or NULL to ignore errors |
- Returns:
- true on success
void server_socket_close |
( |
struct server_socket * |
ss |
) |
|
void server_socket_free |
( |
struct server_socket * |
ss |
) |
|
bool server_socket_open |
( |
struct server_socket * |
ss, |
|
|
GError ** |
error_r | |
|
) |
| | |