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,116 +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
-/** @file
22
- * @brief Parser :: Via parsing automation
23
- *
24
- * @ingroup parser
25
- */
26
-
27
-#ifndef PARSE_VIA_H
28
-#define PARSE_VIA_H
29
-
30
-#include "../str.h"
31
-
32
-struct sip_msg;
33
-
34
-/* via param types
35
- * WARNING: keep in sync with parse_via.c FIN_HIDDEN... 
36
- * and with tm/sip_msg.c via_body_cloner
37
- */
38
-enum {
39
-	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
40
-	PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, PARAM_ALIAS,
41
-#ifdef USE_COMP
42
-	PARAM_COMP,
43
-#endif
44
-	GEN_PARAM=253,
45
-	PARAM_ERROR
46
-};
47
-
48
-
49
-
50
-typedef struct via_param {
51
-	int type;               /* Type of the parameter */
52
-	str name;               /* Name of the parameter */
53
-	str value;              /* Value of the parameter */
54
-	char* start;            /* Pointer to param start, just after ';',
55
-							 * (it can be diff. from name.s!) */
56
-	int size;               /* total size, including preceding and trailing
57
-							 * white space */
58
-	struct via_param* next; /* Next parameter in the list */
59
-} via_param_t;
60
-
61
-
62
-/* Format: name/version/transport host:port;params comment */
63
- /* WARNING: keep in sync with tm/sip_msg.c via_body_cloner */
64
-typedef struct via_body { 
65
-	int error;
66
-	str hdr;   /* Contains "Via" or "v" */
67
-	str name;
68
-	str version;   
69
-	str transport;
70
-	str host;
71
-	short proto; /* transport */
72
-	unsigned short port;
73
-#ifdef USE_COMP
74
-	short comp_no;
75
-#endif
76
-	str port_str;
77
-	str params;
78
-	str comment;
79
-	int bsize;                    /* body size, not including hdr */
80
-	struct via_param* param_lst;  /* list of parameters*/
81
-	struct via_param* last_param; /*last via parameter, internal use*/
82
-
83
-	     /* shortcuts to "important" params*/
84
-	struct via_param* branch;
85
-	str tid; /* transaction id, part of branch */
86
-	struct via_param* received;
87
-	struct via_param* rport;
88
-	struct via_param* i;
89
-	struct via_param* alias; /* alias see draft-ietf-sip-connect-reuse-00 */
90
-#ifdef USE_COMP
91
-	struct via_param* comp; /* see rfc3486 */
92
-#endif
93
-	struct via_body* next; /* pointer to next via body string if
94
-				  compact via or null */
95
-} via_body_t;
96
-
97
-
98
-/*
99
- * Main Via header field parser
100
- */
101
-char* parse_via(char* buffer, const char* const end, struct via_body* const vbody);
102
-
103
-
104
-/*
105
- * Free allocated memory
106
- */
107
-void free_via_list(struct via_body *vb);
108
-
109
-
110
-/*
111
- * Get one Via header
112
- */
113
-int parse_via_header( struct sip_msg *msg, int n, struct via_body** q);
114
-
115
-
116
-#endif /* PARSE_VIA_H */
Browse code

core: parser - typedef'ed via header structures

Daniel-Constantin Mierla authored on 02/02/2016 15:37:52
Showing 1 changed files
... ...
@@ -47,7 +47,7 @@ enum {
47 47
 
48 48
 
49 49
 
50
-struct via_param {
50
+typedef struct via_param {
51 51
 	int type;               /* Type of the parameter */
52 52
 	str name;               /* Name of the parameter */
53 53
 	str value;              /* Value of the parameter */
... ...
@@ -56,12 +56,12 @@ struct via_param {
56 56
 	int size;               /* total size, including preceding and trailing
57 57
 							 * white space */
58 58
 	struct via_param* next; /* Next parameter in the list */
59
-};
59
+} via_param_t;
60 60
 
61 61
 
62 62
 /* Format: name/version/transport host:port;params comment */
63 63
  /* WARNING: keep in sync with tm/sip_msg.c via_body_cloner */
64
-struct via_body { 
64
+typedef struct via_body { 
65 65
 	int error;
66 66
 	str hdr;   /* Contains "Via" or "v" */
67 67
 	str name;
... ...
@@ -92,7 +92,7 @@ struct via_body {
92 92
 #endif
93 93
 	struct via_body* next; /* pointer to next via body string if
94 94
 				  compact via or null */
95
-};
95
+} via_body_t;
96 96
 
97 97
 
98 98
 /*
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.
... ...
@@ -29,18 +24,6 @@
29 24
  * @ingroup parser
30 25
  */
31 26
 
32
-/* 
33
- *  2003-01-21  added rport parsing code, contributed by
34
- *               Maxim Sobolev  <sobomax@FreeBSD.org>
35
- *  2003-01-21  added extra via param parsing code (i=...), used
36
- *               by tcp to identify the sending socket, by andrei
37
- *  2003-01-27  added a new member (start) to via_param, by andrei
38
- *  2003-10-27  added alias to via && PARAM_ALIAS (andrei)
39
- *  2006-02-24  added comp/PARAM_COMP support (andrei)
40
- */
41
-
42
-
43
-
44 27
 #ifndef PARSE_VIA_H
45 28
 #define PARSE_VIA_H
46 29
 
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
 
26 26
 /** @file
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
... ...
@@ -117,7 +117,7 @@ struct via_body {
117 117
 /*
118 118
  * Main Via header field parser
119 119
  */
120
-char* parse_via(char* buffer, char* end, struct via_body *vb);
120
+char* parse_via(char* buffer, const char* const end, struct via_body* const vbody);
121 121
 
122 122
 
123 123
 /*
Browse code

core: Move parse_via_header to correct place.

- Move parse_via_header(...) from select_core to parser
to avoid compiler warnings when accessing it from modules.

Richard Fuchs authored on 19/04/2012 15:38:29 • Andreas Granig committed on 19/04/2012 15:38:29
Showing 1 changed files
... ...
@@ -48,6 +48,8 @@
48 48
 
49 49
 #include "../str.h"
50 50
 
51
+struct sip_msg;
52
+
51 53
 /* via param types
52 54
  * WARNING: keep in sync with parse_via.c FIN_HIDDEN... 
53 55
  * and with tm/sip_msg.c via_body_cloner
... ...
@@ -124,4 +126,10 @@ char* parse_via(char* buffer, char* end, struct via_body *vb);
124 126
 void free_via_list(struct via_body *vb);
125 127
 
126 128
 
129
+/*
130
+ * Get one Via header
131
+ */
132
+int parse_via_header( struct sip_msg *msg, int n, struct via_body** q);
133
+
134
+
127 135
 #endif /* PARSE_VIA_H */
Browse code

Doxygen changes

oej authored on 25/10/2009 18:30:31
Showing 1 changed files
... ...
@@ -25,6 +25,12 @@
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 26
  */
27 27
 
28
+/** @file
29
+ * @brief Parser :: Via parsing automation
30
+ *
31
+ * @ingroup parser
32
+ */
33
+
28 34
 /* 
29 35
  *  2003-01-21  added rport parsing code, contributed by
30 36
  *               Maxim Sobolev  <sobomax@FreeBSD.org>
Browse code

- more struct dest_info conversions (via_builder, tm: build_uac_req, assemble_via a.s.o) - basic support for comp=method (where mehtod=sigcomp|sergz) parsing (via, various uris) and adding (via, rr lumps). The code is compiled only if USE_COMP is defined. NOTE: for now the code is useless (no compression code yet and no compression hooks), so by default it's not compiled.

WARNING: lots of changes and very lightly tested

Andrei Pelinescu-Onciul authored on 21/04/2006 14:28:36
Showing 1 changed files
... ...
@@ -32,6 +32,7 @@
32 32
  *               by tcp to identify the sending socket, by andrei
33 33
  *  2003-01-27  added a new member (start) to via_param, by andrei
34 34
  *  2003-10-27  added alias to via && PARAM_ALIAS (andrei)
35
+ *  2006-02-24  added comp/PARAM_COMP support (andrei)
35 36
  */
36 37
 
37 38
 
... ...
@@ -48,7 +49,10 @@
48 49
 enum {
49 50
 	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
50 51
 	PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, PARAM_ALIAS,
51
-	GEN_PARAM,
52
+#ifdef USE_COMP
53
+	PARAM_COMP,
54
+#endif
55
+	GEN_PARAM=253,
52 56
 	PARAM_ERROR
53 57
 };
54 58
 
... ...
@@ -74,9 +78,12 @@ struct via_body {
74 78
 	str name;
75 79
 	str version;   
76 80
 	str transport;
77
-	int proto; /* transport */
78 81
 	str host;
79
-	int port;
82
+	short proto; /* transport */
83
+	unsigned short port;
84
+#ifdef USE_COMP
85
+	short comp_no;
86
+#endif
80 87
 	str port_str;
81 88
 	str params;
82 89
 	str comment;
... ...
@@ -91,6 +98,9 @@ struct via_body {
91 98
 	struct via_param* rport;
92 99
 	struct via_param* i;
93 100
 	struct via_param* alias; /* alias see draft-ietf-sip-connect-reuse-00 */
101
+#ifdef USE_COMP
102
+	struct via_param* comp; /* see rfc3486 */
103
+#endif
94 104
 	struct via_body* next; /* pointer to next via body string if
95 105
 				  compact via or null */
96 106
 };
Browse code

- Spelling checked

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

- fixed via->alias not translated bug in tm/sip_msg.c via_body_cloner (not criticial) - fixed parse_via, rport set instead of i (critical, could cause core dumps in some configuration involving tcp and would also open an extra tcp connection for replies, if stateless mode is used) - Makefile*: version number increase and excluded cpl-c and pa from compilation (they depend on libxml2, use make include="cpl-c pa" if you want to compile them)

Andrei Pelinescu-Onciul authored on 31/03/2004 09:29:55
Showing 1 changed files
... ...
@@ -43,6 +43,7 @@
43 43
 
44 44
 /* via param types
45 45
  * WARNING: keep in sync with parse_via.c FIN_HIDDEN... 
46
+ * and with tm/sip_msg.c via_body_cloner
46 47
  */
47 48
 enum {
48 49
 	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
... ...
@@ -66,6 +67,7 @@ struct via_param {
66 67
 
67 68
 
68 69
 /* Format: name/version/transport host:port;params comment */
70
+ /* WARNING: keep in sync with tm/sip_msg.c via_body_cloner */
69 71
 struct via_body { 
70 72
 	int error;
71 73
 	str hdr;   /* Contains "Via" or "v" */
Browse code

- changed tcp to support port aliases (major changes) - added via alias parameter parsing - added script var. tcp_accept_aliases= yes|no (honour or not via alias param) - added script. cmd. force_tcp_alias( <void>|port_no) [for more info read the NEWS file]

Andrei Pelinescu-Onciul authored on 29/10/2003 17:41:27
Showing 1 changed files
... ...
@@ -31,6 +31,7 @@
31 31
  *  2003-01-21  added extra via param parsing code (i=...), used
32 32
  *               by tcp to identify the sending socket, by andrei
33 33
  *  2003-01-27  added a new member (start) to via_param, by andrei
34
+ *  2003-10-27  added alias to via && PARAM_ALIAS (andrei)
34 35
  */
35 36
 
36 37
 
... ...
@@ -45,7 +46,8 @@
45 46
  */
46 47
 enum {
47 48
 	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
48
-	PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, GEN_PARAM,
49
+	PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, PARAM_ALIAS,
50
+	GEN_PARAM,
49 51
 	PARAM_ERROR
50 52
 };
51 53
 
... ...
@@ -86,7 +88,7 @@ struct via_body {
86 88
 	struct via_param* received;
87 89
 	struct via_param* rport;
88 90
 	struct via_param* i;
89
-	
91
+	struct via_param* alias; /* alias see draft-ietf-sip-connect-reuse-00 */
90 92
 	struct via_body* next; /* pointer to next via body string if
91 93
 				  compact via or null */
92 94
 };
Browse code

- fixed all rport & via param parsing bugs (hopefully): added a new member (start) to via_param modified parse_via to set new via_param->start member and via->params more rport fixes (make use of new via_param->start)

[ if somebody else is interested in playing with via params I will elaborate ]

Andrei Pelinescu-Onciul authored on 27/01/2003 14:22:07
Showing 1 changed files
... ...
@@ -30,6 +30,7 @@
30 30
  *               Maxim Sobolev  <sobomax@FreeBSD.org>
31 31
  *  2003-01-21  added extra via param parsing code (i=...), used
32 32
  *               by tcp to identify the sending socket, by andrei
33
+ *  2003-01-27  added a new member (start) to via_param, by andrei
33 34
  */
34 35
 
35 36
 
... ...
@@ -54,7 +55,10 @@ struct via_param {
54 55
 	int type;               /* Type of the parameter */
55 56
 	str name;               /* Name of the parameter */
56 57
 	str value;              /* Value of the parameter */
57
-	int size;               /* total size*/
58
+	char* start;            /* Pointer to param start, just after ';',
59
+							 * (it can be diff. from name.s!) */
60
+	int size;               /* total size, including preceding and trailing
61
+							 * white space */
58 62
 	struct via_param* next; /* Next parameter in the list */
59 63
 };
60 64
 
Browse code

- applied parts of Maxim Sobolev patches (rport parsing) - fixed them so they should work - added a new via param (i=) for tcp use - fixed a bug in the via parser (transport.s not initialized), the bug was found by bogdan & daniel. - added an int2str function in ut.h (faster than snprintf %d).

Andrei Pelinescu-Onciul authored on 23/01/2003 18:58:13
Showing 1 changed files
... ...
@@ -25,6 +25,14 @@
25 25
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 26
  */
27 27
 
28
+/* 
29
+ *  2003-01-21  added rport parsing code, contributed by
30
+ *               Maxim Sobolev  <sobomax@FreeBSD.org>
31
+ *  2003-01-21  added extra via param parsing code (i=...), used
32
+ *               by tcp to identify the sending socket, by andrei
33
+ */
34
+
35
+
28 36
 
29 37
 #ifndef PARSE_VIA_H
30 38
 #define PARSE_VIA_H
... ...
@@ -32,11 +40,11 @@
32 40
 #include "../str.h"
33 41
 
34 42
 /* via param types
35
- * WARNING: keep in sync w/ FIN_*, GEN_PARAM and PARAM_ERROR from via_parse.c
43
+ * WARNING: keep in sync with parse_via.c FIN_HIDDEN... 
36 44
  */
37 45
 enum {
38 46
 	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
39
-	PARAM_MADDR, PARAM_RECEIVED, GEN_PARAM,
47
+	PARAM_MADDR, PARAM_RECEIVED, PARAM_RPORT, PARAM_I, GEN_PARAM,
40 48
 	PARAM_ERROR
41 49
 };
42 50
 
... ...
@@ -72,6 +80,8 @@ struct via_body {
72 80
 	struct via_param* branch;
73 81
 	str tid; /* transaction id, part of branch */
74 82
 	struct via_param* received;
83
+	struct via_param* rport;
84
+	struct via_param* i;
75 85
 	
76 86
 	struct via_body* next; /* pointer to next via body string if
77 87
 				  compact via or null */
Browse code

- changed sip_msg (new rcv member containing all the ips, ports, protocol) - added a "proto" parameter to forward_request, via_builder, get_send_sock etc. - added 2 new script commands: forward_udp & forward_tcp - lots of tcp bloat - changed parse_via to recognize TCP - more functions added to ip_addr.h (cmp for ips & sockaddrs etc.)

Andrei Pelinescu-Onciul authored on 12/12/2002 21:46:37
Showing 1 changed files
... ...
@@ -41,6 +41,7 @@ enum {
41 41
 };
42 42
 
43 43
 
44
+
44 45
 struct via_param {
45 46
 	int type;               /* Type of the parameter */
46 47
 	str name;               /* Name of the parameter */
... ...
@@ -57,6 +58,7 @@ struct via_body {
57 58
 	str name;
58 59
 	str version;   
59 60
 	str transport;
61
+	int proto; /* transport */
60 62
 	str host;
61 63
 	int port;
62 64
 	str port_str;
Browse code

- request matching using tid (RFC3216) introduced

Jiri Kuthan authored on 21/10/2002 15:46:27
Showing 1 changed files
... ...
@@ -68,6 +68,7 @@ struct via_body {
68 68
 
69 69
 	     /* shortcuts to "important" params*/
70 70
 	struct via_param* branch;
71
+	str tid; /* transaction id, part of branch */
71 72
 	struct via_param* received;
72 73
 	
73 74
 	struct via_body* next; /* pointer to next via body string if
Browse code

GPLization banner introduced to *.[hc] files

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

- now ser uses received= if present - if no receive present, SRV is used even for Vias

Andrei Pelinescu-Onciul authored on 12/08/2002 18:22:17
Showing 1 changed files
... ...
@@ -44,6 +44,7 @@ struct via_body {
44 44
 
45 45
 	     /* shortcuts to "important" params*/
46 46
 	struct via_param* branch;
47
+	struct via_param* received;
47 48
 	
48 49
 	struct via_body* next; /* pointer to next via body string if
49 50
 				  compact via or null */
Browse code

*** empty log message ***

Jan Janak authored on 12/08/2002 12:16:46
Showing 1 changed files
... ...
@@ -2,8 +2,8 @@
2 2
  * $Id$
3 3
  */
4 4
 
5
-#ifndef PARSE_VIA
6
-#define PARSE_VIA
5
+#ifndef PARSE_VIA_H
6
+#define PARSE_VIA_H
7 7
 
8 8
 #include "../str.h"
9 9
 
... ...
@@ -62,4 +62,4 @@ char* parse_via(char* buffer, char* end, struct via_body *vb);
62 62
 void free_via_list(struct via_body *vb);
63 63
 
64 64
 
65
-#endif
65
+#endif /* PARSE_VIA_H */
Browse code

parser directory cleanup

Jan Janak authored on 08/07/2002 17:53:33
Showing 1 changed files
... ...
@@ -7,9 +7,6 @@
7 7
 
8 8
 #include "../str.h"
9 9
 
10
-#define VIA_PARSE_OK	1
11
-#define VIA_PARSE_ERROR -1
12
-
13 10
 /* via param types
14 11
  * WARNING: keep in sync w/ FIN_*, GEN_PARAM and PARAM_ERROR from via_parse.c
15 12
  */
Browse code

parser directory cleanup

Jan Janak authored on 08/07/2002 17:14:39
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,68 @@
1
+/*
2
+ * $Id$
3
+ */
4
+
5
+#ifndef PARSE_VIA
6
+#define PARSE_VIA
7
+
8
+#include "../str.h"
9
+
10
+#define VIA_PARSE_OK	1
11
+#define VIA_PARSE_ERROR -1
12
+
13
+/* via param types
14
+ * WARNING: keep in sync w/ FIN_*, GEN_PARAM and PARAM_ERROR from via_parse.c
15
+ */
16
+enum {
17
+	PARAM_HIDDEN=230, PARAM_TTL, PARAM_BRANCH, 
18
+	PARAM_MADDR, PARAM_RECEIVED, GEN_PARAM,
19
+	PARAM_ERROR
20
+};
21
+
22
+
23
+struct via_param {
24
+	int type;               /* Type of the parameter */
25
+	str name;               /* Name of the parameter */
26
+	str value;              /* Value of the parameter */
27
+	int size;               /* total size*/
28
+	struct via_param* next; /* Next parameter in the list */
29
+};
30
+
31
+
32
+/* Format: name/version/transport host:port;params comment */
33
+struct via_body { 
34
+	int error;
35
+	str hdr;   /* Contains "Via" or "v" */
36
+	str name;
37
+	str version;   
38
+	str transport;
39
+	str host;
40
+	int port;
41
+	str port_str;
42
+	str params;
43
+	str comment;
44
+	int bsize;                    /* body size, not including hdr */
45
+	struct via_param* param_lst;  /* list of parameters*/
46
+	struct via_param* last_param; /*last via parameter, internal use*/
47
+
48
+	     /* shortcuts to "important" params*/
49
+	struct via_param* branch;
50
+	
51
+	struct via_body* next; /* pointer to next via body string if
52
+				  compact via or null */
53
+};
54
+
55
+
56
+/*
57
+ * Main Via header field parser
58
+ */
59
+char* parse_via(char* buffer, char* end, struct via_body *vb);
60
+
61
+
62
+/*
63
+ * Free allocated memory
64
+ */
65
+void free_via_list(struct via_body *vb);
66
+
67
+
68
+#endif