Revert "Revert "and added files""
[bcm963xx.git] / userapps / opensource / libosip2 / include / osipparser2 / osip_body.h
1 /*
2   The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3   Copyright (C) 2001  Aymeric MOIZARD jack@atosc.org
4   
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9   
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14   
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20
21 #ifndef _OSIP_BODY_H_
22 #define _OSIP_BODY_H_
23
24 #include <osipparser2/headers/osip_content_type.h>
25
26 /**
27  * @file osip_body.h
28  * @brief oSIP SIP Message Body Routines
29  *
30  */
31
32 /**
33  * @defgroup oSIP_BODY oSIP body API
34  * @ingroup oSIP
35  * @{
36  */
37
38 /**
39  * Structure for Body
40  * @defvar osip_body_t
41  */
42 typedef struct osip_body osip_body_t;
43
44 struct osip_body
45 {
46   char *body;
47   osip_list_t *headers;
48   osip_content_type_t *content_type;
49 };
50
51
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif
56
57 /**
58  * Allocate a osip_body_t element.
59  * @param body The element to work on.
60  */
61   int osip_body_init (osip_body_t ** body);
62 /**
63  * Free a osip_body_t element.
64  * @param body The element to work on.
65  */
66   void osip_body_free (osip_body_t * body);
67 /**
68  * Parse a osip_body_t element.
69  * @param body The element to work on.
70  * @param buf The buffer to parse.
71  */
72   int osip_body_parse (osip_body_t * body, const char *buf);
73 /**
74  * Clone a osip_body_t element.
75  * @param body The element to clone.
76  * @param dest The cloned element.
77  */
78   int osip_body_clone (const osip_body_t * body, osip_body_t ** dest);
79 /**
80  * Parse a osip_body_t element. (for mime message format) (NOT TESTED, use with care)
81  * @param body The element to work on.
82  * @param buf The buffer to parse.
83  */
84   int osip_body_parse_mime (osip_body_t * body, const char *buf);
85 /**
86  * Get a string representation of a osip_body_t element.
87  * @param body The element to work on.
88  * @param dest The resulting buffer.
89  */
90   int osip_body_to_str (const osip_body_t * body, char **dest);
91
92 /**
93  * Set the Content-Type header in the osip_body_t element.
94  * @param body The element to work on.
95  * @param hvalue The content type string value.
96  */
97   int osip_body_set_contenttype (osip_body_t * body, const char *hvalue);
98
99 /**
100  * Add a header in the osip_body_t element.
101  * @param body The element to work on.
102  * @param hvalue The header string value.
103  */
104   int osip_body_set_header (osip_body_t * body, const char *hname,
105                             const char *hvalue);
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 /** @} */
112
113 #endif