summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-24 13:55:59 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-24 13:55:59 +0000
commit9d1252606c16a0fd5e44fe0192a464e7a28d51fd (patch)
treecee61b63b0b8737c0cfb89113991cf143be65514 /include
parent2b8703fbe10a01e92ba737d233faffc3727341a4 (diff)
downloadzabbix-9d1252606c16a0fd5e44fe0192a464e7a28d51fd.tar.gz
zabbix-9d1252606c16a0fd5e44fe0192a464e7a28d51fd.tar.xz
zabbix-9d1252606c16a0fd5e44fe0192a464e7a28d51fd.zip
- [DEV-100] C library for JSON data format
git-svn-id: svn://svn.zabbix.com/trunk@5277 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'include')
-rw-r--r--include/common.h2
-rw-r--r--include/zbxjson.h31
2 files changed, 26 insertions, 7 deletions
diff --git a/include/common.h b/include/common.h
index f2a5c40c..250b42a3 100644
--- a/include/common.h
+++ b/include/common.h
@@ -564,6 +564,8 @@ int get_param(const char *param, int num, char *buf, int maxlen);
int num_param(const char *param);
int calculate_item_nextcheck(zbx_uint64_t itemid, int item_type, int delay, char *delay_flex, time_t now);
int check_time_period(const char *period, time_t now);
+char zbx_num2hex(u_char c);
+u_char zbx_hex2num(char c);
int zbx_binary2hex(const u_char *input, int ilen, char **output, int *olen);
int zbx_hex2binary(char *io);
void zbx_hex2octal(const char *input, char **output, int *olen);
diff --git a/include/zbxjson.h b/include/zbxjson.h
index 975bbe86..480f9423 100644
--- a/include/zbxjson.h
+++ b/include/zbxjson.h
@@ -24,17 +24,29 @@
typedef enum
{
+ ZBX_JSON_TYPE_UNKNOWN = 0,
+ ZBX_JSON_TYPE_STRING,
+ ZBX_JSON_TYPE_NULL
+} zbx_json_type_t;
+
+typedef enum
+{
ZBX_JSON_EMPTY = 0,
ZBX_JSON_COMMA
} zbx_json_status_t;
struct zbx_json {
- char *buffer;
- size_t buffer_allocated;
- size_t buffer_offset;
- size_t buffer_size;
+ char *buffer;
+ size_t buffer_allocated;
+ size_t buffer_offset;
+ size_t buffer_size;
zbx_json_status_t status;
- int level;
+ int level;
+};
+
+struct zbx_json_parse {
+ const char *start;
+ const char *end;
};
int zbx_json_init(struct zbx_json *j, size_t allocate);
@@ -42,8 +54,13 @@ int zbx_json_free(struct zbx_json *j);
int zbx_json_addobject(struct zbx_json *j, const char *name);
int zbx_json_addarray(struct zbx_json *j, const char *name);
int zbx_json_addstring(struct zbx_json *j, const char *name, const char *string);
-int zbx_json_addunit64(struct zbx_json *j, const char *name, zbx_uint64_t value);
-int zbx_json_adddouble(struct zbx_json *j, const char *name, const double *value);
+/*int zbx_json_addunit64(struct zbx_json *j, const char *name, zbx_uint64_t value);
+int zbx_json_adddouble(struct zbx_json *j, const char *name, const double *value);*/
int zbx_json_return(struct zbx_json *j);
+int zbx_json_open(const char *buffer, struct zbx_json_parse *jp);
+const char *zbx_json_decodestring(const char *p, char *string, size_t len);
+const char *zbx_json_getvalue_ptr(struct zbx_json_parse *jp, const char *name);
+zbx_json_type_t zbx_json_getvalue_type(const char *p);
+
#endif /* ZABBIX_ZJSON_H */