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,122 +0,0 @@
1
-/*
2
- *
3
- * adding/removing headers or any other data chunk from a message
4
- *
5
- * Copyright (C) 2001-2003 FhG Fokus
6
- *
7
- * This file is part of Kamailio, a free SIP server.
8
- *
9
- * Kamailio 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
- * Kamailio is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License 
20
- * along with this program; if not, write to the Free Software 
21
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
- */
23
-/*!
24
-* \file
25
-* \brief Kamailio core :: Adding/removing headers or any other data chunk from a message
26
-* \ingroup core
27
-* \author jiri, andrei, janakj
28
-* Module: \ref core
29
-*/
30
-
31
-#ifndef lump_struct_h
32
-#define lump_struct_h
33
-
34
-#include "./parser/hf.h"
35
-
36
-
37
-enum lump_op { LUMP_NOP=0, LUMP_DEL, LUMP_ADD, LUMP_ADD_SUBST, LUMP_ADD_OPT };
38
-enum lump_subst{ SUBST_NOP=0,                     /* do nothing */
39
-				 SUBST_RCV_IP,    SUBST_SND_IP,   /* add ip address */
40
-				 SUBST_RCV_PORT,  SUBST_SND_PORT, /* add port no */
41
-				 SUBST_RCV_PROTO, SUBST_SND_PROTO,/* add protocol(udp,tcp,tls)*/
42
-				 SUBST_RCV_ALL,   SUBST_SND_ALL   /*  ip:port;transport=proto */
43
-				};
44
-				/* Where:
45
-				   SND = sending, e.g the src ip of the outgoing message
46
-				   RCV = received e.g the dst ip of the original incoming msg,
47
-				    or the ip of the ser socket on which the msg was received
48
-				   For SUBST_{RCV,SND}_ALL, :port is added only if port!=5060
49
-				    and transport=proto only if proto!=udp
50
-					*/
51
-
52
-enum lump_conditions {	COND_FALSE,         /* always false */
53
-						COND_TRUE,          /* always true */
54
-						COND_IF_DIFF_REALMS,/* true if RCV realm != SND realm */
55
-						COND_IF_DIFF_AF,    /* true if RCV af != SND af */
56
-						COND_IF_DIFF_PROTO, /* true if RCV proto != SND proto */
57
-						COND_IF_DIFF_PORT,  /* true if RCV port != SND port */
58
-						COND_IF_DIFF_IP,    /* true if RCV ip != SND ip */
59
-						COND_IF_RAND        /* 50-50 random prob.of being true*/
60
-						};
61
-						/* Where: 
62
-						   REALM= ip_addr:port:proto
63
-						   af   = address family (ipv4 or ipv6)
64
-						   proto = protocol (tcp, udp, tls)
65
-						*/
66
-
67
-enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2,
68
-	LUMPFLAG_BRANCH=4, LUMPFLAG_COND_TRUE=8 };
69
-
70
-#define LUMP_SET_COND_TRUE(_lump)	 (_lump)->flags |= LUMPFLAG_COND_TRUE
71
-#define LUMP_IS_COND_TRUE(_lump)	 ((_lump)->flags & LUMPFLAG_COND_TRUE)
72
-
73
-typedef struct lump{
74
-	enum _hdr_types_t type; /* HDR_VIA_T, HDR_OTHER_T (0), ... */
75
-	enum lump_op op;   /* DEL, ADD, NOP, UNSPEC(=0) */
76
-	
77
-	union{
78
-		int offset; /* used for DEL, MODIFY */
79
-		enum lump_subst subst; /*what to subst: ip addr, port, proto*/
80
-		enum lump_conditions cond; /* condition for LUMP_ADD_OPT */
81
-		char * value; /* used for ADD */
82
-	}u;
83
-	int len; /* length of this header field */
84
-	
85
-	
86
-	struct lump* before; /* list of headers to be inserted in front of the
87
-								current one */
88
-	struct lump* after; /* list of headers to be inserted immediately after
89
-							  the current one */
90
-	
91
-	struct lump* next;
92
-
93
-	enum lump_flag flags; /* additional hints for use from TM's shmem */
94
-} sr_lump_t;
95
-
96
-
97
-/*
98
- * hdrs must be kept sorted after their offset (DEL, NOP, UNSPEC)
99
- * and/or their position (ADD). E.g.:
100
- *  - to delete header Z insert it in to the list according to its offset 
101
- *   and with op=DELETE
102
- * - if you want to add a new header X after a  header Y, insert Y in the list
103
- *   with op NOP and after it X (op ADD).
104
- * - if you want X before Y, insert X in Y's before list.
105
- * - if you want X to be the first header just put it first in hdr_lst.
106
- *  -if you want to replace Y with X, insert Y with op=DELETE and then X with
107
- *  op=ADD.
108
- * before and after must contain only ADD ops!
109
- * 
110
- * Difference between "after" & "next" when Adding:
111
- * "after" forces the new header immediately after the current one while
112
- * "next" means another header can be inserted between them.
113
- * 
114
- */
115
-
116
-/* frees the content of a lump struct */
117
-void free_lump(struct lump* l);
118
-/* frees an entire lump list, recursively */
119
-void free_lump_list(struct lump* lump_list);
120
-/* count applied lumps in a list having a specific type */
121
-unsigned int count_applied_lumps(struct lump *ll, int type);
122
-#endif
Browse code

core: typef'ed the lump structure

Daniel-Constantin Mierla authored on 03/02/2016 11:57:11
Showing 1 changed files
... ...
@@ -70,7 +70,7 @@ enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2,
70 70
 #define LUMP_SET_COND_TRUE(_lump)	 (_lump)->flags |= LUMPFLAG_COND_TRUE
71 71
 #define LUMP_IS_COND_TRUE(_lump)	 ((_lump)->flags & LUMPFLAG_COND_TRUE)
72 72
 
73
-struct lump{
73
+typedef struct lump{
74 74
 	enum _hdr_types_t type; /* HDR_VIA_T, HDR_OTHER_T (0), ... */
75 75
 	enum lump_op op;   /* DEL, ADD, NOP, UNSPEC(=0) */
76 76
 	
... ...
@@ -91,7 +91,7 @@ struct lump{
91 91
 	struct lump* next;
92 92
 
93 93
 	enum lump_flag flags; /* additional hints for use from TM's shmem */
94
-};
94
+} sr_lump_t;
95 95
 
96 96
 
97 97
 /*
Browse code

Core Update of doxygen, removal of history, changing "ser" to "kamailio"

Olle E. Johansson authored on 03/01/2015 14:03:24
Showing 1 changed files
... ...
@@ -1,23 +1,17 @@
1 1
 /*
2
- * $Id$
3 2
  *
4 3
  * adding/removing headers or any other data chunk from a message
5 4
  *
6 5
  * Copyright (C) 2001-2003 FhG Fokus
7 6
  *
8
- * This file is part of ser, a free SIP server.
7
+ * This file is part of Kamailio, a free SIP server.
9 8
  *
10
- * ser is free software; you can redistribute it and/or modify
9
+ * Kamailio is free software; you can redistribute it and/or modify
11 10
  * it under the terms of the GNU General Public License as published by
12 11
  * the Free Software Foundation; either version 2 of the License, or
13 12
  * (at your option) any later version
14 13
  *
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,
14
+ * Kamailio is distributed in the hope that it will be useful,
21 15
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 16
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 17
  * GNU General Public License for more details.
... ...
@@ -26,18 +20,13 @@
26 20
  * along with this program; if not, write to the Free Software 
27 21
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
28 22
  */
29
-/* History:
30
- * --------
31
- *  2003-01-29  s/int/enum ... more convenient for gdb (jiri)
32
- *  2003-03-31  added subst lumps -- they expand in ip addr, port a.s.o (andrei)
33
- *  2003-04-01  added opt (condition) lumps (andrei)
34
- *  2003-04-02  added more subst lumps: SUBST_{SND,RCV}_ALL  
35
- *              => ip:port;transport=proto (andrei)
36
- *  2003-10-20  split from data_lump.h (andrei)
37
- *  2005-03-24  the type of type attribute changed to enum _hdr_types_t (janakj)
38
- *
39
- */
40
-
23
+/*!
24
+* \file
25
+* \brief Kamailio core :: Adding/removing headers or any other data chunk from a message
26
+* \ingroup core
27
+* \author jiri, andrei, janakj
28
+* Module: \ref core
29
+*/
41 30
 
42 31
 #ifndef lump_struct_h
43 32
 #define lump_struct_h
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
... ...
@@ -24,7 +24,7 @@
24 24
  *
25 25
  * You should have received a copy of the GNU General Public License 
26 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
27
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
28 28
  */
29 29
 /* History:
30 30
  * --------
Browse code

core: added function to count applied lumps

- new defines to set/test lump flag

Daniel-Constantin Mierla authored on 27/04/2009 12:25:31
Showing 1 changed files
... ...
@@ -75,8 +75,11 @@ enum lump_conditions {	COND_FALSE,         /* always false */
75 75
 						   proto = protocol (tcp, udp, tls)
76 76
 						*/
77 77
 
78
-enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2, LUMPFLAG_BRANCH=4 };
78
+enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2,
79
+	LUMPFLAG_BRANCH=4, LUMPFLAG_COND_TRUE=8 };
79 80
 
81
+#define LUMP_SET_COND_TRUE(_lump)	 (_lump)->flags |= LUMPFLAG_COND_TRUE
82
+#define LUMP_IS_COND_TRUE(_lump)	 ((_lump)->flags & LUMPFLAG_COND_TRUE)
80 83
 
81 84
 struct lump{
82 85
 	enum _hdr_types_t type; /* HDR_VIA_T, HDR_OTHER_T (0), ... */
... ...
@@ -123,7 +126,8 @@ struct lump{
123 126
 
124 127
 /* frees the content of a lump struct */
125 128
 void free_lump(struct lump* l);
126
-/*frees an entire lump list, recursively */
129
+/* frees an entire lump list, recursively */
127 130
 void free_lump_list(struct lump* lump_list);
128
-
131
+/* count applied lumps in a list having a specific type */
132
+unsigned int count_applied_lumps(struct lump *ll, int type);
129 133
 #endif
Browse code

- Suppor for branch_route sections in the configuration file.

Jan Janak authored on 18/08/2005 15:46:46
Showing 1 changed files
... ...
@@ -75,7 +75,7 @@ enum lump_conditions {	COND_FALSE,         /* always false */
75 75
 						   proto = protocol (tcp, udp, tls)
76 76
 						*/
77 77
 
78
-enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2 };
78
+enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2, LUMPFLAG_BRANCH=4 };
79 79
 
80 80
 
81 81
 struct lump{
Browse code

- the type of lump->op changed from int to enum _hdr_types-t - the value of HDR_OTHER_T changed to 0 - the value of HDR_VIA1_t changed to 1 (to avoid conflict with value 0 given as parameter to *_lump functions)

Credits go to Norman Brandinger who investigated the problem in detail and
proposed the solution.

Jan Janak authored on 24/03/2005 14:47:26
Showing 1 changed files
... ...
@@ -34,6 +34,7 @@
34 34
  *  2003-04-02  added more subst lumps: SUBST_{SND,RCV}_ALL  
35 35
  *              => ip:port;transport=proto (andrei)
36 36
  *  2003-10-20  split from data_lump.h (andrei)
37
+ *  2005-03-24  the type of type attribute changed to enum _hdr_types_t (janakj)
37 38
  *
38 39
  */
39 40
 
... ...
@@ -41,6 +42,7 @@
41 42
 #ifndef lump_struct_h
42 43
 #define lump_struct_h
43 44
 
45
+#include "./parser/hf.h"
44 46
 
45 47
 
46 48
 enum lump_op { LUMP_NOP=0, LUMP_DEL, LUMP_ADD, LUMP_ADD_SUBST, LUMP_ADD_OPT };
... ...
@@ -77,7 +79,7 @@ enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2 };
77 79
 
78 80
 
79 81
 struct lump{
80
-	int type; /* VIA, OTHER, UNSPEC(=0), ... */
82
+	enum _hdr_types_t type; /* HDR_VIA_T, HDR_OTHER_T (0), ... */
81 83
 	enum lump_op op;   /* DEL, ADD, NOP, UNSPEC(=0) */
82 84
 	
83 85
 	union{
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:45:09
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
  *
4 4
  * adding/removing headers or any other data chunk from a message
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
  *
... ...
@@ -33,7 +33,7 @@
33 33
  *  2003-04-01  added opt (condition) lumps (andrei)
34 34
  *  2003-04-02  added more subst lumps: SUBST_{SND,RCV}_ALL  
35 35
  *              => ip:port;transport=proto (andrei)
36
- *  2003-10-20  splitted from data_lump.h (andrei)
36
+ *  2003-10-20  split from data_lump.h (andrei)
37 37
  *
38 38
  */
39 39
 
... ...
@@ -113,7 +113,7 @@ struct lump{
113 113
  *  op=ADD.
114 114
  * before and after must contain only ADD ops!
115 115
  * 
116
- * Difference between "after" & "next" when ADDing:
116
+ * Difference between "after" & "next" when Adding:
117 117
  * "after" forces the new header immediately after the current one while
118 118
  * "next" means another header can be inserted between them.
119 119
  * 
Browse code

- added body_lumps (jan patches + some changes) - anchor_lump & del_lump compare the offset with msg->eoh and add the lump to add_rm or body_lumps, so make sure to parse_headers(HDR_EOH) if you lumps might modify the body. - changed all the {anchor,del}_lump calls

Andrei Pelinescu-Onciul authored on 20/10/2003 17:10:13
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,127 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * adding/removing headers or any other data chunk from a message
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
+/* History:
30
+ * --------
31
+ *  2003-01-29  s/int/enum ... more convenient for gdb (jiri)
32
+ *  2003-03-31  added subst lumps -- they expand in ip addr, port a.s.o (andrei)
33
+ *  2003-04-01  added opt (condition) lumps (andrei)
34
+ *  2003-04-02  added more subst lumps: SUBST_{SND,RCV}_ALL  
35
+ *              => ip:port;transport=proto (andrei)
36
+ *  2003-10-20  splitted from data_lump.h (andrei)
37
+ *
38
+ */
39
+
40
+
41
+#ifndef lump_struct_h
42
+#define lump_struct_h
43
+
44
+
45
+
46
+enum lump_op { LUMP_NOP=0, LUMP_DEL, LUMP_ADD, LUMP_ADD_SUBST, LUMP_ADD_OPT };
47
+enum lump_subst{ SUBST_NOP=0,                     /* do nothing */
48
+				 SUBST_RCV_IP,    SUBST_SND_IP,   /* add ip address */
49
+				 SUBST_RCV_PORT,  SUBST_SND_PORT, /* add port no */
50
+				 SUBST_RCV_PROTO, SUBST_SND_PROTO,/* add protocol(udp,tcp,tls)*/
51
+				 SUBST_RCV_ALL,   SUBST_SND_ALL   /*  ip:port;transport=proto */
52
+				};
53
+				/* Where:
54
+				   SND = sending, e.g the src ip of the outgoing message
55
+				   RCV = received e.g the dst ip of the original incoming msg,
56
+				    or the ip of the ser socket on which the msg was received
57
+				   For SUBST_{RCV,SND}_ALL, :port is added only if port!=5060
58
+				    and transport=proto only if proto!=udp
59
+					*/
60
+
61
+enum lump_conditions {	COND_FALSE,         /* always false */
62
+						COND_TRUE,          /* always true */
63
+						COND_IF_DIFF_REALMS,/* true if RCV realm != SND realm */
64
+						COND_IF_DIFF_AF,    /* true if RCV af != SND af */
65
+						COND_IF_DIFF_PROTO, /* true if RCV proto != SND proto */
66
+						COND_IF_DIFF_PORT,  /* true if RCV port != SND port */
67
+						COND_IF_DIFF_IP,    /* true if RCV ip != SND ip */
68
+						COND_IF_RAND        /* 50-50 random prob.of being true*/
69
+						};
70
+						/* Where: 
71
+						   REALM= ip_addr:port:proto
72
+						   af   = address family (ipv4 or ipv6)
73
+						   proto = protocol (tcp, udp, tls)
74
+						*/
75
+
76
+enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2 };
77
+
78
+
79
+struct lump{
80
+	int type; /* VIA, OTHER, UNSPEC(=0), ... */
81
+	enum lump_op op;   /* DEL, ADD, NOP, UNSPEC(=0) */
82
+	
83
+	union{
84
+		int offset; /* used for DEL, MODIFY */
85
+		enum lump_subst subst; /*what to subst: ip addr, port, proto*/
86
+		enum lump_conditions cond; /* condition for LUMP_ADD_OPT */
87
+		char * value; /* used for ADD */
88
+	}u;
89
+	int len; /* length of this header field */
90
+	
91
+	
92
+	struct lump* before; /* list of headers to be inserted in front of the
93
+								current one */
94
+	struct lump* after; /* list of headers to be inserted immediately after
95
+							  the current one */
96
+	
97
+	struct lump* next;
98
+
99
+	enum lump_flag flags; /* additional hints for use from TM's shmem */
100
+};
101
+
102
+
103
+/*
104
+ * hdrs must be kept sorted after their offset (DEL, NOP, UNSPEC)
105
+ * and/or their position (ADD). E.g.:
106
+ *  - to delete header Z insert it in to the list according to its offset 
107
+ *   and with op=DELETE
108
+ * - if you want to add a new header X after a  header Y, insert Y in the list
109
+ *   with op NOP and after it X (op ADD).
110
+ * - if you want X before Y, insert X in Y's before list.
111
+ * - if you want X to be the first header just put it first in hdr_lst.
112
+ *  -if you want to replace Y with X, insert Y with op=DELETE and then X with
113
+ *  op=ADD.
114
+ * before and after must contain only ADD ops!
115
+ * 
116
+ * Difference between "after" & "next" when ADDing:
117
+ * "after" forces the new header immediately after the current one while
118
+ * "next" means another header can be inserted between them.
119
+ * 
120
+ */
121
+
122
+/* frees the content of a lump struct */
123
+void free_lump(struct lump* l);
124
+/*frees an entire lump list, recursively */
125
+void free_lump_list(struct lump* lump_list);
126
+
127
+#endif