1 /*
2  * $Id: msg_fline.h 850 2008-04-04 21:29:36Z sayer $
3  *
4  * Copyright (C) 2007 Raphael Coeffic
5  *
6  * This file is part of SEMS, a free SIP media server.
7  *
8  * SEMS 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. This program is released under
12  * the GPL with the additional exemption that compiling, linking,
13  * and/or using OpenSSL is allowed.
14  *
15  * For a license to use the SEMS 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  * SEMS 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 
30 
31 #ifndef _msg_fline_h
32 #define _msg_fline_h
33 
34 #include "cstring.h"
35 #include "parse_common.h"
36 
37 struct sip_msg;
38 
39 //
40 // Request-line builder
41 //
request_line_len(const cstring & method,const cstring & ruri)42 inline int request_line_len(const cstring& method,
43 			    const cstring& ruri)
44 {
45     return method.len + ruri.len + SIPVER_len
46 	+ 4; // 2*SP + CRLF
47 }
48 
49 void request_line_wr(char** c,
50 		     const cstring& method,
51 		     const cstring& ruri);
52 
53 //
54 // Status-line builder
55 //
status_line_len(const cstring & reason)56 inline int status_line_len(const cstring& reason)
57 {
58     return SIPVER_len + 3/*status code*/
59 	+ reason.len
60 	+ 4; // 2*SP + CRLF
61 }
62 
63 void status_line_wr(char** c, int status_code,
64 		    const cstring& reason);
65 
66 
67 #endif
68 
69 
70 /** EMACS **
71  * Local variables:
72  * mode: c++
73  * c-basic-offset: 4
74  * End:
75  */
76