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,230 +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
-/*!
23
- * \file
24
- * \brief Kamailio core :: Error handling
25
- * \ingroup core
26
- * Module: \ref core
27
- */
28
-
29
-
30
-#include <stdio.h>
31
-#include "error.h"
32
-#include "str.h"
33
-#include "parser/msg_parser.h"
34
-#include "mem/mem.h"
35
-
36
-/* current function's error; */
37
-int ser_error=-1;
38
-/* previous error */
39
-int prev_ser_error=-1;
40
-
41
-int err2reason_phrase( 
42
-	int ser_error,  /* current internal ser error */
43
-	int *sip_error,  /* the sip error code to which ser 	
44
-					    ser error will be turned */
45
-	char *phrase,    /* resulting error text */
46
-	int etl, 		/* error text buffer length */
47
-	char *signature ) /* extra text to be appended */
48
-{
49
-
50
-	char *error_txt;
51
-
52
-	switch( ser_error ) {
53
-		case E_SEND:
54
-			error_txt="Unfortunately error on sending to next hop occurred";
55
-			*sip_error=-ser_error;
56
-			break;
57
-		case E_BAD_ADDRESS:
58
-			error_txt="Unresolvable destination";
59
-			*sip_error=-ser_error;
60
-			break;
61
-		case E_BAD_REQ:
62
-			error_txt="Bad Request";
63
-			*sip_error=-ser_error;
64
-			break;
65
-		case E_BAD_URI:
66
-			error_txt="Regretfully, we were not able to process the URI";
67
-			*sip_error=-ser_error;
68
-			break;
69
-		case E_BAD_TUPEL:
70
-			error_txt="Transaction tuple incomplete";
71
-			*sip_error=-E_BAD_REQ;
72
-			break;
73
-		case E_BAD_TO:
74
-			error_txt="Bad To";
75
-			*sip_error=-E_BAD_REQ;
76
-			break;
77
-		case E_EXEC:
78
-			error_txt="Error in external logic";
79
-			*sip_error=-E_BAD_SERVER;
80
-			break;
81
-		case E_TOO_MANY_BRANCHES:
82
-			error_txt="Forking capacity exceeded";
83
-			*sip_error=-E_BAD_SERVER;
84
-			break;
85
-
86
-	        case E_Q_INV_CHAR:
87
-			error_txt="Invalid character in q parameter";
88
-			*sip_error=-E_BAD_REQ;
89
-			break;
90
-
91
-	        case E_Q_EMPTY:
92
-			error_txt="Empty q parameter";
93
-			*sip_error=-E_BAD_REQ;
94
-			break;;
95
-
96
-	        case E_Q_TOO_BIG:
97
-			error_txt="q parameter too big";
98
-			*sip_error=-E_BAD_REQ;
99
-			break;
100
-
101
-	        case E_Q_DEC_MISSING:
102
-			error_txt="Decimal part missing in q";
103
-			*sip_error=-E_BAD_REQ;
104
-			break;
105
-
106
-		case E_CANCELED:
107
-			error_txt="transaction canceled";
108
-			*sip_error=-ser_error;
109
-			break;
110
-
111
-		case E_OUT_OF_MEM:
112
-		/* dont disclose lack of mem in release mode */
113
-#ifdef EXTRA_DEBUG
114
-			error_txt="Excuse me I ran out of memory";
115
-			*sip_error=500;
116
-			break;
117
-#endif
118
-		case E_OK:
119
-			error_txt="No error";
120
-			*sip_error=500;
121
-			break;
122
-		default:
123
-			error_txt="I'm terribly sorry, server error occurred";
124
-			*sip_error=500;
125
-			break;
126
-	}
127
-	return snprintf( phrase, etl, "%s (%d/%s)", error_txt, 
128
-		-ser_error, signature );
129
-}
130
-
131
-char *error_text( int code )
132
-{
133
-	switch(code) {
134
-
135
-		case 100: return "Trying";
136
-		case 180: return "Ringing";
137
-		case 181: return "Call is Being Forwarded";
138
-		case 182: return "Queued";
139
-		case 183: return "Session Progress";
140
-
141
-		case 200: return "OK";
142
-
143
-		case 300: return "Multiple Choices";
144
-		case 301: return "Moved Permanently";
145
-		case 302: return "Moved Temporarily";
146
-		case 305: return "Use Proxy";
147
-		case 380: return "Alternative Service";
148
-
149
-		case 400: return "Bad Request";
150
-		case 401: return "Unauthorized";
151
-		case 402: return "Payment Required";
152
-		case 403: return "Forbidden";
153
-		case 404: return "Not Found";
154
-		case 405: return "Method not Allowed";
155
-		case 406: return "Not Acceptable";
156
-		case 407: return "Proxy authentication Required";
157
-		case 408: return "Request Timeout";
158
-		case 410: return "Gone";
159
-		case 413: return "Request Entity Too Large";
160
-		case 414: return "Request-URI Too Long";
161
-		case 415: return "Unsupported Media Type";
162
-		case 416: return "Unsupported URI Scheme";
163
-		case 417: return "Bad Extension";
164
-		case 421: return "Extension Required";
165
-		case 423: return "Interval Too Brief";
166
-		case 480: return "Temporarily Unavailable";
167
-		case 481: return "Call/Transaction Does not Exist";
168
-		case 482: return "Loop Detected";
169
-		case 483: return "Too Many Hops";
170
-		case 484: return "Address Incomplete";
171
-		case 485: return "Ambiguous";
172
-		case 486: return "Busy Here";
173
-		case 487: return "Request Terminated";
174
-		case 488: return "Not Acceptable Here";
175
-		case 491: return "Request Pending";
176
-	
177
-		case 500: return "Server Internal Error";
178
-		case 501: return "Not Implemented";
179
-		case 502: return "Bad Gateway";
180
-		case 503: return "Service Unavailable";
181
-		case 504: return "Server Time-out";
182
-		case 505: return "Version not Supported";
183
-		case 513: return "Message Too Large";
184
-
185
-		case 600: return "Busy Everywhere";
186
-		case 603: return "Decline";
187
-		case 604: return "Does not Exist Anywhere";
188
-		case 606: return "Not Acceptable";
189
-
190
-	}
191
-
192
-	if (code>=600) return "Global Failure";
193
-	else if (code>=500) return "Server Failure";
194
-	else if (code>=400) return "Request Failure";
195
-	else if (code>=300) return "Redirection";
196
-	else if (code>=200) return "Successful";
197
-	else if (code>=100) return "Provisional";
198
-	else return "Unspecified";
199
-}
200
-
201
-void get_reply_status( str *status, struct sip_msg *reply, int code )
202
-{
203
-	str phrase;
204
-
205
-	status->s=0;
206
-
207
-	if (reply==0) {
208
-		LM_CRIT("0 msg\n");
209
-		return;
210
-	}
211
-
212
-	if (reply==FAKED_REPLY) {
213
-		phrase.s=error_text(code);
214
-		phrase.len=strlen(phrase.s);
215
-	} else {
216
-		phrase=reply->first_line.u.reply.reason;
217
-	}
218
-	status->len=phrase.len+3/*code*/+1/*space*/; 
219
-	status->s=pkg_malloc(status->len+1/*ZT */);
220
-	if (!status->s) {
221
-		LM_ERR("no mem\n");
222
-		return;
223
-	}
224
-	status->s[3]=' ';
225
-	status->s[2]='0'+code % 10; code=code/10;
226
-	status->s[1]='0'+code% 10; code=code/10;
227
-	status->s[0]='0'+code % 10;
228
-	memcpy(&status->s[4], phrase.s, phrase.len);
229
-	status->s[status->len]=0;
230
-}
Browse code

core Update headers, change "SIP-router" to "Kamailio", update doxygen file headers

Olle E. Johansson authored on 03/01/2015 14:15:58
Showing 1 changed files
... ...
@@ -8,11 +8,6 @@
8 8
  * the Free Software Foundation; either version 2 of the License, or
9 9
  * (at your option) any later version
10 10
  *
11
- * For a license to use the ser software under conditions
12
- * other than those described here, or to purchase support for this
13
- * software, please contact iptel.org by e-mail at the following addresses:
14
- *    info@iptel.org
15
- *
16 11
  * Kamailio is distributed in the hope that it will be useful,
17 12
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 13
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
... ...
@@ -26,7 +21,7 @@
26 21
 
27 22
 /*!
28 23
  * \file
29
- * \brief SIP-router core :: Error handling
24
+ * \brief Kamailio core :: Error handling
30 25
  * \ingroup core
31 26
  * Module: \ref core
32 27
  */
Browse code

Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
... ...
@@ -1,12 +1,9 @@
1 1
 /*
2
- * $Id$
3
- *
4
- *
5 2
  * Copyright (C) 2001-2003 FhG Fokus
6 3
  *
7
- * This file is part of ser, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
8 5
  *
9
- * ser is free software; you can redistribute it and/or modify
6
+ * Kamailio is free software; you can redistribute it and/or modify
10 7
  * it under the terms of the GNU General Public License as published by
11 8
  * the Free Software Foundation; either version 2 of the License, or
12 9
  * (at your option) any later version
... ...
@@ -16,7 +13,7 @@
16 13
  * software, please contact iptel.org by e-mail at the following addresses:
17 14
  *    info@iptel.org
18 15
  *
19
- * ser is distributed in the hope that it will be useful,
16
+ * Kamailio is distributed in the hope that it will be useful,
20 17
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 18
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 19
  * GNU General Public License for more details.
... ...
@@ -25,14 +22,11 @@
25 22
  * along with this program; if not, write to the Free Software 
26 23
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 24
  *
28
- * History:
29
- * --------
30
- * 2003-04-04 phrase length corrected not to include trailer 0 (jiri)
31 25
  */
32 26
 
33 27
 /*!
34 28
  * \file
35
- * \brief SIP-router core :: 
29
+ * \brief SIP-router core :: Error handling
36 30
  * \ingroup core
37 31
  * Module: \ref core
38 32
  */
Browse code

error.c: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 21:53:34
Showing 1 changed files
... ...
@@ -216,7 +216,7 @@ void get_reply_status( str *status, struct sip_msg *reply, int code )
216 216
 	status->s=0;
217 217
 
218 218
 	if (reply==0) {
219
-		LOG(L_CRIT, "BUG: get_reply_status called with 0 msg\n");
219
+		LM_CRIT("0 msg\n");
220 220
 		return;
221 221
 	}
222 222
 
... ...
@@ -229,7 +229,7 @@ void get_reply_status( str *status, struct sip_msg *reply, int code )
229 229
 	status->len=phrase.len+3/*code*/+1/*space*/; 
230 230
 	status->s=pkg_malloc(status->len+1/*ZT */);
231 231
 	if (!status->s) {
232
-		LOG(L_ERR, "ERROR: get_reply_status: no mem\n");
232
+		LM_ERR("no mem\n");
233 233
 		return;
234 234
 	}
235 235
 	status->s[3]=' ';
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
... ...
@@ -23,7 +23,7 @@
23 23
  *
24 24
  * You should have received a copy of the GNU General Public License 
25 25
  * along with this program; if not, write to the Free Software 
26
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 27
  *
28 28
  * History:
29 29
  * --------
Browse code

Adding doxygen template to all core .c files

Please fill in after the :: to explain the function of this file.

oej authored on 10/10/2009 13:54:13
Showing 1 changed files
... ...
@@ -30,6 +30,13 @@
30 30
  * 2003-04-04 phrase length corrected not to include trailer 0 (jiri)
31 31
  */
32 32
 
33
+/*!
34
+ * \file
35
+ * \brief SIP-router core :: 
36
+ * \ingroup core
37
+ * Module: \ref core
38
+ */
39
+
33 40
 
34 41
 #include <stdio.h>
35 42
 #include "error.h"
Browse code

- more dest_info conversions: - forward_request takes now a dest_info parameter - various something2dst conversions functions - got rid of the temprary mk_proxy when forwarding after the uri - updated all the affected modules

WARNING: not tested, use with care

Andrei Pelinescu-Onciul authored on 18/04/2006 19:56:48
Showing 1 changed files
... ...
@@ -119,6 +119,10 @@ int err2reason_phrase(
119 119
 			*sip_error=500;
120 120
 			break;
121 121
 #endif
122
+		case E_OK:
123
+			error_txt="No error";
124
+			*sip_error=500;
125
+			break;
122 126
 		default:
123 127
 			error_txt="I'm terribly sorry, server error occurred";
124 128
 			*sip_error=500;
Browse code

- E_CANCELED again (it seems I keep forgetting all the files I've changed :-))

Andrei Pelinescu-Onciul authored on 30/01/2006 08:54:44
Showing 1 changed files
... ...
@@ -107,6 +107,11 @@ int err2reason_phrase(
107 107
 			*sip_error=-E_BAD_REQ;
108 108
 			break;
109 109
 
110
+		case E_CANCELED:
111
+			error_txt="transaction canceled";
112
+			*sip_error=-ser_error;
113
+			break;
114
+
110 115
 		case E_OUT_OF_MEM:
111 116
 		/* dont disclose lack of mem in release mode */
112 117
 #ifdef EXTRA_DEBUG
Browse code

New timer interface: - allows adding timers dynamically - supports one shot and periodic timers - precise - allows timeouts < 0.5 s (depends on the config., by default min. timeout = 62.5 ms) - based on a 3 level hierarchical timing wheel - very fast - low overhead for timer functions (most of the time, the excetion is timer_del which take can take quite a long time in special situations) - supports "slow" timers (compile option, by default on), "slow" timer = a timer handler which is declared as possible taking a long timer to execute. - backward compatible: old timer functions are preserverd => no changes needed for the existing code (although migration to the new interface is recommended) For more information read doc/timers.txt. tm timer update will follow shortly (this week).

Andrei Pelinescu-Onciul authored on 05/12/2005 18:29:30
Showing 1 changed files
... ...
@@ -109,7 +109,7 @@ int err2reason_phrase(
109 109
 
110 110
 		case E_OUT_OF_MEM:
111 111
 		/* dont disclose lack of mem in release mode */
112
-#ifdef DEBUG
112
+#ifdef EXTRA_DEBUG
113 113
 			error_txt="Excuse me I ran out of memory";
114 114
 			*sip_error=500;
115 115
 			break;
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
  * $Id$
3 3
  *
4 4
  *
5
- * Copyright (C) 2001-2003 Fhg Fokus
5
+ * Copyright (C) 2001-2003 FhG Fokus
6 6
  *
7 7
  * This file is part of ser, a free SIP server.
8 8
  *
... ...
@@ -43,7 +43,7 @@ int ser_error=-1;
43 43
 int prev_ser_error=-1;
44 44
 
45 45
 int err2reason_phrase( 
46
-	int ser_error,  /* current itnernal ser error */
46
+	int ser_error,  /* current internal ser error */
47 47
 	int *sip_error,  /* the sip error code to which ser 	
48 48
 					    ser error will be turned */
49 49
 	char *phrase,    /* resulting error text */
... ...
@@ -55,11 +55,11 @@ int err2reason_phrase(
55 55
 
56 56
 	switch( ser_error ) {
57 57
 		case E_SEND:
58
-			error_txt="Unfortunately error on sending to next hop occured";
58
+			error_txt="Unfortunately error on sending to next hop occurred";
59 59
 			*sip_error=-ser_error;
60 60
 			break;
61 61
 		case E_BAD_ADDRESS:
62
-			error_txt="Unresolveable destination";
62
+			error_txt="Unresolvable destination";
63 63
 			*sip_error=-ser_error;
64 64
 			break;
65 65
 		case E_BAD_REQ:
... ...
@@ -67,11 +67,11 @@ int err2reason_phrase(
67 67
 			*sip_error=-ser_error;
68 68
 			break;
69 69
 		case E_BAD_URI:
70
-			error_txt="Regretfuly, we were not able to process the URI";
70
+			error_txt="Regretfully, we were not able to process the URI";
71 71
 			*sip_error=-ser_error;
72 72
 			break;
73 73
 		case E_BAD_TUPEL:
74
-			error_txt="Transaction tupel incomplete";
74
+			error_txt="Transaction tuple incomplete";
75 75
 			*sip_error=-E_BAD_REQ;
76 76
 			break;
77 77
 		case E_BAD_TO:
... ...
@@ -115,7 +115,7 @@ int err2reason_phrase(
115 115
 			break;
116 116
 #endif
117 117
 		default:
118
-			error_txt="I'm terribly sorry, server error occured";
118
+			error_txt="I'm terribly sorry, server error occurred";
119 119
 			*sip_error=500;
120 120
 			break;
121 121
 	}
... ...
@@ -143,7 +143,7 @@ char *error_text( int code )
143 143
 
144 144
 		case 400: return "Bad Request";
145 145
 		case 401: return "Unauthorized";
146
-		case 402: return "Payement Required";
146
+		case 402: return "Payment Required";
147 147
 		case 403: return "Forbidden";
148 148
 		case 404: return "Not Found";
149 149
 		case 405: return "Method not Allowed";
... ...
@@ -163,7 +163,7 @@ char *error_text( int code )
163 163
 		case 482: return "Loop Detected";
164 164
 		case 483: return "Too Many Hops";
165 165
 		case 484: return "Address Incomplete";
166
-		case 485: return "Ambigous";
166
+		case 485: return "Ambiguous";
167 167
 		case 486: return "Busy Here";
168 168
 		case 487: return "Request Terminated";
169 169
 		case 488: return "Not Acceptable Here";
Browse code

str2q implemented append_branch("sip:a@iptel.org", "0.23") implemented append_branch("sip:a@iptel.org", 230) removed (it was not very intuitive)

Jan Janak authored on 26/04/2004 17:11:55
Showing 1 changed files
... ...
@@ -86,6 +86,27 @@ int err2reason_phrase(
86 86
 			error_txt="Forking capacity exceeded";
87 87
 			*sip_error=-E_BAD_SERVER;
88 88
 			break;
89
+
90
+	        case E_Q_INV_CHAR:
91
+			error_txt="Invalid character in q parameter";
92
+			*sip_error=-E_BAD_REQ;
93
+			break;
94
+
95
+	        case E_Q_EMPTY:
96
+			error_txt="Empty q parameter";
97
+			*sip_error=-E_BAD_REQ;
98
+			break;;
99
+
100
+	        case E_Q_TOO_BIG:
101
+			error_txt="q parameter too big";
102
+			*sip_error=-E_BAD_REQ;
103
+			break;
104
+
105
+	        case E_Q_DEC_MISSING:
106
+			error_txt="Decimal part missing in q";
107
+			*sip_error=-E_BAD_REQ;
108
+			break;
109
+
89 110
 		case E_OUT_OF_MEM:
90 111
 		/* dont disclose lack of mem in release mode */
91 112
 #ifdef DEBUG
Browse code

grand acc cleanup: all (core, tm, acc, serweb) but radius intergrated

Jiri Kuthan authored on 04/04/2003 03:21:58
Showing 1 changed files
... ...
@@ -24,6 +24,10 @@
24 24
  * You should have received a copy of the GNU General Public License 
25 25
  * along with this program; if not, write to the Free Software 
26 26
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ *
28
+ * History:
29
+ * --------
30
+ * 2003-04-04 phrase length corrected not to include trailer 0 (jiri)
27 31
  */
28 32
 
29 33
 
... ...
@@ -185,8 +189,8 @@ void get_reply_status( str *status, struct sip_msg *reply, int code )
185 189
 	} else {
186 190
 		phrase=reply->first_line.u.reply.reason;
187 191
 	}
188
-	status->len=phrase.len+3/*code*/+1/*space*/+1/*ZT*/;
189
-	status->s=pkg_malloc(status->len);
192
+	status->len=phrase.len+3/*code*/+1/*space*/; 
193
+	status->s=pkg_malloc(status->len+1/*ZT */);
190 194
 	if (!status->s) {
191 195
 		LOG(L_ERR, "ERROR: get_reply_status: no mem\n");
192 196
 		return;
... ...
@@ -196,5 +200,5 @@ void get_reply_status( str *status, struct sip_msg *reply, int code )
196 200
 	status->s[1]='0'+code% 10; code=code/10;
197 201
 	status->s[0]='0'+code % 10;
198 202
 	memcpy(&status->s[4], phrase.s, phrase.len);
199
-	status->s[status->len-1]=0;
203
+	status->s[status->len]=0;
200 204
 }
Browse code

GPLization banner introduced to *.[hc] files

Jiri Kuthan authored on 19/09/2002 12:23:52
Showing 1 changed files
... ...
@@ -1,8 +1,32 @@
1 1
 /*
2 2
  * $Id$
3 3
  *
4
+ *
5
+ * Copyright (C) 2001-2003 Fhg Fokus
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
4 27
  */
5 28
 
29
+
6 30
 #include <stdio.h>
7 31
 #include "error.h"
8 32
 #include "str.h"
Browse code

/* dont disclose lack of mem in release mode */

Jiri Kuthan authored on 01/09/2002 22:14:17
Showing 1 changed files
... ...
@@ -26,10 +26,6 @@ int err2reason_phrase(
26 26
 	char *error_txt;
27 27
 
28 28
 	switch( ser_error ) {
29
-		case E_OUT_OF_MEM:
30
-			error_txt="Excuse me I ran out of memory";
31
-			*sip_error=500;
32
-			break;
33 29
 		case E_SEND:
34 30
 			error_txt="Unfortunately error on sending to next hop occured";
35 31
 			*sip_error=-ser_error;
... ...
@@ -62,6 +58,13 @@ int err2reason_phrase(
62 58
 			error_txt="Forking capacity exceeded";
63 59
 			*sip_error=-E_BAD_SERVER;
64 60
 			break;
61
+		case E_OUT_OF_MEM:
62
+		/* dont disclose lack of mem in release mode */
63
+#ifdef DEBUG
64
+			error_txt="Excuse me I ran out of memory";
65
+			*sip_error=500;
66
+			break;
67
+#endif
65 68
 		default:
66 69
 			error_txt="I'm terribly sorry, server error occured";
67 70
 			*sip_error=500;
Browse code

added BAD_TO

Jiri Kuthan authored on 18/08/2002 20:56:28
Showing 1 changed files
... ...
@@ -50,6 +50,10 @@ int err2reason_phrase(
50 50
 			error_txt="Transaction tupel incomplete";
51 51
 			*sip_error=-E_BAD_REQ;
52 52
 			break;
53
+		case E_BAD_TO:
54
+			error_txt="Bad To";
55
+			*sip_error=-E_BAD_REQ;
56
+			break;
53 57
 		case E_EXEC:
54 58
 			error_txt="Error in external logic";
55 59
 			*sip_error=-E_BAD_SERVER;
Browse code

minor delayed clean-ups

Jiri Kuthan authored on 16/08/2002 13:26:15
Showing 1 changed files
... ...
@@ -50,6 +50,14 @@ int err2reason_phrase(
50 50
 			error_txt="Transaction tupel incomplete";
51 51
 			*sip_error=-E_BAD_REQ;
52 52
 			break;
53
+		case E_EXEC:
54
+			error_txt="Error in external logic";
55
+			*sip_error=-E_BAD_SERVER;
56
+			break;
57
+		case E_TOO_MANY_BRANCHES:
58
+			error_txt="Forking capacity exceeded";
59
+			*sip_error=-E_BAD_SERVER;
60
+			break;
53 61
 		default:
54 62
 			error_txt="I'm terribly sorry, server error occured";
55 63
 			*sip_error=500;
Browse code

bignag change -- lot of things primarily added in relationship with refurbushing TM; see [sr] archive (2002-08-14) -- "ser update" and "TM update" for a long list of details

Jiri Kuthan authored on 15/08/2002 08:13:29
Showing 1 changed files
... ...
@@ -5,6 +5,9 @@
5 5
 
6 6
 #include <stdio.h>
7 7
 #include "error.h"
8
+#include "str.h"
9
+#include "parser/msg_parser.h"
10
+#include "mem/mem.h"
8 11
 
9 12
 /* current function's error; */
10 13
 int ser_error=-1;
... ...
@@ -43,6 +46,10 @@ int err2reason_phrase(
43 46
 			error_txt="Regretfuly, we were not able to process the URI";
44 47
 			*sip_error=-ser_error;
45 48
 			break;
49
+		case E_BAD_TUPEL:
50
+			error_txt="Transaction tupel incomplete";
51
+			*sip_error=-E_BAD_REQ;
52
+			break;
46 53
 		default:
47 54
 			error_txt="I'm terribly sorry, server error occured";
48 55
 			*sip_error=500;
... ...
@@ -51,3 +58,104 @@ int err2reason_phrase(
51 58
 	return snprintf( phrase, etl, "%s (%d/%s)", error_txt, 
52 59
 		-ser_error, signature );
53 60
 }
61
+
62
+char *error_text( int code )
63
+{
64
+	switch(code) {
65
+
66
+		case 100: return "Trying";
67
+		case 180: return "Ringing";
68
+		case 181: return "Call is Being Forwarded";
69
+		case 182: return "Queued";
70
+		case 183: return "Session Progress";
71
+
72
+		case 200: return "OK";
73
+
74
+		case 300: return "Multiple Choices";
75
+		case 301: return "Moved Permanently";
76
+		case 302: return "Moved Temporarily";
77
+		case 305: return "Use Proxy";
78
+		case 380: return "Alternative Service";
79
+
80
+		case 400: return "Bad Request";
81
+		case 401: return "Unauthorized";
82
+		case 402: return "Payement Required";
83
+		case 403: return "Forbidden";
84
+		case 404: return "Not Found";
85
+		case 405: return "Method not Allowed";
86
+		case 406: return "Not Acceptable";
87
+		case 407: return "Proxy authentication Required";
88
+		case 408: return "Request Timeout";
89
+		case 410: return "Gone";
90
+		case 413: return "Request Entity Too Large";
91
+		case 414: return "Request-URI Too Long";
92
+		case 415: return "Unsupported Media Type";
93
+		case 416: return "Unsupported URI Scheme";
94
+		case 417: return "Bad Extension";
95
+		case 421: return "Extension Required";
96
+		case 423: return "Interval Too Brief";
97
+		case 480: return "Temporarily Unavailable";
98
+		case 481: return "Call/Transaction Does not Exist";
99
+		case 482: return "Loop Detected";
100
+		case 483: return "Too Many Hops";
101
+		case 484: return "Address Incomplete";
102
+		case 485: return "Ambigous";
103
+		case 486: return "Busy Here";
104
+		case 487: return "Request Terminated";
105
+		case 488: return "Not Acceptable Here";
106
+		case 491: return "Request Pending";
107
+	
108
+		case 500: return "Server Internal Error";
109
+		case 501: return "Not Implemented";
110
+		case 502: return "Bad Gateway";
111
+		case 503: return "Service Unavailable";
112
+		case 504: return "Server Time-out";
113
+		case 505: return "Version not Supported";
114
+		case 513: return "Message Too Large";
115
+
116
+		case 600: return "Busy Everywhere";
117
+		case 603: return "Decline";
118
+		case 604: return "Does not Exist Anywhere";
119
+		case 606: return "Not Acceptable";
120
+
121
+	}
122
+
123
+	if (code>=600) return "Global Failure";
124
+	else if (code>=500) return "Server Failure";
125
+	else if (code>=400) return "Request Failure";
126
+	else if (code>=300) return "Redirection";
127
+	else if (code>=200) return "Successful";
128
+	else if (code>=100) return "Provisional";
129
+	else return "Unspecified";
130
+}
131
+
132
+void get_reply_status( str *status, struct sip_msg *reply, int code )
133
+{
134
+	str phrase;
135
+
136
+	status->s=0;
137
+
138
+	if (reply==0) {
139
+		LOG(L_CRIT, "BUG: get_reply_status called with 0 msg\n");
140
+		return;
141
+	}
142
+
143
+	if (reply==FAKED_REPLY) {
144
+		phrase.s=error_text(code);
145
+		phrase.len=strlen(phrase.s);
146
+	} else {
147
+		phrase=reply->first_line.u.reply.reason;
148
+	}
149
+	status->len=phrase.len+3/*code*/+1/*space*/+1/*ZT*/;
150
+	status->s=pkg_malloc(status->len);
151
+	if (!status->s) {
152
+		LOG(L_ERR, "ERROR: get_reply_status: no mem\n");
153
+		return;
154
+	}
155
+	status->s[3]=' ';
156
+	status->s[2]='0'+code % 10; code=code/10;
157
+	status->s[1]='0'+code% 10; code=code/10;
158
+	status->s[0]='0'+code % 10;
159
+	memcpy(&status->s[4], phrase.s, phrase.len);
160
+	status->s[status->len-1]=0;
161
+}
Browse code

- added reply lump processing

Andrei Pelinescu-Onciul authored on 11/07/2002 17:46:58
Showing 1 changed files
... ...
@@ -3,6 +3,7 @@
3 3
  *
4 4
  */
5 5
 
6
+#include <stdio.h>
6 7
 #include "error.h"
7 8
 
8 9
 /* current function's error; */
Browse code

ser_error processing, ipv6-ization of TM, new TM callbacks; not stable yet (serial forking is screwed up)

Jiri Kuthan authored on 31/05/2002 01:59:06
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,52 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ */
5
+
6
+#include "error.h"
7
+
8
+/* current function's error; */
9
+int ser_error=-1;
10
+/* previous error */
11
+int prev_ser_error=-1;
12
+
13
+int err2reason_phrase( 
14
+	int ser_error,  /* current itnernal ser error */
15
+	int *sip_error,  /* the sip error code to which ser 	
16
+					    ser error will be turned */
17
+	char *phrase,    /* resulting error text */
18
+	int etl, 		/* error text buffer length */
19
+	char *signature ) /* extra text to be appended */
20
+{
21
+
22
+	char *error_txt;
23
+
24
+	switch( ser_error ) {
25
+		case E_OUT_OF_MEM:
26
+			error_txt="Excuse me I ran out of memory";
27
+			*sip_error=500;
28
+			break;
29
+		case E_SEND:
30
+			error_txt="Unfortunately error on sending to next hop occured";
31
+			*sip_error=-ser_error;
32
+			break;
33
+		case E_BAD_ADDRESS:
34
+			error_txt="Unresolveable destination";
35
+			*sip_error=-ser_error;
36
+			break;
37
+		case E_BAD_REQ:
38
+			error_txt="Bad Request";
39
+			*sip_error=-ser_error;
40
+			break;
41
+		case E_BAD_URI:
42
+			error_txt="Regretfuly, we were not able to process the URI";
43
+			*sip_error=-ser_error;
44
+			break;
45
+		default:
46
+			error_txt="I'm terribly sorry, server error occured";
47
+			*sip_error=500;
48
+			break;
49
+	}
50
+	return snprintf( phrase, etl, "%s (%d/%s)", error_txt, 
51
+		-ser_error, signature );
52
+}