Go to the source code of this file.
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
Enumerator |
---|
FD_READ |
|
FD_WRITE |
|
FD_EXCEPTION |
|
Enumerator |
---|
SOCKET_CONNECTED |
|
SOCKET_DISCONNECTED |
|
SOCKET_CONNECTION_ERROR |
|
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] | self | The channel instance. |
- Returns
- Error code.
Creates a Kaa TCP channel instance.
- Parameters
-
[in] | self | The pointer to the channel instance. |
[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] | self | The channel instance. |
- Returns
- Error code
Retrieves the socket descriptor from the given channel instance.
- Parameters
-
[in] | self | 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] | self | 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] | self | 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] | self | The channel instance. |
[in] | event_type | The event type: FD_READ, FD_WRITE, FD_EXEPTION. |
- Returns
- Error code.
Sets the callback for the current channel connection state.
See on_kaa_tcp_channel_event_fn .
- Parameters
-
[in] | self | The channel instance. |
[in] | callback | The connection event callback. |
[in] | context | The callback context. |
- Returns
- Error code.