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 @@
0
+/**
1
+ * Copyright (C) 2016 Daniel-Constantin Mierla (asipto.com)
2
+ *
3
+ * This file is part of Kamailio, a free SIP server.
4
+ *
5
+ * Kamailio is free software; you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation; either version 2 of the License, or
8
+ * (at your option) any later version
9
+ *
10
+ * Kamailio is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
+ *
19
+ */
20
+
21
+#include <stdio.h>
22
+#include <unistd.h>
23
+#include <stdlib.h>
24
+
25
+#include "dprint.h"
26
+
27
+#include "kemi.h"
28
+
0 29
new file mode 100644
... ...
@@ -0,0 +1,77 @@
0
+/**
1
+ * Copyright (C) 2016 Daniel-Constantin Mierla (asipto.com)
2
+ *
3
+ * This file is part of Kamailio, a free SIP server.
4
+ *
5
+ * Kamailio is free software; you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation; either version 2 of the License, or
8
+ * (at your option) any later version
9
+ *
10
+ * Kamailio is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18
+ *
19
+ */
20
+
21
+#ifndef _SR_KEMI_H_
22
+#define _SR_KEMI_H_
23
+
24
+#include "str.h"
25
+#include "parser/msg_parser.h"
26
+
27
+#define SR_KEMIP_NONE	(0)
28
+#define SR_KEMIP_INT	(1<<0)
29
+#define SR_KEMIP_STR	(1<<1)
30
+#define SR_KEMIP_BOOL	(1<<2)
31
+
32
+#define SR_KEMI_PARAMS_MAX	6
33
+
34
+typedef struct sr_kemi {
35
+	str mname;
36
+	str fname;
37
+	int rtype;
38
+	void *func;
39
+	int ptypes[SR_KEMI_PARAMS_MAX];
40
+} sr_kemi_t;
41
+
42
+typedef struct sr_kemi_item {
43
+	sr_kemi_t *item;
44
+	int nparams;
45
+	struct sr_kemi_item *next;
46
+} sr_kemi_item_t;
47
+
48
+typedef union {
49
+	int n;
50
+	str s;
51
+} sr_kemi_val_t;
52
+
53
+/* only sip_msg_t */
54
+typedef int (*sr_kemi_fm_f)(sip_msg_t*);
55
+
56
+/* sip_msg_t and one int|str param */
57
+typedef int (*sr_kemi_fmn_f)(sip_msg_t*, int);
58
+typedef int (*sr_kemi_fms_f)(sip_msg_t*, str*);
59
+
60
+/* sip_msg_t and two int|str param */
61
+typedef int (*sr_kemi_fmnn_f)(sip_msg_t*, int, int);
62
+typedef int (*sr_kemi_fmns_f)(sip_msg_t*, int, str*);
63
+typedef int (*sr_kemi_fmsn_f)(sip_msg_t*, str*, int);
64
+typedef int (*sr_kemi_fmss_f)(sip_msg_t*, str*, str*);
65
+
66
+/* sip_msg_t and three int|str param */
67
+typedef int (*sr_kemi_fmnnn_f)(sip_msg_t*, int, int, int);
68
+typedef int (*sr_kemi_fmnns_f)(sip_msg_t*, int, int, str*);
69
+typedef int (*sr_kemi_fmnsn_f)(sip_msg_t*, int, str*, int);
70
+typedef int (*sr_kemi_fmnss_f)(sip_msg_t*, int, str*, str*);
71
+typedef int (*sr_kemi_fmsnn_f)(sip_msg_t*, str*, int, int);
72
+typedef int (*sr_kemi_fmsns_f)(sip_msg_t*, str*, int, str*);
73
+typedef int (*sr_kemi_fmssn_f)(sip_msg_t*, str*, str*, int);
74
+typedef int (*sr_kemi_fmsss_f)(sip_msg_t*, str*, str*, str*);
75
+
76
+#endif