Encapsulates function pointers for system utilities like logging, timers, locks, etc. More...
#include <ccl_platform_if.h>

Data Fields | |
| void(* | save_data )(const char *data, unsigned int length, ccl_save_callback func) |
| Save data on local storage. More... | |
| void(* | load_data )(ccl_load_callback func) |
| Retrieve data from persistent storage. More... | |
| void(* | http_post_request )(const char *url, const char *content_type, const char *request, unsigned int request_length, unsigned int timeout, ccl_http_callback func, void *http_data) |
| Send a request over the HTTP post method. More... | |
| void(* | console_log )(const char *message) |
| Log debugging messages to the console. More... | |
| uint64_t(* | epoch_time_ms )(void) |
| Fetch the current time since Unix epoch, in milliseconds. More... | |
| void(* | get_platform_metadata )(ccl_platform_metadata_t *platform_metadata) |
| Provide metadata specific to this platform. More... | |
| void *(* | create_timer )(ccl_timer_callback func, void *timer_data, unsigned int initial_time, unsigned int interval) |
| Create a new periodic timer. More... | |
| void(* | destroy_timer )(void *timer_handle) |
| Destroy an existing periodic timer. More... | |
| int(* | rand )(void) |
| Generate a random number. More... | |
| void *(* | mutex_init )(void) |
| Initialize a mutex. More... | |
| void(* | mutex_lock )(void *lock) |
| Lock a mutex. More... | |
| void(* | mutex_unlock )(void *lock) |
| Unlock a mutex. More... | |
| void(* | mutex_destroy )(void *lock) |
| Destroy the mutex. More... | |
| void *(* | rwlock_init )(void) |
| Initialize a read-write lock object. if the read/write lock doen't exist then use existing mutex lock. More... | |
| void(* | rwlock_rdlock )(void *rwlock) |
| Lock a read-write lock object for reading. If it is not exist then use mutex lock. More... | |
| void(* | rwlock_wrlock )(void *rwlock) |
| Lock a read-write lock object for writing. If it is not exist use existing mutex lock. More... | |
| void(* | rwlock_unlock )(void *rwlock) |
| Unlock a read-write lock object. More... | |
| void(* | rwlock_destroy )(void *rwlock) |
| Destroy a read-write lock object. More... | |
| void *(* | mem_alloc )(size_t mem_size) |
| Allocates memory for the specified size. More... | |
| void(* | mem_free )(void *memory) |
| Frees the memory. More... | |
| int(* | base64_encode )(const unsigned char *input_msg, const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len) |
| Converts input message to base64 message. More... | |
| ccl_crypto_t | crypto_funcs |
| Cryptographic callback functions. More... | |
Encapsulates function pointers for system utilities like logging, timers, locks, etc.
| int(* ccl_platform_t::base64_encode) (const unsigned char *input_msg, const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len) |
Converts input message to base64 message.
| input_msg | Input message to be converted. |
| input_msg_len | Input message length in bytes. |
| output_msg | Memory buffer for output message after converting. Memory will be provided by SDK |
| output_msg_max_len | Max length for output message in bytes. |
| void(* ccl_platform_t::console_log) (const char *message) |
Log debugging messages to the console.
| message | Message to be logged to the console. |
| void*(* ccl_platform_t::create_timer) (ccl_timer_callback func, void *timer_data, unsigned int initial_time, unsigned int interval) |
Create a new periodic timer.
| func | Function to be regularly invoked by the timer. |
| timer_data | Opaque data for the function. |
| initial_time | Initial delay before the timer is created. In milliseconds. |
| interval | Invoke the function every interval. In milliseconds. |
| ccl_crypto_t ccl_platform_t::crypto_funcs |
Cryptographic callback functions.
Callback functions defined by the application These functions will be called by SDK when needed
| void(* ccl_platform_t::destroy_timer) (void *timer_handle) |
Destroy an existing periodic timer.
| timer_handle | Timer handle obtained via ccl_platform_t::create_timer. |
| uint64_t(* ccl_platform_t::epoch_time_ms) (void) |
Fetch the current time since Unix epoch, in milliseconds.
| void(* ccl_platform_t::get_platform_metadata) (ccl_platform_metadata_t *platform_metadata) |
Provide metadata specific to this platform.
| platform_metadata | Pointer to ccl_platform_metadata_t to be fill in with relevant metadata. |
| void(* ccl_platform_t::http_post_request) (const char *url, const char *content_type, const char *request, unsigned int request_length, unsigned int timeout, ccl_http_callback func, void *http_data) |
Send a request over the HTTP post method.
The function should be a non-blocking call and return quickly.
The recommended timeout for the HTTP request should be enforced.
For HTTPS URLs, SSL must be supported.
| url | URL of the HTTP resource to make the request to. |
| content_type | Content type to be used in HTTP headers. |
| request | Data to be sent for POST requests. |
| request_length | Length of the data to be sent for POST requests. |
| timeout | Recommended timeout for the HTTP request. Cancel the request and callback Conviva with CCL_ERROR when timeout is reached. |
| func | Callback to communicate success status and HTTP response to Conviva. |
| http_data | Opaque HTTP context to pass along with the callback. |
| void(* ccl_platform_t::load_data) (ccl_load_callback func) |
Retrieve data from persistent storage.
| func | Callback function to notifiy the data. |
| void*(* ccl_platform_t::mem_alloc) (size_t mem_size) |
Allocates memory for the specified size.
| mem_size | Memory size to be allocated. |
| void(* ccl_platform_t::mem_free) (void *memory) |
Frees the memory.
| memory | Memory pointer that needs to be freed |
| void(* ccl_platform_t::mutex_destroy) (void *lock) |
Destroy the mutex.
| lock | Mutex to be destroyed. |
| void*(* ccl_platform_t::mutex_init) (void) |
Initialize a mutex.
| void(* ccl_platform_t::mutex_lock) (void *lock) |
Lock a mutex.
| lock | Mutex to be locked. |
| void(* ccl_platform_t::mutex_unlock) (void *lock) |
Unlock a mutex.
| lock | Mutex to be unlocked. |
| int(* ccl_platform_t::rand) (void) |
Generate a random number.
| void(* ccl_platform_t::rwlock_destroy) (void *rwlock) |
Destroy a read-write lock object.
| rwlock | Read-write lock object to be destroyed. |
| void*(* ccl_platform_t::rwlock_init) (void) |
Initialize a read-write lock object. if the read/write lock doen't exist then use existing mutex lock.
| void(* ccl_platform_t::rwlock_rdlock) (void *rwlock) |
Lock a read-write lock object for reading. If it is not exist then use mutex lock.
| rwlock | Read-write lock object to be locked for reading. |
| void(* ccl_platform_t::rwlock_unlock) (void *rwlock) |
Unlock a read-write lock object.
| rwlock | Read-write lock object to be unlocked. |
| void(* ccl_platform_t::rwlock_wrlock) (void *rwlock) |
Lock a read-write lock object for writing. If it is not exist use existing mutex lock.
| rwlock | Read-write lock object to be locked for writing. |
| void(* ccl_platform_t::save_data) (const char *data, unsigned int length, ccl_save_callback func) |
Save data on local storage.
| data | Data to be saved. |
| length | Length of the Data. |
| func | Callback function to notifiy the status of saving operation. |