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

User defined channels manager for Kaa C SDK. More...

#include "kaa_common.h"
#include "platform/ext_transport_channel.h"

Go to the source code of this file.

Macros

#define KAA_CHANNEL_MANAGER_T
 Kaa channel manager structure. More...
 

Typedefs

typedef struct
kaa_channel_manager_t 
kaa_channel_manager_t
 
typedef void(* kaa_auth_failure_fn )(kaa_auth_failure_reason reason, void *context)
 Processes authorization failure. More...
 

Enumerations

enum  kaa_auth_failure_reason { KAA_AUTH_STATUS_UNKNOWN, KAA_AUTH_STATUS_BAD_CREDENTIALS, KAA_AUTH_STATUS_VERIFICATION_FAILED }
 Specifies authorization failure reason. More...
 

Functions

kaa_error_t kaa_transport_channel_id_calculate (kaa_transport_channel_interface_t *channel, uint32_t *channel_id)
 Calculates the unique id for the transport channel implementations. More...
 
kaa_error_t kaa_channel_manager_add_transport_channel (kaa_channel_manager_t *self, kaa_transport_channel_interface_t *channel, uint32_t *channel_id)
 Adds user-defined transport channel implementation as a sync request handler for the given list of services. More...
 
kaa_transport_channel_interface_tkaa_channel_manager_get_transport_channel (kaa_channel_manager_t *self, kaa_extension_id service_type)
 Gets transport channel associated with the service. More...
 
kaa_error_t kaa_channel_manager_remove_transport_channel (kaa_channel_manager_t *self, uint32_t channel_id)
 Removes user-defined transport channel implementation from the currently registered list. More...
 
void kaa_channel_manager_set_auth_failure_handler (kaa_channel_manager_t *self, kaa_auth_failure_fn handler, void *context)
 Specify authorization failure handler. More...
 
void kaa_channel_manager_process_auth_failure (kaa_channel_manager_t *self, kaa_auth_failure_reason reason)
 Processes authorization failure if valid handler exists. More...
 

Detailed Description

User defined channels manager for Kaa C SDK.

Manages client transport channels.

Notifies about new access points and indicates to user defined protocol implementations that Kaa services have data to sync with Operations server.

Macro Definition Documentation

#define KAA_CHANNEL_MANAGER_T

Kaa channel manager structure.

Typedef Documentation

typedef void(* kaa_auth_failure_fn)(kaa_auth_failure_reason reason, void *context)

Processes authorization failure.

Parameters
[in]reasonAuthorization failure reason.
[in]contextHandler context.

Enumeration Type Documentation

Specifies authorization failure reason.

Enumerator
KAA_AUTH_STATUS_UNKNOWN 

Authorization failed for unknown reason.

KAA_AUTH_STATUS_BAD_CREDENTIALS 

Authorization failed because credentials are invalid.

KAA_AUTH_STATUS_VERIFICATION_FAILED 

Authorization failed because of verification failure.

Function Documentation

kaa_error_t kaa_channel_manager_add_transport_channel ( kaa_channel_manager_t self,
kaa_transport_channel_interface_t channel,
uint32_t *  channel_id 
)

Adds user-defined transport channel implementation as a sync request handler for the given list of services.

Kaa library will call the channel's callback when there is data to be sent to Operations server for one of the specified services.

NOTE: It is possible to register more than one channel for the same service. In such event Kaa library will use the last registered one.

Parameters
[in]selfChannel manager.
[in]channelTransport channel implementations.
[in,out]channel_idPointer to calculate channel id. May be NULL if id isn't needed.
Returns
Error code.
kaa_transport_channel_interface_t* kaa_channel_manager_get_transport_channel ( kaa_channel_manager_t self,
kaa_extension_id  service_type 
)

Gets transport channel associated with the service.

Parameters
[in]selfChannel manager.
[in]service_typeType of service with associated channel.
Returns
Channel, if found. NULL if not found.
void kaa_channel_manager_process_auth_failure ( kaa_channel_manager_t self,
kaa_auth_failure_reason  reason 
)

Processes authorization failure if valid handler exists.

Parameters
[in]selfChannel manager.
[in]reasonAuthorization failure reason.
kaa_error_t kaa_channel_manager_remove_transport_channel ( kaa_channel_manager_t self,
uint32_t  channel_id 
)

Removes user-defined transport channel implementation from the currently registered list.

NOTE: The channel manager is responsible to release all resources related to this channel.

Parameters
[in]selfChannel manager.
[in]channel_idChannel id.
Returns
Error code.
void kaa_channel_manager_set_auth_failure_handler ( kaa_channel_manager_t self,
kaa_auth_failure_fn  handler,
void *  context 
)

Specify authorization failure handler.

Parameters
[in]selfChannel manager.
[in]handlerAuthorization failure handler.
[in]contextHandler context.
kaa_error_t kaa_transport_channel_id_calculate ( kaa_transport_channel_interface_t channel,
uint32_t *  channel_id 
)

Calculates the unique id for the transport channel implementations.

Parameters
[in]channelInterface of the transport channel implementations.
[in,out]channel_idPointer to calculated channel id.
Returns
Error code.