Conviva Client Library
 
Loading...
Searching...
No Matches
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
27typedef enum {
28
30 CCL_DEVICE_TYPE_UNKNOWN = 0, // default when memset to 0.
31
34
37
40
43
46
49
52
55
57
59typedef 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
99typedef enum {
103
105typedef struct ccl_platform_metadata {
110
115
120
123
126
133
140
145
154
159
164
169
176
178
180typedef void (*ccl_timer_callback) (void *timer_data);
181
187typedef void (*ccl_http_callback) (int status, void *http_data, const char *response, unsigned int response_length);
188
193typedef void (*ccl_load_callback) (int status, const char *data, unsigned int length);
194
199typedef void (*ccl_save_callback) (int status, const char *error, unsigned int length);
200
205typedef void (*ccl_http_get_callback) (int status, const char *response, unsigned int response_length);
206
208typedef 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);
224
226typedef enum {
228 CCL_UNKNOWN_COMPRESSION = 0, // default when memset to 0.
232
234typedef struct {
235 char *url;
237 void *data;
245
247typedef 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
280 void (*http_post_request) (const char *url, const char *content_type,
281 const char *request, unsigned int request_length,
282 unsigned int timeout,
283 ccl_http_callback func, void *http_data);
284
288 void (*console_log) (const char *message);
289
293 uint64_t (*epoch_time_ms) (void);
294
298 void (*get_platform_metadata) (ccl_platform_metadata_t *platform_metadata);
299
308 void * (*create_timer) (ccl_timer_callback func, void *timer_data,
309 unsigned int initial_time, unsigned int interval);
310
314 void (*destroy_timer) (void *timer_handle);
315
319 int (*rand) (void);
320
324 void * (*mutex_init) (void);
325
329 void (*mutex_lock) (void *lock);
330
334 void (*mutex_unlock) (void *lock);
335
339 void (*mutex_destroy) (void *lock);
340
344 void * (*rwlock_init) (void);
345
349 void (*rwlock_rdlock) (void *rwlock);
350
354 void (*rwlock_wrlock) (void *rwlock);
355
359 void (*rwlock_unlock) (void *rwlock);
360
364 void (*rwlock_destroy) (void *rwlock);
365
371 void * (*mem_alloc) (size_t mem_size);
372
376 void (*mem_free) (void *memory);
377
378
388 int (*base64_encode) (const unsigned char *input_msg,
389 const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len);
390
396
397
403 char *(*generate_uuid)(void);
404
412 void (*http_get_request) (const char *url, ccl_http_get_callback func);
413
414
423 char* (*get_encoded_data) (const char *input, int len, ccl_compression_type_t type, int *output_len);
424
432 void (*http_post_with_headers) (ccl_http_request_t *req);
433
435
436#endif /* CCLPLATFORMIF_H */
437
struct ccl_platform_metadata ccl_platform_metadata_t
Encapsulates platform-specific metadata to be reported to Conviva.
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_compression_type_t
Constants for valid device types.
Definition ccl_platform_if.h:226
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
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_device_category_t
Constants for valid device categories.
Definition ccl_platform_if.h:59
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
void(* ccl_timer_callback)(void *timer_data)
Callback function for use with timers.
Definition ccl_platform_if.h:180
ccl_device_type_t
Constants for valid device types.
Definition ccl_platform_if.h:27
#define CCL_MAX_PLATFORM_METADATA_LENGTH
Definition ccl_platform_if.h:24
ccl_hash_algo_t
Constants for Hash algos.
Definition ccl_platform_if.h:99
@ CCL_UNKNOWN_COMPRESSION
Default compression type.
Definition ccl_platform_if.h:228
@ CCL_GZIP_COMPRESSION
Gzip compression.
Definition ccl_platform_if.h:230
@ CCL_DEVICE_CATEGORY_SIMULATOR
Definition ccl_platform_if.h:71
@ CCL_DEVICE_CATEGORY_WEB
Definition ccl_platform_if.h:91
@ CCL_DEVICE_CATEGORY_LNX
Definition ccl_platform_if.h:77
@ CCL_DEVICE_CATEGORY_XB
Definition ccl_platform_if.h:95
@ CCL_DEVICE_CATEGORY_DSKAPP
Definition ccl_platform_if.h:69
@ CCL_DEVICE_CATEGORY_SAMSUNGTV
Definition ccl_platform_if.h:85
@ CCL_DEVICE_CATEGORY_RK
Definition ccl_platform_if.h:83
@ CCL_DEVICE_CATEGORY_NINTENDO
Definition ccl_platform_if.h:79
@ CCL_DEVICE_CATEGORY_LGTV
Definition ccl_platform_if.h:75
@ CCL_DEVICE_CATEGORY_VIDAA
Definition ccl_platform_if.h:87
@ CCL_DEVICE_CATEGORY_APL
Definition ccl_platform_if.h:65
@ CCL_DEVICE_CATEGORY_WIN
Definition ccl_platform_if.h:93
@ 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_CHR
Definition ccl_platform_if.h:67
@ CCL_DEVICE_CATEGORY_VIZIOTV
Definition ccl_platform_if.h:89
@ CCL_DEVICE_CATEGORY_AND
Definition ccl_platform_if.h:63
@ CCL_DEVICE_CATEGORY_KAIOS
Definition ccl_platform_if.h:73
@ CCL_DEVICE_CATEGORY_PS
Definition ccl_platform_if.h:81
@ CCL_DEVICE_TYPE_OTHER
other device types.
Definition ccl_platform_if.h:54
@ CCL_DEVICE_TYPE_SMARTTV
The device is a smart TV.
Definition ccl_platform_if.h:48
@ CCL_DEVICE_TYPE_VEHICLE
The device is vehicle infotainment system.
Definition ccl_platform_if.h:51
@ CCL_DEVICE_TYPE_MOBILE
The device is a mobile phone.
Definition ccl_platform_if.h:42
@ CCL_DEVICE_TYPE_CONSOLE
The device is a gaming console.
Definition ccl_platform_if.h:36
@ CCL_DEVICE_TYPE_TABLET
The device is a tablet.
Definition ccl_platform_if.h:45
@ CCL_DEVICE_TYPE_UNKNOWN
The device type is not known or does not fit any other category.
Definition ccl_platform_if.h:30
@ CCL_DEVICE_TYPE_DESKTOP
The device is a desktop/laptop computer.
Definition ccl_platform_if.h:33
@ CCL_DEVICE_TYPE_SETTOP
The device is a set-top box.
Definition ccl_platform_if.h:39
@ CCL_HASH_SHA1
SHA1 hash algo.
Definition ccl_platform_if.h:101
Encapsulates function pointers for cryptographic functionalities like hashing, base64,...
Definition ccl_platform_if.h:208
Request type contains all the details for the http post.
Definition ccl_platform_if.h:234
int timeout_secs
Definition ccl_platform_if.h:242
int header_count
Definition ccl_platform_if.h:241
void * data
Definition ccl_platform_if.h:237
int data_len
Definition ccl_platform_if.h:238
char ** header_keys
Definition ccl_platform_if.h:239
ccl_http_callback cbk_func
Definition ccl_platform_if.h:243
char * content_type
Definition ccl_platform_if.h:236
char ** header_values
Definition ccl_platform_if.h:240
char * url
Definition ccl_platform_if.h:235
Encapsulates platform-specific metadata to be reported to Conviva.
Definition ccl_platform_if.h:105
int screen_height
Screen Height of the display device.
Definition ccl_platform_if.h:163
char device_manufacturer[CCL_MAX_PLATFORM_METADATA_LENGTH]
Manufacturer of the device.
Definition ccl_platform_if.h:114
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
char device_brand[CCL_MAX_PLATFORM_METADATA_LENGTH]
Brand of the device.
Definition ccl_platform_if.h:109
double screen_scale_factor
Screen Scale Factor of the display device.
Definition ccl_platform_if.h:175
char operating_system_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the operating system used by the device.
Definition ccl_platform_if.h:158
char framework_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the framework used by your application, if applicable.
Definition ccl_platform_if.h:144
int screen_width
Screen Width of the display device.
Definition ccl_platform_if.h:168
char device_model[CCL_MAX_PLATFORM_METADATA_LENGTH]
Model of the device.
Definition ccl_platform_if.h:119
ccl_device_category_t device_category
Category of the device. Defined Values.
Definition ccl_platform_if.h:122
ccl_device_type_t device_type
Type of the device. Defined Values.
Definition ccl_platform_if.h:125
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
char device_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the device.
Definition ccl_platform_if.h:132
Encapsulates function pointers for system utilities like logging, timers, locks, etc.
Definition ccl_platform_if.h:247
ccl_crypto_t crypto_funcs
Cryptographic callback functions.
Definition ccl_platform_if.h:395