Browse code

kazoo: add json.count transformation

lazedo authored on 27/06/2017 22:01:37
Showing 1 changed files
... ...
@@ -33,6 +33,7 @@
33 33
 #include <json.h>
34 34
 
35 35
 
36
+int kz_json_get_count(str* json, str* field, pv_value_p dst_val);
36 37
 int kz_json_get_field(struct sip_msg* msg, char* json, char* field, char* dst);
37 38
 int kz_json_get_field_ex(str* json, str* field, pv_value_p dst_val);
38 39
 int kz_json_get_keys(struct sip_msg* msg, char* json, char* field, char* dst);
Browse code

kazoo: add exchange bindings

lazedo authored on 07/04/2017 15:06:32
Showing 1 changed files
... ...
@@ -36,8 +36,61 @@
36 36
 int kz_json_get_field(struct sip_msg* msg, char* json, char* field, char* dst);
37 37
 int kz_json_get_field_ex(str* json, str* field, pv_value_p dst_val);
38 38
 int kz_json_get_keys(struct sip_msg* msg, char* json, char* field, char* dst);
39
+enum json_type kz_json_get_type(struct json_object *jso);
39 40
 
40 41
 struct json_object* kz_json_parse(const char *str);
41 42
 struct json_object* kz_json_get_object(struct json_object* jso, const char *key);
42 43
 
44
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L
45
+
46
+# define json_foreach(obj,key,val) \
47
+	char *key; \
48
+	struct json_object *val __attribute__((__unused__)); \
49
+	for(struct lh_entry *entry ## key = json_object_get_object(obj)->head, *entry_next ## key = NULL; \
50
+		({ if(entry ## key) { \
51
+			key = (char*)entry ## key->k; \
52
+			val = (struct json_object*)entry ## key->v; \
53
+			entry_next ## key = entry ## key->next; \
54
+		} ; entry ## key; }); \
55
+		entry ## key = entry_next ## key )
56
+
57
+# define json_foreach_key(obj,key) \
58
+	char *key; \
59
+	for(struct lh_entry *entry ## key = json_object_get_object(obj)->head, *entry_next ## key = NULL; \
60
+		({ if(entry ## key) { \
61
+			key = (char*)entry ## key->k; \
62
+			entry_next ## key = entry ## key->next; \
63
+		} ; entry ## key; }); \
64
+		entry ## key = entry_next ## key )
65
+
66
+#else /* ANSI C or MSC */
67
+
68
+# define json_foreach(obj,key,val) \
69
+	char *key;\
70
+	struct json_object *val; \
71
+	struct lh_entry *entry ## key; \
72
+	struct lh_entry *entry_next ## key = NULL; \
73
+	for(entry ## key = json_object_get_object(obj)->head; \
74
+		(entry ## key ? ( \
75
+			key = (char*)entry ## key->k, \
76
+			val = (struct json_object*)entry ## key->v, \
77
+			entry_next ## key = entry ## key->next, \
78
+			entry ## key) : 0); \
79
+		entry ## key = entry_next ## key)
80
+
81
+# define json_foreach_key(obj,key) \
82
+	char *key;\
83
+	struct lh_entry *entry ## key; \
84
+	struct lh_entry *entry_next ## key = NULL; \
85
+	for(entry ## key = json_object_get_object(obj)->head; \
86
+		(entry ## key ? ( \
87
+			key = (char*)entry ## key->k, \
88
+			entry_next ## key = entry ## key->next, \
89
+			entry ## key) : 0); \
90
+		entry ## key = entry_next ## key)
91
+
92
+#endif /* defined(__GNUC__) && !defined(__STRICT_ANSI__) && __STDC_VERSION__ >= 199901L */
93
+
94
+
95
+
43 96
 #endif /* KZ_JSON_H_ */
Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -29,7 +29,7 @@
29 29
 #ifndef KZ_JSON_H_
30 30
 #define KZ_JSON_H_
31 31
 
32
-#include "../../parser/msg_parser.h"
32
+#include "../../core/parser/msg_parser.h"
33 33
 #include <json.h>
34 34
 
35 35
 
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Kazoo module interface
5
+ *
6
+ * Copyright (C) 2010-2014 2600Hz
7
+ *
8
+ * This file is part of Kamailio, a free SIP server.
9
+ *
10
+ * Kamailio is free software; you can redistribute it and/or modify
11
+ * it under the terms of the GNU General Public License as published by
12
+ * the Free Software Foundation; either version 2 of the License, or
13
+ * (at your option) any later version
14
+ *
15
+ * Kamailio is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
+ * GNU General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU General Public License
21
+ * along with this program; if not, write to the Free Software
22
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
+ *
24
+ * History:
25
+ * --------
26
+ * 2014-08  first version (2600hz)
27
+ */
28
+
29
+#ifndef KZ_JSON_H_
30
+#define KZ_JSON_H_
31
+
32
+#include "../../parser/msg_parser.h"
33
+#include <json.h>
34
+
35
+
36
+int kz_json_get_field(struct sip_msg* msg, char* json, char* field, char* dst);
37
+int kz_json_get_field_ex(str* json, str* field, pv_value_p dst_val);
38
+int kz_json_get_keys(struct sip_msg* msg, char* json, char* field, char* dst);
39
+
40
+struct json_object* kz_json_parse(const char *str);
41
+struct json_object* kz_json_get_object(struct json_object* jso, const char *key);
42
+
43
+#endif /* KZ_JSON_H_ */