Kaa client C SDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Data Fields
kaa_extension Struct Reference

An extension interface facing Kaa core. More...

#include <kaa_extension.h>

Data Fields

kaa_extension_id id
 
kaa_error_t(* init )(struct kaa_context_s *kaa_context, void **context)
 Init function must initialize resource or return error code. More...
 
kaa_error_t(* deinit )(void *context)
 A reverse of init(). More...
 
kaa_error_t(* request_serialize )(void *context, uint32_t request_id, uint8_t *buffer, size_t *size, bool *sync_needed)
 Serialize request. More...
 
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. More...
 

Detailed Description

An extension interface facing Kaa core.

Field Documentation

kaa_error_t(* kaa_extension::deinit)(void *context)

A reverse of init().

Must deinit all allocated resources.

It's guaranteed to be called only once per init() call and with output of init().

Parameters
[in]contextContext returned by call to init.
kaa_extension_id kaa_extension::id
kaa_error_t(* kaa_extension::init)(struct kaa_context_s *kaa_context, void **context)

Init function must initialize resource or return error code.

In case of error all resources should be freed.

Parameters
[in]kaa_contextKaa client context.
[out]contextOpaque extension context.
kaa_error_t(* kaa_extension::request_serialize)(void *context, uint32_t request_id, uint8_t *buffer, size_t *size, bool *sync_needed)

Serialize request.

Note
buffer may be NULL. In that case the function must return the required size of the buffer in size.
Parameters
[in]contextThe context of the extension, as returned by init().
[in]request_idThe id of the currently serializing request.
[out]bufferSerialized request.
[in,out]sizeSize of the buffer. The function must set to the actual size used (or required).
[out]sync_neededExtension must set it to true if it requires syncing. If set to false, the extension's buffer is ignored and not synced.
Returns
Error code.
Return values
KAA_ERR_BUFFER_IS_NOT_ENOUGHShould be returned if size is smaller than needed.
Note
Error codes other than KAA_ERR_NONE will result in abort of transaction; extension must set sync_needed to false if extension has nothing to say.
kaa_error_t(* kaa_extension::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.

Parameters
[in]contextThe extension context, as returned by init().
[in]request_idThe id of the request server is responding.
[in]extension_options

Protocol-dependent options.

Note
Don't rely on it, as it may be removed in the future.
Parameters
[in]bufferThe message.
[in]sizeSize of the buffer.
Returns
Error code.

The documentation for this struct was generated from the following file: