source: ogServer-Git/src/json.h @ 10b07ba

Last change on this file since 10b07ba was 24e6fbf, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

#1008 Restore support for 4 disks and 16 partitions

ogServer expects to receive information of 1 disk and 4 partitions
from ogClient. Previous ogServer versions support several disks and
partitions.

Add ogServer support for 4 disks and 16 partitions.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1#ifndef _OG_JSON_H
2#define _OG_JSON_H
3
4#include <jansson.h>
5#include "schedule.h"
6
7int og_json_parse_string(json_t *element, const char **str);
8int og_json_parse_string_copy(json_t *element, char *str, size_t size);
9int og_json_parse_uint64(json_t *element, uint64_t *integer);
10int og_json_parse_uint(json_t *element, uint32_t *integer);
11int 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
22struct 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
33#define OG_DISK_MAX             4
34#define OG_PARTITION_MAX        (4 * OG_DISK_MAX)
35
36int og_json_parse_partition(json_t *element, struct og_partition *part,
37                            uint64_t required_flags);
38
39#define OG_CLIENTS_MAX  4096
40
41struct 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
56#define OG_PARAM_SCOPE_ID       (1UL << 0)
57#define OG_PARAM_SCOPE_TYPE     (1UL << 1)
58
59struct og_scope {
60        uint32_t        id;
61        const char      *type;
62};
63
64int og_json_parse_scope(json_t *element, struct og_scope *scope,
65                        const uint64_t required_flags);
66
67struct og_msg_params {
68        const char      *ips_array[OG_CLIENTS_MAX];
69        const char      *mac_array[OG_CLIENTS_MAX];
70        const char      *netmask_array[OG_CLIENTS_MAX];
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
Note: See TracBrowser for help on using the repository browser.