[04ca20e] | 1 | #ifndef _OG_JSON_H |
---|
| 2 | #define _OG_JSON_H |
---|
| 3 | |
---|
| 4 | #include <jansson.h> |
---|
| 5 | #include "schedule.h" |
---|
| 6 | |
---|
| 7 | int og_json_parse_string(json_t *element, const char **str); |
---|
[27fbc65] | 8 | int og_json_parse_string_copy(json_t *element, char *str, size_t size); |
---|
[0efc182] | 9 | int og_json_parse_uint64(json_t *element, uint64_t *integer); |
---|
[04ca20e] | 10 | int og_json_parse_uint(json_t *element, uint32_t *integer); |
---|
| 11 | int og_json_parse_bool(json_t *element, bool *value); |
---|
| 12 | |
---|
| 13 | #define OG_PARAM_PART_NUMBER (1UL << 0) |
---|
| 14 | #define OG_PARAM_PART_CODE (1UL << 1) |
---|
| 15 | #define OG_PARAM_PART_FILESYSTEM (1UL << 2) |
---|
| 16 | #define OG_PARAM_PART_SIZE (1UL << 3) |
---|
| 17 | #define OG_PARAM_PART_FORMAT (1UL << 4) |
---|
| 18 | #define OG_PARAM_PART_DISK (1UL << 5) |
---|
| 19 | #define OG_PARAM_PART_OS (1UL << 6) |
---|
| 20 | #define OG_PARAM_PART_USED_SIZE (1UL << 7) |
---|
| 21 | |
---|
| 22 | struct og_partition { |
---|
| 23 | const char *disk; |
---|
| 24 | const char *number; |
---|
| 25 | const char *code; |
---|
| 26 | const char *size; |
---|
| 27 | const char *filesystem; |
---|
| 28 | const char *format; |
---|
| 29 | const char *os; |
---|
| 30 | const char *used_size; |
---|
| 31 | }; |
---|
| 32 | |
---|
[24e6fbf] | 33 | #define OG_DISK_MAX 4 |
---|
| 34 | #define OG_PARTITION_MAX (4 * OG_DISK_MAX) |
---|
[04ca20e] | 35 | |
---|
| 36 | int og_json_parse_partition(json_t *element, struct og_partition *part, |
---|
| 37 | uint64_t required_flags); |
---|
| 38 | |
---|
| 39 | #define OG_CLIENTS_MAX 4096 |
---|
| 40 | |
---|
| 41 | struct og_sync_params { |
---|
| 42 | const char *sync; |
---|
| 43 | const char *diff; |
---|
| 44 | const char *remove; |
---|
| 45 | const char *compress; |
---|
| 46 | const char *cleanup; |
---|
| 47 | const char *cache; |
---|
| 48 | const char *cleanup_cache; |
---|
| 49 | const char *remove_dst; |
---|
| 50 | const char *diff_id; |
---|
| 51 | const char *diff_name; |
---|
| 52 | const char *path; |
---|
| 53 | const char *method; |
---|
| 54 | }; |
---|
| 55 | |
---|
[33b0c6f] | 56 | #define OG_PARAM_SCOPE_ID (1UL << 0) |
---|
| 57 | #define OG_PARAM_SCOPE_TYPE (1UL << 1) |
---|
| 58 | |
---|
| 59 | struct og_scope { |
---|
| 60 | uint32_t id; |
---|
| 61 | const char *type; |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | int og_json_parse_scope(json_t *element, struct og_scope *scope, |
---|
| 65 | const uint64_t required_flags); |
---|
| 66 | |
---|
[04ca20e] | 67 | struct og_msg_params { |
---|
| 68 | const char *ips_array[OG_CLIENTS_MAX]; |
---|
| 69 | const char *mac_array[OG_CLIENTS_MAX]; |
---|
[06af0c2] | 70 | const char *netmask_array[OG_CLIENTS_MAX]; |
---|
[04ca20e] | 71 | unsigned int ips_array_len; |
---|
| 72 | const char *wol_type; |
---|
| 73 | char run_cmd[4096]; |
---|
| 74 | const char *disk; |
---|
| 75 | const char *partition; |
---|
| 76 | const char *repository; |
---|
| 77 | const char *name; |
---|
| 78 | const char *id; |
---|
| 79 | const char *code; |
---|
| 80 | const char *type; |
---|
| 81 | const char *profile; |
---|
| 82 | const char *cache; |
---|
| 83 | const char *cache_size; |
---|
| 84 | bool echo; |
---|
| 85 | struct og_partition partition_setup[OG_PARTITION_MAX]; |
---|
| 86 | struct og_sync_params sync_setup; |
---|
| 87 | struct og_schedule_time time; |
---|
| 88 | const char *task_id; |
---|
| 89 | uint64_t flags; |
---|
| 90 | }; |
---|
| 91 | |
---|
| 92 | #endif |
---|