Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Structures | Functions
kaa_extension.h File Reference

Extension manager. More...

#include <kaa_common.h>
#include <kaa_error.h>
#include <stddef.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  kaa_extension
 An extension interface facing Kaa core. More...
 

Functions

const struct kaa_extensionkaa_extension_get (kaa_extension_id id)
 Return extension for given extension id. More...
 
void * kaa_extension_get_context (kaa_extension_id id)
 Return context for the given extension id. More...
 
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(). More...
 
kaa_error_t kaa_extension_init_all (struct kaa_context_s *kaa_context)
 Initializes all extensions. More...
 
kaa_error_t kaa_extension_deinit_all (void)
 Deinitializes all extensions in reverse order. More...
 
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(). More...
 
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(). More...
 

Detailed Description

Extension manager.

The extensions should be defined in the kaa_extension_private.h. Currently that file is static but will be auto-generated in the future.

Function Documentation

kaa_error_t kaa_extension_deinit_all ( void  )

Deinitializes all extensions in reverse order.

If any extension errored during deinitialization, error code is returned.

Warning
The function doesn't check if extension was initialized. Must only be called if kaa_extension_init_all() succeeded before.
Return values
KAA_ERR_NONEAll extensions deinitialized successfully.
Note
In case several extensions failed deinitialization it's unspecified which error code is returned.
const struct kaa_extension* kaa_extension_get ( kaa_extension_id  id)

Return extension for given extension id.

Return values
NULLExtension not found.
void* kaa_extension_get_context ( kaa_extension_id  id)

Return context for the given extension id.

Return values
NULLExtension not found.
kaa_error_t kaa_extension_init_all ( struct kaa_context_s kaa_context)

Initializes all extensions.

If error occurs, it deinitializes all initialized extensions in reverse order and returns error.

Returns
Error code.
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().

Return values
KAA_ERR_NOT_FOUNDExtension was not found.
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().

Return values
KAA_ERR_NOT_FOUNDExtension was not found.
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().

Return values
KAA_ERR_NONESuccess.
KAA_ERR_NOT_FOUNDNo extension with such id.