libpcp_web: JSON API coding consistency, small improvements and fixes
[pcp.git] / src / include / pcp / pmjson.h
blobb4117500569b0eb4bbc33230ba575f96873e6ffd
1 /*
2 * Copyright (c) 2015-2017 Red Hat.
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 * License for more details.
14 * Javascript Object Notation metric value extraction (libpcp_web)
16 #ifndef PCP_PMJSON_H
17 #define PCP_PMJSON_H
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
23 typedef enum json_flags {
24 pmjson_flag_bitfield = (1<<0),
25 pmjson_flag_boolean = (1<<1),
26 pmjson_flag_s32 = (1<<2),
27 pmjson_flag_u32 = (1<<3),
28 pmjson_flag_s64 = (1<<4),
29 pmjson_flag_u64 = (1<<5),
30 pmjson_flag_float = (1<<6),
31 pmjson_flag_double = (1<<7),
32 } json_flags;
34 typedef struct json_metric_desc {
35 char *json_pointer; /* json pointer to metric */
36 json_flags flags; /* flags to check if set */
37 int num_values; /* number of values */
38 pmAtomValue values; /* metric value */
39 char *dom; /* instance name */
40 } json_metric_desc;
42 typedef int (*json_get)(char *, int, void *);
43 PCP_CALL extern int pmjsonGet(json_metric_desc *, int, pmInDom, json_get, void *);
45 PCP_CALL extern int pmjsonInit(int fd, json_metric_desc *, int);
46 PCP_CALL extern int pmjsonInitIndom(int fd, json_metric_desc *, int, pmInDom);
48 #ifdef __cplusplus
50 #endif
52 #endif /* PCP_PMJSON_H */