headers.h 26.7 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
	belle-sip - SIP (RFC3261) library.
    Copyright (C) 2010  Belledonne Communications SARL

    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
    the Free Software Foundation, either version 3 of the License, or
    (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 HEADERS_H_
#define HEADERS_H_

#include "belle-sip/uri.h"
jehan's avatar
jehan committed
23

24 25


jehan's avatar
jehan committed
26 27 28 29 30 31 32 33
/***************************************************************************************
 * header address
 *
 **************************************************************************************/

typedef struct _belle_sip_header_address belle_sip_header_address_t;

belle_sip_header_address_t* belle_sip_header_address_new();
jehan's avatar
jehan committed
34 35 36 37 38 39 40 41
/*
 * creates an address from a display name and an uri
 * Note the uri not copied but only its ref count is incremented
 * @param  display display name. May be null.
 * @param uri uri set to the newly created header_address
 * @return
 * */
belle_sip_header_address_t* belle_sip_header_address_create(const char* display, belle_sip_uri_t* uri);
jehan's avatar
jehan committed
42 43 44 45 46 47

belle_sip_header_address_t* belle_sip_header_address_parse (const char* address) ;

/**
 *
 */
48
belle_sip_uri_t* belle_sip_header_address_get_uri(const belle_sip_header_address_t* address);
jehan's avatar
jehan committed
49 50 51 52 53 54 55 56
/**
 *
 */
void belle_sip_header_address_set_uri(belle_sip_header_address_t* address, belle_sip_uri_t* uri);

/**
 *
 */
57
const char* belle_sip_header_address_get_displayname(const belle_sip_header_address_t* address);
jehan's avatar
jehan committed
58 59 60 61 62
/**
 *
 */
void belle_sip_header_address_set_displayname(belle_sip_header_address_t* address, const char* uri);

jehan's avatar
jehan committed
63 64 65
#define BELLE_SIP_HEADER_ADDRESS(t) BELLE_SIP_CAST(t,belle_sip_header_address_t)


jehan's avatar
jehan committed
66 67 68 69 70 71 72

/***************************************************************************************
 * header common
 *
 **************************************************************************************/

typedef struct _belle_sip_header belle_sip_header_t;
jehan's avatar
jehan committed
73
belle_sip_header_t* belle_sip_header_create (const char* name,const char* value);
74
const char* belle_sip_header_get_name (const belle_sip_header_t* obj);
jehan's avatar
jehan committed
75
void belle_sip_header_set_name (belle_sip_header_t* obj,const char* value);
jehan's avatar
jehan committed
76
int belle_sip_header_marshal(belle_sip_header_t* header, char* buff, unsigned int offset,unsigned int buff_size);
jehan's avatar
jehan committed
77 78

#define BELLE_SIP_HEADER(t) BELLE_SIP_CAST(t,belle_sip_header_t)
jehan's avatar
jehan committed
79 80 81 82 83 84 85 86 87 88 89

/******************************
 *
 * Allow header inherit from header
 *
 ******************************/
typedef struct _belle_sip_header_allow belle_sip_header_allow_t;

belle_sip_header_allow_t* belle_sip_header_allow_new();

belle_sip_header_allow_t* belle_sip_header_allow_parse (const char* allow) ;
jehan's avatar
jehan committed
90 91
belle_sip_header_allow_t* belle_sip_header_allow_create (const char* methods) ;

jehan's avatar
jehan committed
92 93 94
const char* belle_sip_header_allow_get_method(const belle_sip_header_allow_t* allow);
void belle_sip_header_allow_set_method(belle_sip_header_allow_t* allow,const char* method);
#define BELLE_SIP_HEADER_ALLOW(t) BELLE_SIP_CAST(t,belle_sip_header_allow_t)
jehan's avatar
jehan committed
95
#define BELLE_SIP_ALLOW "Allow"
jehan's avatar
jehan committed
96

jehan's avatar
jehan committed
97
/***********************
jehan's avatar
jehan committed
98
 * Contact header object
jehan's avatar
jehan committed
99
 ************************/
jehan's avatar
jehan committed
100 101 102 103 104 105 106
typedef struct _belle_sip_header_contact belle_sip_header_contact_t;

belle_sip_header_contact_t* belle_sip_header_contact_new();


belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact) ;

jehan's avatar
jehan committed
107 108
belle_sip_header_contact_t* belle_sip_header_contact_create (const belle_sip_header_address_t* contact) ;

jehan's avatar
jehan committed
109 110 111 112 113 114

/**
* Returns the value of the expires parameter or -1 if no expires parameter was specified or if the parameter value cannot be parsed as an int.
*@returns value of the expires parameter measured in delta-seconds, O implies removal of Registration specified in Contact Header.
*
*/
115
 int	belle_sip_header_contact_get_expires(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
116 117 118 119
/**
 * Returns the value of the q-value parameter of this ContactHeader. The q-value parameter indicates the relative preference amongst a set of locations. q-values are decimal numbers from 0 to 1, with higher values indicating higher preference.
 * @return the q-value parameter of this ContactHeader, -1 if the q-value is not set.
 */
120
 float	belle_sip_header_contact_get_qvalue(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
121 122 123 124
 /**
  * Returns a boolean value that indicates if the contact header has the format of Contact: *.
  * @return true if this is a wildcard address, false otherwise.
  */
125
 unsigned int belle_sip_header_contact_is_wildcard(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
126 127 128 129 130 131 132
 /**
 *
 */
 int belle_sip_header_contact_set_expires(belle_sip_header_contact_t* contact, int expires);
/**
 *  Sets the qValue value of the Name Address.
 */
jehan's avatar
jehan committed
133
 int belle_sip_header_contact_set_qvalue(belle_sip_header_contact_t* contact, float qvalue);
jehan's avatar
jehan committed
134 135 136 137
/**
 * Sets a wildcard on this contact address that is "*" is assigned to the contact header so that the header will have the format of Contact: *.
 *
 */
jehan's avatar
jehan committed
138
 void belle_sip_header_contact_set_wildcard(belle_sip_header_contact_t* contact,unsigned int is_wildcard);
jehan's avatar
jehan committed
139 140 141 142 143 144
 /** Contact heaader equality function
  * @return 0 if not equals
  *
  * */
 unsigned int belle_sip_header_contact_equals(const belle_sip_header_contact_t* a,const belle_sip_header_contact_t* b);

145 146 147 148 149 150 151
 /** Contact heaader equality function, same as #belle_sip_header_contact_equals but return 0 if equals, very useful with #belle_sip_list
   * @return 0 if equals
   *
   * */
 unsigned int belle_sip_header_contact_not_equals(const belle_sip_header_contact_t* a,const belle_sip_header_contact_t* b);


152
#define BELLE_SIP_RANDOM_TAG ((const char*)-1)
jehan's avatar
jehan committed
153
#define BELLE_SIP_HEADER_CONTACT(t) BELLE_SIP_CAST(t,belle_sip_header_contact_t)
jehan's avatar
jehan committed
154
#define BELLE_SIP_CONTACT "Contact"
jehan's avatar
jehan committed
155
 /******************************
jehan's avatar
jehan committed
156 157
 * From header object inherent from header_address
 *
jehan's avatar
jehan committed
158
 ******************************/
jehan's avatar
jehan committed
159 160 161 162
 typedef struct _belle_sip_header_from belle_sip_header_from_t;

 belle_sip_header_from_t* belle_sip_header_from_new();

jehan's avatar
jehan committed
163 164 165
 belle_sip_header_from_t* belle_sip_header_from_create(const belle_sip_header_address_t* address, const char *tag);

 belle_sip_header_from_t* belle_sip_header_from_create2(const char *address, const char *tag);
jehan's avatar
jehan committed
166

167
 belle_sip_header_from_t* belle_sip_header_from_parse(const char* from) ;
jehan's avatar
jehan committed
168

169
 void belle_sip_header_from_set_tag(belle_sip_header_from_t* from, const char* tag);
jehan's avatar
jehan committed
170

171
 const char* belle_sip_header_from_get_tag(const belle_sip_header_from_t* from);
jehan's avatar
jehan committed
172

173 174
 void belle_sip_header_from_set_random_tag(belle_sip_header_from_t *obj);

jehan's avatar
jehan committed
175
#define BELLE_SIP_HEADER_FROM(t) BELLE_SIP_CAST(t,belle_sip_header_from_t)
jehan's avatar
jehan committed
176
#define BELLE_SIP_FROM "From"
jehan's avatar
jehan committed
177 178 179 180 181 182 183 184
 /******************************
 * To header object inherent from header_address
 *
 ******************************/
 typedef struct _belle_sip_header_to belle_sip_header_to_t;

 belle_sip_header_to_t* belle_sip_header_to_new();

185
 belle_sip_header_to_t* belle_sip_header_to_parse(const char* to) ;
jehan's avatar
jehan committed
186

jehan's avatar
jehan committed
187 188 189
 belle_sip_header_to_t* belle_sip_header_to_create(const belle_sip_header_address_t *address, const char *tag);

 belle_sip_header_to_t* belle_sip_header_to_create2(const char *address, const char *tag);
jehan's avatar
jehan committed
190 191 192

 void belle_sip_header_to_set_tag(belle_sip_header_to_t* from, const char* tag);

193
 const char* belle_sip_header_to_get_tag(const belle_sip_header_to_t* from);
jehan's avatar
jehan committed
194

195 196
 void belle_sip_header_to_set_random_tag(belle_sip_header_to_t *obj);

jehan's avatar
jehan committed
197
#define BELLE_SIP_HEADER_TO(t) BELLE_SIP_CAST(t,belle_sip_header_to_t)
jehan's avatar
fix tag  
jehan committed
198
#define BELLE_SIP_TO "To"
jehan's avatar
jehan committed
199 200 201 202 203 204 205 206

/******************************
 * Via header object inherent from header_address
 *
 ******************************/
typedef struct _belle_sip_header_via belle_sip_header_via_t;

belle_sip_header_via_t* belle_sip_header_via_new();
207
belle_sip_header_via_t* belle_sip_header_via_create(const char *host, int port, const char *transport, const char *branch);
jehan's avatar
jehan committed
208
belle_sip_header_via_t* belle_sip_header_via_parse (const char* via) ;
209 210
const char*	belle_sip_header_via_get_branch(const belle_sip_header_via_t* via);
const char*	belle_sip_header_via_get_transport(const belle_sip_header_via_t* via);
211 212 213 214 215
/**
 * Get lower case version of the transport
 * @return the lower case version of the transport if from tcp,udp,tls or dtls else, return the value from #belle_sip_header_via_get_transport
 */
const char*	belle_sip_header_via_get_transport_lowercase(const belle_sip_header_via_t* via);
216 217 218 219 220 221 222 223 224
const char*	belle_sip_header_via_get_host(const belle_sip_header_via_t* via);
int belle_sip_header_via_get_port(const belle_sip_header_via_t* via);
int belle_sip_header_via_get_listening_port(const belle_sip_header_via_t *via);

const char*	belle_sip_header_via_get_maddr(const belle_sip_header_via_t* via);
const char*	belle_sip_header_via_get_protocol(const belle_sip_header_via_t* via);
const char*	belle_sip_header_via_get_received(const belle_sip_header_via_t* via);
int belle_sip_header_via_get_rport(const belle_sip_header_via_t* via);
int	belle_sip_header_via_get_ttl(const belle_sip_header_via_t* via);
225 226 227 228 229 230 231 232 233 234

void belle_sip_header_via_set_branch(belle_sip_header_via_t* via,const char* branch);
void belle_sip_header_via_set_host(belle_sip_header_via_t* via, const char* host);
int belle_sip_header_via_set_port(belle_sip_header_via_t* via,int port);
void belle_sip_header_via_set_maddr(belle_sip_header_via_t* via, const char* maddr);
void belle_sip_header_via_set_protocol(belle_sip_header_via_t* via, const char* protocol);
void belle_sip_header_via_set_received(belle_sip_header_via_t* via, const char* received);
int belle_sip_header_via_set_rport(belle_sip_header_via_t* via,int rport);
void belle_sip_header_via_set_transport(belle_sip_header_via_t* via,const char* transport);
int belle_sip_header_via_set_ttl(belle_sip_header_via_t* via, int ttl);
jehan's avatar
jehan committed
235
#define BELLE_SIP_HEADER_VIA(t) BELLE_SIP_CAST(t,belle_sip_header_via_t)
jehan's avatar
jehan committed
236
#define BELLE_SIP_VIA "Via"
jehan's avatar
jehan committed
237

238 239 240 241
/******************************
 * Call id object inherent from object
 *
 ******************************/
jehan's avatar
jehan committed
242
typedef struct _belle_sip_header_call_id belle_sip_header_call_id_t;
243

jehan's avatar
jehan committed
244
belle_sip_header_call_id_t* belle_sip_header_call_id_new();
245

jehan's avatar
jehan committed
246
belle_sip_header_call_id_t* belle_sip_header_call_id_parse (const char* call_id) ;
247
const char*	belle_sip_header_call_id_get_call_id(const belle_sip_header_call_id_t* call_id);
248 249
void belle_sip_header_call_id_set_call_id(belle_sip_header_call_id_t* call_id,const char* id);
unsigned int belle_sip_header_call_id_equals(const belle_sip_header_call_id_t* a,const belle_sip_header_call_id_t* b);
jehan's avatar
jehan committed
250
#define BELLE_SIP_HEADER_CALL_ID(t) BELLE_SIP_CAST(t,belle_sip_header_call_id_t)
jehan's avatar
fix tag  
jehan committed
251
#define BELLE_SIP_CALL_ID "Call-ID"
252 253 254 255 256 257 258
/******************************
 * cseq object inherent from object
 *
 ******************************/
typedef struct _belle_sip_header_cseq belle_sip_header_cseq_t;

belle_sip_header_cseq_t* belle_sip_header_cseq_new();
259
belle_sip_header_cseq_t* belle_sip_header_cseq_create(unsigned int number, const char *method);
260
belle_sip_header_cseq_t* belle_sip_header_cseq_parse (const char* cseq) ;
261
const char*	belle_sip_header_cseq_get_method(const belle_sip_header_cseq_t* cseq);
262
void belle_sip_header_cseq_set_method(belle_sip_header_cseq_t* cseq,const char* method);
263
unsigned int	belle_sip_header_cseq_get_seq_number(const belle_sip_header_cseq_t* cseq);
264 265
void belle_sip_header_cseq_set_seq_number(belle_sip_header_cseq_t* cseq,unsigned int seq_number);
#define BELLE_SIP_HEADER_CSEQ(t) BELLE_SIP_CAST(t,belle_sip_header_cseq_t)
266
#define BELLE_SIP_CSEQ "CSeq"
267 268 269 270 271 272 273 274
/******************************
 * content type object inherent from parameters
 *
 ******************************/
typedef struct _belle_sip_header_content_type belle_sip_header_content_type_t;

belle_sip_header_content_type_t* belle_sip_header_content_type_new();
belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
jehan's avatar
jehan committed
275
belle_sip_header_content_type_t* belle_sip_header_content_type_create (const char* type,const char* sub_type) ;
jehan's avatar
jehan committed
276

277
belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
278
const char*	belle_sip_header_content_type_get_type(const belle_sip_header_content_type_t* content_type);
279
void belle_sip_header_content_type_set_type(belle_sip_header_content_type_t* content_type,const char* type);
280
const char*	belle_sip_header_content_type_get_subtype(const belle_sip_header_content_type_t* content_type);
281 282
void belle_sip_header_content_type_set_subtype(belle_sip_header_content_type_t* content_type,const char* sub_type);
#define BELLE_SIP_HEADER_CONTENT_TYPE(t) BELLE_SIP_CAST(t,belle_sip_header_content_type_t)
jehan's avatar
jehan committed
283
#define BELLE_SIP_CONTENT_TYPE "Content-Type"
jehan's avatar
jehan committed
284 285 286 287 288 289 290 291 292 293 294 295 296
/******************************
 *
 * Expires inherit from header
 *
 ******************************/
typedef struct _belle_sip_header_expires belle_sip_header_expires_t;

belle_sip_header_expires_t* belle_sip_header_expires_new();

belle_sip_header_expires_t* belle_sip_header_expires_parse (const char* expires) ;
int belle_sip_header_expires_get_expires(const belle_sip_header_expires_t* expires);
void belle_sip_header_expires_set_expires(belle_sip_header_expires_t* expires,int value);
int belle_sip_header_expires_decrement_expires(belle_sip_header_expires_t* expires);
jehan's avatar
jehan committed
297
belle_sip_header_expires_t* belle_sip_header_expires_create(int expires);
jehan's avatar
jehan committed
298
#define BELLE_SIP_HEADER_EXPIRES(t) BELLE_SIP_CAST(t,belle_sip_header_expires_t)
299
#define BELLE_SIP_EXPIRES "Expires"
jehan's avatar
jehan committed
300 301 302 303 304 305 306 307
/******************************
 * Route header object inherent from header_address
 *
 ******************************/
 typedef struct _belle_sip_header_route belle_sip_header_route_t;

 belle_sip_header_route_t* belle_sip_header_route_new();
 belle_sip_header_route_t* belle_sip_header_route_parse (const char* route) ;
jehan's avatar
jehan committed
308
 belle_sip_header_route_t* belle_sip_header_route_create(const belle_sip_header_address_t* route);
jehan's avatar
jehan committed
309 310

#define BELLE_SIP_HEADER_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_route_t)
jehan's avatar
jehan committed
311
#define BELLE_SIP_ROUTE "Route"
jehan's avatar
jehan committed
312 313 314 315 316 317 318 319 320
/******************************
 * Record route header object inherent from header_address
 *
 ******************************/
 typedef struct _belle_sip_header_record_route belle_sip_header_record_route_t;

 belle_sip_header_record_route_t* belle_sip_header_record_route_new();
 belle_sip_header_record_route_t* belle_sip_header_record_route_parse (const char* route) ;

jehan's avatar
jehan committed
321
#define BELLE_SIP_HEADER_RECORD_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_record_route_t)
Simon Morlat's avatar
Simon Morlat committed
322
#define BELLE_SIP_RECORD_ROUTE	"Record-route"
jehan's avatar
jehan committed
323 324 325 326 327 328 329 330 331 332 333
 /******************************
  *
  * user-Agent header inherit from header
  *
  ******************************/
 typedef struct _belle_sip_header_user_agent belle_sip_header_user_agent_t;

 belle_sip_header_user_agent_t* belle_sip_header_user_agent_new();

 belle_sip_header_user_agent_t* belle_sip_header_user_agent_parse (const char* user_agent) ;
 belle_sip_list_t* belle_sip_header_user_agent_get_products(const belle_sip_header_user_agent_t* user_agent);
jehan's avatar
jehan committed
334 335 336 337 338 339 340 341
 /**
  * concatenates products
  * @param user_agent [in] user agent header
  * @param value [out]buffer where to put result in
  * @param value_size [in] size of the buffer
  * @return number of written characters or -1 inca se of error;
  */
 int belle_sip_header_user_agent_get_products_as_string(const belle_sip_header_user_agent_t* user_agent,char* value,unsigned int value_size);
jehan's avatar
jehan committed
342 343 344 345 346
 void belle_sip_header_user_agent_set_products(belle_sip_header_user_agent_t* user_agent,belle_sip_list_t* value);
 void belle_sip_header_user_agent_add_product(belle_sip_header_user_agent_t* user_agent,const char* product);
 #define BELLE_SIP_HEADER_USER_AGENT(t) BELLE_SIP_CAST(t,belle_sip_header_user_agent_t)

 /******************************
jehan's avatar
jehan committed
347 348 349 350 351 352 353 354
 * Content length inherent from object
 *
 ******************************/
typedef struct _belle_sip_header_content_length belle_sip_header_content_length_t;

belle_sip_header_content_length_t* belle_sip_header_content_length_new();

belle_sip_header_content_length_t* belle_sip_header_content_length_parse (const char* content_length) ;
jehan's avatar
jehan committed
355
belle_sip_header_content_length_t* belle_sip_header_content_length_create (int content_length) ;
356
unsigned int belle_sip_header_content_length_get_content_length(const belle_sip_header_content_length_t* content_length);
jehan's avatar
jehan committed
357 358
void belle_sip_header_content_length_set_content_length(belle_sip_header_content_length_t* content_length,unsigned int length);
#define BELLE_SIP_HEADER_CONTENT_LENGTH(t) BELLE_SIP_CAST(t,belle_sip_header_content_length_t)
jehan's avatar
jehan committed
359
#define BELLE_SIP_CONTENT_LENGTH "Content-Length"
jehan's avatar
jehan committed
360

jehan's avatar
jehan committed
361
/******************************
362
 * authorization header inherit from parameters
363 364 365 366
 *
 ******************************/
typedef struct _belle_sip_header_authorization belle_sip_header_authorization_t;

jehan's avatar
jehan committed
367
belle_sip_header_authorization_t* belle_sip_header_authorization_new();
368 369 370 371
belle_sip_header_authorization_t* belle_sip_header_authorization_parse(const char* authorization);
const char*	belle_sip_header_authorization_get_algorithm(const belle_sip_header_authorization_t* authorization );
const char*	belle_sip_header_authorization_get_cnonce(const belle_sip_header_authorization_t* authorization );
const char* belle_sip_header_authorization_get_nonce(const belle_sip_header_authorization_t* authorization);
jehan's avatar
jehan committed
372 373 374 375
/*convert nonce count as string id present
 * @return 0 in case of success
 * */
int belle_sip_header_authorization_get_nonce_count_as_string(const belle_sip_header_authorization_t* authorization,char nounce_count[9]);
376 377 378 379 380 381 382 383 384 385 386 387 388 389
int	belle_sip_header_authorization_get_nonce_count(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_opaque(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_qop(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_realm(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_response(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_scheme(const belle_sip_header_authorization_t* authorization);
belle_sip_uri_t* belle_sip_header_authorization_get_uri(const belle_sip_header_authorization_t* authorization);
const char*	belle_sip_header_authorization_get_username(const belle_sip_header_authorization_t* authorization);
void belle_sip_header_authorization_set_algorithm(belle_sip_header_authorization_t* authorization, const char* algorithm);
void belle_sip_header_authorization_set_cnonce(belle_sip_header_authorization_t* authorization, const char* cNonce);
void belle_sip_header_authorization_set_nonce(belle_sip_header_authorization_t* authorization, const char* nonce);
void belle_sip_header_authorization_set_nonce_count(belle_sip_header_authorization_t* authorization, int nonceCount);
void belle_sip_header_authorization_set_opaque(belle_sip_header_authorization_t* authorization, const char* opaque);
void belle_sip_header_authorization_set_qop(belle_sip_header_authorization_t* authorization, const char* qop);
jehan's avatar
jehan committed
390
void belle_sip_header_authorization_add_qop(belle_sip_header_authorization_t* authorization, const char* qop);
391 392 393 394 395 396 397
void belle_sip_header_authorization_set_realm(belle_sip_header_authorization_t* authorization, const char* realm);
void belle_sip_header_authorization_set_response(belle_sip_header_authorization_t* authorization, const char* response);
void belle_sip_header_authorization_set_scheme(belle_sip_header_authorization_t* authorization, const char* scheme);
void belle_sip_header_authorization_set_uri(belle_sip_header_authorization_t* authorization, belle_sip_uri_t* uri);
void belle_sip_header_authorization_set_username(belle_sip_header_authorization_t* authorization, const char* username);

#define BELLE_SIP_HEADER_AUTHORIZATION(t) BELLE_SIP_CAST(t,belle_sip_header_authorization_t)
398
#define BELLE_SIP_AUTHORIZATION "Authorization"
399

400 401 402 403 404 405 406
/*******************************
 * proxy_authorization inherit from Authorization
 */
typedef struct _belle_sip_header_proxy_authorization belle_sip_header_proxy_authorization_t;
belle_sip_header_proxy_authorization_t* belle_sip_header_proxy_authorization_new();
belle_sip_header_proxy_authorization_t* belle_sip_header_proxy_authorization_parse(const char* proxy_authorization);
#define BELLE_SIP_HEADER_PROXY_AUTHORIZATION(t) BELLE_SIP_CAST(t,belle_sip_header_proxy_authorization_t)
407
#define BELLE_SIP_PROXY_AUTHORIZATION "Proxy-Authorization"
408

jehan's avatar
jehan committed
409 410 411 412 413 414 415 416 417
/*******************************
 * www_authenticate inherit from parameters
 */
typedef struct _belle_sip_header_www_authenticate belle_sip_header_www_authenticate_t;
belle_sip_header_www_authenticate_t* belle_sip_header_www_authenticate_new();
belle_sip_header_www_authenticate_t* belle_sip_header_www_authenticate_parse(const char* www_authenticate);
const char*	belle_sip_header_www_authenticate_get_algorithm(const belle_sip_header_www_authenticate_t* www_authenticate );
const char* belle_sip_header_www_authenticate_get_nonce(const belle_sip_header_www_authenticate_t* www_authenticate);
const char*	belle_sip_header_www_authenticate_get_opaque(const belle_sip_header_www_authenticate_t* www_authenticate);
jehan's avatar
jehan committed
418
belle_sip_list_t* belle_sip_header_www_authenticate_get_qop(const belle_sip_header_www_authenticate_t* www_authetication);
419
const char* belle_sip_header_www_authenticate_get_qop_first(const belle_sip_header_www_authenticate_t* www_authetication);
jehan's avatar
jehan committed
420 421 422 423 424 425 426
const char*	belle_sip_header_www_authenticate_get_realm(const belle_sip_header_www_authenticate_t* www_authenticate);
const char*	belle_sip_header_www_authenticate_get_scheme(const belle_sip_header_www_authenticate_t* www_authenticate);
const char*	belle_sip_header_www_authenticate_get_domain(const belle_sip_header_www_authenticate_t* www_authenticate);
unsigned int belle_sip_header_www_authenticate_is_stale(const belle_sip_header_www_authenticate_t* www_authenticate);
void belle_sip_header_www_authenticate_set_algorithm(belle_sip_header_www_authenticate_t* www_authenticate, const char* algorithm);
void belle_sip_header_www_authenticate_set_nonce(belle_sip_header_www_authenticate_t* www_authenticate, const char* nonce);
void belle_sip_header_www_authenticate_set_opaque(belle_sip_header_www_authenticate_t* www_authenticate, const char* opaque);
jehan's avatar
jehan committed
427 428
void belle_sip_header_www_authenticate_set_qop(belle_sip_header_www_authenticate_t* www_authentication, belle_sip_list_t*  qop);
void belle_sip_header_www_authenticate_add_qop(belle_sip_header_www_authenticate_t* www_authentication, const char*  qop_param);
jehan's avatar
jehan committed
429 430 431 432 433
void belle_sip_header_www_authenticate_set_realm(belle_sip_header_www_authenticate_t* www_authenticate, const char* realm);
void belle_sip_header_www_authenticate_set_scheme(belle_sip_header_www_authenticate_t* www_authenticate, const char* scheme);
void belle_sip_header_www_authenticate_set_domain(belle_sip_header_www_authenticate_t* www_authenticate,const char* domain);
void belle_sip_header_www_authenticate_set_stale(belle_sip_header_www_authenticate_t* www_authenticate, unsigned int enable);
#define BELLE_SIP_HEADER_WWW_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_www_authenticate_t)
jehan's avatar
jehan committed
434
#define BELLE_SIP_WWW_AUTHENTICATE "WWW-Authenticate"
jehan's avatar
jehan committed
435

jehan's avatar
jehan committed
436 437 438 439 440 441 442
/*******************************
 * proxy_authenticate inherit from www_authenticate
 */
typedef struct _belle_sip_header_proxy_authenticate belle_sip_header_proxy_authenticate_t;
belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_new();
belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_parse(const char* proxy_authenticate);
#define BELLE_SIP_HEADER_PROXY_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_proxy_authenticate_t)
jehan's avatar
jehan committed
443
#define BELLE_SIP_PROXY_AUTHENTICATE "Proxy-Authenticate"
jehan's avatar
jehan committed
444

445
/******************************
446
 *
447
 * Extension header inherit from header
jehan's avatar
jehan committed
448 449 450 451 452 453 454
 *
 ******************************/
typedef struct _belle_sip_header_extension belle_sip_header_extension_t;

belle_sip_header_extension_t* belle_sip_header_extension_new();

belle_sip_header_extension_t* belle_sip_header_extension_parse (const char* extension) ;
jehan's avatar
jehan committed
455
belle_sip_header_extension_t* belle_sip_header_extension_create (const char* name,const char* value);
456 457
const char* belle_sip_header_extension_get_value(const belle_sip_header_extension_t* extension);
void belle_sip_header_extension_set_value(belle_sip_header_extension_t* extension,const char* value);
jehan's avatar
jehan committed
458
#define BELLE_SIP_HEADER_EXTENSION(t) BELLE_SIP_CAST(t,belle_sip_header_extension_t)
jehan's avatar
jehan committed
459 460 461 462 463 464 465 466 467 468 469 470 471 472
/******************************
 *
 * Max forward inherit from header
 *
 ******************************/
typedef struct _belle_sip_header_max_forwards belle_sip_header_max_forwards_t;

belle_sip_header_max_forwards_t* belle_sip_header_max_forwards_new();

belle_sip_header_max_forwards_t* belle_sip_header_max_forwards_parse (const char* max_forwards) ;
int belle_sip_header_max_forwards_get_max_forwards(const belle_sip_header_max_forwards_t* max_forwards);
void belle_sip_header_max_forwards_set_max_forwards(belle_sip_header_max_forwards_t* max_forwards,int value);
int belle_sip_header_max_forwards_decrement_max_forwards(belle_sip_header_max_forwards_t* max_forwards);
#define BELLE_SIP_HEADER_MAX_FORWARDS(t) BELLE_SIP_CAST(t,belle_sip_header_max_forwards_t)
jehan's avatar
jehan committed
473 474 475 476 477 478 479 480 481 482 483 484
#define BELLE_SIP_MAX_FORWARDS "Max-Forwards"

/******************************
 *
 * Subscription state  inherit from parameters
 *
 ******************************/
typedef struct _belle_sip_header_subscription_state belle_sip_header_subscription_state_t;

belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_new();

belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_parse (const char* subscription_state) ;
485
belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_create (const char* subscription_state,int expires);
jehan's avatar
jehan committed
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502

const char* belle_sip_header_subscription_state_get_state(const belle_sip_header_subscription_state_t* subscription_state);
int belle_sip_header_subscription_state_get_expires(const belle_sip_header_subscription_state_t* subscription_state);
const char* belle_sip_header_subscription_state_get_reason(const belle_sip_header_subscription_state_t* subscription_state);
int belle_sip_header_subscription_state_get_retry_after(const belle_sip_header_subscription_state_t* subscription_state);

void belle_sip_header_subscription_state_set_state(belle_sip_header_subscription_state_t* subscription_state,const char* state);
void belle_sip_header_subscription_state_set_expires(belle_sip_header_subscription_state_t* subscription_state,int expire);
void belle_sip_header_subscription_state_set_reason(belle_sip_header_subscription_state_t* subscription_state, const char* reason);
void belle_sip_header_subscription_state_set_retry_after(belle_sip_header_subscription_state_t* subscription_state, int retry_after );


#define BELLE_SIP_HEADER_SUBSCRIPTION_STATE(t) BELLE_SIP_CAST(t,belle_sip_header_subscription_state_t)
#define BELLE_SIP_SUBSCRIPTION_STATE "Subscription-State"
#define BELLE_SIP_SUBSCRIPTION_STATE_ACTIVE  "active"
#define BELLE_SIP_SUBSCRIPTION_STATE_PENDING "pending"
#define BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED "terminated"
jehan's avatar
jehan committed
503

504

jehan's avatar
jehan committed
505
#endif /* HEADERS_H_ */