source: ogServer-Git/sources/json.h @ 9c8e5c7

Last change on this file since 9c8e5c7 was 04ca20e, checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago

#971 split into smaller file

Split ogAdmServer into several files:

  • sources/rest.c that implements the server REST API.
  • sources/client.c that implements the client REST API.
  • sources/json.c that provides a few JSON helpers.
  • Property mode set to 100644
File size: 1.8 KB
RevLine 
[04ca20e]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_uint(json_t *element, uint32_t *integer);
9int og_json_parse_bool(json_t *element, bool *value);
10
11#define OG_PARAM_PART_NUMBER                    (1UL << 0)
12#define OG_PARAM_PART_CODE                      (1UL << 1)
13#define OG_PARAM_PART_FILESYSTEM                (1UL << 2)
14#define OG_PARAM_PART_SIZE                      (1UL << 3)
15#define OG_PARAM_PART_FORMAT                    (1UL << 4)
16#define OG_PARAM_PART_DISK                      (1UL << 5)
17#define OG_PARAM_PART_OS                        (1UL << 6)
18#define OG_PARAM_PART_USED_SIZE                 (1UL << 7)
19
20struct og_partition {
21        const char      *disk;
22        const char      *number;
23        const char      *code;
24        const char      *size;
25        const char      *filesystem;
26        const char      *format;
27        const char      *os;
28        const char      *used_size;
29};
30
31#define OG_PARTITION_MAX        4
32
33int og_json_parse_partition(json_t *element, struct og_partition *part,
34                            uint64_t required_flags);
35
36#define OG_CLIENTS_MAX  4096
37
38struct og_sync_params {
39        const char      *sync;
40        const char      *diff;
41        const char      *remove;
42        const char      *compress;
43        const char      *cleanup;
44        const char      *cache;
45        const char      *cleanup_cache;
46        const char      *remove_dst;
47        const char      *diff_id;
48        const char      *diff_name;
49        const char      *path;
50        const char      *method;
51};
52
53struct og_msg_params {
54        const char      *ips_array[OG_CLIENTS_MAX];
55        const char      *mac_array[OG_CLIENTS_MAX];
56        unsigned int    ips_array_len;
57        const char      *wol_type;
58        char            run_cmd[4096];
59        const char      *disk;
60        const char      *partition;
61        const char      *repository;
62        const char      *name;
63        const char      *id;
64        const char      *code;
65        const char      *type;
66        const char      *profile;
67        const char      *cache;
68        const char      *cache_size;
69        bool            echo;
70        struct og_partition     partition_setup[OG_PARTITION_MAX];
71        struct og_sync_params sync_setup;
72        struct og_schedule_time time;
73        const char      *task_id;
74        uint64_t        flags;
75};
76
77#endif
Note: See TracBrowser for help on using the repository browser.