libcontrac
A library for contact tracing
utils.h
Go to the documentation of this file.
1 
25 #ifndef __UTILS_H
26 #define __UTILS_H
27 
28 // Includes
29 
30 #include <time.h>
31 
32 // Defines
33 
34 #define MAX(a,b) \
35  ({ __typeof__ (a) _a = (a); \
36  __typeof__ (b) _b = (b); \
37  _a > _b ? _a : _b; })
38 
39 #define MIN(a,b) \
40  ({ __typeof__ (a) _a = (a); \
41  __typeof__ (b) _b = (b); \
42  _a < _b ? _a : _b; })
43 
44 // Structures
45 
46 // Function prototypes
47 
48 size_t base64_encode_size(size_t binary_input);
49 size_t base64_decode_size(size_t base64_input);
50 void base64_encode_binary_to_base64(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size);
51 void base64_decode_base64_to_binary(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size);
52 
53 uint32_t epoch_to_day_number(time_t epoch);
54 uint8_t epoch_to_time_interval_number(time_t epoch);
55 
56 // Function definitions
57 
58 #endif // __UTILS_H
59 
size_t base64_encode_size(size_t binary_input)
Definition: utils.c:54
void base64_encode_binary_to_base64(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size)
Definition: utils.c:95
uint8_t epoch_to_time_interval_number(time_t epoch)
Definition: utils.c:178
uint32_t epoch_to_day_number(time_t epoch)
Definition: utils.c:155
void base64_decode_base64_to_binary(unsigned char const *input, size_t input_size, unsigned char *output, size_t *output_size)
Definition: utils.c:128
size_t base64_decode_size(size_t base64_input)
Definition: utils.c:73