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,246 +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
-/** Parser :: parse header files
23
- * @file
24
- * @ingroup parser
25
- */
26
-
27
-
28
-#include "hf.h"
29
-#include "parse_via.h"
30
-#include "parse_to.h"
31
-#include "parse_cseq.h"
32
-#include "parse_date.h"
33
-#include "parse_identity.h"
34
-#include "parse_identityinfo.h"
35
-#include "../dprint.h"
36
-#include "../mem/mem.h"
37
-#include "parse_def.h"
38
-#include "digest/digest.h" /* free_credentials */
39
-#include "parse_event.h"
40
-#include "parse_expires.h"
41
-#include "parse_sipifmatch.h"
42
-#include "parse_rr.h"
43
-#include "parse_subscription_state.h"
44
-#include "contact/parse_contact.h"
45
-#include "parse_disposition.h"
46
-#include "parse_allow.h"
47
-#include "../ut.h"
48
-#include "parse_ppi_pai.h"
49
-
50
-/** Frees a hdr_field structure.
51
- * WARNING: it frees only parsed (and not name.s, body.s)
52
- */
53
-void clean_hdr_field(struct hdr_field* const hf)
54
-{
55
-	void** h_parsed;
56
-
57
-	if (hf->parsed){
58
-		h_parsed=&hf->parsed; /* strict aliasing warnings workarround */
59
-		switch(hf->type){
60
-		/* headers with pkg alloc for parsed structure (alphabetic order) */
61
-		case HDR_ACCEPT_T:
62
-			pkg_free(hf->parsed);
63
-			break;
64
-
65
-		case HDR_ALLOW_T:
66
-			free_allow_header(hf);
67
-			break;
68
-
69
-		case HDR_AUTHORIZATION_T:
70
-			free_credentials((auth_body_t**)h_parsed);
71
-			break;
72
-
73
-		case HDR_CONTACT_T:
74
-			free_contact((contact_body_t**)h_parsed);
75
-			break;
76
-
77
-		case HDR_CONTENTDISPOSITION_T:
78
-			free_disposition( ((struct disposition**)h_parsed));
79
-			break;
80
-
81
-		case HDR_CSEQ_T:
82
-			free_cseq(hf->parsed);
83
-			break;
84
-
85
-		case HDR_DATE_T:
86
-			free_date(hf->parsed);
87
-			break;
88
-
89
-		case HDR_DIVERSION_T:
90
-			free_to(hf->parsed);
91
-			break;
92
-
93
-		case HDR_EVENT_T:
94
-			free_event((event_t**)h_parsed);
95
-			break;
96
-
97
-		case HDR_EXPIRES_T:
98
-			free_expires((exp_body_t**)h_parsed);
99
-			break;
100
-
101
-		case HDR_MIN_EXPIRES_T:
102
-			free_expires((exp_body_t**)h_parsed);
103
-			break;
104
-
105
-		case HDR_FROM_T:
106
-			free_to(hf->parsed);
107
-			break;
108
-
109
-		case HDR_IDENTITY_INFO_T:
110
-			free_identityinfo(hf->parsed);
111
-			break;
112
-
113
-		case HDR_IDENTITY_T:
114
-			free_identity(hf->parsed);
115
-			break;
116
-
117
-		case HDR_PAI_T:
118
-			free_pai_ppi_body(hf->parsed);
119
-			break;
120
-
121
-		case HDR_PPI_T:
122
-			free_pai_ppi_body(hf->parsed);
123
-			break;
124
-
125
-		case HDR_PROXYAUTH_T:
126
-			free_credentials((auth_body_t**)h_parsed);
127
-			break;
128
-
129
-		case HDR_RECORDROUTE_T:
130
-			free_rr((rr_t**)h_parsed);
131
-			break;
132
-
133
-		case HDR_REFER_TO_T:
134
-			free_to(hf->parsed);
135
-			break;
136
-
137
-		case HDR_ROUTE_T:
138
-			free_rr((rr_t**)h_parsed);
139
-			break;
140
-
141
-		case HDR_RPID_T:
142
-			free_to(hf->parsed);
143
-			break;
144
-
145
-		case HDR_SESSIONEXPIRES_T:
146
-			hdr_free_parsed(h_parsed);
147
-			break;
148
-
149
-		case HDR_SIPIFMATCH_T:
150
-			free_sipifmatch((str **)h_parsed);
151
-			break;
152
-
153
-		case HDR_SUBSCRIPTION_STATE_T:
154
-			free_subscription_state((subscription_state_t**)h_parsed);
155
-			break;
156
-
157
-		case HDR_SUPPORTED_T:
158
-			hdr_free_parsed(h_parsed);
159
-			break;
160
-
161
-		case HDR_TO_T:
162
-			free_to(hf->parsed);
163
-			break;
164
-
165
-		case HDR_VIA_T:
166
-			free_via_list(hf->parsed);
167
-			break;
168
-
169
-		/* headers with no alloc for parsed structure */
170
-		case HDR_CALLID_T:
171
-		case HDR_MAXFORWARDS_T:
172
-		case HDR_CONTENTTYPE_T:
173
-		case HDR_CONTENTLENGTH_T:
174
-		case HDR_RETRY_AFTER_T:
175
-		case HDR_REQUIRE_T:
176
-		case HDR_PROXYREQUIRE_T:
177
-		case HDR_UNSUPPORTED_T:
178
-		case HDR_ACCEPTLANGUAGE_T:
179
-		case HDR_ORGANIZATION_T:
180
-		case HDR_PRIORITY_T:
181
-		case HDR_SUBJECT_T:
182
-		case HDR_USERAGENT_T:
183
-		case HDR_SERVER_T:
184
-		case HDR_MIN_SE_T:
185
-		case HDR_ACCEPTCONTACT_T:
186
-		case HDR_ALLOWEVENTS_T:
187
-		case HDR_CONTENTENCODING_T:
188
-		case HDR_REFERREDBY_T:
189
-		case HDR_REJECTCONTACT_T:
190
-		case HDR_REQUESTDISPOSITION_T:
191
-		case HDR_WWW_AUTHENTICATE_T:
192
-		case HDR_PROXY_AUTHENTICATE_T:
193
-		case HDR_PATH_T:
194
-		case HDR_PRIVACY_T:
195
-		case HDR_REASON_T:
196
-			break;
197
-
198
-		default:
199
-			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
200
-			    hf->type);
201
-			break;
202
-		}
203
-	}
204
-}
205
-
206
-
207
-/** Frees a hdr_field list.
208
- * WARNING: frees only ->parsed and ->next*/
209
-void free_hdr_field_lst(struct hdr_field* hf)
210
-{
211
-	struct hdr_field* foo;
212
-
213
-	while(hf) {
214
-		foo=hf;
215
-		hf=hf->next;
216
-		clean_hdr_field(foo);
217
-		pkg_free(foo);
218
-		foo = 0;
219
-	}
220
-}
221
-
222
-/* print the content of hdr_field */
223
-void dump_hdr_field(struct hdr_field const* const hf )
224
-{
225
-	LOG(L_ERR, "DEBUG: dump_hdr_field: type=%d, name=%.*s, "
226
-		"body=%.*s, parsed=%p, next=%p\n",
227
-		hf->type, hf->name.len, ZSW(hf->name.s),
228
-		hf->body.len, ZSW(hf->body.s),
229
-		hf->parsed, hf->next );
230
-}
231
-
232
-/**
233
- * free hdr parsed structure using inner free function
234
- * - hdr parsed struct must have as first file a free function,
235
- *   so it can be caseted to hf_parsed_t
236
- */
237
-void hdr_free_parsed(void **h_parsed)
238
-{
239
-	if(h_parsed==NULL || *h_parsed==NULL)
240
-		return;
241
-
242
-	if(((hf_parsed_t*)(*h_parsed))->hfree) {
243
-		((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
244
-	}
245
-	*h_parsed = 0;
246
-}
Browse code

core: fix double free on clearing hdr

Dragos Oancea authored on 22/08/2016 07:58:07
Showing 1 changed files
... ...
@@ -215,6 +215,7 @@ void free_hdr_field_lst(struct hdr_field* hf)
215 215
 		hf=hf->next;
216 216
 		clean_hdr_field(foo);
217 217
 		pkg_free(foo);
218
+		foo = 0;
218 219
 	}
219 220
 }
220 221
 
Browse code

parser: Add parser for Min-Expires

Alex Hermann authored on 05/07/2016 09:45:41
Showing 1 changed files
... ...
@@ -98,6 +98,10 @@ void clean_hdr_field(struct hdr_field* const hf)
98 98
 			free_expires((exp_body_t**)h_parsed);
99 99
 			break;
100 100
 
101
+		case HDR_MIN_EXPIRES_T:
102
+			free_expires((exp_body_t**)h_parsed);
103
+			break;
104
+
101 105
 		case HDR_FROM_T:
102 106
 			free_to(hf->parsed);
103 107
 			break;
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,19 +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
- * 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
- * ser is distributed in the hope that it will be useful,
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
19 14
  * GNU General Public License for more details.
... ...
@@ -22,13 +17,6 @@
22 17
  * along with this program; if not, write to the Free Software
23 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 19
  *
25
- * History:
26
- * -------
27
- * 2003-03-26 Frees also hdr->parsed for Route & Record-Route (janakj)
28
- * 2003-04-26 ZSW (jiri)
29
- * 2003-08-05 free the parsed part of Accept header (bogdan)
30
- * 2007-01-26 HDR_DATE_T, HDR_IDENTITY_T, HDR_IDENTITY_INFO_T added (gergo)
31
- * 2007-07-27 added HDR_RETRY_AFTER_T (andrei)
32 20
  */
33 21
 
34 22
 /** Parser :: parse header files
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
... ...
@@ -20,7 +20,7 @@
20 20
  *
21 21
  * You should have received a copy of the GNU General Public License
22 22
  * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
24 24
  *
25 25
  * History:
26 26
  * -------
Browse code

parser,modules/pv,modules/sipcapture: Improved parsing of P-Asserted/Preferred-Identity headers

parser:
- Abstracted addr-spec parsing from parse_to.c into new file.
(parse_addr_spec.c)
- Added support for comma separated addr-spec values.
- Created new P-Asserted-Identity and P-Preferred-Identity header parsers
that parse all instances and allows comma separated values.
modules/pv:
- Added PV index to $ai, $pu, $pU, $pd and $pn variables to retreive the
n'th URI instance. E.g. $(ai[1])
modules/sipcapture:
- Updated to use the new structure
- Maintains previous behaviour - only uses the first URI

Hugh Waite authored on 11/03/2013 16:55:23
Showing 1 changed files
... ...
@@ -57,6 +57,7 @@
57 57
 #include "parse_disposition.h"
58 58
 #include "parse_allow.h"
59 59
 #include "../ut.h"
60
+#include "parse_ppi_pai.h"
60 61
 
61 62
 /** Frees a hdr_field structure.
62 63
  * WARNING: it frees only parsed (and not name.s, body.s)
... ...
@@ -122,11 +123,11 @@ void clean_hdr_field(struct hdr_field* const hf)
122 123
 			break;
123 124
 
124 125
 		case HDR_PAI_T:
125
-			free_to(hf->parsed);
126
+			free_pai_ppi_body(hf->parsed);
126 127
 			break;
127 128
 
128 129
 		case HDR_PPI_T:
129
-			free_to(hf->parsed);
130
+			free_pai_ppi_body(hf->parsed);
130 131
 			break;
131 132
 
132 133
 		case HDR_PROXYAUTH_T:
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
... ...
@@ -63,7 +63,7 @@
63 63
 /** Frees a hdr_field structure.
64 64
  * WARNING: it frees only parsed (and not name.s, body.s)
65 65
  */
66
-void clean_hdr_field(struct hdr_field* hf)
66
+void clean_hdr_field(struct hdr_field* const hf)
67 67
 {
68 68
 	void** h_parsed;
69 69
 
... ...
@@ -228,7 +228,7 @@ void free_hdr_field_lst(struct hdr_field* hf)
228 228
 }
229 229
 
230 230
 /* print the content of hdr_field */
231
-void dump_hdr_field( struct hdr_field* hf )
231
+void dump_hdr_field(struct hdr_field const* const hf )
232 232
 {
233 233
 	LOG(L_ERR, "DEBUG: dump_hdr_field: type=%d, name=%.*s, "
234 234
 		"body=%.*s, parsed=%p, next=%p\n",
Browse code

parser: removed accept_disposition hdr hook from sip_msg_t

- it was not used at all, just hooked and cloned for no good reason

Daniel-Constantin Mierla authored on 18/04/2012 12:03:10
Showing 1 changed files
... ...
@@ -190,7 +190,6 @@ void clean_hdr_field(struct hdr_field* hf)
190 190
 		case HDR_SUBJECT_T:
191 191
 		case HDR_USERAGENT_T:
192 192
 		case HDR_SERVER_T:
193
-		case HDR_ACCEPTDISPOSITION_T:
194 193
 		case HDR_MIN_SE_T:
195 194
 		case HDR_ACCEPTCONTACT_T:
196 195
 		case HDR_ALLOWEVENTS_T:
Browse code

core: helper function to free parsed header struct with inner free function

Daniel-Constantin Mierla authored on 28/02/2011 16:17:09
Showing 1 changed files
... ...
@@ -152,10 +152,7 @@ void clean_hdr_field(struct hdr_field* hf)
152 152
 			break;
153 153
 
154 154
 		case HDR_SESSIONEXPIRES_T:
155
-			if(*h_parsed) {
156
-				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
157
-				*h_parsed = 0;
158
-			}
155
+			hdr_free_parsed(h_parsed);
159 156
 			break;
160 157
 
161 158
 		case HDR_SIPIFMATCH_T:
... ...
@@ -167,9 +164,7 @@ void clean_hdr_field(struct hdr_field* hf)
167 164
 			break;
168 165
 
169 166
 		case HDR_SUPPORTED_T:
170
-			if(*h_parsed) {
171
-				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
172
-			}
167
+			hdr_free_parsed(h_parsed);
173 168
 			break;
174 169
 
175 170
 		case HDR_TO_T:
... ...
@@ -233,6 +228,7 @@ void free_hdr_field_lst(struct hdr_field* hf)
233 228
 	}
234 229
 }
235 230
 
231
+/* print the content of hdr_field */
236 232
 void dump_hdr_field( struct hdr_field* hf )
237 233
 {
238 234
 	LOG(L_ERR, "DEBUG: dump_hdr_field: type=%d, name=%.*s, "
... ...
@@ -241,3 +237,19 @@ void dump_hdr_field( struct hdr_field* hf )
241 237
 		hf->body.len, ZSW(hf->body.s),
242 238
 		hf->parsed, hf->next );
243 239
 }
240
+
241
+/**
242
+ * free hdr parsed structure using inner free function
243
+ * - hdr parsed struct must have as first file a free function,
244
+ *   so it can be caseted to hf_parsed_t
245
+ */
246
+void hdr_free_parsed(void **h_parsed)
247
+{
248
+	if(h_parsed==NULL || *h_parsed==NULL)
249
+		return;
250
+
251
+	if(((hf_parsed_t*)(*h_parsed))->hfree) {
252
+		((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
253
+	}
254
+	*h_parsed = 0;
255
+}
Browse code

core: order the list of headers that allocate pkg

- easier to spot the missing ones

Daniel-Constantin Mierla authored on 28/02/2011 15:18:24
Showing 1 changed files
... ...
@@ -68,154 +68,134 @@ void clean_hdr_field(struct hdr_field* hf)
68 68
 	void** h_parsed;
69 69
 
70 70
 	if (hf->parsed){
71
-		h_parsed=&hf->parsed; /*strict aliasing warnings workarround */
71
+		h_parsed=&hf->parsed; /* strict aliasing warnings workarround */
72 72
 		switch(hf->type){
73
-		case HDR_VIA_T:
74
-			free_via_list(hf->parsed);
75
-			break;
76
-
77
-		case HDR_TO_T:
78
-			free_to(hf->parsed);
79
-			break;
80
-
81
-		case HDR_FROM_T:
82
-			free_to(hf->parsed);
83
-			break;
84
-
85
-		case HDR_CSEQ_T:
86
-			free_cseq(hf->parsed);
73
+		/* headers with pkg alloc for parsed structure (alphabetic order) */
74
+		case HDR_ACCEPT_T:
75
+			pkg_free(hf->parsed);
87 76
 			break;
88 77
 
89
-		case HDR_CALLID_T:
78
+		case HDR_ALLOW_T:
79
+			free_allow_header(hf);
90 80
 			break;
91 81
 
92
-		case HDR_SIPIFMATCH_T:
93
-			free_sipifmatch((str **)h_parsed);
82
+		case HDR_AUTHORIZATION_T:
83
+			free_credentials((auth_body_t**)h_parsed);
94 84
 			break;
95 85
 
96 86
 		case HDR_CONTACT_T:
97 87
 			free_contact((contact_body_t**)h_parsed);
98 88
 			break;
99 89
 
100
-		case HDR_MAXFORWARDS_T:
101
-			break;
102
-
103
-		case HDR_ROUTE_T:
104
-			free_rr((rr_t**)h_parsed);
105
-			break;
106
-
107
-		case HDR_RECORDROUTE_T:
108
-			free_rr((rr_t**)h_parsed);
90
+		case HDR_CONTENTDISPOSITION_T:
91
+			free_disposition( ((struct disposition**)h_parsed));
109 92
 			break;
110 93
 
111
-		case HDR_CONTENTTYPE_T:
94
+		case HDR_CSEQ_T:
95
+			free_cseq(hf->parsed);
112 96
 			break;
113 97
 
114
-		case HDR_CONTENTLENGTH_T:
98
+		case HDR_DATE_T:
99
+			free_date(hf->parsed);
115 100
 			break;
116 101
 
117
-		case HDR_RETRY_AFTER_T:
102
+		case HDR_DIVERSION_T:
103
+			free_to(hf->parsed);
118 104
 			break;
119 105
 
120
-		case HDR_AUTHORIZATION_T:
121
-			free_credentials((auth_body_t**)h_parsed);
106
+		case HDR_EVENT_T:
107
+			free_event((event_t**)h_parsed);
122 108
 			break;
123 109
 
124 110
 		case HDR_EXPIRES_T:
125 111
 			free_expires((exp_body_t**)h_parsed);
126 112
 			break;
127 113
 
128
-		case HDR_PROXYAUTH_T:
129
-			free_credentials((auth_body_t**)h_parsed);
130
-			break;
131
-
132
-		case HDR_SUPPORTED_T:
133
-			if(*h_parsed) {
134
-				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
135
-			}
136
-			break;
137
-
138
-		case HDR_REQUIRE_T:
139
-			break;
140
-
141
-		case HDR_PROXYREQUIRE_T:
142
-			break;
143
-
144
-		case HDR_UNSUPPORTED_T:
145
-			break;
146
-
147
-		case HDR_ALLOW_T:
148
-			free_allow_header(hf);
149
-			break;
150
-
151
-		case HDR_EVENT_T:
152
-			free_event((event_t**)h_parsed);
153
-			break;
154
-
155
-		case HDR_ACCEPT_T:
156
-			pkg_free(hf->parsed);
114
+		case HDR_FROM_T:
115
+			free_to(hf->parsed);
157 116
 			break;
158 117
 
159
-		case HDR_ACCEPTLANGUAGE_T:
118
+		case HDR_IDENTITY_INFO_T:
119
+			free_identityinfo(hf->parsed);
160 120
 			break;
161 121
 
162
-		case HDR_ORGANIZATION_T:
122
+		case HDR_IDENTITY_T:
123
+			free_identity(hf->parsed);
163 124
 			break;
164 125
 
165
-		case HDR_PRIORITY_T:
126
+		case HDR_PAI_T:
127
+			free_to(hf->parsed);
166 128
 			break;
167 129
 
168
-		case HDR_SUBJECT_T:
130
+		case HDR_PPI_T:
131
+			free_to(hf->parsed);
169 132
 			break;
170 133
 
171
-		case HDR_USERAGENT_T:
134
+		case HDR_PROXYAUTH_T:
135
+			free_credentials((auth_body_t**)h_parsed);
172 136
 			break;
173 137
 
174
-		case HDR_SERVER_T:
138
+		case HDR_RECORDROUTE_T:
139
+			free_rr((rr_t**)h_parsed);
175 140
 			break;
176 141
 
177
-		case HDR_ACCEPTDISPOSITION_T:
142
+		case HDR_REFER_TO_T:
143
+			free_to(hf->parsed);
178 144
 			break;
179 145
 
180
-		case HDR_CONTENTDISPOSITION_T:
181
-			free_disposition( ((struct disposition**)h_parsed));
146
+		case HDR_ROUTE_T:
147
+			free_rr((rr_t**)h_parsed);
182 148
 			break;
183 149
 
184
-		case HDR_DIVERSION_T:
150
+		case HDR_RPID_T:
185 151
 			free_to(hf->parsed);
186 152
 			break;
187 153
 
188
-		case HDR_RPID_T:
189
-			free_to(hf->parsed);
154
+		case HDR_SESSIONEXPIRES_T:
155
+			if(*h_parsed) {
156
+				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
157
+				*h_parsed = 0;
158
+			}
190 159
 			break;
191 160
 
192
-		case HDR_REFER_TO_T:
193
-			free_to(hf->parsed);
161
+		case HDR_SIPIFMATCH_T:
162
+			free_sipifmatch((str **)h_parsed);
194 163
 			break;
195 164
 
196 165
 		case HDR_SUBSCRIPTION_STATE_T:
197 166
 			free_subscription_state((subscription_state_t**)h_parsed);
198 167
 			break;
199 168
 
200
-		case HDR_DATE_T:
201
-			free_date(hf->parsed);
202
-			break;
203
-
204
-		case HDR_IDENTITY_INFO_T:
205
-			free_identityinfo(hf->parsed);
169
+		case HDR_SUPPORTED_T:
170
+			if(*h_parsed) {
171
+				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
172
+			}
206 173
 			break;
207 174
 
208
-		case HDR_IDENTITY_T:
209
-			free_identity(hf->parsed);
175
+		case HDR_TO_T:
176
+			free_to(hf->parsed);
210 177
 			break;
211 178
 
212
-		case HDR_SESSIONEXPIRES_T:
213
-			if(*h_parsed) {
214
-				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
215
-				*h_parsed = 0;
216
-			}
179
+		case HDR_VIA_T:
180
+			free_via_list(hf->parsed);
217 181
 			break;
218 182
 
183
+		/* headers with no alloc for parsed structure */
184
+		case HDR_CALLID_T:
185
+		case HDR_MAXFORWARDS_T:
186
+		case HDR_CONTENTTYPE_T:
187
+		case HDR_CONTENTLENGTH_T:
188
+		case HDR_RETRY_AFTER_T:
189
+		case HDR_REQUIRE_T:
190
+		case HDR_PROXYREQUIRE_T:
191
+		case HDR_UNSUPPORTED_T:
192
+		case HDR_ACCEPTLANGUAGE_T:
193
+		case HDR_ORGANIZATION_T:
194
+		case HDR_PRIORITY_T:
195
+		case HDR_SUBJECT_T:
196
+		case HDR_USERAGENT_T:
197
+		case HDR_SERVER_T:
198
+		case HDR_ACCEPTDISPOSITION_T:
219 199
 		case HDR_MIN_SE_T:
220 200
 		case HDR_ACCEPTCONTACT_T:
221 201
 		case HDR_ALLOWEVENTS_T:
... ...
@@ -230,14 +210,6 @@ void clean_hdr_field(struct hdr_field* hf)
230 210
 		case HDR_REASON_T:
231 211
 			break;
232 212
 
233
-		case HDR_PPI_T:
234
-			free_to(hf->parsed);
235
-			break;
236
-
237
-		case HDR_PAI_T:
238
-			free_to(hf->parsed);
239
-			break;
240
-
241 213
 		default:
242 214
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
243 215
 			    hf->type);
Browse code

core: free SE header parsed structure

- use the generic free framework for headers

Daniel-Constantin Mierla authored on 28/02/2011 10:17:10
Showing 1 changed files
... ...
@@ -210,6 +210,12 @@ void clean_hdr_field(struct hdr_field* hf)
210 210
 			break;
211 211
 
212 212
 		case HDR_SESSIONEXPIRES_T:
213
+			if(*h_parsed) {
214
+				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
215
+				*h_parsed = 0;
216
+			}
217
+			break;
218
+
213 219
 		case HDR_MIN_SE_T:
214 220
 		case HDR_ACCEPTCONTACT_T:
215 221
 		case HDR_ALLOWEVENTS_T:
Browse code

core: framework for generic free of parsed headers

- the structure of parsed headers can define as first field a function
to free the content
- this allow to implement the parser for headers our of the core

Daniel-Constantin Mierla authored on 27/02/2011 15:40:37
Showing 1 changed files
... ...
@@ -130,6 +130,9 @@ void clean_hdr_field(struct hdr_field* hf)
130 130
 			break;
131 131
 
132 132
 		case HDR_SUPPORTED_T:
133
+			if(*h_parsed) {
134
+				((hf_parsed_t*)(*h_parsed))->hfree(*h_parsed);
135
+			}
133 136
 			break;
134 137
 
135 138
 		case HDR_REQUIRE_T:
Browse code

core: support for parsing the Reason header

Andrei Pelinescu-Onciul authored on 18/02/2010 20:20:07
Showing 1 changed files
... ...
@@ -33,10 +33,9 @@
33 33
  * 2007-07-27 added HDR_RETRY_AFTER_T (andrei)
34 34
  */
35 35
 
36
-/*! \file 
37
- * \brief Parser :: 
38
- *
39
- * \ingroup parser
36
+/** Parser :: parse header files
37
+ * @file
38
+ * @ingroup parser
40 39
  */
41 40
 
42 41
 
... ...
@@ -61,8 +60,7 @@
61 60
 #include "parse_allow.h"
62 61
 #include "../ut.h"
63 62
 
64
-/*! \brief
65
- * Frees a hdr_field structure,
63
+/** Frees a hdr_field structure.
66 64
  * WARNING: it frees only parsed (and not name.s, body.s)
67 65
  */
68 66
 void clean_hdr_field(struct hdr_field* hf)
... ...
@@ -220,6 +218,7 @@ void clean_hdr_field(struct hdr_field* hf)
220 218
 		case HDR_PROXY_AUTHENTICATE_T:
221 219
 		case HDR_PATH_T:
222 220
 		case HDR_PRIVACY_T:
221
+		case HDR_REASON_T:
223 222
 			break;
224 223
 
225 224
 		case HDR_PPI_T:
... ...
@@ -239,8 +238,7 @@ void clean_hdr_field(struct hdr_field* hf)
239 238
 }
240 239
 
241 240
 
242
-/*! \brief
243
- * Frees a hdr_field list,
241
+/** Frees a hdr_field list.
244 242
  * WARNING: frees only ->parsed and ->next*/
245 243
 void free_hdr_field_lst(struct hdr_field* hf)
246 244
 {
Browse code

Merge remote branch 'origin/sr_3.0'

latest sr_3.0 fixes.

* origin/sr_3.0: (36 commits)
core: added id to every field of gw table schema
tcp: use the forced socket ip as source
tmx: pv_t_copy_msg: copy also the send flags
textops(k): msg_apply_changes: preserve the send flags
seas: use set_force_socket()
rr(k): use set_force_socket()
registrar(k): use set_force_socket()
pv: use set_force_socket()
kex: use set_force_socket()
domainpolicy: use set_force_socket()
rr(s): use set_force_socket()
registrar(s): use set_force_socket()
tm: use set_force_socket() instead of msg->force_send_socket
tm: preserve forced sockets and send flags during dns failover
core: extra flag when forcing a socket
core: kamailio mode config parser fix
core: PAI and PPI parsing support fixed
core: dset minor cleanups
core: append_branch() sets also the send_socket, path & flags
remove extra backslash in make modules-doc action
...

Andrei Pelinescu-Onciul authored on 06/11/2009 07:56:40
Showing 0 changed files
Browse code

core: PAI and PPI parsing support fixed

- use a new function to identify hdr type instead of 'case' construct
- reported by Juha Heinanen
(cherry picked from commit 78f069c3726085902101a55d3bb98f0be7549b60)

Daniel-Constantin Mierla authored on 01/11/2009 13:06:04 • Juha Heinanen committed on 01/11/2009 12:50:42
Showing 1 changed files
... ...
@@ -216,6 +216,15 @@ void clean_hdr_field(struct hdr_field* hf)
216 216
 		case HDR_PATH_T:
217 217
 		case HDR_PRIVACY_T:
218 218
 			break;
219
+
220
+		case HDR_PPI_T:
221
+			free_to(hf->parsed);
222
+			break;
223
+
224
+		case HDR_PAI_T:
225
+			free_to(hf->parsed);
226
+			break;
227
+
219 228
 		default:
220 229
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
221 230
 			    hf->type);
Browse code

Doxygen for the parser directory

There's still a lot of files untouched. Feel free to jump in and help!

oej authored on 25/10/2009 15:58:41
Showing 1 changed files
... ...
@@ -33,6 +33,12 @@
33 33
  * 2007-07-27 added HDR_RETRY_AFTER_T (andrei)
34 34
  */
35 35
 
36
+/*! \file 
37
+ * \brief Parser :: 
38
+ *
39
+ * \ingroup parser
40
+ */
41
+
36 42
 
37 43
 #include "hf.h"
38 44
 #include "parse_via.h"
... ...
@@ -55,8 +61,7 @@
55 61
 #include "parse_allow.h"
56 62
 #include "../ut.h"
57 63
 
58
-
59
-/*
64
+/*! \brief
60 65
  * Frees a hdr_field structure,
61 66
  * WARNING: it frees only parsed (and not name.s, body.s)
62 67
  */
... ...
@@ -225,7 +230,7 @@ void clean_hdr_field(struct hdr_field* hf)
225 230
 }
226 231
 
227 232
 
228
-/*
233
+/*! \brief
229 234
  * Frees a hdr_field list,
230 235
  * WARNING: frees only ->parsed and ->next*/
231 236
 void free_hdr_field_lst(struct hdr_field* hf)
Browse code

Kamailio compatibility: Privacy header field name parser

This patch adds support for the Privacy header field name parser.

Jan Janak authored on 27/03/2009 07:59:37
Showing 1 changed files
... ...
@@ -214,6 +214,7 @@ void clean_hdr_field(struct hdr_field* hf)
214 214
 		case HDR_WWW_AUTHENTICATE_T:
215 215
 		case HDR_PROXY_AUTHENTICATE_T:
216 216
 		case HDR_PATH_T:
217
+		case HDR_PRIVACY_T:
217 218
 			break;
218 219
 		default:
219 220
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
Browse code

Allow parser syn'ced with kamailio version

Sync'ed parse_allow_header() prototype name with implementation. New
parse_allow() function that work over sim_msg structure

Signed-off-by: Jan Janak <jan@iptel.org>

Daniel-Constantin Mierla authored on 20/03/2009 16:19:22 • Jan Janak committed on 23/03/2009 10:11:41
Showing 1 changed files
... ...
@@ -52,6 +52,7 @@
52 52
 #include "parse_subscription_state.h"
53 53
 #include "contact/parse_contact.h"
54 54
 #include "parse_disposition.h"
55
+#include "parse_allow.h"
55 56
 #include "../ut.h"
56 57
 
57 58
 
... ...
@@ -138,6 +139,7 @@ void clean_hdr_field(struct hdr_field* hf)
138 139
 			break;
139 140
 
140 141
 		case HDR_ALLOW_T:
142
+			free_allow_header(hf);
141 143
 			break;
142 144
 
143 145
 		case HDR_EVENT_T:
Browse code

Teach sip-router how to recognized Path header field name.

Jan Janak authored on 16/03/2009 17:49:27
Showing 1 changed files
... ...
@@ -211,6 +211,7 @@ void clean_hdr_field(struct hdr_field* hf)
211 211
 		case HDR_REQUESTDISPOSITION_T:
212 212
 		case HDR_WWW_AUTHENTICATE_T:
213 213
 		case HDR_PROXY_AUTHENTICATE_T:
214
+		case HDR_PATH_T:
214 215
 			break;
215 216
 		default:
216 217
 			LOG(L_CRIT, "BUG: clean_hdr_field: unknown header type %d\n",
Browse code

Identity, Identity-info, Date headers would be parsed only if they were required

Gergely Kovacs authored on 15/10/2007 14:21:01
Showing 1 changed files
... ...
@@ -39,6 +39,8 @@
39 39
 #include "parse_to.h"
40 40
 #include "parse_cseq.h"
41 41
 #include "parse_date.h"
42
+#include "parse_identity.h"
43
+#include "parse_identityinfo.h"
42 44
 #include "../dprint.h"
43 45
 #include "../mem/mem.h"
44 46
 #include "parse_def.h"
Browse code

- added support for parsing the Retry-After header

Andrei Pelinescu-Onciul authored on 30/07/2007 19:49:09
Showing 1 changed files
... ...
@@ -30,6 +30,7 @@
30 30
  * 2003-04-26 ZSW (jiri)
31 31
  * 2003-08-05 free the parsed part of Accept header (bogdan)
32 32
  * 2007-01-26 HDR_DATE_T, HDR_IDENTITY_T, HDR_IDENTITY_INFO_T added (gergo)
33
+ * 2007-07-27 added HDR_RETRY_AFTER_T (andrei)
33 34
  */
34 35
 
35 36
 
... ...
@@ -107,6 +108,9 @@ void clean_hdr_field(struct hdr_field* hf)
107 108
 		case HDR_CONTENTLENGTH_T:
108 109
 			break;
109 110
 
111
+		case HDR_RETRY_AFTER_T:
112
+			break;
113
+
110 114
 		case HDR_AUTHORIZATION_T:
111 115
 			free_credentials((auth_body_t**)h_parsed);
112 116
 			break;
Browse code

Hook up Server header field support.

Maxim Sobolev authored on 01/05/2007 21:25:53
Showing 1 changed files
... ...
@@ -157,6 +157,9 @@ void clean_hdr_field(struct hdr_field* hf)
157 157
 		case HDR_USERAGENT_T:
158 158
 			break;
159 159
 
160
+		case HDR_SERVER_T:
161
+			break;
162
+
160 163
 		case HDR_ACCEPTDISPOSITION_T:
161 164
 			break;
162 165
 
Browse code

Date, Identity, Identity-info HF support added

Gergely Kovacs authored on 08/03/2007 14:56:10
Showing 1 changed files
... ...
@@ -29,6 +29,7 @@
29 29
  * 2003-03-26 Frees also hdr->parsed for Route & Record-Route (janakj)
30 30
  * 2003-04-26 ZSW (jiri)
31 31
  * 2003-08-05 free the parsed part of Accept header (bogdan)
32
+ * 2007-01-26 HDR_DATE_T, HDR_IDENTITY_T, HDR_IDENTITY_INFO_T added (gergo)
32 33
  */
33 34
 
34 35
 
... ...
@@ -36,6 +37,7 @@
36 37
 #include "parse_via.h"
37 38
 #include "parse_to.h"
38 39
 #include "parse_cseq.h"
40
+#include "parse_date.h"
39 41
 #include "../dprint.h"
40 42
 #include "../mem/mem.h"
41 43
 #include "parse_def.h"
... ...
@@ -57,7 +59,7 @@
57 59
 void clean_hdr_field(struct hdr_field* hf)
58 60
 {
59 61
 	void** h_parsed;
60
-	
62
+
61 63
 	if (hf->parsed){
62 64
 		h_parsed=&hf->parsed; /*strict aliasing warnings workarround */
63 65
 		switch(hf->type){
... ...
@@ -122,7 +124,7 @@ void clean_hdr_field(struct hdr_field* hf)
122 124
 
123 125
 		case HDR_REQUIRE_T:
124 126
 			break;
125
-			
127
+
126 128
 		case HDR_PROXYREQUIRE_T:
127 129
 			break;
128 130
 
... ...
@@ -173,11 +175,23 @@ void clean_hdr_field(struct hdr_field* hf)
173 175
 		case HDR_REFER_TO_T:
174 176
 			free_to(hf->parsed);
175 177
 			break;
176
-		
178
+
177 179
 		case HDR_SUBSCRIPTION_STATE_T:
178 180
 			free_subscription_state((subscription_state_t**)h_parsed);
179 181
 			break;
180 182
 
183
+		case HDR_DATE_T:
184
+			free_date(hf->parsed);
185
+			break;
186
+
187
+		case HDR_IDENTITY_INFO_T:
188
+			free_identityinfo(hf->parsed);
189
+			break;
190
+
191
+		case HDR_IDENTITY_T:
192
+			free_identity(hf->parsed);
193