client-c  0.9.0
kaa_tcp_channel.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2016 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef KAA_TCP_CHANNEL_H_
19 #define KAA_TCP_CHANNEL_H_
20 
21 #include "../../kaa_error.h"
22 #include "../../platform/ext_transport_channel.h"
23 #include "../../platform/defaults.h"
24 #include "../../platform/ext_tcp_utils.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 
31 typedef enum {
35 } fd_event_t;
36 
37 
38 typedef enum {
43 
44 
57 typedef kaa_error_t (*on_kaa_tcp_channel_event_fn)(void *context
58  , kaa_tcp_channel_event_t event_type
59  , kaa_fd_t fd);
60 
61 
73  , kaa_logger_t *logger
74  , kaa_extension_id *supported_services
75  , size_t supported_service_count);
76 
77 
88  , kaa_fd_t *fd_p);
89 
90 
101  , fd_event_t event_type);
102 
103 
113  , fd_event_t event_type);
114 
115 
127  , uint16_t *max_timeout);
128 
129 
141 
142 
155  , on_kaa_tcp_channel_event_fn callback
156  , void *context);
157 
166 
167 #ifdef __cplusplus
168 } /* extern "C" */
169 #endif
170 
171 
172 #endif /* KAA_TCP_CHANNEL_H_ */
kaa_error_t
Definition: kaa_error.h:31
Interface for a client transport channel implementation.
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.
kaa_error_t kaa_tcp_channel_disconnect(kaa_transport_channel_interface_t *self)
Disconnects the current channel.
kaa_extension_id
Kaa extensions.
Definition: kaa_common.h:35
struct kaa_logger_t kaa_logger_t
Definition: kaa_log.h:68
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. ...
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...
kaa_tcp_channel_event_t
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 ...
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_che...
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.
kaa_error_t kaa_tcp_channel_create(kaa_transport_channel_interface_t *self, kaa_logger_t *logger, kaa_extension_id *supported_services, size_t supported_service_count)
Creates a Kaa TCP channel instance.
int kaa_fd_t
Definition: cc32xx_sock.h:74
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.
fd_event_t