Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
kaa_extension.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 
22 #ifndef KAA_EXTENSION_H
23 #define KAA_EXTENSION_H
24 
25 #include <kaa_common.h>
26 #include <kaa_error.h>
27 #include <stddef.h>
28 #include <stdbool.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 // Forward-declaring kaa_context_t
35 struct kaa_context_s;
36 
40 struct kaa_extension {
42 
50  kaa_error_t (*init)(struct kaa_context_s *kaa_context, void **context);
51 
60  kaa_error_t (*deinit)(void *context);
61 
92  kaa_error_t (*request_serialize)(void *context, uint32_t request_id,
93  uint8_t *buffer, size_t *size, bool *sync_needed);
94 
115  kaa_error_t (*server_sync)(void *context, uint32_t request_id,
116  uint16_t extension_options, const uint8_t *buffer, size_t size);
117 };
118 
125 
132 
141 
149 
166 
173  uint8_t *buffer, size_t *size, bool *sync_needed);
174 
181  uint16_t extension_options, const uint8_t *buffer, size_t size);
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif /* KAA_EXTENSION_H */
void * kaa_extension_get_context(kaa_extension_id id)
Return context for the given extension id.
kaa_error_t kaa_extension_request_serialize(kaa_extension_id id, uint32_t request_id, uint8_t *buffer, size_t *size, bool *sync_needed)
A proxy for kaa_extension::request_serialize().
General Kaa endpoint context.
Definition: kaa_context.h:50
An extension interface facing Kaa core.
Definition: kaa_extension.h:40
kaa_extension_id id
Definition: kaa_extension.h:41
Common C EP SDK definitions and small utilities.
kaa_error_t
Definition: kaa_error.h:31
kaa_error_t kaa_extension_deinit_all(void)
Deinitializes all extensions in reverse order.
kaa_error_t(* server_sync)(void *context, uint32_t request_id, uint16_t extension_options, const uint8_t *buffer, size_t size)
Extension's action in response to the server's sync message.
Definition: kaa_extension.h:115
kaa_error_t kaa_extension_init_all(struct kaa_context_s *kaa_context)
Initializes all extensions.
kaa_error_t(* deinit)(void *context)
A reverse of init().
Definition: kaa_extension.h:60
Kaa error codes.
kaa_error_t kaa_extension_server_sync(kaa_extension_id id, uint32_t request_id, uint16_t extension_options, const uint8_t *buffer, size_t size)
A proxy for kaa_extension::server_sync().
kaa_extension_id
Kaa extensions.
Definition: kaa_common.h:35
const struct kaa_extension * kaa_extension_get(kaa_extension_id id)
Return extension for given extension id.
kaa_error_t(* request_serialize)(void *context, uint32_t request_id, uint8_t *buffer, size_t *size, bool *sync_needed)
Serialize request.
Definition: kaa_extension.h:92
kaa_error_t(* init)(struct kaa_context_s *kaa_context, void **context)
Init function must initialize resource or return error code.
Definition: kaa_extension.h:50
kaa_error_t kaa_extension_set_context(kaa_extension_id id, void *context)
Sets extension context to later be retrieved with kaa_extension_get_context().