generic-uri.h 4.38 KB
Newer Older
1 2 3 4 5 6
/*
	belle-sip - SIP (RFC3261) library.
    Copyright (C) 2013  Belledonne Communications SARL, Grenoble, France

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
7
    the Free Software Foundation, either version 2 of the License, or
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef BELLE_GENERIC_URI_H_
#define BELLE_GENERIC_URI_H_


#include "belle-sip/defs.h"
#include "belle-sip/list.h"
#include "belle-sip/utils.h"



BELLE_SIP_BEGIN_DECLS

/**
 *
 */
BELLESIP_EXPORT belle_generic_uri_t* belle_generic_uri_new();

/**
 *
 */
Simon Morlat's avatar
Simon Morlat committed
39
BELLESIP_EXPORT belle_generic_uri_t* belle_generic_uri_parse (const char* uri);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
/*
 * 	          Returns the host part of this uri.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_host(const belle_generic_uri_t* uri) ;
/**
 * 	          Returns the value of the maddr parameter, or null if this is not set.
 *
 */
BELLESIP_EXPORT int	belle_generic_uri_get_port(const belle_generic_uri_t* uri) ;
/**
 * Returns the port of the uri, if not specified in the uri returns the well known port according to the transport.
**/
BELLESIP_EXPORT int belle_generic_uri_get_listening_port(const belle_generic_uri_t *uri);

/**
 * 	          Returns the user part of this URI.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_user(const belle_generic_uri_t* uri) ;

/**
 * 	          Gets user password of uri, or null if it is not set.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_user_password(const belle_generic_uri_t* uri) ;

/**
 *
 * 	          Returns uri scheme.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_scheme(const belle_generic_uri_t* uri) ;
/**
 *
 * 	          Returns uri path.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_path(const belle_generic_uri_t* uri) ;
/**
 *
 * 	          Returns uri query.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_query(const belle_generic_uri_t* uri) ;


/**
 * 	          Removes the port part of this uri.
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_remove_port(belle_generic_uri_t* uri) ;
/**
 * 	          Set the host part of this uri to the newly supplied host parameter.
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_host(belle_generic_uri_t* uri,const char*host) ;

/**
 * 	          Set the port part of this uri to the newly supplied port parameter.
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_port(belle_generic_uri_t* uri, int port) ;
/**
 * 	          Sets the scheme of this URI .
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_scheme(belle_generic_uri_t* uri,const char* scheme) ;
/**
 * 	          Sets the path of this URI .
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_path(belle_generic_uri_t* uri,const char* scheme) ;
/**
 * 	          Sets the query of this URI .
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_query(belle_generic_uri_t* uri,const char* scheme) ;

/**
 *  	          Sets the user of uri.
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_user(belle_generic_uri_t* uri,const char*user) ;

/**
 * 	          Sets the user password associated with the user of uri.
 *
 */
BELLESIP_EXPORT void	belle_generic_uri_set_user_password(belle_generic_uri_t* uri,const char*userPassword) ;

/**
 * 	          This method returns the URI as a string.
 *
 */
BELLESIP_EXPORT char*	belle_generic_uri_to_string(belle_generic_uri_t* uri) ;

jehan's avatar
jehan committed
137
BELLESIP_EXPORT belle_sip_error_code belle_generic_uri_marshal(const belle_generic_uri_t* uri, char* buff, size_t buff_size, size_t *offset);
138 139


140 141 142 143 144 145 146 147 148 149 150 151 152
/**
 * 	         gets opaque part of this uri if hierarchies part not detected.
 *
 */
BELLESIP_EXPORT const char*	belle_generic_uri_get_opaque_part(const belle_generic_uri_t* uri) ;

/**
 * 	         sets opaque part of this uri. Means hierarchies part is ignored if present.
 *
 */
BELLESIP_EXPORT void belle_generic_uri_set_opaque_part(belle_generic_uri_t* uri,const char * opaque_part) ;


153 154 155 156 157 158 159 160 161 162 163
#define BELLE_GENERIC_URI(obj) BELLE_SIP_CAST(obj,belle_generic_uri_t)




BELLE_SIP_END_DECLS




#endif /* belle_generic_uri_H_ */