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
deleted file mode 100644
... ...
@@ -1,106 +0,0 @@
1
-/*
2
- * Copyright (C) 2009 Daniel-Constantin Mierla (asipto.com) 
3
- *
4
- * Permission to use, copy, modify, and distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
16
-
17
-
18
-#ifndef _SR_XAVP_H_
19
-#define _SR_XAVP_H_
20
-
21
-#ifdef WITH_XAVP
22
-
23
-#include <time.h>
24
-#include "str.h"
25
-#include "str_list.h"
26
-
27
-struct _sr_xavp;
28
-
29
-/* types for xavp values */
30
-typedef enum {
31
-	SR_XTYPE_NULL=0,
32
-	SR_XTYPE_INT,     /* integer value */
33
-	SR_XTYPE_STR,     /* str value */
34
-	SR_XTYPE_TIME,    /* timestamp value */
35
-	SR_XTYPE_LONG,    /* long value */
36
-	SR_XTYPE_LLONG,   /* long long value */
37
-	SR_XTYPE_XAVP,    /* xavp value */
38
-	SR_XTYPE_DATA     /* custom data value */
39
-} sr_xtype_t;
40
-
41
-typedef void (*sr_xavp_sfree_f)(void *d);
42
-typedef void (*sr_data_free_f)(void *d, sr_xavp_sfree_f sfree);
43
-
44
-/* structure custom data value */
45
-typedef struct _sr_data {
46
-	void *p;
47
-	sr_data_free_f pfree;
48
-} sr_data_t;
49
-
50
-/* avp value */
51
-typedef struct _sr_xval {
52
-	sr_xtype_t type;           /* type of the value */
53
-	union {
54
-		int i;
55
-		str s;                 /* cloned in shared memory */
56
-		time_t t;
57
-		long l;
58
-		long long ll;
59
-		struct _sr_xavp *xavp; /* must be given in shm (not cloned) */
60
-		sr_data_t *data;       /* must be given in shm (not cloned) */
61
-	} v;
62
-} sr_xval_t;
63
-
64
-/* structure for extended avp */
65
-typedef struct _sr_xavp {
66
-	unsigned int id;          /* internal hash id */
67
-	str name;                 /* name of the xavp */
68
-	sr_xval_t val;            /* value of the xavp */
69
-	struct _sr_xavp *next;    /* pointer to next xavp in list */
70
-} sr_xavp_t;
71
-
72
-int xavp_init_head(void);
73
-void xavp_free(sr_xavp_t *xa);
74
-
75
-int xavp_add(sr_xavp_t *xavp, sr_xavp_t **list);
76
-int xavp_add_last(sr_xavp_t *xavp, sr_xavp_t **list);
77
-sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t **list);
78
-sr_xavp_t *xavp_add_xavp_value(str *rname, str *name, sr_xval_t *val, sr_xavp_t **list);
79
-sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list);
80
-sr_xavp_t *xavp_get(str *name, sr_xavp_t *start);
81
-sr_xavp_t *xavp_get_by_index(str *name, int idx, sr_xavp_t **start);
82
-sr_xavp_t *xavp_get_next(sr_xavp_t *start);
83
-int xavp_rm_by_name(str *name, int all, sr_xavp_t **head);
84
-int xavp_rm_by_index(str *name, int idx, sr_xavp_t **head);
85
-int xavp_rm(sr_xavp_t *xa, sr_xavp_t **head);
86
-int xavp_count(str *name, sr_xavp_t **start);
87
-void xavp_destroy_list_unsafe(sr_xavp_t **head);
88
-void xavp_destroy_list(sr_xavp_t **head);
89
-void xavp_reset_list(void);
90
-sr_xavp_t **xavp_set_list(sr_xavp_t **head);
91
-sr_xavp_t **xavp_get_crt_list(void);
92
-struct str_list *xavp_get_list_key_names(sr_xavp_t *xavp);
93
-
94
-int xavp_insert(sr_xavp_t *xavp, int idx, sr_xavp_t **list);
95
-sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list);
96
-
97
-void xavp_print_list(sr_xavp_t **head);
98
-
99
-sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold);
100
-
101
-sr_xavp_t* xavp_get_child(str *rname, str *cname);
102
-sr_xavp_t* xavp_get_child_with_ival(str *rname, str *cname);
103
-sr_xavp_t* xavp_get_child_with_sval(str *rname, str *cname);
104
-#endif
105
-
106
-#endif
Browse code

core: Fix typo in xavp header file

- Corrected avpx_free to xavp_free

Hugh Waite authored on 26/05/2015 15:30:23
Showing 1 changed files
... ...
@@ -70,7 +70,7 @@ typedef struct _sr_xavp {
70 70
 } sr_xavp_t;
71 71
 
72 72
 int xavp_init_head(void);
73
-void avpx_free(sr_xavp_t *xa);
73
+void xavp_free(sr_xavp_t *xa);
74 74
 
75 75
 int xavp_add(sr_xavp_t *xavp, sr_xavp_t **list);
76 76
 int xavp_add_last(sr_xavp_t *xavp, sr_xavp_t **list);
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2009 Daniel-Constantin Mierla (asipto.com) 
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,11 +13,6 @@
15 13
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 14
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 15
  */
18
-/*
19
- * History:
20
- * --------
21
- *  2009-05-20  created by daniel
22
- */
23 16
 
24 17
 
25 18
 #ifndef _SR_XAVP_H_
Browse code

core: helper functions to get xavp child nodes

- one function to get the $xavp(rootname=>childname) in code
- wrappers for child node, child node with int value and child node with str value

Daniel-Constantin Mierla authored on 30/09/2013 13:47:30
Showing 1 changed files
... ...
@@ -104,6 +104,10 @@ sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list);
104 104
 void xavp_print_list(sr_xavp_t **head);
105 105
 
106 106
 sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold);
107
+
108
+sr_xavp_t* xavp_get_child(str *rname, str *cname);
109
+sr_xavp_t* xavp_get_child_with_ival(str *rname, str *cname);
110
+sr_xavp_t* xavp_get_child_with_sval(str *rname, str *cname);
107 111
 #endif
108 112
 
109 113
 #endif
Browse code

core[xavp]: Added helper function to get a list of keys from a xavp variable.

Victor Seva authored on 22/04/2013 08:46:17 • Daniel-Constantin Mierla committed on 25/04/2013 08:05:46
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@
29 29
 
30 30
 #include <time.h>
31 31
 #include "str.h"
32
+#include "str_list.h"
32 33
 
33 34
 struct _sr_xavp;
34 35
 
... ...
@@ -95,6 +96,7 @@ void xavp_destroy_list(sr_xavp_t **head);
95 96
 void xavp_reset_list(void);
96 97
 sr_xavp_t **xavp_set_list(sr_xavp_t **head);
97 98
 sr_xavp_t **xavp_get_crt_list(void);
99
+struct str_list *xavp_get_list_key_names(sr_xavp_t *xavp);
98 100
 
99 101
 int xavp_insert(sr_xavp_t *xavp, int idx, sr_xavp_t **list);
100 102
 sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list);
Browse code

core: added a fuction that adds an xavp with an xavp value

Daniel-Constantin Mierla authored on 28/12/2012 18:21:28
Showing 1 changed files
... ...
@@ -81,6 +81,7 @@ void avpx_free(sr_xavp_t *xa);
81 81
 int xavp_add(sr_xavp_t *xavp, sr_xavp_t **list);
82 82
 int xavp_add_last(sr_xavp_t *xavp, sr_xavp_t **list);
83 83
 sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t **list);
84
+sr_xavp_t *xavp_add_xavp_value(str *rname, str *name, sr_xval_t *val, sr_xavp_t **list);
84 85
 sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list);
85 86
 sr_xavp_t *xavp_get(str *name, sr_xavp_t *start);
86 87
 sr_xavp_t *xavp_get_by_index(str *name, int idx, sr_xavp_t **start);
Browse code

core: extended xavp api

- functions to add an avp last in a list or inserted at a specific
position, to extract an avp from top of the list

Daniel-Constantin Mierla authored on 24/12/2012 09:02:01
Showing 1 changed files
... ...
@@ -78,6 +78,8 @@ typedef struct _sr_xavp {
78 78
 int xavp_init_head(void);
79 79
 void avpx_free(sr_xavp_t *xa);
80 80
 
81
+int xavp_add(sr_xavp_t *xavp, sr_xavp_t **list);
82
+int xavp_add_last(sr_xavp_t *xavp, sr_xavp_t **list);
81 83
 sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t **list);
82 84
 sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list);
83 85
 sr_xavp_t *xavp_get(str *name, sr_xavp_t *start);
... ...
@@ -93,7 +95,12 @@ void xavp_reset_list(void);
93 95
 sr_xavp_t **xavp_set_list(sr_xavp_t **head);
94 96
 sr_xavp_t **xavp_get_crt_list(void);
95 97
 
98
+int xavp_insert(sr_xavp_t *xavp, int idx, sr_xavp_t **list);
99
+sr_xavp_t *xavp_extract(str *name, sr_xavp_t **list);
100
+
96 101
 void xavp_print_list(sr_xavp_t **head);
102
+
103
+sr_xavp_t *xavp_clone_level_nodata(sr_xavp_t *xold);
97 104
 #endif
98 105
 
99 106
 #endif
Browse code

core: added comments to xavps structures

Daniel-Constantin Mierla authored on 12/12/2012 10:08:45
Showing 1 changed files
... ...
@@ -32,43 +32,47 @@
32 32
 
33 33
 struct _sr_xavp;
34 34
 
35
+/* types for xavp values */
35 36
 typedef enum {
36 37
 	SR_XTYPE_NULL=0,
37
-	SR_XTYPE_INT,
38
-	SR_XTYPE_STR,
39
-	SR_XTYPE_TIME,
40
-	SR_XTYPE_LONG,
41
-	SR_XTYPE_LLONG,
42
-	SR_XTYPE_XAVP,
43
-	SR_XTYPE_DATA
38
+	SR_XTYPE_INT,     /* integer value */
39
+	SR_XTYPE_STR,     /* str value */
40
+	SR_XTYPE_TIME,    /* timestamp value */
41
+	SR_XTYPE_LONG,    /* long value */
42
+	SR_XTYPE_LLONG,   /* long long value */
43
+	SR_XTYPE_XAVP,    /* xavp value */
44
+	SR_XTYPE_DATA     /* custom data value */
44 45
 } sr_xtype_t;
45 46
 
46 47
 typedef void (*sr_xavp_sfree_f)(void *d);
47 48
 typedef void (*sr_data_free_f)(void *d, sr_xavp_sfree_f sfree);
48 49
 
50
+/* structure custom data value */
49 51
 typedef struct _sr_data {
50 52
 	void *p;
51 53
 	sr_data_free_f pfree;
52 54
 } sr_data_t;
53 55
 
56
+/* avp value */
54 57
 typedef struct _sr_xval {
55
-	sr_xtype_t type;
58
+	sr_xtype_t type;           /* type of the value */
56 59
 	union {
57 60
 		int i;
58
-		str s;                 /* replicated */
61
+		str s;                 /* cloned in shared memory */
59 62
 		time_t t;
60 63
 		long l;
61 64
 		long long ll;
62
-		struct _sr_xavp *xavp; /* must be given in shm */
63
-		sr_data_t *data;       /* must be given in shm */
65
+		struct _sr_xavp *xavp; /* must be given in shm (not cloned) */
66
+		sr_data_t *data;       /* must be given in shm (not cloned) */
64 67
 	} v;
65 68
 } sr_xval_t;
66 69
 
70
+/* structure for extended avp */
67 71
 typedef struct _sr_xavp {
68
-	unsigned int id;
69
-	str name;
70
-	sr_xval_t val;
71
-	struct _sr_xavp *next;
72
+	unsigned int id;          /* internal hash id */
73
+	str name;                 /* name of the xavp */
74
+	sr_xval_t val;            /* value of the xavp */
75
+	struct _sr_xavp *next;    /* pointer to next xavp in list */
72 76
 } sr_xavp_t;
73 77
 
74 78
 int xavp_init_head(void);
Browse code

core: introducing xavp (eXtended AVP)

- design:
- one master list stored in core
- internal integer id to optimise the search in list (hash value over the string name)
- name stored as str and null terminated (can use regexp over it)
- string values stored as str and null terminated
- other types of value that can be used internally (not in config)
- long
- long long
- time
- xavp (or list of xavp)
- generic data structure
- for more see: http://sip-router.org/wiki/devel/xavp
- NOTE: this is not a replacement for existing AVPs, but an add-on, a new pseudo-variable class

Daniel-Constantin Mierla authored on 30/06/2009 10:26:56
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,95 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2009 Daniel-Constantin Mierla (asipto.com) 
5
+ *
6
+ * Permission to use, copy, modify, and distribute this software for any
7
+ * purpose with or without fee is hereby granted, provided that the above
8
+ * copyright notice and this permission notice appear in all copies.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+ */
18
+/*
19
+ * History:
20
+ * --------
21
+ *  2009-05-20  created by daniel
22
+ */
23
+
24
+
25
+#ifndef _SR_XAVP_H_
26
+#define _SR_XAVP_H_
27
+
28
+#ifdef WITH_XAVP
29
+
30
+#include <time.h>
31
+#include "str.h"
32
+
33
+struct _sr_xavp;
34
+
35
+typedef enum {
36
+	SR_XTYPE_NULL=0,
37
+	SR_XTYPE_INT,
38
+	SR_XTYPE_STR,
39
+	SR_XTYPE_TIME,
40
+	SR_XTYPE_LONG,
41
+	SR_XTYPE_LLONG,
42
+	SR_XTYPE_XAVP,
43
+	SR_XTYPE_DATA
44
+} sr_xtype_t;
45
+
46
+typedef void (*sr_xavp_sfree_f)(void *d);
47
+typedef void (*sr_data_free_f)(void *d, sr_xavp_sfree_f sfree);
48
+
49
+typedef struct _sr_data {
50
+	void *p;
51
+	sr_data_free_f pfree;
52
+} sr_data_t;
53
+
54
+typedef struct _sr_xval {
55
+	sr_xtype_t type;
56
+	union {
57
+		int i;
58
+		str s;                 /* replicated */
59
+		time_t t;
60
+		long l;
61
+		long long ll;
62
+		struct _sr_xavp *xavp; /* must be given in shm */
63
+		sr_data_t *data;       /* must be given in shm */
64
+	} v;
65
+} sr_xval_t;
66
+
67
+typedef struct _sr_xavp {
68
+	unsigned int id;
69
+	str name;
70
+	sr_xval_t val;
71
+	struct _sr_xavp *next;
72
+} sr_xavp_t;
73
+
74
+int xavp_init_head(void);
75
+void avpx_free(sr_xavp_t *xa);
76
+
77
+sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t **list);
78
+sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list);
79
+sr_xavp_t *xavp_get(str *name, sr_xavp_t *start);
80
+sr_xavp_t *xavp_get_by_index(str *name, int idx, sr_xavp_t **start);
81
+sr_xavp_t *xavp_get_next(sr_xavp_t *start);
82
+int xavp_rm_by_name(str *name, int all, sr_xavp_t **head);
83
+int xavp_rm_by_index(str *name, int idx, sr_xavp_t **head);
84
+int xavp_rm(sr_xavp_t *xa, sr_xavp_t **head);
85
+int xavp_count(str *name, sr_xavp_t **start);
86
+void xavp_destroy_list_unsafe(sr_xavp_t **head);
87
+void xavp_destroy_list(sr_xavp_t **head);
88
+void xavp_reset_list(void);
89
+sr_xavp_t **xavp_set_list(sr_xavp_t **head);
90
+sr_xavp_t **xavp_get_crt_list(void);
91
+
92
+void xavp_print_list(sr_xavp_t **head);
93
+#endif
94
+
95
+#endif