00001 /* 00002 The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) 00003 Copyright (C) 2001,2002,2003,2004,2005 Aymeric MOIZARD jack@atosc.org 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 00021 #ifndef _OSIP_FROM_H_ 00022 #define _OSIP_FROM_H_ 00023 00024 #include <osipparser2/osip_list.h> 00025 #include <osipparser2/osip_uri.h> 00026 00042 typedef struct osip_from osip_from_t; 00043 00048 struct osip_from 00049 { 00050 char *displayname; 00051 osip_uri_t *url; 00052 osip_list_t *gen_params; 00053 }; 00054 00055 #ifdef __cplusplus 00056 extern "C" 00057 { 00058 #endif 00059 00064 int osip_from_init (osip_from_t ** header); 00069 void osip_from_free (osip_from_t * header); 00075 int osip_from_parse (osip_from_t * header, const char *hvalue); 00081 int osip_from_to_str (const osip_from_t * header, char **dest); 00087 int osip_from_clone (const osip_from_t * header, osip_from_t ** dest); 00093 void osip_from_set_displayname (osip_from_t * header, char *value); 00098 char *osip_from_get_displayname (osip_from_t * header); 00104 void osip_from_set_url (osip_from_t * header, osip_uri_t * url); 00109 osip_uri_t *osip_from_get_url (osip_from_t * header); 00116 int osip_from_param_get (osip_from_t * header, int pos, osip_generic_param_t ** dest); 00123 #define osip_from_param_add(header,name,value) osip_generic_param_add((header)->gen_params,name,value) 00124 00130 #define osip_from_param_get_byname(header,name,dest) osip_generic_param_get_byname((header)->gen_params,name,dest) 00131 00137 #define osip_from_get_tag(header,dest) osip_generic_param_get_byname((header)->gen_params, "tag",dest) 00138 00143 #define osip_from_set_tag(header,value) osip_generic_param_add((header)->gen_params, osip_strdup("tag"),value) 00144 00145 #ifndef DOXYGEN /* avoid DOXYGEN warning */ 00146 /* Compare the username, host and tag part (if exist) of the two froms */ 00147 int osip_from_compare (osip_from_t * header1, osip_from_t * header2); 00148 #endif 00149 00156 int osip_from_tag_match (osip_from_t * from1, osip_from_t * from2); 00157 00158 00159 #ifdef __cplusplus 00160 } 00161 #endif 00162 00165 #endif