Browse code

modules/mtree: added mt_match API function

Juha Heinanen authored on 15/05/2017 13:40:28
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,57 @@
1
+/*
2
+ * Mtree module API specification
3
+ *
4
+ * This file is part of Kamailio, a free SIP server.
5
+ *
6
+ * Kamailio is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ * Kamailio is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
+ *
20
+ */
21
+
22
+#ifndef _MTREE_API_H_
23
+#define _MTREE_API_H_
24
+
25
+#include "../../core/parser/msg_parser.h"
26
+
27
+typedef int (*mt_match_f)(sip_msg_t *msg, str *tname, str *tomatch, int mval);
28
+
29
+typedef struct mtree_api {
30
+	mt_match_f mt_match;
31
+	mt_match_f mt_match_value;
32
+	mt_match_f mt_match_values;
33
+} mtree_api_t;
34
+
35
+typedef int (*bind_mtree_f)(mtree_api_t* api);
36
+
37
+/**
38
+ * @brief Load Mtree API
39
+ */
40
+static inline int mtree_load_api(mtree_api_t *api)
41
+{
42
+	bind_mtree_f bind_mtree;
43
+
44
+	bind_mtree = (bind_mtree_f)find_export("bind_mtree", 0, 0);
45
+	if (bind_mtree == 0) {
46
+		LM_ERR("cannot find bind_mtree\n");
47
+		return -1;
48
+	}
49
+	if (bind_mtree(api) <0) {
50
+		LM_ERR("cannot bind mtree api\n");
51
+		return -1;
52
+	}
53
+	return 0;
54
+}
55
+
56
+
57
+#endif /* _MTREE_API_H_ */