source: ogServer-Git/src/json.h @ cb7fa56

Last change on this file since cb7fa56 was 12d8fff, checked in by OpenGnSys Support Team <soporte-og@…>, 3 years ago

#1037 Add disk type

Add ogServer support for parsing and storing in the DB disk type data
from ogClient refresh response.

See also commits with #1037 in ogClient and WebConsole? repo.

  • Property mode set to 100644
File size: 2.3 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#define OG_PARAM_PART_DISK_TYPE                 (1UL << 8)
22
23struct og_partition {
24        const char      *disk;
25        const char      *disk_type;
26        const char      *number;
27        const char      *code;
28        const char      *size;
29        const char      *filesystem;
30        const char      *format;
31        const char      *os;
32        const char      *used_size;
33};
34
35#define OG_DISK_MAX             4
36#define OG_PARTITION_MAX        (4 * OG_DISK_MAX)
37
38int og_json_parse_partition(json_t *element, struct og_partition *part,
39                            uint64_t required_flags);
40
41#define OG_CLIENTS_MAX  4096
42
43struct og_sync_params {
44        const char      *sync;
45        const char      *diff;
46        const char      *remove;
47        const char      *compress;
48        const char      *cleanup;
49        const char      *cache;
50        const char      *cleanup_cache;
51        const char      *remove_dst;
52        const char      *diff_id;
53        const char      *diff_name;
54        const char      *path;
55        const char      *method;
56};
57
58#define OG_PARAM_SCOPE_ID       (1UL << 0)
59#define OG_PARAM_SCOPE_TYPE     (1UL << 1)
60
61struct og_scope {
62        uint32_t        id;
63        const char      *type;
64};
65
66int og_json_parse_scope(json_t *element, struct og_scope *scope,
67                        const uint64_t required_flags);
68
69struct og_msg_params {
70        const char      *ips_array[OG_CLIENTS_MAX];
71        const char      *mac_array[OG_CLIENTS_MAX];
72        const char      *netmask_array[OG_CLIENTS_MAX];
73        unsigned int    ips_array_len;
74        const char      *wol_type;
75        char            run_cmd[4096];
76        const char      *disk;
77        const char      *partition;
78        const char      *repository;
79        const char      *name;
80        const char      *id;
81        const char      *code;
82        const char      *type;
83        const char      *profile;
84        const char      *cache;
85        const char      *cache_size;
86        const char      *comment;
87        bool            echo;
88        struct og_partition     partition_setup[OG_PARTITION_MAX];
89        struct og_sync_params sync_setup;
90        struct og_schedule_time time;
91        const char      *task_id;
92        uint64_t        flags;
93};
94
95#endif
Note: See TracBrowser for help on using the repository browser.