|
Kore
|
Provides low-level network-communication via UDP or TCP-sockets. More...
#include <kinc/global.h>Go to the source code of this file.
Data Structures | |
| struct | kinc_socket |
| struct | kinc_socket_options |
Typedefs | |
| typedef enum kinc_socket_protocol | kinc_socket_protocol_t |
| typedef enum kinc_socket_family | kinc_socket_family_t |
| typedef struct kinc_socket | kinc_socket_t |
| typedef struct kinc_socket_options | kinc_socket_options_t |
Enumerations | |
| enum | kinc_socket_protocol { KINC_SOCKET_PROTOCOL_UDP , KINC_SOCKET_PROTOCOL_TCP } |
| enum | kinc_socket_family { KINC_SOCKET_FAMILY_IP4 , KINC_SOCKET_FAMILY_IP6 } |
Functions | |
| KINC_FUNC void | kinc_socket_options_set_defaults (kinc_socket_options_t *options) |
| Initializes a socket-options-object to the default options. | |
| KINC_FUNC void | kinc_socket_init (kinc_socket_t *socket) |
| Initializes a socket-object. To set the host and port use kinc_socket_set. Host will be localhost Port will be 8080 Family will be IPv4 Protocol will be TCP. | |
| KINC_FUNC bool | kinc_socket_set (kinc_socket_t *socket, const char *host, int port, kinc_socket_family_t family, kinc_socket_protocol_t protocol) |
| Sets the sockets properties. | |
| KINC_FUNC void | kinc_socket_destroy (kinc_socket_t *socket) |
| Destroys a socket-object. | |
| KINC_FUNC bool | kinc_socket_open (kinc_socket_t *socket, kinc_socket_options_t *options) |
| Opens a socket-connection. | |
| KINC_FUNC bool | kinc_socket_select (kinc_socket_t *socket, uint32_t waittime, bool read, bool write) |
| For use with non-blocking sockets to try to see if we are connected. | |
| KINC_FUNC bool | kinc_socket_bind (kinc_socket_t *socket) |
| KINC_FUNC bool | kinc_socket_listen (kinc_socket_t *socket, int backlog) |
| KINC_FUNC bool | kinc_socket_accept (kinc_socket_t *socket, kinc_socket_t *new_socket, unsigned *remote_address, unsigned *remote_port) |
| KINC_FUNC bool | kinc_socket_connect (kinc_socket_t *socket) |
| KINC_FUNC int | kinc_socket_send (kinc_socket_t *socket, const uint8_t *data, int size) |
| KINC_FUNC int | kinc_socket_send_address (kinc_socket_t *socket, unsigned address, int port, const uint8_t *data, int size) |
| KINC_FUNC int | kinc_socket_send_url (kinc_socket_t *socket, const char *url, int port, const uint8_t *data, int size) |
| KINC_FUNC int | kinc_socket_receive (kinc_socket_t *socket, uint8_t *data, int maxSize, unsigned *from_address, unsigned *from_port) |
| KINC_FUNC unsigned | kinc_url_to_int (const char *url, int port) |
| Resolves a DNS-entry to an IP and returns its integer representation. | |
Provides low-level network-communication via UDP or TCP-sockets.
| KINC_FUNC void kinc_socket_destroy | ( | kinc_socket_t * | socket | ) |
Destroys a socket-object.
| socket | The socket to destroy |
| KINC_FUNC void kinc_socket_init | ( | kinc_socket_t * | socket | ) |
Initializes a socket-object. To set the host and port use kinc_socket_set. Host will be localhost Port will be 8080 Family will be IPv4 Protocol will be TCP.
| socket | The socket to initialize |
| KINC_FUNC bool kinc_socket_open | ( | kinc_socket_t * | socket, |
| kinc_socket_options_t * | options ) |
Opens a socket-connection.
| socket | The socket-object to use |
| protocol | The protocol to use |
| port | The port to use |
| options | The options to use |
| KINC_FUNC void kinc_socket_options_set_defaults | ( | kinc_socket_options_t * | options | ) |
Initializes a socket-options-object to the default options.
| options | The new default options |
| KINC_FUNC bool kinc_socket_select | ( | kinc_socket_t * | socket, |
| uint32_t | waittime, | ||
| bool | read, | ||
| bool | write ) |
For use with non-blocking sockets to try to see if we are connected.
| socket | The socket-object to use |
| waittime | The amount of time in seconds the select function will timeout. |
| read | Check if the socket is ready to be read from. |
| write | Check if the socket is ready to be written to. |
| KINC_FUNC bool kinc_socket_set | ( | kinc_socket_t * | socket, |
| const char * | host, | ||
| int | port, | ||
| kinc_socket_family_t | family, | ||
| kinc_socket_protocol_t | protocol ) |
Sets the sockets properties.
| socket | The socket-object to use |
| host | The host to use as IP or URL |
| port | The port to use |
| family | The IP-family to use |
| protocol | The protocol to use |
| KINC_FUNC unsigned kinc_url_to_int | ( | const char * | url, |
| int | port ) |
Resolves a DNS-entry to an IP and returns its integer representation.
| url | |
| port |