Conviva Client Library
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 
51 
53 typedef enum {
57 
59 typedef struct ccl_platform_metadata {
64 
69 
74 
77 
84 
91 
96 
105 
110 
115 
120 
127 
129 
131 typedef void (*ccl_timer_callback) (void *timer_data);
132 
138 typedef void (*ccl_http_callback) (int status, void *http_data, const char *response, unsigned int response_length);
139 
144 typedef void (*ccl_load_callback) (int status, const char *data, unsigned int length);
145 
150 typedef void (*ccl_save_callback) (int status, const char *error, unsigned int length);
151 
153 typedef struct {
154 
165  int (*generate_hash) (const ccl_hash_algo_t hash_algo_type, const unsigned char *input_msg,
166  const int input_msg_len, unsigned char *output_msg,
167  const int output_msg_max_len);
168 } ccl_crypto_t;
169 
171 typedef struct {
172 
181  void (*save_data) (const char *data, unsigned int length, ccl_save_callback func);
182 
187  void (*load_data) (ccl_load_callback func);
188 
203  void (*http_post_request) (const char *url, const char *content_type,
204  const char *request, unsigned int request_length,
205  unsigned int timeout,
206  ccl_http_callback func, void *http_data);
207 
211  void (*console_log) (const char *message);
212 
216  uint64_t (*epoch_time_ms) (void);
217 
221  void (*get_platform_metadata) (ccl_platform_metadata_t *platform_metadata);
222 
231  void * (*create_timer) (ccl_timer_callback func, void *timer_data,
232  unsigned int initial_time, unsigned int interval);
233 
237  void (*destroy_timer) (void *timer_handle);
238 
242  int (*rand) (void);
243 
247  void * (*mutex_init) (void);
248 
252  void (*mutex_lock) (void *lock);
253 
257  void (*mutex_unlock) (void *lock);
258 
262  void (*mutex_destroy) (void *lock);
263 
267  void * (*rwlock_init) (void);
268 
272  void (*rwlock_rdlock) (void *rwlock);
273 
277  void (*rwlock_wrlock) (void *rwlock);
278 
282  void (*rwlock_unlock) (void *rwlock);
283 
287  void (*rwlock_destroy) (void *rwlock);
288 
294  void * (*mem_alloc) (size_t mem_size);
295 
299  void (*mem_free) (void *memory);
300 
301 
311  int (*base64_encode) (const unsigned char *input_msg,
312  const int input_msg_len, unsigned char *output_msg, const int output_msg_max_len);
313 
319 
321 
322 #endif /* CCLPLATFORMIF_H */
323 
char framework_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the framework used by your application, if applicable.
Definition: ccl_platform_if.h:95
double screen_scale_factor
Screen Scale Factor of the display device.
Definition: ccl_platform_if.h:126
int screen_width
Screen Width of the display device.
Definition: ccl_platform_if.h:119
char device_brand[CCL_MAX_PLATFORM_METADATA_LENGTH]
Brand of the device.
Definition: ccl_platform_if.h:63
The device is a tablet.
Definition: ccl_platform_if.h:45
The device is a smart TV.
Definition: ccl_platform_if.h:48
ccl_crypto_t crypto_funcs
Cryptographic callback functions.
Definition: ccl_platform_if.h:318
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:138
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:150
char device_manufacturer[CCL_MAX_PLATFORM_METADATA_LENGTH]
Manufacturer of the device.
Definition: ccl_platform_if.h:68
char framework_name[CCL_MAX_PLATFORM_METADATA_LENGTH]
Name of the main framework used by your application, if applicable.
Definition: ccl_platform_if.h:90
int screen_height
Screen Height of the display device.
Definition: ccl_platform_if.h:114
char device_model[CCL_MAX_PLATFORM_METADATA_LENGTH]
Model of the device.
Definition: ccl_platform_if.h:73
ccl_device_type_t device_type
Type of the device. Case sensitive.
Definition: ccl_platform_if.h:76
The device is a set-top box.
Definition: ccl_platform_if.h:39
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:144
The device type is not known or does not fit any other category.
Definition: ccl_platform_if.h:30
char device_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the device.
Definition: ccl_platform_if.h:83
SHA1 hash algo.
Definition: ccl_platform_if.h:55
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:104
The device is a mobile phone.
Definition: ccl_platform_if.h:42
void(* ccl_timer_callback)(void *timer_data)
Callback function for use with timers.
Definition: ccl_platform_if.h:131
#define CCL_MAX_PLATFORM_METADATA_LENGTH
Definition: ccl_platform_if.h:24
The device is a desktop/laptop computer.
Definition: ccl_platform_if.h:33
Encapsulates platform-specific metadata to be reported to Conviva.
Definition: ccl_platform_if.h:59
struct ccl_platform_metadata ccl_platform_metadata_t
Encapsulates platform-specific metadata to be reported to Conviva.
ccl_hash_algo_t
Constants for Hash algos.
Definition: ccl_platform_if.h:53
ccl_device_type_t
Constants for valid device types.
Definition: ccl_platform_if.h:27
The device is a gaming console.
Definition: ccl_platform_if.h:36
Encapsulates function pointers for system utilities like logging, timers, locks, etc.
Definition: ccl_platform_if.h:171
Encapsulates function pointers for cryptographic functionalities like hashing, base64, etc.
Definition: ccl_platform_if.h:153
char operating_system_version[CCL_MAX_PLATFORM_METADATA_LENGTH]
Version of the operating system used by the device.
Definition: ccl_platform_if.h:109