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,102 +0,0 @@
1
-/* 
2
- * Copyright (C) 2001-2003 FhG Fokus
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
-/*! \file
23
- * \brief Parser :: Cseq header field handling
24
- *
25
- * \ingroup parser
26
- */
27
-
28
-
29
-
30
-#include "../comp_defs.h"
31
-#include "parse_cseq.h"
32
-#include "parser_f.h"  /* eat_space_end and so on */
33
-#include "../dprint.h"
34
-#include "parse_def.h"
35
-#include "parse_methods.h"
36
-#include "../mem/mem.h"
37
-
38
-/*BUGGY*/
39
-char* parse_cseq(char* const buf, const char* const end, struct cseq_body* const cb)
40
-{
41
-	char *t, *m, *m_end;
42
-	
43
-	cb->error=PARSE_ERROR;
44
-	t=buf;
45
-	
46
-	cb->number.s=t;
47
-	t=eat_token_end(t, end);
48
-	if (t>=end) goto error;
49
-	cb->number.len=t-cb->number.s;
50
-
51
-	m=eat_space_end(t, end);
52
-	m_end=eat_token_end(m, end);
53
-
54
-	if (m_end>=end) {
55
-			LOG(L_ERR, "ERROR: parse_cseq: "
56
-						"method terminated unexpectedly\n");
57
-			goto error;
58
-	}
59
-	if (m_end==m){
60
-		/* null method*/
61
-		LOG(L_ERR,  "ERROR:parse_cseq: no method found\n");
62
-		goto error;
63
-	}
64
-	cb->method.s=m;
65
-	t=m_end;
66
-	cb->method.len=t-cb->method.s;
67
-
68
-	/* Cache method id */
69
-	if (parse_method_name(&cb->method, &cb->method_id)!=0){
70
-		LOG(L_ERR, "Cannot parse method string\n");
71
-		goto error;
72
-	}
73
-
74
-	/* there may be trailing LWS 
75
-	 * (it was not my idea to put it in SIP; -jiri )
76
-	 */
77
-	t=eat_lws_end(t, end);
78
-	/*check if the header ends here*/
79
-	if (t>=end) {
80
-		LOG(L_ERR, "ERROR: parse_cseq: strange EoHF\n");
81
-		goto error;
82
-	}
83
-	if (*t=='\r' && t+1<end && *(t+1)=='\n') {
84
-			cb->error=PARSE_OK;
85
-			return t+2;
86
-	}
87
-	if (*t=='\n') {
88
-			cb->error=PARSE_OK;
89
-			return t+1;
90
-	}
91
-	LOG(L_ERR, "ERROR: CSeq EoL expected\n");
92
-
93
-error:
94
-	LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
95
-	return t;
96
-}
97
-
98
-
99
-void free_cseq(struct cseq_body* const cb)
100
-{
101
-	pkg_free(cb);
102
-}
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
... ...
@@ -1,14 +1,14 @@
1 1
 /* 
2 2
  * Copyright (C) 2001-2003 FhG Fokus
3 3
  *
4
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
7 7
  * it under the terms of the GNU General Public License as published by
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * ser is distributed in the hope that it will be useful,
11
+ * Kamailio is distributed in the hope that it will be useful,
12 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 14
  * GNU General Public License for more details.
... ...
@@ -17,10 +17,6 @@
17 17
  * along with this program; if not, write to the Free Software 
18 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  * 
20
- * History:
21
- * --------
22
- * 2003-02-28 scratchpad compatibility abandoned (jiri)
23
- * 2003-01-22 zero-termination in CSeq eliminated (jiri)
24 20
  */
25 21
 
26 22
 /*! \file
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
... ...
@@ -15,7 +15,7 @@
15 15
  *
16 16
  * You should have received a copy of the GNU General Public License 
17 17
  * along with this program; if not, write to the Free Software 
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19 19
  * 
20 20
  * History:
21 21
  * --------
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
  * Copyright (C) 2001-2003 FhG Fokus
5 3
  *
6 4
  * This file is part of ser, a free SIP server.
Browse code

parser: make get_hdr_field(..) and necessary called functions const-correct

Henning Westerholt authored on 05/07/2012 20:35:22
Showing 1 changed files
... ...
@@ -42,7 +42,7 @@
42 42
 #include "../mem/mem.h"
43 43
 
44 44
 /*BUGGY*/
45
-char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
45
+char* parse_cseq(char* const buf, const char* const end, struct cseq_body* const cb)
46 46
 {
47 47
 	char *t, *m, *m_end;
48 48
 	
... ...
@@ -102,7 +102,7 @@ error:
102 102
 }
103 103
 
104 104
 
105
-void free_cseq(struct cseq_body* cb)
105
+void free_cseq(struct cseq_body* const cb)
106 106
 {
107 107
 	pkg_free(cb);
108 108
 }
Browse code

More parser/ doxygen changes

oej authored on 25/10/2009 17:26:46
Showing 1 changed files
... ...
@@ -10,11 +10,6 @@
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 13
  * ser 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
... ...
@@ -30,6 +25,13 @@
30 25
  * 2003-01-22 zero-termination in CSeq eliminated (jiri)
31 26
  */
32 27
 
28
+/*! \file
29
+ * \brief Parser :: Cseq header field handling
30
+ *
31
+ * \ingroup parser
32
+ */
33
+
34
+
33 35
 
34 36
 #include "../comp_defs.h"
35 37
 #include "parse_cseq.h"
... ...
@@ -39,10 +41,6 @@
39 41
 #include "parse_methods.h"
40 42
 #include "../mem/mem.h"
41 43
 
42
-/*
43
- * Parse CSeq header field
44
- */
45
-
46 44
 /*BUGGY*/
47 45
 char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
48 46
 {
Browse code

core: parse_cseq wrong use of parse_method fix

- parse_method renamed to parse_method_advance(), made static and
changed to check if the method name ends with a non-token char.
- added parse_method_name() for parsing a single method name with
known length (no leading or trailing whitespace).
- changed parse_cseq() to use parse_method_name()
(it's previous use of parse_method() had the side effect of
setting the method name to "").

Reported-by: Henning Westerholt <henning.westerholt@1und1.de>

Andrei Pelinescu-Onciul authored on 20/05/2009 17:06:43
Showing 1 changed files
... ...
@@ -74,8 +74,8 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
74 74
 	cb->method.len=t-cb->method.s;
75 75
 
76 76
 	/* Cache method id */
77
-	if (parse_method(&cb->method, &cb->method_id) == 0) {
78
-		LOG(L_ERR, "ERROR: parse_cseq: Cannot parse method string\n");
77
+	if (parse_method_name(&cb->method, &cb->method_id)!=0){
78
+		LOG(L_ERR, "Cannot parse method string\n");
79 79
 		goto error;
80 80
 	}
81 81
 
Browse code

Kamailio compatibility: Parse and store integer message id in cseq.

This patch modifies the CSeq header field parser. The new version of
the parser will also parse the method string and store an integer id
of the method string in the data structure representing cseq header
fields.

Jan Janak authored on 15/03/2009 20:17:30
Showing 1 changed files
... ...
@@ -36,6 +36,7 @@
36 36
 #include "parser_f.h"  /* eat_space_end and so on */
37 37
 #include "../dprint.h"
38 38
 #include "parse_def.h"
39
+#include "parse_methods.h"
39 40
 #include "../mem/mem.h"
40 41
 
41 42
 /*
... ...
@@ -72,6 +73,12 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
72 73
 	t=m_end;
73 74
 	cb->method.len=t-cb->method.s;
74 75
 
76
+	/* Cache method id */
77
+	if (parse_method(&cb->method, &cb->method_id) == 0) {
78
+		LOG(L_ERR, "ERROR: parse_cseq: Cannot parse method string\n");
79
+		goto error;
80
+	}
81
+
75 82
 	/* there may be trailing LWS 
76 83
 	 * (it was not my idea to put it in SIP; -jiri )
77 84
 	 */
Browse code

- Spelling checked

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

elderly (un)defs junked (hopefuly the right ones)

Jiri Kuthan authored on 28/02/2003 14:12:25
Showing 1 changed files
... ...
@@ -26,6 +26,7 @@
26 26
  * 
27 27
  * History:
28 28
  * --------
29
+ * 2003-02-28 scratchpad compatibility abandoned (jiri)
29 30
  * 2003-01-22 zero-termination in CSeq eliminated (jiri)
30 31
  */
31 32
 
... ...
@@ -45,17 +46,9 @@
45 46
 char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
46 47
 {
47 48
 	char *t, *m, *m_end;
48
-#ifdef PRESERVE_ZT
49
-	char c;
50
-#endif
51 49
 	
52 50
 	cb->error=PARSE_ERROR;
53
-#ifdef PRESERVE_ZT /* already called in calling function */
54
-	t=eat_space_end(buf, end);
55
-	if (t>=end) goto error;
56
-#else
57 51
 	t=buf;
58
-#endif
59 52
 	
60 53
 	cb->number.s=t;
61 54
 	t=eat_token_end(t, end);
... ...
@@ -64,7 +57,6 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
64 57
 
65 58
 	m=eat_space_end(t, end);
66 59
 	m_end=eat_token_end(m, end);
67
-	SET_ZT(*t);
68 60
 
69 61
 	if (m_end>=end) {
70 62
 			LOG(L_ERR, "ERROR: parse_cseq: "
... ...
@@ -80,27 +72,6 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
80 72
 	t=m_end;
81 73
 	cb->method.len=t-cb->method.s;
82 74
 
83
-#ifdef PRESERVE_ZT
84
-	c=*t;
85
-	*t=0; /*null terminate it*/
86
-	t++;
87
-	/*check if the header ends here*/
88
-	if (c=='\n') goto check_continue;
89
-	do{
90
-		for (;(t<end)&&((*t==' ')||(*t=='\t')||(*t=='\r'));t++);
91
-		if (t>=end) goto error;
92
-		if (*t!='\n'){
93
-			LOG(L_ERR, "ERROR:parse_cseq: unexpected char <%c> at end of"
94
-					" cseq\n", *t);
95
-			goto error;
96
-		}
97
-		t++;
98
-check_continue:
99
-		;
100
-	}while( (t<end) && ((*t==' ')||(*t=='\t')) );
101
-	cb->error=PARSE_OK;
102
-	return t;
103
-#else
104 75
 	/* there may be trailing LWS 
105 76
 	 * (it was not my idea to put it in SIP; -jiri )
106 77
 	 */
... ...
@@ -119,7 +90,7 @@ check_continue:
119 90
 			return t+1;
120 91
 	}
121 92
 	LOG(L_ERR, "ERROR: CSeq EoL expected\n");
122
-#endif
93
+
123 94
 error:
124 95
 	LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
125 96
 	return t;
Browse code

parser changed to make body to point to body (w/o LWS), have a len encompassing the complete hf (name.s..CRLF) and not to put zero- terminators after header field names and cseq

Jiri Kuthan authored on 27/01/2003 21:19:48
Showing 1 changed files
... ...
@@ -23,9 +23,14 @@
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 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ * 
27
+ * History:
28
+ * --------
29
+ * 2003-01-22 zero-termination in CSeq eliminated (jiri)
26 30
  */
27 31
 
28 32
 
33
+#include "../comp_defs.h"
29 34
 #include "parse_cseq.h"
30 35
 #include "parser_f.h"  /* eat_space_end and so on */
31 36
 #include "../dprint.h"
... ...
@@ -40,21 +45,32 @@
40 45
 char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
41 46
 {
42 47
 	char *t, *m, *m_end;
48
+#ifdef PRESERVE_ZT
43 49
 	char c;
50
+#endif
44 51
 	
45 52
 	cb->error=PARSE_ERROR;
53
+#ifdef PRESERVE_ZT /* already called in calling function */
46 54
 	t=eat_space_end(buf, end);
47 55
 	if (t>=end) goto error;
56
+#else
57
+	t=buf;
58
+#endif
48 59
 	
49 60
 	cb->number.s=t;
50 61
 	t=eat_token_end(t, end);
51 62
 	if (t>=end) goto error;
63
+	cb->number.len=t-cb->number.s;
64
+
52 65
 	m=eat_space_end(t, end);
53 66
 	m_end=eat_token_end(m, end);
54
-	*t=0; /*null terminate it*/
55
-	cb->number.len=t-cb->number.s;
67
+	SET_ZT(*t);
56 68
 
57
-	if (m_end>=end) goto error;
69
+	if (m_end>=end) {
70
+			LOG(L_ERR, "ERROR: parse_cseq: "
71
+						"method terminated unexpectedly\n");
72
+			goto error;
73
+	}
58 74
 	if (m_end==m){
59 75
 		/* null method*/
60 76
 		LOG(L_ERR,  "ERROR:parse_cseq: no method found\n");
... ...
@@ -62,9 +78,11 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
62 78
 	}
63 79
 	cb->method.s=m;
64 80
 	t=m_end;
81
+	cb->method.len=t-cb->method.s;
82
+
83
+#ifdef PRESERVE_ZT
65 84
 	c=*t;
66 85
 	*t=0; /*null terminate it*/
67
-	cb->method.len=t-cb->method.s;
68 86
 	t++;
69 87
 	/*check if the header ends here*/
70 88
 	if (c=='\n') goto check_continue;
... ...
@@ -80,9 +98,28 @@ char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
80 98
 check_continue:
81 99
 		;
82 100
 	}while( (t<end) && ((*t==' ')||(*t=='\t')) );
83
-
84 101
 	cb->error=PARSE_OK;
85 102
 	return t;
103
+#else
104
+	/* there may be trailing LWS 
105
+	 * (it was not my idea to put it in SIP; -jiri )
106
+	 */
107
+	t=eat_lws_end(t, end);
108
+	/*check if the header ends here*/
109
+	if (t>=end) {
110
+		LOG(L_ERR, "ERROR: parse_cseq: strange EoHF\n");
111
+		goto error;
112
+	}
113
+	if (*t=='\r' && t+1<end && *(t+1)=='\n') {
114
+			cb->error=PARSE_OK;
115
+			return t+2;
116
+	}
117
+	if (*t=='\n') {
118
+			cb->error=PARSE_OK;
119
+			return t+1;
120
+	}
121
+	LOG(L_ERR, "ERROR: CSeq EoL expected\n");
122
+#endif
86 123
 error:
87 124
 	LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
88 125
 	return t;
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,7 +1,31 @@
1 1
 /* 
2 2
  * $Id$ 
3
+ *
4
+ * Copyright (C) 2001-2003 Fhg Fokus
5
+ *
6
+ * This file is part of ser, a free SIP server.
7
+ *
8
+ * ser 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
+ * 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,
19
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
+ * GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the GNU General Public License 
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
3 26
  */
4 27
 
28
+
5 29
 #include "parse_cseq.h"
6 30
 #include "parser_f.h"  /* eat_space_end and so on */
7 31
 #include "../dprint.h"
Browse code

fixed CVS substitutes

Jiri Kuthan authored on 27/08/2002 21:42:55
Showing 1 changed files
... ...
@@ -1,5 +1,5 @@
1 1
 /* 
2
- * $Id 
2
+ * $Id$ 
3 3
  */
4 4
 
5 5
 #include "parse_cseq.h"
Browse code

parser directory cleanup

Jan Janak authored on 08/07/2002 17:14:39
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,71 @@
1
+/* 
2
+ * $Id 
3
+ */
4
+
5
+#include "parse_cseq.h"
6
+#include "parser_f.h"  /* eat_space_end and so on */
7
+#include "../dprint.h"
8
+#include "parse_def.h"
9
+#include "../mem/mem.h"
10
+
11
+/*
12
+ * Parse CSeq header field
13
+ */
14
+
15
+/*BUGGY*/
16
+char* parse_cseq(char *buf, char* end, struct cseq_body* cb)
17
+{
18
+	char *t, *m, *m_end;
19
+	char c;
20
+	
21
+	cb->error=PARSE_ERROR;
22
+	t=eat_space_end(buf, end);
23
+	if (t>=end) goto error;
24
+	
25
+	cb->number.s=t;
26
+	t=eat_token_end(t, end);
27
+	if (t>=end) goto error;
28
+	m=eat_space_end(t, end);
29
+	m_end=eat_token_end(m, end);
30
+	*t=0; /*null terminate it*/
31
+	cb->number.len=t-cb->number.s;
32
+
33
+	if (m_end>=end) goto error;
34
+	if (m_end==m){
35
+		/* null method*/
36
+		LOG(L_ERR,  "ERROR:parse_cseq: no method found\n");
37
+		goto error;
38
+	}
39
+	cb->method.s=m;
40
+	t=m_end;
41
+	c=*t;
42
+	*t=0; /*null terminate it*/
43
+	cb->method.len=t-cb->method.s;
44
+	t++;
45
+	/*check if the header ends here*/
46
+	if (c=='\n') goto check_continue;
47
+	do{
48
+		for (;(t<end)&&((*t==' ')||(*t=='\t')||(*t=='\r'));t++);
49
+		if (t>=end) goto error;
50
+		if (*t!='\n'){
51
+			LOG(L_ERR, "ERROR:parse_cseq: unexpected char <%c> at end of"
52
+					" cseq\n", *t);
53
+			goto error;
54
+		}
55
+		t++;
56
+check_continue:
57
+		;
58
+	}while( (t<end) && ((*t==' ')||(*t=='\t')) );
59
+
60
+	cb->error=PARSE_OK;
61
+	return t;
62
+error:
63
+	LOG(L_ERR, "ERROR: parse_cseq: bad cseq\n");
64
+	return t;
65
+}
66
+
67
+
68
+void free_cseq(struct cseq_body* cb)
69
+{
70
+	pkg_free(cb);
71
+}