Browse code

core: added generic interface for kamailio embedded api

Daniel-Constantin Mierla authored on 11/04/2016 16:00:46
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,29 @@
1
+/**
2
+ * Copyright (C) 2016 Daniel-Constantin Mierla (asipto.com)
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
+#include <stdio.h>
23
+#include <unistd.h>
24
+#include <stdlib.h>
25
+
26
+#include "dprint.h"
27
+
28
+#include "kemi.h"
29
+
0 30
new file mode 100644
... ...
@@ -0,0 +1,77 @@
1
+/**
2
+ * Copyright (C) 2016 Daniel-Constantin Mierla (asipto.com)
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 _SR_KEMI_H_
23
+#define _SR_KEMI_H_
24
+
25
+#include "str.h"
26
+#include "parser/msg_parser.h"
27
+
28
+#define SR_KEMIP_NONE	(0)
29
+#define SR_KEMIP_INT	(1<<0)
30
+#define SR_KEMIP_STR	(1<<1)
31
+#define SR_KEMIP_BOOL	(1<<2)
32
+
33
+#define SR_KEMI_PARAMS_MAX	6
34
+
35
+typedef struct sr_kemi {
36
+	str mname;
37
+	str fname;
38
+	int rtype;
39
+	void *func;
40
+	int ptypes[SR_KEMI_PARAMS_MAX];
41
+} sr_kemi_t;
42
+
43
+typedef struct sr_kemi_item {
44
+	sr_kemi_t *item;
45
+	int nparams;
46
+	struct sr_kemi_item *next;
47
+} sr_kemi_item_t;
48
+
49
+typedef union {
50
+	int n;
51
+	str s;
52
+} sr_kemi_val_t;
53
+
54
+/* only sip_msg_t */
55
+typedef int (*sr_kemi_fm_f)(sip_msg_t*);
56
+
57
+/* sip_msg_t and one int|str param */
58
+typedef int (*sr_kemi_fmn_f)(sip_msg_t*, int);
59
+typedef int (*sr_kemi_fms_f)(sip_msg_t*, str*);
60
+
61
+/* sip_msg_t and two int|str param */
62
+typedef int (*sr_kemi_fmnn_f)(sip_msg_t*, int, int);
63
+typedef int (*sr_kemi_fmns_f)(sip_msg_t*, int, str*);
64
+typedef int (*sr_kemi_fmsn_f)(sip_msg_t*, str*, int);
65
+typedef int (*sr_kemi_fmss_f)(sip_msg_t*, str*, str*);
66
+
67
+/* sip_msg_t and three int|str param */
68
+typedef int (*sr_kemi_fmnnn_f)(sip_msg_t*, int, int, int);
69
+typedef int (*sr_kemi_fmnns_f)(sip_msg_t*, int, int, str*);
70
+typedef int (*sr_kemi_fmnsn_f)(sip_msg_t*, int, str*, int);
71
+typedef int (*sr_kemi_fmnss_f)(sip_msg_t*, int, str*, str*);
72
+typedef int (*sr_kemi_fmsnn_f)(sip_msg_t*, str*, int, int);
73
+typedef int (*sr_kemi_fmsns_f)(sip_msg_t*, str*, int, str*);
74
+typedef int (*sr_kemi_fmssn_f)(sip_msg_t*, str*, str*, int);
75
+typedef int (*sr_kemi_fmsss_f)(sip_msg_t*, str*, str*, str*);
76
+
77
+#endif