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,183 +0,0 @@
1
-/*
2
- * Route & Record-Route Parser
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- *
6
- * This file is part of Kamailio, a free SIP server.
7
- *
8
- * Kamailio is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * Kamailio is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
- */
22
-
23
-/*! \file
24
- * \brief Parser :: Route & Record-Route header field parser
25
- *
26
- * \ingroup parser
27
- */
28
-
29
-#ifndef PARSE_RR_H
30
-#define PARSE_RR_H
31
-
32
-#include <stdio.h>
33
-#include "msg_parser.h"
34
-#include "parse_nameaddr.h"
35
-#include "parse_param.h"
36
-#include "hf.h"
37
-
38
-
39
-/*! \brief
40
- * Structure representing a Route & Record-Route HF body
41
- */
42
-typedef struct rr {
43
-	name_addr_t nameaddr; /*!< Name-addr part */
44
-	param_t* r2;          /*!< Hook to r2 parameter */
45
-	param_t* params;      /*!< Linked list of other parameters */
46
-	int len;              /*!< Length of the whole route field */
47
-	struct rr* next;      /*!< Next RR in the list */
48
-} rr_t;
49
-
50
-
51
-/*
52
- * Parse Route & Record-Route header fields
53
- */
54
-int parse_rr(struct hdr_field* _r);
55
-
56
-/*
57
- * Parse the body of Route & Record-Route headers
58
- */
59
-int parse_rr_body(char *buf, int len, rr_t **head);
60
-
61
-/*
62
- * Free list of rr
63
- * _c is head of the list
64
- */
65
-void free_rr(rr_t** _r);
66
-
67
-
68
-/*
69
- * Free list of rr
70
- * _c is head of the list
71
- */
72
-void shm_free_rr(rr_t** _r);
73
-
74
-
75
-/*
76
- * Print list of rrs, just for debugging
77
- */
78
-void print_rr(FILE* _o, rr_t* _r);
79
-
80
-
81
-/*
82
- * Duplicate a single rr_t structure using pkg_malloc
83
- */
84
-int duplicate_rr(rr_t** _new, rr_t* _r);
85
-
86
-
87
-/*
88
- * Duplicate a single rr_t structure using pkg_malloc
89
- */
90
-int shm_duplicate_rr(rr_t** _new, rr_t* _r);
91
-
92
-/*
93
- * Find out if a URI contains r2 parameter which indicates
94
- * that we put 2 record routes
95
- */
96
-static inline int is_2rr(str* _params)
97
-{
98
-	str s;
99
-	int i, state = 0;
100
-
101
-	if (_params->len == 0) return 0;
102
-	s = *_params;
103
-
104
-	for(i = 0; i < s.len; i++) {
105
-		switch(state) {
106
-		case 0:
107
-			switch(s.s[i]) {
108
-			case ' ':
109
-			case '\r':
110
-			case '\n':
111
-			case '\t':           break;
112
-			case 'r':
113
-			case 'R': state = 1; break;
114
-			default:  state = 4; break;
115
-			}
116
-			break;
117
-
118
-		case 1:
119
-			switch(s.s[i]) {
120
-			case '2': state = 2; break;
121
-			default:  state = 4; break;
122
-			}
123
-			break;
124
-
125
-		case 2:
126
-			switch(s.s[i]) {
127
-			case ';':  return 1;
128
-			case '=':  return 1;
129
-			case ' ':
130
-			case '\r':
131
-			case '\n':
132
-			case '\t': state = 3; break;
133
-			default:   state = 4; break;
134
-			}
135
-			break;
136
-
137
-		case 3:
138
-			switch(s.s[i]) {
139
-			case ';':  return 1;
140
-			case '=':  return 1;
141
-			case ' ':
142
-			case '\r':
143
-			case '\n':
144
-			case '\t': break;
145
-			default:   state = 4; break;
146
-			}
147
-			break;
148
-
149
-		case 4:
150
-			switch(s.s[i]) {
151
-			case '\"': state = 5; break;
152
-			case ';':  state = 0; break;
153
-			default:              break;
154
-			}
155
-			break;
156
-
157
-		case 5:
158
-			switch(s.s[i]) {
159
-			case '\\': state = 6; break;
160
-			case '\"': state = 4; break;
161
-			default:              break;
162
-			}
163
-			break;
164
-
165
-		case 6: state = 5; break;
166
-		}
167
-	}
168
-
169
-	if ((state == 2) || (state == 3)) return 1;
170
-	else return 0;
171
-}
172
-
173
-/*!
174
- * get first RR header and print comma separated bodies in oroute
175
- * - order = 0 normal; order = 1 reverse
176
- * - nb_recs - input=skip number of rr; output=number of printed rrs
177
- */
178
-int print_rr_body(struct hdr_field *iroute, str *oroute, int order,
179
-				  unsigned int * nb_recs);
180
-
181
-int get_path_dst_uri(str *_p, str *_dst);
182
-
183
-#endif /* PARSE_RR_H */
Browse code

core parser - remove svn ID, remove history, change "ser" => "Kamailio"

Olle E. Johansson authored on 18/01/2015 19:36:18
Showing 1 changed files
... ...
@@ -3,19 +3,14 @@
3 3
  *
4 4
  * Copyright (C) 2001-2003 FhG Fokus
5 5
  *
6
- * This file is part of ser, a free SIP server.
6
+ * This file is part of Kamailio, a free SIP server.
7 7
  *
8
- * ser is free software; you can redistribute it and/or modify
8
+ * Kamailio is free software; you can redistribute it and/or modify
9 9
  * it under the terms of the GNU General Public License as published by
10 10
  * the Free Software Foundation; either version 2 of the License, or
11 11
  * (at your option) any later version
12 12
  *
13
- * For a license to use the ser software under conditions
14
- * other than those described here, or to purchase support for this
15
- * software, please contact iptel.org by e-mail at the following addresses:
16
- *    info@iptel.org
17
- *
18
- * ser is distributed in the hope that it will be useful,
13
+ * Kamailio is distributed in the hope that it will be useful,
19 14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 16
  * GNU General Public License for more details.
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -22,7 +22,7 @@
22 22
  *
23 23
  * You should have received a copy of the GNU General Public License 
24 24
  * along with this program; if not, write to the Free Software 
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
26 26
  */
27 27
 
28 28
 /*! \file
Browse code

parser: remove old $Id$ docs header from subversion times, not usable anymore

Henning Westerholt authored on 05/07/2012 21:39:51
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Route & Record-Route Parser
5 3
  *
6 4
  * Copyright (C) 2001-2003 FhG Fokus
Browse code

parser: relocated helper functions

Daniel-Constantin Mierla authored on 10/01/2012 22:33:00
Showing 1 changed files
... ...
@@ -177,4 +177,14 @@ static inline int is_2rr(str* _params)
177 177
 	else return 0;
178 178
 }
179 179
 
180
+/*!
181
+ * get first RR header and print comma separated bodies in oroute
182
+ * - order = 0 normal; order = 1 reverse
183
+ * - nb_recs - input=skip number of rr; output=number of printed rrs
184
+ */
185
+int print_rr_body(struct hdr_field *iroute, str *oroute, int order,
186
+				  unsigned int * nb_recs);
187
+
188
+int get_path_dst_uri(str *_p, str *_dst);
189
+
180 190
 #endif /* PARSE_RR_H */
Browse code

Doxygen changes

oej authored on 25/10/2009 18:30:31
Showing 1 changed files
... ...
@@ -27,6 +27,11 @@
27 27
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 28
  */
29 29
 
30
+/*! \file
31
+ * \brief Parser :: Route & Record-Route header field parser
32
+ *
33
+ * \ingroup parser
34
+ */
30 35
 
31 36
 #ifndef PARSE_RR_H
32 37
 #define PARSE_RR_H
... ...
@@ -38,15 +43,15 @@
38 43
 #include "hf.h"
39 44
 
40 45
 
41
-/*
46
+/*! \brief
42 47
  * Structure representing a Route & Record-Route HF body
43 48
  */
44 49
 typedef struct rr {
45
-	name_addr_t nameaddr; /* Name-addr part */
46
-	param_t* r2;          /* Hook to r2 parameter */
47
-	param_t* params;      /* Linked list of other parameters */
48
-	int len;              /* Length of the whole route field */
49
-	struct rr* next;      /* Next RR in the list */
50
+	name_addr_t nameaddr; /*!< Name-addr part */
51
+	param_t* r2;          /*!< Hook to r2 parameter */
52
+	param_t* params;      /*!< Linked list of other parameters */
53
+	int len;              /*!< Length of the whole route field */
54
+	struct rr* next;      /*!< Next RR in the list */
50 55
 } rr_t;
51 56
 
52 57
 
Browse code

is_2rr moved into rr parser to allow its usage from other modules

Vaclav Kubart authored on 24/08/2007 08:29:04
Showing 1 changed files
... ...
@@ -91,5 +91,85 @@ int duplicate_rr(rr_t** _new, rr_t* _r);
91 91
  */
92 92
 int shm_duplicate_rr(rr_t** _new, rr_t* _r);
93 93
 
94
+/*
95
+ * Find out if a URI contains r2 parameter which indicates
96
+ * that we put 2 record routes
97
+ */
98
+static inline int is_2rr(str* _params)
99
+{
100
+	str s;
101
+	int i, state = 0;
102
+
103
+	if (_params->len == 0) return 0;
104
+	s = *_params;
105
+
106
+	for(i = 0; i < s.len; i++) {
107
+		switch(state) {
108
+		case 0:
109
+			switch(s.s[i]) {
110
+			case ' ':
111
+			case '\r':
112
+			case '\n':
113
+			case '\t':           break;
114
+			case 'r':
115
+			case 'R': state = 1; break;
116
+			default:  state = 4; break;
117
+			}
118
+			break;
119
+
120
+		case 1:
121
+			switch(s.s[i]) {
122
+			case '2': state = 2; break;
123
+			default:  state = 4; break;
124
+			}
125
+			break;
126
+
127
+		case 2:
128
+			switch(s.s[i]) {
129
+			case ';':  return 1;
130
+			case '=':  return 1;
131
+			case ' ':
132
+			case '\r':
133
+			case '\n':
134
+			case '\t': state = 3; break;
135
+			default:   state = 4; break;
136
+			}
137
+			break;
138
+
139
+		case 3:
140
+			switch(s.s[i]) {
141
+			case ';':  return 1;
142
+			case '=':  return 1;
143
+			case ' ':
144
+			case '\r':
145
+			case '\n':
146
+			case '\t': break;
147
+			default:   state = 4; break;
148
+			}
149
+			break;
150
+
151
+		case 4:
152
+			switch(s.s[i]) {
153
+			case '\"': state = 5; break;
154
+			case ';':  state = 0; break;
155
+			default:              break;
156
+			}
157
+			break;
158
+
159
+		case 5:
160
+			switch(s.s[i]) {
161
+			case '\\': state = 6; break;
162
+			case '\"': state = 4; break;
163
+			default:              break;
164
+			}
165
+			break;
166
+
167
+		case 6: state = 5; break;
168
+		}
169
+	}
170
+
171
+	if ((state == 2) || (state == 3)) return 1;
172
+	else return 0;
173
+}
94 174
 
95 175
 #endif /* PARSE_RR_H */
Browse code

- Spelling checked

Jan Janak authored on 24/08/2004 09:01:24
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
  *
4 4
  * Route & Record-Route Parser
5 5
  *
6
- * Copyright (C) 2001-2003 Fhg Fokus
6
+ * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
8 8
  * This file is part of ser, a free SIP server.
9 9
  *
Browse code

- extracted inline function from parse_rr() to parse only the body of the header - parse_rr() calls now this function - wrapper to the inline function so that can be called from everywhere - duplicate_rr functions duplicates the whole likend list of routes, if applicable

Daniel-Constantin Mierla authored on 29/10/2003 12:25:31
Showing 1 changed files
... ...
@@ -46,7 +46,7 @@ typedef struct rr {
46 46
 	param_t* r2;          /* Hook to r2 parameter */
47 47
 	param_t* params;      /* Linked list of other parameters */
48 48
 	int len;              /* Length of the whole route field */
49
-        struct rr* next;      /* Next RR in the list */
49
+	struct rr* next;      /* Next RR in the list */
50 50
 } rr_t;
51 51
 
52 52
 
... ...
@@ -55,6 +55,10 @@ typedef struct rr {
55 55
  */
56 56
 int parse_rr(struct hdr_field* _r);
57 57
 
58
+/*
59
+ * Parse the body of Route & Record-Route headers
60
+ */
61
+int parse_rr_body(char *buf, int len, rr_t **head);
58 62
 
59 63
 /*
60 64
  * Free list of rr
Browse code

- unnecesarry parameter removed from *_duplicate_rr (thanks to Daniel)

Jan Janak authored on 13/10/2003 21:40:21
Showing 1 changed files
... ...
@@ -79,13 +79,13 @@ void print_rr(FILE* _o, rr_t* _r);
79 79
 /*
80 80
  * Duplicate a single rr_t structure using pkg_malloc
81 81
  */
82
-int duplicate_rr(struct sip_msg* _m, rr_t** _new, rr_t* _r);
82
+int duplicate_rr(rr_t** _new, rr_t* _r);
83 83
 
84 84
 
85 85
 /*
86 86
  * Duplicate a single rr_t structure using pkg_malloc
87 87
  */
88
-int shm_duplicate_rr(struct sip_msg* _m, rr_t** _new, rr_t* _r);
88
+int shm_duplicate_rr(rr_t** _new, rr_t* _r);
89 89
 
90 90
 
91 91
 #endif /* PARSE_RR_H */
Browse code

- print_* function don't use stdout anymore

Jan Janak authored on 10/04/2003 12:38:18
Showing 1 changed files
... ...
@@ -31,6 +31,7 @@
31 31
 #ifndef PARSE_RR_H
32 32
 #define PARSE_RR_H
33 33
 
34
+#include <stdio.h>
34 35
 #include "msg_parser.h"
35 36
 #include "parse_nameaddr.h"
36 37
 #include "parse_param.h"
... ...
@@ -72,7 +73,7 @@ void shm_free_rr(rr_t** _r);
72 73
 /*
73 74
  * Print list of rrs, just for debugging
74 75
  */
75
-void print_rr(rr_t* _r);
76
+void print_rr(FILE* _o, rr_t* _r);
76 77
 
77 78
 
78 79
 /*
Browse code

shm duplication functions

Jan Janak authored on 07/04/2003 11:48:26
Showing 1 changed files
... ...
@@ -62,6 +62,13 @@ int parse_rr(struct hdr_field* _r);
62 62
 void free_rr(rr_t** _r);
63 63
 
64 64
 
65
+/*
66
+ * Free list of rr
67
+ * _c is head of the list
68
+ */
69
+void shm_free_rr(rr_t** _r);
70
+
71
+
65 72
 /*
66 73
  * Print list of rrs, just for debugging
67 74
  */
... ...
@@ -74,4 +81,10 @@ void print_rr(rr_t* _r);
74 81
 int duplicate_rr(struct sip_msg* _m, rr_t** _new, rr_t* _r);
75 82
 
76 83
 
84
+/*
85
+ * Duplicate a single rr_t structure using pkg_malloc
86
+ */
87
+int shm_duplicate_rr(struct sip_msg* _m, rr_t** _new, rr_t* _r);
88
+
89
+
77 90
 #endif /* PARSE_RR_H */
Browse code

len field added (total length of one Route field).

Jan Janak authored on 04/04/2003 14:04:00
Showing 1 changed files
... ...
@@ -44,6 +44,7 @@ typedef struct rr {
44 44
 	name_addr_t nameaddr; /* Name-addr part */
45 45
 	param_t* r2;          /* Hook to r2 parameter */
46 46
 	param_t* params;      /* Linked list of other parameters */
47
+	int len;              /* Length of the whole route field */
47 48
         struct rr* next;      /* Next RR in the list */
48 49
 } rr_t;
49 50
 
Browse code

- duplicate_parameters function added - duplicate_rr function added

Jan Janak authored on 31/03/2003 15:49:15
Showing 1 changed files
... ...
@@ -31,7 +31,7 @@
31 31
 #ifndef PARSE_RR_H
32 32
 #define PARSE_RR_H
33 33
 
34
-
34
+#include "msg_parser.h"
35 35
 #include "parse_nameaddr.h"
36 36
 #include "parse_param.h"
37 37
 #include "hf.h"
... ...
@@ -67,4 +67,10 @@ void free_rr(rr_t** _r);
67 67
 void print_rr(rr_t* _r);
68 68
 
69 69
 
70
+/*
71
+ * Duplicate a single rr_t structure using pkg_malloc
72
+ */
73
+int duplicate_rr(struct sip_msg* _m, rr_t** _new, rr_t* _r);
74
+
75
+
70 76
 #endif /* PARSE_RR_H */
Browse code

bug fix.

Jan Janak authored on 27/03/2003 20:45:40
Showing 1 changed files
... ...
@@ -42,7 +42,6 @@
42 42
  */
43 43
 typedef struct rr {
44 44
 	name_addr_t nameaddr; /* Name-addr part */
45
-	param_t* lr;          /* Hook to lr parameter */
46 45
 	param_t* r2;          /* Hook to r2 parameter */
47 46
 	param_t* params;      /* Linked list of other parameters */
48 47
         struct rr* next;      /* Next RR in the list */
Browse code

bugs fixed

Jan Janak authored on 26/03/2003 16:45:32
Showing 1 changed files
... ...
@@ -31,9 +31,10 @@
31 31
 #ifndef PARSE_RR_H
32 32
 #define PARSE_RR_H
33 33
 
34
-#include "../../str.h"
35
-#include "../parse_nameaddr.h"
36
-#include "../parse_param.h"
34
+
35
+#include "parse_nameaddr.h"
36
+#include "parse_param.h"
37
+#include "hf.h"
37 38
 
38 39
 
39 40
 /*
... ...
@@ -51,14 +52,14 @@ typedef struct rr {
51 52
 /*
52 53
  * Parse Route & Record-Route header fields
53 54
  */
54
-int parse_rr(str* _s, rr_t** _r);
55
+int parse_rr(struct hdr_field* _r);
55 56
 
56 57
 
57 58
 /*
58 59
  * Free list of rr
59 60
  * _c is head of the list
60 61
  */
61
-void free_rr(rr_t* _r);
62
+void free_rr(rr_t** _r);
62 63
 
63 64
 
64 65
 /*
Browse code

Route & Record-Route parser

Jan Janak authored on 26/03/2003 13:50:44
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Route & Record-Route Parser
5
+ *
6
+ * Copyright (C) 2001-2003 Fhg Fokus
7
+ *
8
+ * This file is part of ser, a free SIP server.
9
+ *
10
+ * ser 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
+ * For a license to use the ser software under conditions
16
+ * other than those described here, or to purchase support for this
17
+ * software, please contact iptel.org by e-mail at the following addresses:
18
+ *    info@iptel.org
19
+ *
20
+ * ser is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License 
26
+ * along with this program; if not, write to the Free Software 
27
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28
+ */
29
+
30
+
31
+#ifndef PARSE_RR_H
32
+#define PARSE_RR_H
33
+
34
+#include "../../str.h"
35
+#include "../parse_nameaddr.h"
36
+#include "../parse_param.h"
37
+
38
+
39
+/*
40
+ * Structure representing a Route & Record-Route HF body
41
+ */
42
+typedef struct rr {
43
+	name_addr_t nameaddr; /* Name-addr part */
44
+	param_t* lr;          /* Hook to lr parameter */
45
+	param_t* r2;          /* Hook to r2 parameter */
46
+	param_t* params;      /* Linked list of other parameters */
47
+        struct rr* next;      /* Next RR in the list */
48
+} rr_t;
49
+
50
+
51
+/*
52
+ * Parse Route & Record-Route header fields
53
+ */
54
+int parse_rr(str* _s, rr_t** _r);
55
+
56
+
57
+/*
58
+ * Free list of rr
59
+ * _c is head of the list
60
+ */
61
+void free_rr(rr_t* _r);
62
+
63
+
64
+/*
65
+ * Print list of rrs, just for debugging
66
+ */
67
+void print_rr(rr_t* _r);
68
+
69
+
70
+#endif /* PARSE_RR_H */