Go to the source code of this file.
|
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_set_keepalive_timeout (kaa_transport_channel_interface_t *self, uint16_t keepalive) |
| Sets a keepalive timeout for the current channel. More...
|
|
kaa_error_t | kaa_tcp_channel_disconnect (kaa_transport_channel_interface_t *self) |
| Disconnects the current channel. More...
|
|
Notifies about the current channel's state. Used by kaa_tcp_channel_set_socket_events_callback .
- Parameters
-
[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. |
- Returns
- Error code
Definition at line 57 of file kaa_tcp_channel.h.
Enumerator |
---|
SOCKET_CONNECTED |
|
SOCKET_DISCONNECTED |
|
SOCKET_CONNECTION_ERROR |
|
Definition at line 38 of file kaa_tcp_channel.h.
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.
- Parameters
-
[in] | channel | The channel instance. |
- Returns
- Error code.
Creates a Kaa TCP channel instance.
- Parameters
-
[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. |
- Returns
- Error code
Disconnects the current channel.
- Parameters
-
[in] | channel | The channel instance. |
- Returns
- Error code
Retrieves the socket descriptor from the given channel instance.
- Parameters
-
[in] | channel | The channel instance. |
[out] | fd_p | The socket descriptor or KAA_TCP_SOCKET_NOT_SET if there is no open descriptor. |
- Returns
- Error code.
Retrieves the maximum timeout for the multiplexing I/O like select/poll. Used for kaa_tcp_channel_check_keepalive needs.
- Parameters
-
[in] | channel | The channel instance. |
[out] | max_timeout | The maximum timeout value (in seconds), 0 - indicates that timeout is not used by this channel. |
- Returns
- Error code.
Checks whether the given channel instance is ready to handle the specified event.
- Parameters
-
[in] | channel | The channel instance. |
[in] | event_type | The event type: FD_READ, FD_WRITE, FD_EXCEPTION. |
- Returns
- true - if the channel is ready to handle the specified event, false - otherwise.
Notifies the channel instance about the I/O event.
- Parameters
-
[in] | channel | The channel instance. |
[in] | event_type | The event type: FD_READ, FD_WRITE, FD_EXEPTION. |
- Returns
- Error code.
Sets a keepalive timeout for the current channel.
- Parameters
-
[in] | channel | The channel instance. |
[in] | keepalive | The keepalive timeout (in seconds). 0 - indicates that a keepalive is not used. |
- Returns
- Error code
Sets the callback for the current channel connection state.
See kaa_tcp_channel_event_fn .
- Parameters
-
[in] | channel | The channel instance. |
[in] | callback | The connection event callback. |
[in] | context | The callback context. |
- Returns
- Error code.