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
24 #include <osipparser2/osip_port.h>
25 #include <osipparser2/osip_message.h>
26 #include <osipparser2/osip_parser.h>
28 /* fills the proxy-authenticate header of message. */
29 /* INPUT : char *hvalue | value of header. */
30 /* OUTPUT: osip_message_t *sip | structure to save results. */
31 /* returns -1 on error. */
33 osip_message_set_proxy_authenticate (osip_message_t * sip, const char *hvalue)
35 osip_proxy_authenticate_t *proxy_authenticate;
38 if (hvalue == NULL || hvalue[0] == '\0')
41 i = osip_proxy_authenticate_init (&(proxy_authenticate));
44 i = osip_proxy_authenticate_parse (proxy_authenticate, hvalue);
47 osip_proxy_authenticate_free (proxy_authenticate);
50 sip->message_property = 2;
51 osip_list_add (sip->proxy_authenticates, proxy_authenticate, -1);
57 /* returns the proxy_authenticate header. */
58 /* INPUT : osip_message_t *sip | sip message. */
59 /* returns null on error. */
61 osip_message_get_proxy_authenticate (const osip_message_t * sip, int pos,
62 osip_proxy_authenticate_t ** dest)
64 osip_proxy_authenticate_t *proxy_authenticate;
67 if (osip_list_size (sip->proxy_authenticates) <= pos)
68 return -1; /* does not exist */
70 proxy_authenticate = (osip_proxy_authenticate_t *)
71 osip_list_get (sip->proxy_authenticates, pos);
73 *dest = proxy_authenticate;