2 The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3 Copyright (C) 2001,2002,2003 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
23 #include <osipparser2/osip_port.h>
24 #include <osipparser2/osip_message.h>
25 #include <osipparser2/osip_parser.h>
28 osip_to_init (osip_to_t ** to)
30 return osip_from_init ((osip_from_t **) to);
33 /* adds the to header to message. */
34 /* INPUT : const char *hvalue | value of header. */
35 /* OUTPUT: osip_message_t *sip | structure to save results. */
36 /* returns -1 on error. */
38 osip_message_set_to (osip_message_t * sip, const char *hvalue)
42 if (hvalue == NULL || hvalue[0] == '\0')
47 i = osip_to_init (&(sip->to));
50 sip->message_property = 2;
51 i = osip_to_parse (sip->to, hvalue);
54 osip_to_free (sip->to);
61 /* returns the to header. */
62 /* INPUT : osip_message_t *sip | sip message. */
63 /* returns null on error. */
65 osip_message_get_to (const osip_message_t * sip)
71 osip_to_parse (osip_to_t * to, const char *hvalue)
73 return osip_from_parse ((osip_from_t *) to, hvalue);
76 /* returns the to header as a string. */
77 /* INPUT : osip_to_t *to | to header. */
78 /* returns null on error. */
80 osip_to_to_str (const osip_to_t * to, char **dest)
82 return osip_from_to_str ((osip_from_t *) to, dest);
85 /* deallocates a osip_to_t structure. */
86 /* INPUT : osip_to_t *to | to header. */
88 osip_to_free (osip_to_t * to)
90 osip_from_free ((osip_from_t *) to);
94 osip_to_clone (const osip_to_t * to, osip_to_t ** dest)
96 return osip_from_clone ((osip_from_t *) to, (osip_from_t **) dest);
100 osip_to_tag_match (osip_to_t * to1, osip_to_t * to2)
102 return osip_from_tag_match ((osip_from_t *) to1, (osip_from_t *) to2);