Conviva Client Library  2.188.0.0
ccl_platform_if.h
1 //
2 // Copyright (c) 2014 Conviva. All rights reserved.
3 // CCL - Conviva Client Library
4 //
5 
10 
18 
19 #ifndef CCLPLATFORMIF_H
20 #define CCLPLATFORMIF_H
21 
22 #include <stdint.h>
23 
24 #define CCL_MAX_PLATFORM_METADATA_LENGTH 128
25 
27 typedef enum {
28 
30  CCL_DEVICE_TYPE_UNKNOWN = 0, // default when memset to 0.
31 
34 
37 
40 
43 
46 
49 
52 
55 
57 
59 typedef enum {
61  CCL_DEVICE_CATEGORY_INVALID = 0, // default when memset to 0.
62  //The device is a Android Device like Samsung Galaxy or Amazon Fire TV or Android TV or Android Tablet.
64  //The device is a Apple device like iPhone or Apple TV.
66  //The device is a Google Chromecast STB or Android TV with built-in Chromecast.
68  //The device is a desktop computer(including notebook)
70  //The device is a simulated device video session for testing.
72  //The device is a Phone or other device based on KaiOS OS, like Lyf Jio F30C.
74  //The device is a LG smart TV including NetCast and webOS.
76  //It mostly covers various Set-Top Boxes and Smart TVs that provide custom Linux-based SDKs
78  //The device is a Nintendo games console including Wii and Switch.
80  //The device is a PlayStation games console including PS3 and PS4.
82  //The device is a Roku device.
84  //The device is a Samsung Smart TV including Orsay and Tizen.
86  //Vidaa - based devices. This is the operating system developed by Hisense.
88  //Category for native app integrations on Vizio TVs based on a SmartCast platform (2016).
90  //The device can any device with in-browser HTML5-based players.
92  //The device is a Windows OS - based handheld device, like Windows Phone or Windows Tablet.
94  //The device is a Xbox games console including Xbox 360 and Xbox One.
97 
99 typedef enum {
103 
105 typedef struct ccl_platform_metadata {
110 
115 
120 
123 
126 
133 
140 
145 
154 
159 
164 
169 
176 
178 
180 typedef void (*ccl_timer_callback) (void *timer_data);
181 
187 typedef void (*ccl_http_callback) (int status, void *http_data, const char *response, unsigned int response_length);
188 
193 typedef void (*ccl_load_callback) (int status, const char *data, unsigned int length);
194 
199 typedef void (*ccl_save_callback) (int status, const char *error, unsigned int length);
200 
205 typedef void (*ccl_http_get_callback) (int status, const char *response, unsigned int response_length);
206 
208 typedef struct {
209 
220  int (*generate_hash) (const ccl_hash_algo_t hash_algo_type, const unsigned char *input_msg,
221  const int input_msg_len, unsigned char *output_msg,
222  const int output_msg_max_len);
223 } ccl_crypto_t;
224 
226 typedef enum {
228  CCL_UNKNOWN_COMPRESSION = 0, // default when memset to 0.
232 
234 typedef struct {
235  char *url;
237  void *data;
238  int data_len;
239  char **header_keys;
245 
247 typedef struct {
248 
257  void (*save_data) (const char *data, unsigned int length, ccl_save_callback func);
258 
263  void (*load_data) (ccl_load_callback func);
264 
265 
288  void (*http_post_request) (const char *url, const char *content_type,
289  const char *request, unsigned int request_length,
290  unsigned int timeout,
291  ccl_http_callback func, void *http_data);
292 
296  void (*console_log) (const char *message);
297 
301  uint64_t (*epoch_time_ms) (void);
302 
306  void (*get_platform_metadata) (ccl_platform_metadata_t *platform_metadata);
307 
316  void * (*create_timer) (ccl_timer_callback func, void *timer_data,
317  unsigned int initial_time, unsigned int interval);
318 
322  void (*destroy_timer) (void *timer_handle);
323 
327  int (*rand) (void);
328 
332  void * (*mutex_init) (void);
333 
337  void (*mutex_lock) (void *lock);
338 
342  void (*mutex_unlock) (void *lock);
343 
347  void (*mutex_destroy) (void *lock);
348 
352  void * (*rwlock_init) (void);
353 
357  void (*rwlock_rdlock) (void *rwlock);
358 
362  void (*rwlock_wrlock) (void *rwlock);
363 
367  void (*rwlock_unlock) (void *rwlock);
368 
372  void (*rwlock_destroy) (void *rwlock);
373 
379  void * (*mem_alloc) (size_t mem_size);
380 
384  void (*mem_free) (void *memory);
385 
386 
396  int (*base64_encode) (const unsigned char *input_msg,
397  const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len);
398 
404 
405 
411  char *(*generate_uuid)(void);
412 
420  void (*http_get_request) (const char *url, ccl_http_get_callback func);
421 
422 
431  char* (*get_encoded_data) (const char *input, int len, ccl_compression_type_t type, int *output_len);
432 
440  void (*http_post_with_headers) (ccl_http_request_t *req);
441 
443 
444 #endif /* CCLPLATFORMIF_H */
445 
CCL_DEVICE_TYPE_UNKNOWN
@ CCL_DEVICE_TYPE_UNKNOWN
The device type is not known or does not fit any other category.
Definition: ccl_platform_if.h:30
ccl_platform_metadata::screen_height
int screen_height
Screen Height of the display device.
Definition: ccl_platform_if.h:163
ccl_http_request_t::data_len
int data_len
Definition: ccl_platform_if.h:238
ccl_platform_t::crypto_funcs
ccl_crypto_t crypto_funcs
Cryptographic callback functions.
Definition: ccl_platform_if.h:403
ccl_platform_metadata::screen_scale_factor
double screen_scale_factor
Screen Scale Factor of the display device.
Definition: ccl_platform_if.h:175
ccl_timer_callback
void(* ccl_timer_callback)(void *timer_data)
Callback function for use with timers.
Definition: ccl_platform_if.h:180
CCL_UNKNOWN_COMPRESSION
@ CCL_UNKNOWN_COMPRESSION
Default compression type.
Definition: ccl_platform_if.h:228
ccl_http_request_t
Request type contains all the details for the http post.
Definition: ccl_platform_if.h:234
CCL_DEVICE_CATEGORY_LGTV
@ CCL_DEVICE_CATEGORY_LGTV
Definition: ccl_platform_if.h:75
CCL_DEVICE_TYPE_SMARTTV
@ CCL_DEVICE_TYPE_SMARTTV
The device is a smart TV.
Definition: ccl_platform_if.h:48
ccl_platform_metadata::screen_width
int screen_width
Screen Width of the display device.
Definition: ccl_platform_if.h:168
ccl_http_request_t::header_count
int header_count
Definition: ccl_platform_if.h:241
CCL_DEVICE_CATEGORY_RK
@ CCL_DEVICE_CATEGORY_RK
Definition: ccl_platform_if.h:83
CCL_DEVICE_CATEGORY_SIMULATOR
@ CCL_DEVICE_CATEGORY_SIMULATOR
Definition: ccl_platform_if.h:71
CCL_DEVICE_CATEGORY_PS
@ CCL_DEVICE_CATEGORY_PS
Definition: ccl_platform_if.h:81
CCL_DEVICE_CATEGORY_CHR
@ CCL_DEVICE_CATEGORY_CHR
Definition: ccl_platform_if.h:67
ccl_device_category_t
ccl_device_category_t
Constants for valid device categories.
Definition: ccl_platform_if.h:59
ccl_platform_metadata::device_version
char device_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the device.
Definition: ccl_platform_if.h:132
ccl_platform_metadata::operating_system_version
char operating_system_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the operating system used by the device.
Definition: ccl_platform_if.h:158
ccl_platform_metadata_t
struct ccl_platform_metadata ccl_platform_metadata_t
Encapsulates platform-specific metadata to be reported to Conviva.
CCL_DEVICE_TYPE_TABLET
@ CCL_DEVICE_TYPE_TABLET
The device is a tablet.
Definition: ccl_platform_if.h:45
CCL_DEVICE_CATEGORY_WIN
@ CCL_DEVICE_CATEGORY_WIN
Definition: ccl_platform_if.h:93
CCL_DEVICE_CATEGORY_INVALID
@ CCL_DEVICE_CATEGORY_INVALID
The device type is not known or does not fit any other category.
Definition: ccl_platform_if.h:61
CCL_DEVICE_CATEGORY_AND
@ CCL_DEVICE_CATEGORY_AND
Definition: ccl_platform_if.h:63
ccl_platform_metadata::device_model
char device_model[CCL_MAX_PLATFORM_METADATA_LENGTH]
Model of the device.
Definition: ccl_platform_if.h:119
ccl_platform_metadata::device_manufacturer
char device_manufacturer[CCL_MAX_PLATFORM_METADATA_LENGTH]
Manufacturer of the device.
Definition: ccl_platform_if.h:114
CCL_DEVICE_TYPE_VEHICLE
@ CCL_DEVICE_TYPE_VEHICLE
The device is vehicle infotainment system.
Definition: ccl_platform_if.h:51
CCL_HASH_SHA1
@ CCL_HASH_SHA1
SHA1 hash algo.
Definition: ccl_platform_if.h:101
CCL_DEVICE_CATEGORY_XB
@ CCL_DEVICE_CATEGORY_XB
Definition: ccl_platform_if.h:95
CCL_DEVICE_CATEGORY_DSKAPP
@ CCL_DEVICE_CATEGORY_DSKAPP
Definition: ccl_platform_if.h:69
ccl_platform_metadata::framework_version
char framework_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the framework used by your application, if applicable.
Definition: ccl_platform_if.h:144
ccl_http_request_t::url
char * url
Definition: ccl_platform_if.h:235
CCL_DEVICE_CATEGORY_KAIOS
@ CCL_DEVICE_CATEGORY_KAIOS
Definition: ccl_platform_if.h:73
ccl_device_type_t
ccl_device_type_t
Constants for valid device types.
Definition: ccl_platform_if.h:27
ccl_http_get_callback
void(* ccl_http_get_callback)(int status, const char *response, unsigned int response_length)
Callback function to communicate HTTP get back to Conviva.
Definition: ccl_platform_if.h:205
ccl_platform_metadata::framework_name
char framework_name[CCL_MAX_PLATFORM_METADATA_LENGTH]
Name of the main framework used by your application, if applicable.
Definition: ccl_platform_if.h:139
ccl_http_request_t::cbk_func
ccl_http_callback cbk_func
Definition: ccl_platform_if.h:243
CCL_DEVICE_TYPE_SETTOP
@ CCL_DEVICE_TYPE_SETTOP
The device is a set-top box.
Definition: ccl_platform_if.h:39
ccl_load_callback
void(* ccl_load_callback)(int status, const char *data, unsigned int length)
Callback function to notify a local data to the ccl library.
Definition: ccl_platform_if.h:193
CCL_DEVICE_CATEGORY_LNX
@ CCL_DEVICE_CATEGORY_LNX
Definition: ccl_platform_if.h:77
ccl_platform_metadata
Encapsulates platform-specific metadata to be reported to Conviva.
Definition: ccl_platform_if.h:105
CCL_DEVICE_TYPE_MOBILE
@ CCL_DEVICE_TYPE_MOBILE
The device is a mobile phone.
Definition: ccl_platform_if.h:42
CCL_DEVICE_CATEGORY_SAMSUNGTV
@ CCL_DEVICE_CATEGORY_SAMSUNGTV
Definition: ccl_platform_if.h:85
CCL_DEVICE_CATEGORY_WEB
@ CCL_DEVICE_CATEGORY_WEB
Definition: ccl_platform_if.h:91
CCL_DEVICE_CATEGORY_VIZIOTV
@ CCL_DEVICE_CATEGORY_VIZIOTV
Definition: ccl_platform_if.h:89
ccl_platform_metadata::operating_system_name
char operating_system_name[CCL_MAX_PLATFORM_METADATA_LENGTH]
Name of the operating system used by the device, in uppercase.
Definition: ccl_platform_if.h:153
CCL_DEVICE_CATEGORY_APL
@ CCL_DEVICE_CATEGORY_APL
Definition: ccl_platform_if.h:65
CCL_DEVICE_TYPE_OTHER
@ CCL_DEVICE_TYPE_OTHER
other device types.
Definition: ccl_platform_if.h:54
CCL_DEVICE_CATEGORY_VIDAA
@ CCL_DEVICE_CATEGORY_VIDAA
Definition: ccl_platform_if.h:87
CCL_DEVICE_TYPE_DESKTOP
@ CCL_DEVICE_TYPE_DESKTOP
The device is a desktop/laptop computer.
Definition: ccl_platform_if.h:33
ccl_platform_metadata::device_brand
char device_brand[CCL_MAX_PLATFORM_METADATA_LENGTH]
Brand of the device.
Definition: ccl_platform_if.h:109
ccl_platform_metadata::device_type
ccl_device_type_t device_type
Type of the device. Defined Values.
Definition: ccl_platform_if.h:125
ccl_http_request_t::data
void * data
Definition: ccl_platform_if.h:237
ccl_hash_algo_t
ccl_hash_algo_t
Constants for Hash algos.
Definition: ccl_platform_if.h:99
ccl_platform_metadata::device_category
ccl_device_category_t device_category
Category of the device. Defined Values.
Definition: ccl_platform_if.h:122
ccl_http_callback
void(* ccl_http_callback)(int status, void *http_data, const char *response, unsigned int response_length)
Callback function to communicate HTTP responses back to Conviva.
Definition: ccl_platform_if.h:187
ccl_compression_type_t
ccl_compression_type_t
Constants for valid device types.
Definition: ccl_platform_if.h:226
ccl_http_request_t::content_type
char * content_type
Definition: ccl_platform_if.h:236
ccl_http_request_t::timeout_secs
int timeout_secs
Definition: ccl_platform_if.h:242
CCL_DEVICE_TYPE_CONSOLE
@ CCL_DEVICE_TYPE_CONSOLE
The device is a gaming console.
Definition: ccl_platform_if.h:36
ccl_http_request_t::header_keys
char ** header_keys
Definition: ccl_platform_if.h:239
ccl_crypto_t
Encapsulates function pointers for cryptographic functionalities like hashing, base64,...
Definition: ccl_platform_if.h:208
CCL_DEVICE_CATEGORY_NINTENDO
@ CCL_DEVICE_CATEGORY_NINTENDO
Definition: ccl_platform_if.h:79
ccl_http_request_t::header_values
char ** header_values
Definition: ccl_platform_if.h:240
ccl_save_callback
void(* ccl_save_callback)(int status, const char *error, unsigned int length)
Callback function to notify a status of saving operation to the ccl library.
Definition: ccl_platform_if.h:199
CCL_MAX_PLATFORM_METADATA_LENGTH
#define CCL_MAX_PLATFORM_METADATA_LENGTH
Definition: ccl_platform_if.h:24
CCL_GZIP_COMPRESSION
@ CCL_GZIP_COMPRESSION
Gzip compression.
Definition: ccl_platform_if.h:230
ccl_platform_t
Encapsulates function pointers for system utilities like logging, timers, locks, etc.
Definition: ccl_platform_if.h:247