1 #ifndef INCLUDE_OONIFFI_H_
2 #define INCLUDE_OONIFFI_H_
3 
4 #include <stdint.h>
5 #include <stdlib.h>
6 
7 /*
8  * ABI compatible with Measurement Kit v0.10.11 [1].
9  *
10  * Just replace `mk_` with `ooniffi_` and recompile.
11  *
12  * .. [1] https://github.com/measurement-kit/measurement-kit/tree/v0.10.11/
13  *
14  * This is not used in any OONI product. We may break something
15  * in ooniffi without noticing it. Please, be aware of that.
16  */
17 
18 typedef struct ooniffi_task_ ooniffi_task_t;
19 typedef struct ooniffi_event_ ooniffi_event_t;
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 extern ooniffi_task_t *ooniffi_task_start(const char *settings);
26 extern ooniffi_event_t *ooniffi_task_wait_for_next_event(ooniffi_task_t *task);
27 extern int ooniffi_task_is_done(ooniffi_task_t *task);
28 extern void ooniffi_task_interrupt(ooniffi_task_t *task);
29 extern const char *ooniffi_event_serialization(ooniffi_event_t *str);
30 extern void ooniffi_event_destroy(ooniffi_event_t *str);
31 extern void ooniffi_task_destroy(ooniffi_task_t *task);
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 
37 /*
38  * Define OONIFFI_EMULATE_MK_API to provide a MK-compatible API at
39  * compile time that will map to ooniffi's own API.
40  */
41 #ifdef OONIFFI_EMULATE_MK_API
42 #define mk_task_start ooniffi_task_start
43 #define mk_task_wait_for_next_event ooniffi_task_wait_for_next_event
44 #define mk_task_is_done ooniffi_task_is_done
45 #define mk_task_interrupt ooniffi_task_interrupt
46 #define mk_event_serialization ooniffi_event_serialization
47 #define mk_event_destroy ooniffi_event_destroy
48 #define mk_task_destroy ooniffi_task_destroy
49 #endif
50 
51 #endif /* INCLUDE_OONIFFI_H_ */
52