client-c
0.8.1
|
External interface for socket manipulations used by Kaa transport channel implementations. More...
Go to the source code of this file.
Classes | |
struct | kaa_dns_resolve_listener_t |
Interface for the deferred DNS results. More... | |
struct | kaa_dns_resolve_info_t |
The target host information which is used for the DNS resolve needs. More... | |
Macros | |
#define | KAA_TCP_SOCKET_NOT_SET -1 |
Typedefs | |
typedef kaa_error_t(* | on_dns_resolve_complete_fn )(void *context, const kaa_sockaddr_t *addr, kaa_socklen_t addr_size) |
The callback for successful DNS results. See ext_tcp_utils_getaddrbyhost. More... | |
typedef kaa_error_t(* | on_dns_resolve_failed_fn )(void *context) |
The callback for negative host resolve results. More... | |
Functions | |
ext_tcp_utils_function_return_state_t | ext_tcp_utils_getaddrbyhost (kaa_dns_resolve_listener_t *resolve_listener, const kaa_dns_resolve_info_t *resolve_props, kaa_sockaddr_t *result, kaa_socklen_t *result_size) |
Resolves the address of the target host. More... | |
kaa_error_t | ext_tcp_utils_set_sockaddr_port (kaa_sockaddr_t *addr, uint16_t port) |
Sets a new port value to the given sockaddr structure. More... | |
kaa_error_t | ext_tcp_utils_open_tcp_socket (kaa_fd_t *fd, const kaa_sockaddr_t *destination, kaa_socklen_t destination_size) |
Creates a non-blocking TCP socket and connects it to the given target host. More... | |
ext_tcp_socket_state_t | ext_tcp_utils_tcp_socket_check (kaa_fd_t fd, const kaa_sockaddr_t *destination, kaa_socklen_t destination_size) |
Checks the state of the given socket descriptor. More... | |
ext_tcp_socket_io_errors_t | ext_tcp_utils_tcp_socket_write (kaa_fd_t fd, const char *buffer, size_t buffer_size, size_t *bytes_written) |
Writes the buffer into the given socket. More... | |
ext_tcp_socket_io_errors_t | ext_tcp_utils_tcp_socket_read (kaa_fd_t fd, char *buffer, size_t buffer_size, size_t *bytes_read) |
Reads bytes from the given socket. More... | |
kaa_error_t | ext_tcp_utils_tcp_socket_close (kaa_fd_t fd) |
Closes the given socket. More... | |
External interface for socket manipulations used by Kaa transport channel implementations.
Copyright 2014-2016 CyberVision, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file ext_tcp_utils.h.
#define KAA_TCP_SOCKET_NOT_SET -1 |
Definition at line 35 of file ext_tcp_utils.h.
typedef kaa_error_t(* on_dns_resolve_complete_fn)(void *context, const kaa_sockaddr_t *addr, kaa_socklen_t addr_size) |
The callback for successful DNS results. See ext_tcp_utils_getaddrbyhost.
[in] | context | Callback's context. |
[in] | addr | The sockaddr structure of the resolved target host. |
[in] | addr_size | The size of the sockaddr structure. |
Definition at line 69 of file ext_tcp_utils.h.
typedef kaa_error_t(* on_dns_resolve_failed_fn)(void *context) |
The callback for negative host resolve results.
See ext_tcp_utils_getaddrbyhost.
[in] | context | Callback's context. |
Definition at line 83 of file ext_tcp_utils.h.
Enumerator | |
---|---|
KAA_TCP_SOCK_IO_OK | |
KAA_TCP_SOCK_IO_EOF | |
KAA_TCP_SOCK_IO_ERROR |
Definition at line 53 of file ext_tcp_utils.h.
Enumerator | |
---|---|
KAA_TCP_SOCK_ERROR | |
KAA_TCP_SOCK_CONNECTING | |
KAA_TCP_SOCK_CONNECTED |
Definition at line 46 of file ext_tcp_utils.h.
Enumerator | |
---|---|
RET_STATE_VALUE_ERROR | |
RET_STATE_BUFFER_NOT_ENOUGH | |
RET_STATE_VALUE_READY | |
RET_STATE_VALUE_IN_PROGRESS |
Definition at line 38 of file ext_tcp_utils.h.
ext_tcp_utils_function_return_state_t ext_tcp_utils_getaddrbyhost | ( | kaa_dns_resolve_listener_t * | resolve_listener, |
const kaa_dns_resolve_info_t * | resolve_props, | ||
kaa_sockaddr_t * | result, | ||
kaa_socklen_t * | result_size | ||
) |
Resolves the address of the target host.
[in] | resolve_listener | The listener properties. It is used in case when this function can't resolve a hostname right now. |
[in] | resolve_props | The target host properties (like hostname and port). |
[out] | result | The sockaddr_* structure to which the result will be copied. |
[in,out] | result_size | The total size of the given storage. It will be updated by the actual result size. |
kaa_error_t ext_tcp_utils_open_tcp_socket | ( | kaa_fd_t * | fd, |
const kaa_sockaddr_t * | destination, | ||
kaa_socklen_t | destination_size | ||
) |
Creates a non-blocking TCP socket and connects it to the given target host.
[out] | fd | The valid pointer to a socket descriptor where the result will be saved. |
[in] | destination | The destination address of the target host. |
[in] | destination_size | The size of the destination address. |
kaa_error_t ext_tcp_utils_set_sockaddr_port | ( | kaa_sockaddr_t * | addr, |
uint16_t | port | ||
) |
Sets a new port value to the given sockaddr structure.
[in] | addr | The valid pointer to a sockaddr structure. |
[in] | port | The new port value in a host byte order. |
ext_tcp_socket_state_t ext_tcp_utils_tcp_socket_check | ( | kaa_fd_t | fd, |
const kaa_sockaddr_t * | destination, | ||
kaa_socklen_t | destination_size | ||
) |
Checks the state of the given socket descriptor.
[in] | fd | The socket descriptor which is going to be checked. |
[in] | destination | The destination address of the target host. |
[in] | destination_size | The size of the destination address. |
kaa_error_t ext_tcp_utils_tcp_socket_close | ( | kaa_fd_t | fd | ) |
Closes the given socket.
[in] | fd | The socket descriptor which is going to be closed. |
ext_tcp_socket_io_errors_t ext_tcp_utils_tcp_socket_read | ( | kaa_fd_t | fd, |
char * | buffer, | ||
size_t | buffer_size, | ||
size_t * | bytes_read | ||
) |
Reads bytes from the given socket.
[in] | fd | The socket descriptor. |
[in] | buffer | The buffer to which the read result will be saved. |
[in] | buffer_size | The maximum number of bytes to be read. |
[out] | bytes_read | The actual number of bytes which were read from the socket. |
ext_tcp_socket_io_errors_t ext_tcp_utils_tcp_socket_write | ( | kaa_fd_t | fd, |
const char * | buffer, | ||
size_t | buffer_size, | ||
size_t * | bytes_written | ||
) |
Writes the buffer into the given socket.
[in] | fd | The socket descriptor. |
[in] | buffer | The buffer which is going to be written into the socket. |
[in] | buffer_size | The size of the given buffer. |
[out] | bytes_written | The actual number of bytes which were successfully written into the socket. |