client-c
0.8.1
|
#include "../../kaa_error.h"
#include "../../platform/ext_transport_channel.h"
#include "../../platform/defaults.h"
#include "../../platform/ext_tcp_utils.h"
Go to the source code of this file.
Typedefs | |
typedef kaa_error_t(* | on_kaa_tcp_channel_event_fn )(void *context, kaa_tcp_channel_event_t event_type, kaa_fd_t fd) |
Notifies about the current channel's state. Used by kaa_tcp_channel_set_socket_events_callback . More... | |
Enumerations | |
enum | fd_event_t { FD_READ, FD_WRITE, FD_EXCEPTION } |
enum | kaa_tcp_channel_event_t { SOCKET_CONNECTED, SOCKET_DISCONNECTED, SOCKET_CONNECTION_ERROR } |
Functions | |
kaa_error_t | kaa_tcp_channel_create (kaa_transport_channel_interface_t *self, kaa_logger_t *logger, kaa_service_t *supported_services, size_t supported_service_count) |
Creates a Kaa TCP channel instance. More... | |
kaa_error_t | kaa_tcp_channel_get_descriptor (kaa_transport_channel_interface_t *self, kaa_fd_t *fd_p) |
Retrieves the socket descriptor from the given channel instance. More... | |
bool | kaa_tcp_channel_is_ready (kaa_transport_channel_interface_t *self, fd_event_t event_type) |
Checks whether the given channel instance is ready to handle the specified event. More... | |
kaa_error_t | kaa_tcp_channel_process_event (kaa_transport_channel_interface_t *self, fd_event_t event_type) |
Notifies the channel instance about the I/O event. More... | |
kaa_error_t | kaa_tcp_channel_get_max_timeout (kaa_transport_channel_interface_t *self, uint16_t *max_timeout) |
Retrieves the maximum timeout for the multiplexing I/O like select/poll. Used for kaa_tcp_channel_check_keepalive needs. More... | |
kaa_error_t | kaa_tcp_channel_check_keepalive (kaa_transport_channel_interface_t *self) |
Checks whether a keepalive timeout occurred. If so, sends a keepalive message to the server. More... | |
kaa_error_t | kaa_tcp_channel_set_socket_events_callback (kaa_transport_channel_interface_t *self, on_kaa_tcp_channel_event_fn callback, void *context) |
Sets the callback for the current channel connection state. More... | |
kaa_error_t | kaa_tcp_channel_disconnect (kaa_transport_channel_interface_t *self) |
Disconnects the current channel. More... | |
typedef kaa_error_t(* on_kaa_tcp_channel_event_fn)(void *context, kaa_tcp_channel_event_t event_type, kaa_fd_t fd) |
Notifies about the current channel's state. Used by kaa_tcp_channel_set_socket_events_callback .
[in] | context | Callback's context |
[in] | event_type | The current state of the channel (SOCKET_CONNECTED, SOCKET_DISCONNECTED or SOCKET_CONNECTION_ERROR). |
[in] | fd | The socket descriptor to which the event occurred. |
Definition at line 57 of file kaa_tcp_channel.h.
enum fd_event_t |
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.
Enumerator | |
---|---|
FD_READ | |
FD_WRITE | |
FD_EXCEPTION |
Definition at line 31 of file kaa_tcp_channel.h.
Enumerator | |
---|---|
SOCKET_CONNECTED | |
SOCKET_DISCONNECTED | |
SOCKET_CONNECTION_ERROR |
Definition at line 38 of file kaa_tcp_channel.h.
kaa_error_t kaa_tcp_channel_check_keepalive | ( | kaa_transport_channel_interface_t * | self | ) |
Checks whether a keepalive timeout occurred. If so, sends a keepalive message to the server.
Should be called if the multiplexing I/O (like select/poll) time limit expires.
[in] | channel | The channel instance. |
kaa_error_t kaa_tcp_channel_create | ( | kaa_transport_channel_interface_t * | self, |
kaa_logger_t * | logger, | ||
kaa_service_t * | supported_services, | ||
size_t | supported_service_count | ||
) |
Creates a Kaa TCP channel instance.
[in] | channel | The pointer to the channel instance. t* |
[in] | logger | The pointer to the Kaa logger instance. |
[in] | supported_services | A list of supported services for this channel. |
[in] | supported_service_count | The number of services in the list. |
kaa_error_t kaa_tcp_channel_disconnect | ( | kaa_transport_channel_interface_t * | self | ) |
Disconnects the current channel.
[in] | channel | The channel instance. |
kaa_error_t kaa_tcp_channel_get_descriptor | ( | kaa_transport_channel_interface_t * | self, |
kaa_fd_t * | fd_p | ||
) |
Retrieves the socket descriptor from the given channel instance.
[in] | channel | The channel instance. |
[out] | fd_p | The socket descriptor or KAA_TCP_SOCKET_NOT_SET if there is no open descriptor. |
kaa_error_t kaa_tcp_channel_get_max_timeout | ( | kaa_transport_channel_interface_t * | self, |
uint16_t * | max_timeout | ||
) |
Retrieves the maximum timeout for the multiplexing I/O like select/poll. Used for kaa_tcp_channel_check_keepalive needs.
[in] | channel | The channel instance. |
[out] | max_timeout | The maximum timeout value (in seconds), 0 - indicates that timeout is not used by this channel. |
bool kaa_tcp_channel_is_ready | ( | kaa_transport_channel_interface_t * | self, |
fd_event_t | event_type | ||
) |
Checks whether the given channel instance is ready to handle the specified event.
[in] | channel | The channel instance. |
[in] | event_type | The event type: FD_READ, FD_WRITE, FD_EXCEPTION. |
kaa_error_t kaa_tcp_channel_process_event | ( | kaa_transport_channel_interface_t * | self, |
fd_event_t | event_type | ||
) |
Notifies the channel instance about the I/O event.
[in] | channel | The channel instance. |
[in] | event_type | The event type: FD_READ, FD_WRITE, FD_EXEPTION. |
kaa_error_t kaa_tcp_channel_set_socket_events_callback | ( | kaa_transport_channel_interface_t * | self, |
on_kaa_tcp_channel_event_fn | callback, | ||
void * | context | ||
) |
Sets the callback for the current channel connection state.
See kaa_tcp_channel_event_fn .
[in] | channel | The channel instance. |
[in] | callback | The connection event callback. |
[in] | context | The callback context. |