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) 2010 iptelorg GmbH
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
-/** compute the characteristic value of a message.
18
- * @file
19
- * @ingroup core
20
- * \author andrei
21
- *
22
- * Defines:
23
- *  BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
24
- *   including the full from & to bodies will be used (instead of only the
25
- *   tags).
26
- * BRANCH_IGNORE_3261_VIA - if defined, no check and special/simpler handling
27
- *   of messages with 3261 cookies in the via branch will be made (same
28
- *   behaviour as in pre 3.1 versions).
29
-*/
30
-
31
-#ifndef __char_msg_val_h
32
-#define __char_msg_val_h
33
-
34
-#include "comp_defs.h"
35
-#include "compiler_opt.h"
36
-#include "str.h"
37
-#include "parser/msg_parser.h"
38
-#include "parser/parse_to.h"
39
-#include "parser/parse_from.h"
40
-#include "md5utils.h"
41
-
42
-/*! \brief calculate characteristic value of a message -- this value
43
-   is used to identify a transaction during the process of
44
-   reply matching
45
- */
46
-inline static int char_msg_val( struct sip_msg *msg, char *cv )
47
-{
48
-	str src[8];
49
-
50
-	if (unlikely(!check_transaction_quadruple(msg))) {
51
-		LM_ERR("can't calculate char_value due to a parsing error\n");
52
-		memset( cv, '0', MD5_LEN );
53
-		return 0;
54
-	}
55
-#ifndef BRANCH_IGNORE_3261_VIA
56
-	if (likely(msg->via1->branch && msg->via1->branch->value.len>MCOOKIE_LEN &&
57
-				memcmp(msg->via1->branch->value.s, MCOOKIE, MCOOKIE_LEN)==0)){
58
-		/* 3261 branch cookie present => hash only the received branch ID */
59
-		src[0]=msg->via1->branch->value;
60
-		MD5StringArray ( cv, src, 1 );
61
-		return 1; /* success */
62
-	}
63
-#endif /* BRANCH_IGNORE_3261_VIA */
64
-#ifdef BRANCH_INCLUDE_FROMTO_BODY
65
-	/* use the from & to full bodies */
66
-	src[0]= msg->from->body;
67
-	src[1]= msg->to->body;
68
-#else
69
-	/* to body is automatically parsed (via check_transactionquadruple / 
70
-	   parse_header), but the from body has to be parsed manually */
71
-	if (msg->from->parsed==0){
72
-		/* parse from body */
73
-		if (unlikely(parse_from_header(msg) == -1)){
74
-			LM_ERR("error while parsing From header\n");
75
-			return 0;
76
-		}
77
-	}
78
-	/* use only the from & to tags */
79
-	src[0]=get_from(msg)->tag_value;
80
-	src[1]=get_to(msg)->tag_value;
81
-#endif /* BRANCH_INCLUDE_FROMTO_BODY */
82
-	src[2]= msg->callid->body;
83
-	src[3]= msg->first_line.u.request.uri;
84
-	src[4]= get_cseq( msg )->number;
85
-
86
-	/* topmost Via is part of transaction key as well ! */
87
-	src[5]= msg->via1->host;
88
-	src[6]= msg->via1->port_str;
89
-	if (likely(msg->via1->branch)) {
90
-		src[7]= msg->via1->branch->value;
91
-		MD5StringArray ( cv, src, 8 );
92
-	} else {
93
-		MD5StringArray( cv, src, 7 );
94
-	}
95
-	return 1;
96
-}
97
-
98
-
99
-
100
-#endif /*__char_msg_val_h*/
101
-
102
-/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
Browse code

core : Update include files - delete IDs, update doxygen, delete history

Olle E. Johansson authored on 03/01/2015 10:55:48
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /* 
2
- * $Id$
3
- * 
4 2
  * Copyright (C) 2010 iptelorg GmbH
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,20 +13,13 @@
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
- * char_msg_val.h
20
- */
21
-/*
22
- * History:
23
- * --------
24
- *  2010-02-10  moved from parser/msg_parser.h and added tag only mode
25
- *               by default (andrei)
26
-*/
16
+
27 17
 /** compute the characteristic value of a message.
28 18
  * @file
29 19
  * @ingroup core
30
- */
31
-/* Defines:
20
+ * \author andrei
21
+ *
22
+ * Defines:
32 23
  *  BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
33 24
  *   including the full from & to bodies will be used (instead of only the
34 25
  *   tags).
Browse code

char_msg_val.h: concatenate ERR log

Ovidiu Sas authored on 03/10/2014 18:49:35
Showing 1 changed files
... ...
@@ -57,8 +57,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
57 57
 	str src[8];
58 58
 
59 59
 	if (unlikely(!check_transaction_quadruple(msg))) {
60
-		LM_ERR("can't calculate char_value due "
61
-			"to a parsing error\n");
60
+		LM_ERR("can't calculate char_value due to a parsing error\n");
62 61
 		memset( cv, '0', MD5_LEN );
63 62
 		return 0;
64 63
 	}
Browse code

char_msg_val.h: logging: convert LOG to LM_*

Ovidiu Sas authored on 03/10/2014 18:43:39
Showing 1 changed files
... ...
@@ -57,7 +57,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
57 57
 	str src[8];
58 58
 
59 59
 	if (unlikely(!check_transaction_quadruple(msg))) {
60
-		LOG(L_ERR, "ERROR: can't calculate char_value due "
60
+		LM_ERR("can't calculate char_value due "
61 61
 			"to a parsing error\n");
62 62
 		memset( cv, '0', MD5_LEN );
63 63
 		return 0;
... ...
@@ -81,7 +81,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
81 81
 	if (msg->from->parsed==0){
82 82
 		/* parse from body */
83 83
 		if (unlikely(parse_from_header(msg) == -1)){
84
-			LOG(L_ERR, "error while parsing From header\n");
84
+			LM_ERR("error while parsing From header\n");
85 85
 			return 0;
86 86
 		}
87 87
 	}
Browse code

core: use the prev. via branch id if it's 3261

When computing the via branch value in syn_branch==0 mode, use the
previous via branch id and not the to_tag, from_tag, callid, ruri,
cseq number, via port and host, if the previous via branch id is
in rfc3261 format (begins with the magic cookie).
See rfc3261/16.11 P116 for more informations.
To revert to the old behaviour, define BRANCH_IGNORE_3261_VIA.

Andrei Pelinescu-Onciul authored on 10/02/2010 20:48:00
Showing 1 changed files
... ...
@@ -22,7 +22,7 @@
22 22
  * History:
23 23
  * --------
24 24
  *  2010-02-10  moved from parser/msg_parser.h and added tag only mode
25
- *              by default (andrei)
25
+ *               by default (andrei)
26 26
 */
27 27
 /** compute the characteristic value of a message.
28 28
  * @file
... ...
@@ -32,6 +32,9 @@
32 32
  *  BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
33 33
  *   including the full from & to bodies will be used (instead of only the
34 34
  *   tags).
35
+ * BRANCH_IGNORE_3261_VIA - if defined, no check and special/simpler handling
36
+ *   of messages with 3261 cookies in the via branch will be made (same
37
+ *   behaviour as in pre 3.1 versions).
35 38
 */
36 39
 
37 40
 #ifndef __char_msg_val_h
... ...
@@ -59,7 +62,15 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
59 62
 		memset( cv, '0', MD5_LEN );
60 63
 		return 0;
61 64
 	}
62
-
65
+#ifndef BRANCH_IGNORE_3261_VIA
66
+	if (likely(msg->via1->branch && msg->via1->branch->value.len>MCOOKIE_LEN &&
67
+				memcmp(msg->via1->branch->value.s, MCOOKIE, MCOOKIE_LEN)==0)){
68
+		/* 3261 branch cookie present => hash only the received branch ID */
69
+		src[0]=msg->via1->branch->value;
70
+		MD5StringArray ( cv, src, 1 );
71
+		return 1; /* success */
72
+	}
73
+#endif /* BRANCH_IGNORE_3261_VIA */
63 74
 #ifdef BRANCH_INCLUDE_FROMTO_BODY
64 75
 	/* use the from & to full bodies */
65 76
 	src[0]= msg->from->body;
... ...
@@ -77,7 +88,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
77 88
 	/* use only the from & to tags */
78 89
 	src[0]=get_from(msg)->tag_value;
79 90
 	src[1]=get_to(msg)->tag_value;
80
-#endif
91
+#endif /* BRANCH_INCLUDE_FROMTO_BODY */
81 92
 	src[2]= msg->callid->body;
82 93
 	src[3]= msg->first_line.u.request.uri;
83 94
 	src[4]= get_cseq( msg )->number;
... ...
@@ -85,7 +96,7 @@ inline static int char_msg_val( struct sip_msg *msg, char *cv )
85 96
 	/* topmost Via is part of transaction key as well ! */
86 97
 	src[5]= msg->via1->host;
87 98
 	src[6]= msg->via1->port_str;
88
-	if (msg->via1->branch) {
99
+	if (likely(msg->via1->branch)) {
89 100
 		src[7]= msg->via1->branch->value;
90 101
 		MD5StringArray ( cv, src, 8 );
91 102
 	} else {
Browse code

core: include only from/to tags when computing via branch value

- use only the to & from tags when computing the via branch value
in syn_branch==0 mode. This should improve interoperability with
broken implementations that don't keep the from & to headers
unchanged. Defining BRANCH_INCLUDE_FROMTO_BODY will revert to
the old behaviour.
- moved char_msg_val from parser/msg_parser.h to its own file
(it has nothing to do with parsing).

Andrei Pelinescu-Onciul authored on 10/02/2010 20:30:11
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,101 @@
1
+/* 
2
+ * $Id$
3
+ * 
4
+ * Copyright (C) 2010 iptelorg GmbH
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
+ * char_msg_val.h
20
+ */
21
+/*
22
+ * History:
23
+ * --------
24
+ *  2010-02-10  moved from parser/msg_parser.h and added tag only mode
25
+ *              by default (andrei)
26
+*/
27
+/** compute the characteristic value of a message.
28
+ * @file
29
+ * @ingroup core
30
+ */
31
+/* Defines:
32
+ *  BRANCH_INCLUDE_FROMTO_BODY - if defined the old (pre 3.1) mode of
33
+ *   including the full from & to bodies will be used (instead of only the
34
+ *   tags).
35
+*/
36
+
37
+#ifndef __char_msg_val_h
38
+#define __char_msg_val_h
39
+
40
+#include "comp_defs.h"
41
+#include "compiler_opt.h"
42
+#include "str.h"
43
+#include "parser/msg_parser.h"
44
+#include "parser/parse_to.h"
45
+#include "parser/parse_from.h"
46
+#include "md5utils.h"
47
+
48
+/*! \brief calculate characteristic value of a message -- this value
49
+   is used to identify a transaction during the process of
50
+   reply matching
51
+ */
52
+inline static int char_msg_val( struct sip_msg *msg, char *cv )
53
+{
54
+	str src[8];
55
+
56
+	if (unlikely(!check_transaction_quadruple(msg))) {
57
+		LOG(L_ERR, "ERROR: can't calculate char_value due "
58
+			"to a parsing error\n");
59
+		memset( cv, '0', MD5_LEN );
60
+		return 0;
61
+	}
62
+
63
+#ifdef BRANCH_INCLUDE_FROMTO_BODY
64
+	/* use the from & to full bodies */
65
+	src[0]= msg->from->body;
66
+	src[1]= msg->to->body;
67
+#else
68
+	/* to body is automatically parsed (via check_transactionquadruple / 
69
+	   parse_header), but the from body has to be parsed manually */
70
+	if (msg->from->parsed==0){
71
+		/* parse from body */
72
+		if (unlikely(parse_from_header(msg) == -1)){
73
+			LOG(L_ERR, "error while parsing From header\n");
74
+			return 0;
75
+		}
76
+	}
77
+	/* use only the from & to tags */
78
+	src[0]=get_from(msg)->tag_value;
79
+	src[1]=get_to(msg)->tag_value;
80
+#endif
81
+	src[2]= msg->callid->body;
82
+	src[3]= msg->first_line.u.request.uri;
83
+	src[4]= get_cseq( msg )->number;
84
+
85
+	/* topmost Via is part of transaction key as well ! */
86
+	src[5]= msg->via1->host;
87
+	src[6]= msg->via1->port_str;
88
+	if (msg->via1->branch) {
89
+		src[7]= msg->via1->branch->value;
90
+		MD5StringArray ( cv, src, 8 );
91
+	} else {
92
+		MD5StringArray( cv, src, 7 );
93
+	}
94
+	return 1;
95
+}
96
+
97
+
98
+
99
+#endif /*__char_msg_val_h*/
100
+
101
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */