Conviva Client Library  2.185.0.2
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 struct {
227 
236  void (*save_data) (const char *data, unsigned int length, ccl_save_callback func);
237 
242  void (*load_data) (ccl_load_callback func);
243 
258  void (*http_post_request) (const char *url, const char *content_type,
259  const char *request, unsigned int request_length,
260  unsigned int timeout,
261  ccl_http_callback func, void *http_data);
262 
266  void (*console_log) (const char *message);
267 
271  uint64_t (*epoch_time_ms) (void);
272 
276  void (*get_platform_metadata) (ccl_platform_metadata_t *platform_metadata);
277 
286  void * (*create_timer) (ccl_timer_callback func, void *timer_data,
287  unsigned int initial_time, unsigned int interval);
288 
292  void (*destroy_timer) (void *timer_handle);
293 
297  int (*rand) (void);
298 
302  void * (*mutex_init) (void);
303 
307  void (*mutex_lock) (void *lock);
308 
312  void (*mutex_unlock) (void *lock);
313 
317  void (*mutex_destroy) (void *lock);
318 
322  void * (*rwlock_init) (void);
323 
327  void (*rwlock_rdlock) (void *rwlock);
328 
332  void (*rwlock_wrlock) (void *rwlock);
333 
337  void (*rwlock_unlock) (void *rwlock);
338 
342  void (*rwlock_destroy) (void *rwlock);
343 
349  void * (*mem_alloc) (size_t mem_size);
350 
354  void (*mem_free) (void *memory);
355 
356 
366  int (*base64_encode) (const unsigned char *input_msg,
367  const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len);
368 
374 
375 
381  char *(*generate_uuid)(void);
382 
390  void (*http_get_request) (const char *url, ccl_http_get_callback func);
391 
393 
394 #endif /* CCLPLATFORMIF_H */
395 
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_platform_t::crypto_funcs
ccl_crypto_t crypto_funcs
Cryptographic callback functions.
Definition: ccl_platform_if.h:373
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_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_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_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_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_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_DEVICE_TYPE_CONSOLE
@ CCL_DEVICE_TYPE_CONSOLE
The device is a gaming console.
Definition: ccl_platform_if.h:36
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_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_platform_t
Encapsulates function pointers for system utilities like logging, timers, locks, etc.
Definition: ccl_platform_if.h:226