and added files
[bcm963xx.git] / userapps / opensource / libosip2 / include / osipparser2 / headers / osip_to.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_TO_H_
22 #define _OSIP_TO_H_
23
24 #include <osipparser2/headers/osip_from.h>
25
26 /**
27  * @file osip_to.h
28  * @brief oSIP osip_to header definition.
29  */
30
31 /**
32  * @defgroup oSIP_TO oSIP to header definition.
33  * @ingroup oSIP_HEADERS
34  * @{
35  */
36
37 /**
38  * Structure for To headers.
39  * @defvar osip_to_t
40  */
41   typedef osip_from_t osip_to_t;
42
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif
47
48 /**
49  * Allocate a To element.
50  * @param header The element to work on.
51  */
52   int osip_to_init (osip_to_t ** header);
53 /**
54  * Free a To element.
55  * @param header The element to work on.
56  */
57   void osip_to_free (osip_to_t * header);
58 /**
59  * Parse a To element.
60  * @param header The element to work on.
61  * @param hvalue The string to parse.
62  */
63   int osip_to_parse (osip_to_t * header, const char *hvalue);
64 /**
65  * Get a string representation of a To element.
66  * @param header The element to work on.
67  * @param dest A pointer on the new allocated string.
68  */
69   int osip_to_to_str (const osip_to_t * header, char **dest);
70 /**
71  * Clone a To element.
72  * @param header The element to work on.
73  * @param dest A pointer on the copy of the element.
74  */
75   int osip_to_clone (const osip_to_t * header, osip_to_t ** dest);
76 /**
77  * Set the displayname in the To element.
78  * @param header The element to work on.
79  * @param value The value of the element.
80  */
81 #define osip_to_set_displayname(header,value) osip_from_set_displayname((osip_from_t*)header,value)
82 /**
83  * Get the displayname from a To header.
84  * @param header The element to work on.
85  */
86 #define osip_to_get_displayname(header)       osip_from_get_displayname((osip_from_t*)header)
87 /**
88  * Set the url in the To element.
89  * @param header The element to work on.
90  * @param url The value of the element.
91  */
92 #define osip_to_set_url(header,url)         osip_from_set_url((osip_from_t*)header,url)
93 /**
94  * Get the url from a To header.
95  * @param header The element to work on.
96  */
97 #define osip_to_get_url(header)               osip_from_get_url((osip_from_t*)header)
98 /**
99  * Get a header parameter from a To element.
100  * @param header The element to work on.
101  * @param pos The index of the element to get.
102  * @param dest A pointer on the element found.
103  */
104 #define osip_to_param_get(header,pos,dest) osip_from_param_get((osip_from_t*)header,pos,dest)
105 /**
106  * Find a header parameter in a To element.
107  * @param header The element to work on.
108  * @param name The token name to search.
109  * @param dest A pointer on the element found.
110  */
111 #define osip_to_param_get_byname(header,name,dest) osip_generic_param_get_byname((header)->gen_params,name,dest)
112 /**
113  * Allocate and add a generic parameter element in a list.
114  * @param header The element to work on.
115  * @param name The token name.
116  * @param value The token value.
117  */
118 #define osip_to_param_add(header,name,value) osip_generic_param_add((header)->gen_params,name,value)
119
120 /**
121  * Allocate and add a tag parameter element in a list.
122  * @param header The element to work on.
123  * @param value The token value.
124  */
125 #define osip_to_set_tag(header,value) osip_generic_param_add((header)->gen_params, osip_strdup("tag"),value)
126 /**
127  * Find a tag parameter in a To element.
128  * @param header The element to work on.
129  * @param dest A pointer on the element found.
130  */
131 #define osip_to_get_tag(header,dest) osip_generic_param_get_byname((header)->gen_params, "tag",dest)
132
133 #ifndef DOXYGEN                 /* avoid DOXYGEN warning */
134 /* Compare the username, host and tag part of the two froms */
135 #define osip_to_compare(header1, header2) osip_from_compare((osip_from_t *)header1, (osip_from_t *)header2)
136 #endif
137
138 /**
139  * Check if the tags in the To headers match.
140  * NOTE: THIS IS AN INTERNAL METHOD ONLY
141  * @param to1 The first To header.
142  * @param to2 The second To header.
143  */
144   int osip_to_tag_match (osip_to_t * to1, osip_to_t * to2);
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 /** @} */
151
152 #endif