1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Feature: Defined the socket API

This commit is contained in:
Philipp Schafft 2019-09-18 18:40:59 +00:00
parent 23d4385e94
commit 8ce757f1f7

View File

@ -29,10 +29,56 @@ extern "C" {
/* Put stuff here */
#include "io.h"
#include <igloo/config.h>
#include "types.h"
igloo_RO_FORWARD_TYPE(igloo_socket_t);
typedef enum {
igloo_SOCKET_SHUTDOWN_NONE = 0x0,
igloo_SOCKET_SHUTDOWN_RECEIVE = 0x1,
igloo_SOCKET_SHUTDOWN_SEND = 0x2,
igloo_SOCKET_SHUTDOWN_RECEIVESEND = igloo_SOCKET_SHUTDOWN_RECEIVE|igloo_SOCKET_SHUTDOWN_SEND
} igloo_socket_shutdown_t;
/* Advanced control functions.
*/
typedef enum {
igloo_SOCKET_CONTROL_NONE = 0,
igloo_SOCKET_CONTROL_SET_NODELAY,
igloo_SOCKET_CONTROL_SET_SEND_BUFFER,
igloo_SOCKET_CONTROL_SET_RECEIVE_BUFFER
} igloo_socket_control_t;
typedef enum {
igloo_SOCKET_ADDRESSOP_CLEAR,
igloo_SOCKET_ADDRESSOP_ADD,
igloo_SOCKET_ADDRESSOP_REMOVE,
igloo_SOCKET_ADDRESSOP_REPLACE
} igloo_socket_addressop_t;
typedef enum {
igloo_SOCKET_ENDPOINT_LOCAL,
igloo_SOCKET_ENDPOINT_LOCAL_PHYSICAL,
igloo_SOCKET_ENDPOINT_LOCAL_LOGICAL,
igloo_SOCKET_ENDPOINT_PEER,
igloo_SOCKET_ENDPOINT_PEER_PHYSICAL,
igloo_SOCKET_ENDPOINT_PEER_LOGICAL
} igloo_socket_endpoint_t;
igloo_socket_t * igloo_socket_new(igloo_socketaddr_domain_t domain, igloo_socketaddr_type_t type, igloo_socketaddr_protocol_t protocol, const char *name, igloo_ro_t associated, igloo_ro_t instance);
igloo_error_t igloo_socket_alter_address(igloo_socket_t *sock, igloo_socket_addressop_t op, igloo_socket_endpoint_t endpoint, igloo_socketaddr_t *addr);
igloo_socketaddr_t * igloo_socket_get_main_address(igloo_socket_t *sock, igloo_socket_endpoint_t endpoint, igloo_error_t *error);
igloo_list_t * igloo_socket_get_address(igloo_socket_t *sock, igloo_socket_endpoint_t endpoint, igloo_error_t *error);
igloo_error_t igloo_socket_connect(igloo_socket_t *sock);
igloo_error_t igloo_socket_listen(igloo_socket_t *sock, ssize_t backlog);
igloo_error_t igloo_socket_shutdown(igloo_socket_t *sock, igloo_socket_shutdown_t how);
igloo_socket_t * igloo_socket_accept(igloo_socket_t *sock, igloo_error_t *error);
igloo_error_t igloo_socket_control(igloo_socket_t *sock, igloo_socket_control_t control, ...);
#ifdef __cplusplus
}
#endif