2 The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3 Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org
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.
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.
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
24 #include <osipparser2/osip_list.h>
25 #include <osipparser2/osip_uri.h>
29 * @brief oSIP osip_from header definition.
33 * @defgroup oSIP_FROM oSIP from header definition.
34 * @ingroup oSIP_HEADERS
39 * Structure for From headers.
42 typedef struct osip_from osip_from_t;
47 osip_uri_t *url; /* could contain various urischeme_t ? only in the future */
48 osip_list_t *gen_params;
57 * Allocate a From element.
58 * @param header The element to work on.
60 int osip_from_init (osip_from_t ** header);
62 * Free a From element.
63 * @param header The element to work on.
65 void osip_from_free (osip_from_t * header);
67 * Parse a From element.
68 * @param header The element to work on.
69 * @param hvalue The string to parse.
71 int osip_from_parse (osip_from_t * header, const char *hvalue);
73 * Get a string representation of a From element.
74 * @param header The element to work on.
75 * @param dest A pointer on the new allocated string.
77 int osip_from_to_str (const osip_from_t * header, char **dest);
79 * Clone a From element.
80 * @param header The element to work on.
81 * @param dest A pointer on the copy of the element.
83 int osip_from_clone (const osip_from_t * header, osip_from_t ** dest);
85 * Set the displayname in the From element.
86 * @param header The element to work on.
87 * @param value The value of the element.
89 void osip_from_set_displayname (osip_from_t * header, char *value);
91 * Get the displayname from a From header.
92 * @param header The element to work on.
94 char *osip_from_get_displayname (osip_from_t * header);
96 * Set the url in the From element.
97 * @param header The element to work on.
98 * @param url The value of the element.
100 void osip_from_set_url (osip_from_t * header, osip_uri_t * url);
102 * Get the url from a From header.
103 * @param header The element to work on.
105 osip_uri_t *osip_from_get_url (osip_from_t * header);
107 * Get a header parameter from a From element.
108 * @param header The element to work on.
109 * @param pos The index of the element to get.
110 * @param dest A pointer on the element found.
112 int osip_from_param_get (osip_from_t * header, int pos, osip_generic_param_t ** dest);
114 * Allocate and add a generic parameter element in a list.
115 * @param header The element to work on.
116 * @param name The token name.
117 * @param value The token value.
119 #define osip_from_param_add(header,name,value) osip_generic_param_add((header)->gen_params,name,value)
121 * Find a header parameter in a From element.
122 * @param header The element to work on.
123 * @param name The token name to search.
124 * @param dest A pointer on the element found.
126 #define osip_from_param_get_byname(header,name,dest) osip_generic_param_get_byname((header)->gen_params,name,dest)
129 * Find the tag parameter in a From element.
130 * @param header The element to work on.
131 * @param dest A pointer on the element found.
133 #define osip_from_get_tag(header,dest) osip_generic_param_get_byname((header)->gen_params, "tag",dest)
135 * Allocate and add a tag parameter element in a Contact element.
136 * @param header The element to work on.
137 * @param value The token value.
139 #define osip_from_set_tag(header,value) osip_generic_param_add((header)->gen_params, osip_strdup("tag"),value)
141 #ifndef DOXYGEN /* avoid DOXYGEN warning */
142 /* Compare the username, host and tag part (if exist) of the two froms */
143 int osip_from_compare (osip_from_t * header1, osip_from_t * header2);
147 * Check if the tags in the From headers match.
148 * NOTE: THIS IS AN INTERNAL METHOD ONLY
149 * @param from1 The first From header.
150 * @param from2 The second From header.
152 int osip_from_tag_match (osip_from_t * from1, osip_from_t * from2);