headers.h 47.7 KB
Newer Older
jehan's avatar
jehan committed
1 2 3 4 5 6
/*
	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
7
    the Free Software Foundation, either version 2 of the License, or
jehan's avatar
jehan committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21
    (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_

22
#include "belle-sip/defs.h"
23
#include "belle-sip/sip-uri.h"
24
#include "belle-sip/generic-uri.h"
Ghislain MARY's avatar
Ghislain MARY committed
25
#include "belle-sip/utils.h"
Simon Morlat's avatar
Simon Morlat committed
26
#include "belle-sip/parameters.h"
27

Simon Morlat's avatar
Simon Morlat committed
28
#include <time.h>
29

30 31
BELLE_SIP_BEGIN_DECLS

32

jehan's avatar
jehan committed
33 34 35 36 37 38 39
/***************************************************************************************
 * header address
 *
 **************************************************************************************/

typedef struct _belle_sip_header_address belle_sip_header_address_t;

40
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_new(void);
jehan's avatar
jehan committed
41 42 43 44 45 46 47
/*
 * 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
 * */
48
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_create(const char* display, belle_sip_uri_t* uri);
jehan's avatar
jehan committed
49

50 51 52 53 54 55 56 57 58 59
/*
 * creates an address from a display name and an absolute 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
 * */
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_create2(const char* display, belle_generic_uri_t* uri);


60
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_parse (const char* address) ;
jehan's avatar
jehan committed
61

62 63 64 65 66 67
/*
 same as belle_sip_header_address_parse but with less syntax checking
 */
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_fast_parse (const char* address) ;


jehan's avatar
jehan committed
68
/**
69
 * returns a sip uri. A header address cannot have both a sip uri and an absolute uri.
jehan's avatar
jehan committed
70
 */
71
BELLESIP_EXPORT belle_sip_uri_t* belle_sip_header_address_get_uri(const belle_sip_header_address_t* address);
jehan's avatar
jehan committed
72
/**
73
 * set an absolute uri. A header address cannot have both a sip uri and an absolute uri. This function also to absolute uri to NULL
jehan's avatar
jehan committed
74
 */
75
BELLESIP_EXPORT void belle_sip_header_address_set_uri(belle_sip_header_address_t* address, belle_sip_uri_t* uri);
jehan's avatar
jehan committed
76

77 78 79 80 81 82 83 84 85
/**
 * returns an absolute uri. A header address cannot have both a sip uri and an absolute uri.
 */
BELLESIP_EXPORT belle_generic_uri_t* belle_sip_header_address_get_absolute_uri(const belle_sip_header_address_t* address);
/**
 * set an absolute uri. A header address cannot have both a sip uri and an absolute uri. This function also to uri to NULL
 */
BELLESIP_EXPORT void belle_sip_header_address_set_absolute_uri(belle_sip_header_address_t* address, belle_generic_uri_t* uri);

86 87 88 89 90 91 92 93
/**
  * Enable automatic filling of the contact ip, port and transport according to the channel that sends this message.
 **/
BELLESIP_EXPORT void belle_sip_header_address_set_automatic(belle_sip_header_address_t *address, int automatic);

BELLESIP_EXPORT int belle_sip_header_address_get_automatic(const belle_sip_header_address_t *address);


jehan's avatar
jehan committed
94 95 96
/**
 *
 */
97
BELLESIP_EXPORT const char* belle_sip_header_address_get_displayname(const belle_sip_header_address_t* address);
jehan's avatar
jehan committed
98 99 100
/**
 *
 */
Sylvain Berfini's avatar
Sylvain Berfini committed
101
BELLESIP_EXPORT void belle_sip_header_address_set_displayname(belle_sip_header_address_t* address, const char* uri);
jehan's avatar
jehan committed
102

103 104 105 106 107 108 109 110 111
/*
 * Clone both display name and an uri from an belle_sip_header_address_t to a newly allocated belle_sip_header_address_t
 * @param orig, originating header adderss.
 * @return belle_sip_header_address_t
 * */
BELLESIP_EXPORT belle_sip_header_address_t* belle_sip_header_address_clone(const belle_sip_header_address_t* orig);



112 113 114
#define BELLE_SIP_HEADER_ADDRESS(t) BELLE_SIP_CAST(t,belle_sip_header_address_t)


jehan's avatar
jehan committed
115 116 117 118 119 120

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

jehan's avatar
jehan committed
121
BELLESIP_EXPORT belle_sip_header_t* belle_sip_header_parse (const char* header);
122
BELLESIP_EXPORT belle_sip_header_t* belle_sip_header_create (const char* name,const char* value);
jehan's avatar
jehan committed
123
BELLESIP_EXPORT belle_sip_header_t* belle_http_header_create (const char* name,const char* value);
Ghislain MARY's avatar
Ghislain MARY committed
124
BELLESIP_EXPORT const char* belle_sip_header_get_name (const belle_sip_header_t* obj);
125
BELLESIP_EXPORT void belle_sip_header_set_name (belle_sip_header_t* obj,const char* value);
126
BELLESIP_EXPORT belle_sip_error_code belle_sip_header_marshal(belle_sip_header_t* header, char* buff, size_t buff_size, size_t *offset);
Simon Morlat's avatar
Simon Morlat committed
127
BELLESIP_EXPORT const char *belle_sip_header_get_unparsed_value(belle_sip_header_t* obj);
jehan's avatar
jehan committed
128 129

#define BELLE_SIP_HEADER(t) BELLE_SIP_CAST(t,belle_sip_header_t)
130 131 132 133 134 135 136 137

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

138
belle_sip_header_allow_t* belle_sip_header_allow_new(void);
139

140 141
BELLESIP_EXPORT belle_sip_header_allow_t* belle_sip_header_allow_parse (const char* allow) ;
BELLESIP_EXPORT belle_sip_header_allow_t* belle_sip_header_allow_create (const char* methods) ;
jehan's avatar
jehan committed
142

143
BELLESIP_EXPORT const char* belle_sip_header_allow_get_method(const belle_sip_header_allow_t* allow);
Ghislain MARY's avatar
Ghislain MARY committed
144
BELLESIP_EXPORT void belle_sip_header_allow_set_method(belle_sip_header_allow_t* allow,const char* method);
145
#define BELLE_SIP_HEADER_ALLOW(t) BELLE_SIP_CAST(t,belle_sip_header_allow_t)
jehan's avatar
jehan committed
146
#define BELLE_SIP_ALLOW "Allow"
147

148
/***********************
jehan's avatar
jehan committed
149
 * Contact header object
150
 ************************/
jehan's avatar
jehan committed
151 152
typedef struct _belle_sip_header_contact belle_sip_header_contact_t;

153
BELLESIP_EXPORT belle_sip_header_contact_t* belle_sip_header_contact_new(void);
jehan's avatar
jehan committed
154 155


156
BELLESIP_EXPORT belle_sip_header_contact_t* belle_sip_header_contact_parse (const char* contact) ;
jehan's avatar
jehan committed
157

Sylvain Berfini's avatar
Sylvain Berfini committed
158
BELLESIP_EXPORT belle_sip_header_contact_t* belle_sip_header_contact_create (const belle_sip_header_address_t* contact) ;
jehan's avatar
jehan committed
159

jehan's avatar
jehan committed
160 161 162 163 164 165

/**
* 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.
*
*/
166
 BELLESIP_EXPORT int	belle_sip_header_contact_get_expires(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
167 168 169 170
/**
 * 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.
 */
171
 BELLESIP_EXPORT float	belle_sip_header_contact_get_qvalue(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
172 173 174 175
 /**
  * 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.
  */
Ghislain MARY's avatar
Ghislain MARY committed
176
 BELLESIP_EXPORT unsigned int belle_sip_header_contact_is_wildcard(const belle_sip_header_contact_t* contact);
jehan's avatar
jehan committed
177 178 179
 /**
 *
 */
180
 BELLESIP_EXPORT int belle_sip_header_contact_set_expires(belle_sip_header_contact_t* contact, int expires);
jehan's avatar
jehan committed
181 182 183
/**
 *  Sets the qValue value of the Name Address.
 */
Ghislain MARY's avatar
Ghislain MARY committed
184
 BELLESIP_EXPORT int belle_sip_header_contact_set_qvalue(belle_sip_header_contact_t* contact, float qvalue);
jehan's avatar
jehan committed
185 186 187 188
/**
 * 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: *.
 *
 */
Ghislain MARY's avatar
Ghislain MARY committed
189
 BELLESIP_EXPORT void belle_sip_header_contact_set_wildcard(belle_sip_header_contact_t* contact,unsigned int is_wildcard);
jehan's avatar
jehan committed
190 191 192 193
 /** Contact heaader equality function
  * @return 0 if not equals
  *
  * */
Ghislain MARY's avatar
Ghislain MARY committed
194
 BELLESIP_EXPORT unsigned int belle_sip_header_contact_equals(const belle_sip_header_contact_t* a,const belle_sip_header_contact_t* b);
jehan's avatar
jehan committed
195

196 197 198 199
 /** 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
   *
   * */
Ghislain MARY's avatar
Ghislain MARY committed
200
 BELLESIP_EXPORT unsigned int belle_sip_header_contact_not_equals(const belle_sip_header_contact_t* a,const belle_sip_header_contact_t* b);
201 202 203
 
 /**
  * Enable automatic filling of the contact ip, port and transport according to the channel that sends this message.
204
  * @deprecated use belle_sip_header_address_set_automatic();
205 206 207 208 209
 **/
 BELLESIP_EXPORT void belle_sip_header_contact_set_automatic(belle_sip_header_contact_t *a, int enabled);
 
 BELLESIP_EXPORT int belle_sip_header_contact_get_automatic(const belle_sip_header_contact_t *a);
 
210 211 212 213 214 215 216
 /**
  * Indicates whether a contact in automatic mode (see belle_sip_header_contact_set_automatic()) could be filled properly when the message was sent.
  * If a message is sent through a connection that has just been initiated, public IP and port are unknown, they will be learned after receiving the first response.
  * This can be used by the upper layer to decide to resubmit the request.
 **/
 BELLESIP_EXPORT int belle_sip_header_contact_is_unknown(const belle_sip_header_contact_t *a);
 
217
#define BELLE_SIP_RANDOM_TAG ((const char*)-1)
218
#define BELLE_SIP_HEADER_CONTACT(t) BELLE_SIP_CAST(t,belle_sip_header_contact_t)
jehan's avatar
jehan committed
219
#define BELLE_SIP_CONTACT "Contact"
220
 /******************************
jehan's avatar
jehan committed
221 222
 * From header object inherent from header_address
 *
223
 ******************************/
jehan's avatar
jehan committed
224 225
 typedef struct _belle_sip_header_from belle_sip_header_from_t;

226
 BELLESIP_EXPORT belle_sip_header_from_t* belle_sip_header_from_new(void);
jehan's avatar
jehan committed
227

228
 BELLESIP_EXPORT belle_sip_header_from_t* belle_sip_header_from_create(const belle_sip_header_address_t* address, const char *tag);
jehan's avatar
jehan committed
229

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

232
 BELLESIP_EXPORT belle_sip_header_from_t* belle_sip_header_from_parse(const char* from) ;
jehan's avatar
jehan committed
233

Ghislain MARY's avatar
Ghislain MARY committed
234
 BELLESIP_EXPORT void belle_sip_header_from_set_tag(belle_sip_header_from_t* from, const char* tag);
jehan's avatar
jehan committed
235

236
 BELLESIP_EXPORT const char* belle_sip_header_from_get_tag(const belle_sip_header_from_t* from);
jehan's avatar
jehan committed
237

Ghislain MARY's avatar
Ghislain MARY committed
238
 BELLESIP_EXPORT void belle_sip_header_from_set_random_tag(belle_sip_header_from_t *obj);
239

240
#define BELLE_SIP_HEADER_FROM(t) BELLE_SIP_CAST(t,belle_sip_header_from_t)
jehan's avatar
jehan committed
241
#define BELLE_SIP_FROM "From"
242 243 244 245 246 247
 /******************************
 * To header object inherent from header_address
 *
 ******************************/
 typedef struct _belle_sip_header_to belle_sip_header_to_t;

248
 BELLESIP_EXPORT belle_sip_header_to_t* belle_sip_header_to_new(void);
249

250
 BELLESIP_EXPORT belle_sip_header_to_t* belle_sip_header_to_parse(const char* to) ;
251

252
 BELLESIP_EXPORT belle_sip_header_to_t* belle_sip_header_to_create(const belle_sip_header_address_t *address, const char *tag);
jehan's avatar
jehan committed
253

254
 BELLESIP_EXPORT belle_sip_header_to_t* belle_sip_header_to_create2(const char *address, const char *tag);
255

Ghislain MARY's avatar
Ghislain MARY committed
256
 BELLESIP_EXPORT void belle_sip_header_to_set_tag(belle_sip_header_to_t* from, const char* tag);
257

258
 BELLESIP_EXPORT const char* belle_sip_header_to_get_tag(const belle_sip_header_to_t* from);
jehan's avatar
jehan committed
259

Ghislain MARY's avatar
Ghislain MARY committed
260
 BELLESIP_EXPORT void belle_sip_header_to_set_random_tag(belle_sip_header_to_t *obj);
261

262
#define BELLE_SIP_HEADER_TO(t) BELLE_SIP_CAST(t,belle_sip_header_to_t)
jehan's avatar
jehan committed
263
#define BELLE_SIP_TO "To"
264

jehan's avatar
jehan committed
265 266 267 268 269 270
/******************************
 * Diversion header object inherent from header_address
 *
 ******************************/
 typedef struct _belle_sip_header_diversion belle_sip_header_diversion_t;

271
 BELLESIP_EXPORT belle_sip_header_diversion_t* belle_sip_header_diversion_new(void);
jehan's avatar
jehan committed
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287

 BELLESIP_EXPORT belle_sip_header_diversion_t* belle_sip_header_diversion_parse(const char* diversion) ;

 BELLESIP_EXPORT belle_sip_header_diversion_t* belle_sip_header_diversion_create(const belle_sip_header_address_t *address, const char *tag);

 BELLESIP_EXPORT belle_sip_header_diversion_t* belle_sip_header_diversion_create2(const char *address, const char *tag);

 BELLESIP_EXPORT void belle_sip_header_diversion_set_tag(belle_sip_header_diversion_t* diversion, const char* tag);

 BELLESIP_EXPORT const char* belle_sip_header_diversion_get_tag(const belle_sip_header_diversion_t* from);

 BELLESIP_EXPORT void belle_sip_header_diversion_set_random_tag(belle_sip_header_diversion_t *obj);

#define BELLE_SIP_HEADER_DIVERSION(t) BELLE_SIP_CAST(t,belle_sip_header_diversion_t)
#define BELLE_SIP_DIVERSION "Diversion"

288 289 290 291 292 293
/******************************
 * Via header object inherent from header_address
 *
 ******************************/
typedef struct _belle_sip_header_via belle_sip_header_via_t;

294
BELLESIP_EXPORT belle_sip_header_via_t* belle_sip_header_via_new(void);
Ghislain MARY's avatar
Ghislain MARY committed
295
BELLESIP_EXPORT belle_sip_header_via_t* belle_sip_header_via_create(const char *host, int port, const char *transport, const char *branch);
296 297 298
BELLESIP_EXPORT belle_sip_header_via_t* belle_sip_header_via_parse (const char* via) ;
BELLESIP_EXPORT const char*	belle_sip_header_via_get_branch(const belle_sip_header_via_t* via);
BELLESIP_EXPORT const char*	belle_sip_header_via_get_transport(const belle_sip_header_via_t* via);
299 300 301 302
/**
 * 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
 */
Sylvain Berfini's avatar
Sylvain Berfini committed
303
BELLESIP_EXPORT const char*	belle_sip_header_via_get_transport_lowercase(const belle_sip_header_via_t* via);
304 305
BELLESIP_EXPORT const char*	belle_sip_header_via_get_host(const belle_sip_header_via_t* via);
BELLESIP_EXPORT int belle_sip_header_via_get_port(const belle_sip_header_via_t* via);
Sylvain Berfini's avatar
Sylvain Berfini committed
306
BELLESIP_EXPORT int belle_sip_header_via_get_listening_port(const belle_sip_header_via_t *via);
307

308
BELLESIP_EXPORT const char*	belle_sip_header_via_get_maddr(const belle_sip_header_via_t* via);
309 310
BELLESIP_EXPORT const char*	belle_sip_header_via_get_protocol(const belle_sip_header_via_t* via);
BELLESIP_EXPORT const char*	belle_sip_header_via_get_received(const belle_sip_header_via_t* via);
Sylvain Berfini's avatar
Sylvain Berfini committed
311
BELLESIP_EXPORT int belle_sip_header_via_get_rport(const belle_sip_header_via_t* via);
312
BELLESIP_EXPORT int	belle_sip_header_via_get_ttl(const belle_sip_header_via_t* via);
313

314 315 316 317 318
BELLESIP_EXPORT void belle_sip_header_via_set_branch(belle_sip_header_via_t* via,const char* branch);
BELLESIP_EXPORT void belle_sip_header_via_set_host(belle_sip_header_via_t* via, const char* host);
BELLESIP_EXPORT int belle_sip_header_via_set_port(belle_sip_header_via_t* via,int port);
BELLESIP_EXPORT void belle_sip_header_via_set_maddr(belle_sip_header_via_t* via, const char* maddr);
BELLESIP_EXPORT void belle_sip_header_via_set_protocol(belle_sip_header_via_t* via, const char* protocol);
319
BELLESIP_EXPORT void belle_sip_header_via_set_received(belle_sip_header_via_t* via, const char* received);
320 321 322
BELLESIP_EXPORT int belle_sip_header_via_set_rport(belle_sip_header_via_t* via,int rport);
BELLESIP_EXPORT void belle_sip_header_via_set_transport(belle_sip_header_via_t* via,const char* transport);
BELLESIP_EXPORT int belle_sip_header_via_set_ttl(belle_sip_header_via_t* via, int ttl);
323
#define BELLE_SIP_HEADER_VIA(t) BELLE_SIP_CAST(t,belle_sip_header_via_t)
jehan's avatar
jehan committed
324
#define BELLE_SIP_VIA "Via"
jehan's avatar
jehan committed
325

326 327 328 329
/******************************
 * Call id object inherent from object
 *
 ******************************/
jehan's avatar
jehan committed
330
typedef struct _belle_sip_header_call_id belle_sip_header_call_id_t;
331

332
BELLESIP_EXPORT belle_sip_header_call_id_t* belle_sip_header_call_id_new(void);
333

334 335
BELLESIP_EXPORT belle_sip_header_call_id_t* belle_sip_header_call_id_parse (const char* call_id) ;
BELLESIP_EXPORT const char*	belle_sip_header_call_id_get_call_id(const belle_sip_header_call_id_t* call_id);
Ghislain MARY's avatar
Ghislain MARY committed
336
BELLESIP_EXPORT void belle_sip_header_call_id_set_call_id(belle_sip_header_call_id_t* call_id,const char* id);
337
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
338
#define BELLE_SIP_HEADER_CALL_ID(t) BELLE_SIP_CAST(t,belle_sip_header_call_id_t)
jehan's avatar
jehan committed
339
#define BELLE_SIP_CALL_ID "Call-ID"
340 341 342 343 344 345
/******************************
 * cseq object inherent from object
 *
 ******************************/
typedef struct _belle_sip_header_cseq belle_sip_header_cseq_t;

346
BELLESIP_EXPORT belle_sip_header_cseq_t* belle_sip_header_cseq_new(void);
347 348 349
BELLESIP_EXPORT belle_sip_header_cseq_t* belle_sip_header_cseq_create(unsigned int number, const char *method);
BELLESIP_EXPORT belle_sip_header_cseq_t* belle_sip_header_cseq_parse (const char* cseq) ;
BELLESIP_EXPORT const char*	belle_sip_header_cseq_get_method(const belle_sip_header_cseq_t* cseq);
Ghislain MARY's avatar
Ghislain MARY committed
350
BELLESIP_EXPORT void belle_sip_header_cseq_set_method(belle_sip_header_cseq_t* cseq,const char* method);
351 352
BELLESIP_EXPORT unsigned int	belle_sip_header_cseq_get_seq_number(const belle_sip_header_cseq_t* cseq);
BELLESIP_EXPORT void belle_sip_header_cseq_set_seq_number(belle_sip_header_cseq_t* cseq,unsigned int seq_number);
353
#define BELLE_SIP_HEADER_CSEQ(t) BELLE_SIP_CAST(t,belle_sip_header_cseq_t)
354
#define BELLE_SIP_CSEQ "CSeq"
355 356 357 358 359 360
/******************************
 * content type object inherent from parameters
 *
 ******************************/
typedef struct _belle_sip_header_content_type belle_sip_header_content_type_t;

361
BELLESIP_EXPORT belle_sip_header_content_type_t* belle_sip_header_content_type_new(void);
362 363
BELLESIP_EXPORT belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
BELLESIP_EXPORT belle_sip_header_content_type_t* belle_sip_header_content_type_create (const char* type,const char* sub_type) ;
jehan's avatar
jehan committed
364

Ghislain MARY's avatar
Ghislain MARY committed
365
BELLESIP_EXPORT belle_sip_header_content_type_t* belle_sip_header_content_type_parse (const char* content_type) ;
366
BELLESIP_EXPORT const char*	belle_sip_header_content_type_get_type(const belle_sip_header_content_type_t* content_type);
Ghislain MARY's avatar
Ghislain MARY committed
367
BELLESIP_EXPORT void belle_sip_header_content_type_set_type(belle_sip_header_content_type_t* content_type,const char* type);
368
BELLESIP_EXPORT const char*	belle_sip_header_content_type_get_subtype(const belle_sip_header_content_type_t* content_type);
Ghislain MARY's avatar
Ghislain MARY committed
369
BELLESIP_EXPORT void belle_sip_header_content_type_set_subtype(belle_sip_header_content_type_t* content_type,const char* sub_type);
370
#define BELLE_SIP_HEADER_CONTENT_TYPE(t) BELLE_SIP_CAST(t,belle_sip_header_content_type_t)
jehan's avatar
jehan committed
371
#define BELLE_SIP_CONTENT_TYPE "Content-Type"
372 373 374 375 376 377 378
/******************************
 *
 * Expires inherit from header
 *
 ******************************/
typedef struct _belle_sip_header_expires belle_sip_header_expires_t;

379
BELLESIP_EXPORT belle_sip_header_expires_t* belle_sip_header_expires_new(void);
380

381 382 383
BELLESIP_EXPORT belle_sip_header_expires_t* belle_sip_header_expires_parse (const char* expires) ;
BELLESIP_EXPORT int belle_sip_header_expires_get_expires(const belle_sip_header_expires_t* expires);
BELLESIP_EXPORT void belle_sip_header_expires_set_expires(belle_sip_header_expires_t* expires,int value);
Ghislain MARY's avatar
Ghislain MARY committed
384
BELLESIP_EXPORT int belle_sip_header_expires_decrement_expires(belle_sip_header_expires_t* expires);
385
BELLESIP_EXPORT belle_sip_header_expires_t* belle_sip_header_expires_create(int expires);
386
#define BELLE_SIP_HEADER_EXPIRES(t) BELLE_SIP_CAST(t,belle_sip_header_expires_t)
387
#define BELLE_SIP_EXPIRES "Expires"
388 389 390 391
/******************************
 * Route header object inherent from header_address
 *
 ******************************/
392
typedef struct _belle_sip_header_route belle_sip_header_route_t;
393

394
BELLESIP_EXPORT belle_sip_header_route_t* belle_sip_header_route_new(void);
395 396
BELLESIP_EXPORT belle_sip_header_route_t* belle_sip_header_route_parse (const char* route) ;
BELLESIP_EXPORT belle_sip_header_route_t* belle_sip_header_route_create(const belle_sip_header_address_t* route);
397 398

#define BELLE_SIP_HEADER_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_route_t)
399
#define BELLE_SIP_ROUTE "Route"
400 401 402 403
/******************************
 * Record route header object inherent from header_address
 *
 ******************************/
404
typedef struct _belle_sip_header_record_route belle_sip_header_record_route_t;
405

406
BELLESIP_EXPORT belle_sip_header_record_route_t* belle_sip_header_record_route_new(void);
407
BELLESIP_EXPORT belle_sip_header_record_route_t* belle_sip_header_record_route_parse (const char* route);
408
BELLESIP_EXPORT belle_sip_header_record_route_t* belle_sip_header_record_route_new_auto_outgoing(void);
409 410 411 412

BELLESIP_EXPORT unsigned char belle_sip_header_record_route_get_auto_outgoing(const belle_sip_header_record_route_t *a);
 
 
413

jehan's avatar
jehan committed
414
#define BELLE_SIP_HEADER_RECORD_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_record_route_t)
Simon Morlat's avatar
Simon Morlat committed
415
#define BELLE_SIP_RECORD_ROUTE	"Record-route"
jehan's avatar
jehan committed
416 417 418 419 420 421
 /******************************
  * Service route header object inherent from header_address
  *
  ******************************/
  typedef struct _belle_sip_header_service_route belle_sip_header_service_route_t;

422
  BELLESIP_EXPORT belle_sip_header_service_route_t* belle_sip_header_service_route_new(void);
423
  BELLESIP_EXPORT belle_sip_header_service_route_t* belle_sip_header_service_route_parse (const char* route) ;
jehan's avatar
jehan committed
424 425 426

 #define BELLE_SIP_HEADER_SERVICE_ROUTE(t) BELLE_SIP_CAST(t,belle_sip_header_service_route_t)
 #define BELLE_SIP_SERVICE_ROUTE	"Service-route"
427 428 429 430 431 432 433
 /******************************
  *
  * user-Agent header inherit from header
  *
  ******************************/
 typedef struct _belle_sip_header_user_agent belle_sip_header_user_agent_t;

434
 BELLESIP_EXPORT belle_sip_header_user_agent_t* belle_sip_header_user_agent_new(void);
435

436 437
 BELLESIP_EXPORT belle_sip_header_user_agent_t* belle_sip_header_user_agent_parse (const char* user_agent) ;
 BELLESIP_EXPORT 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
438 439 440 441 442 443 444
 /**
  * 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;
  */
Sylvain Berfini's avatar
Sylvain Berfini committed
445 446 447
 BELLESIP_EXPORT 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);
 BELLESIP_EXPORT void belle_sip_header_user_agent_set_products(belle_sip_header_user_agent_t* user_agent,belle_sip_list_t* value);
 BELLESIP_EXPORT void belle_sip_header_user_agent_add_product(belle_sip_header_user_agent_t* user_agent,const char* product);
448
 #define BELLE_SIP_HEADER_USER_AGENT(t) BELLE_SIP_CAST(t,belle_sip_header_user_agent_t)
jehan's avatar
jehan committed
449
#define BELLE_SIP_USER_AGENT "User-Agent"
450 451

 /******************************
jehan's avatar
jehan committed
452 453 454 455 456
 * Content length inherent from object
 *
 ******************************/
typedef struct _belle_sip_header_content_length belle_sip_header_content_length_t;

457
BELLESIP_EXPORT belle_sip_header_content_length_t* belle_sip_header_content_length_new(void);
jehan's avatar
jehan committed
458

459
BELLESIP_EXPORT belle_sip_header_content_length_t* belle_sip_header_content_length_parse (const char* content_length) ;
460 461 462
BELLESIP_EXPORT belle_sip_header_content_length_t* belle_sip_header_content_length_create (size_t content_length) ;
BELLESIP_EXPORT size_t belle_sip_header_content_length_get_content_length(const belle_sip_header_content_length_t* content_length);
BELLESIP_EXPORT void belle_sip_header_content_length_set_content_length(belle_sip_header_content_length_t* content_length,size_t length);
jehan's avatar
jehan committed
463
#define BELLE_SIP_HEADER_CONTENT_LENGTH(t) BELLE_SIP_CAST(t,belle_sip_header_content_length_t)
jehan's avatar
jehan committed
464
#define BELLE_SIP_CONTENT_LENGTH "Content-Length"
465

466
/******************************
467
 * authorization header inherit from parameters
468 469 470 471
 *
 ******************************/
typedef struct _belle_sip_header_authorization belle_sip_header_authorization_t;

472
BELLESIP_EXPORT belle_sip_header_authorization_t* belle_sip_header_authorization_new(void);
473 474 475 476
BELLESIP_EXPORT belle_sip_header_authorization_t* belle_sip_header_authorization_parse(const char* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_algorithm(const belle_sip_header_authorization_t* authorization );
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_cnonce(const belle_sip_header_authorization_t* authorization );
BELLESIP_EXPORT const char* belle_sip_header_authorization_get_nonce(const belle_sip_header_authorization_t* authorization);
jehan's avatar
jehan committed
477 478 479
/*convert nonce count as string id present
 * @return 0 in case of success
 * */
Ghislain MARY's avatar
Ghislain MARY committed
480
BELLESIP_EXPORT int belle_sip_header_authorization_get_nonce_count_as_string(const belle_sip_header_authorization_t* authorization,char nounce_count[9]);
481 482 483 484 485 486 487 488
BELLESIP_EXPORT int	belle_sip_header_authorization_get_nonce_count(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_opaque(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_qop(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_realm(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_response(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_scheme(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT belle_sip_uri_t* belle_sip_header_authorization_get_uri(const belle_sip_header_authorization_t* authorization);
BELLESIP_EXPORT const char*	belle_sip_header_authorization_get_username(const belle_sip_header_authorization_t* authorization);
Ghislain MARY's avatar
Ghislain MARY committed
489
BELLESIP_EXPORT void belle_sip_header_authorization_set_algorithm(belle_sip_header_authorization_t* authorization, const char* algorithm);
490
BELLESIP_EXPORT void belle_sip_header_authorization_set_cnonce(belle_sip_header_authorization_t* authorization, const char* cNonce);
Ghislain MARY's avatar
Ghislain MARY committed
491
BELLESIP_EXPORT void belle_sip_header_authorization_set_nonce(belle_sip_header_authorization_t* authorization, const char* nonce);
492
BELLESIP_EXPORT void belle_sip_header_authorization_set_nonce_count(belle_sip_header_authorization_t* authorization, int nonceCount);
Ghislain MARY's avatar
Ghislain MARY committed
493
BELLESIP_EXPORT void belle_sip_header_authorization_set_opaque(belle_sip_header_authorization_t* authorization, const char* opaque);
494
BELLESIP_EXPORT void belle_sip_header_authorization_set_qop(belle_sip_header_authorization_t* authorization, const char* qop);
Ghislain MARY's avatar
Ghislain MARY committed
495 496 497 498
BELLESIP_EXPORT void belle_sip_header_authorization_add_qop(belle_sip_header_authorization_t* authorization, const char* qop);
BELLESIP_EXPORT void belle_sip_header_authorization_set_realm(belle_sip_header_authorization_t* authorization, const char* realm);
BELLESIP_EXPORT void belle_sip_header_authorization_set_response(belle_sip_header_authorization_t* authorization, const char* response);
BELLESIP_EXPORT void belle_sip_header_authorization_set_scheme(belle_sip_header_authorization_t* authorization, const char* scheme);
499
BELLESIP_EXPORT void belle_sip_header_authorization_set_uri(belle_sip_header_authorization_t* authorization, belle_sip_uri_t* uri);
Ghislain MARY's avatar
Ghislain MARY committed
500
BELLESIP_EXPORT void belle_sip_header_authorization_set_username(belle_sip_header_authorization_t* authorization, const char* username);
501 502

#define BELLE_SIP_HEADER_AUTHORIZATION(t) BELLE_SIP_CAST(t,belle_sip_header_authorization_t)
503
#define BELLE_SIP_AUTHORIZATION "Authorization"
504

505 506 507 508
/*******************************
 * proxy_authorization inherit from Authorization
 */
typedef struct _belle_sip_header_proxy_authorization belle_sip_header_proxy_authorization_t;
509
BELLESIP_EXPORT belle_sip_header_proxy_authorization_t* belle_sip_header_proxy_authorization_new(void);
510
BELLESIP_EXPORT belle_sip_header_proxy_authorization_t* belle_sip_header_proxy_authorization_parse(const char* proxy_authorization);
511
#define BELLE_SIP_HEADER_PROXY_AUTHORIZATION(t) BELLE_SIP_CAST(t,belle_sip_header_proxy_authorization_t)
512
#define BELLE_SIP_PROXY_AUTHORIZATION "Proxy-Authorization"
513

jehan's avatar
jehan committed
514 515 516 517
/*******************************
 * http_authorization inherit from Authorization
 */
typedef struct _belle_http_header_authorization belle_http_header_authorization_t;
518
BELLESIP_EXPORT belle_http_header_authorization_t* belle_http_header_authorization_new(void);
jehan's avatar
jehan committed
519 520 521 522 523 524 525 526 527
/*cannot be parsed for now
BELLESIP_EXPORT belle_http_header_authorization_t* belle_http_header_authorization_parse(const char* proxy_authorization);
*/
BELLESIP_EXPORT void belle_http_header_authorization_set_uri(belle_http_header_authorization_t* authorization, belle_generic_uri_t* uri);
BELLESIP_EXPORT belle_generic_uri_t* belle_http_header_authorization_get_uri(const belle_http_header_authorization_t* authorization);
#define BELLE_HTTP_HEADER_AUTHORIZATION(t) BELLE_SIP_CAST(t,belle_http_header_authorization_t)
#define BELLE_HTTP_AUTHORIZATION "Authorization"


jehan's avatar
jehan committed
528 529 530 531
/*******************************
 * www_authenticate inherit from parameters
 */
typedef struct _belle_sip_header_www_authenticate belle_sip_header_www_authenticate_t;
532
BELLESIP_EXPORT belle_sip_header_www_authenticate_t* belle_sip_header_www_authenticate_new(void);
533 534 535 536 537
BELLESIP_EXPORT belle_sip_header_www_authenticate_t* belle_sip_header_www_authenticate_parse(const char* www_authenticate);
BELLESIP_EXPORT const char*	belle_sip_header_www_authenticate_get_algorithm(const belle_sip_header_www_authenticate_t* www_authenticate );
BELLESIP_EXPORT const char* belle_sip_header_www_authenticate_get_nonce(const belle_sip_header_www_authenticate_t* www_authenticate);
BELLESIP_EXPORT const char*	belle_sip_header_www_authenticate_get_opaque(const belle_sip_header_www_authenticate_t* www_authenticate);
BELLESIP_EXPORT belle_sip_list_t* belle_sip_header_www_authenticate_get_qop(const belle_sip_header_www_authenticate_t* www_authetication);
Ghislain MARY's avatar
Ghislain MARY committed
538
BELLESIP_EXPORT const char* belle_sip_header_www_authenticate_get_qop_first(const belle_sip_header_www_authenticate_t* www_authetication);
539 540 541 542
BELLESIP_EXPORT const char*	belle_sip_header_www_authenticate_get_realm(const belle_sip_header_www_authenticate_t* www_authenticate);
BELLESIP_EXPORT const char*	belle_sip_header_www_authenticate_get_scheme(const belle_sip_header_www_authenticate_t* www_authenticate);
BELLESIP_EXPORT const char*	belle_sip_header_www_authenticate_get_domain(const belle_sip_header_www_authenticate_t* www_authenticate);
BELLESIP_EXPORT unsigned int belle_sip_header_www_authenticate_is_stale(const belle_sip_header_www_authenticate_t* www_authenticate);
Ghislain MARY's avatar
Ghislain MARY committed
543
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_algorithm(belle_sip_header_www_authenticate_t* www_authenticate, const char* algorithm);
544
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_nonce(belle_sip_header_www_authenticate_t* www_authenticate, const char* nonce);
Ghislain MARY's avatar
Ghislain MARY committed
545 546
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_opaque(belle_sip_header_www_authenticate_t* www_authenticate, const char* opaque);
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_qop(belle_sip_header_www_authenticate_t* www_authentication, belle_sip_list_t*  qop);
547
BELLESIP_EXPORT void belle_sip_header_www_authenticate_add_qop(belle_sip_header_www_authenticate_t* www_authentication, const char*  qop_param);
Ghislain MARY's avatar
Ghislain MARY committed
548 549 550 551
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_realm(belle_sip_header_www_authenticate_t* www_authenticate, const char* realm);
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_scheme(belle_sip_header_www_authenticate_t* www_authenticate, const char* scheme);
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_domain(belle_sip_header_www_authenticate_t* www_authenticate,const char* domain);
BELLESIP_EXPORT void belle_sip_header_www_authenticate_set_stale(belle_sip_header_www_authenticate_t* www_authenticate, unsigned int enable);
jehan's avatar
jehan committed
552
#define BELLE_SIP_HEADER_WWW_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_www_authenticate_t)
jehan's avatar
jehan committed
553
#define BELLE_SIP_WWW_AUTHENTICATE "WWW-Authenticate"
jehan's avatar
jehan committed
554

jehan's avatar
jehan committed
555 556 557 558
/*******************************
 * proxy_authenticate inherit from www_authenticate
 */
typedef struct _belle_sip_header_proxy_authenticate belle_sip_header_proxy_authenticate_t;
559
BELLESIP_EXPORT belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_new(void);
560
BELLESIP_EXPORT belle_sip_header_proxy_authenticate_t* belle_sip_header_proxy_authenticate_parse(const char* proxy_authenticate);
jehan's avatar
jehan committed
561
#define BELLE_SIP_HEADER_PROXY_AUTHENTICATE(t) BELLE_SIP_CAST(t,belle_sip_header_proxy_authenticate_t)
jehan's avatar
jehan committed
562
#define BELLE_SIP_PROXY_AUTHENTICATE "Proxy-Authenticate"
jehan's avatar
jehan committed
563

jehan's avatar
jehan committed
564 565 566 567 568 569 570
/******************************
 *
 * Max forward inherit from header
 *
 ******************************/
typedef struct _belle_sip_header_max_forwards belle_sip_header_max_forwards_t;

571
BELLESIP_EXPORT belle_sip_header_max_forwards_t* belle_sip_header_max_forwards_new(void);
572
BELLESIP_EXPORT belle_sip_header_max_forwards_t* belle_sip_header_max_forwards_create(int value);
jehan's avatar
jehan committed
573

574 575
BELLESIP_EXPORT belle_sip_header_max_forwards_t* belle_sip_header_max_forwards_parse (const char* max_forwards) ;
BELLESIP_EXPORT int belle_sip_header_max_forwards_get_max_forwards(const belle_sip_header_max_forwards_t* max_forwards);
Ghislain MARY's avatar
Ghislain MARY committed
576
BELLESIP_EXPORT void belle_sip_header_max_forwards_set_max_forwards(belle_sip_header_max_forwards_t* max_forwards,int value);
577
BELLESIP_EXPORT int belle_sip_header_max_forwards_decrement_max_forwards(belle_sip_header_max_forwards_t* max_forwards);
jehan's avatar
jehan committed
578
#define BELLE_SIP_HEADER_MAX_FORWARDS(t) BELLE_SIP_CAST(t,belle_sip_header_max_forwards_t)
jehan's avatar
jehan committed
579 580 581 582 583 584 585 586 587
#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;

588
BELLESIP_EXPORT belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_new(void);
jehan's avatar
jehan committed
589

590
BELLESIP_EXPORT belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_parse (const char* subscription_state) ;
Sylvain Berfini's avatar
Sylvain Berfini committed
591
BELLESIP_EXPORT belle_sip_header_subscription_state_t* belle_sip_header_subscription_state_create (const char* subscription_state,int expires);
jehan's avatar
jehan committed
592

593 594
BELLESIP_EXPORT const char* belle_sip_header_subscription_state_get_state(const belle_sip_header_subscription_state_t* subscription_state);
BELLESIP_EXPORT int belle_sip_header_subscription_state_get_expires(const belle_sip_header_subscription_state_t* subscription_state);
Ghislain MARY's avatar
Ghislain MARY committed
595 596
BELLESIP_EXPORT const char* belle_sip_header_subscription_state_get_reason(const belle_sip_header_subscription_state_t* subscription_state);
BELLESIP_EXPORT int belle_sip_header_subscription_state_get_retry_after(const belle_sip_header_subscription_state_t* subscription_state);
jehan's avatar
jehan committed
597

Ghislain MARY's avatar
Ghislain MARY committed
598 599 600 601
BELLESIP_EXPORT void belle_sip_header_subscription_state_set_state(belle_sip_header_subscription_state_t* subscription_state,const char* state);
BELLESIP_EXPORT void belle_sip_header_subscription_state_set_expires(belle_sip_header_subscription_state_t* subscription_state,int expire);
BELLESIP_EXPORT void belle_sip_header_subscription_state_set_reason(belle_sip_header_subscription_state_t* subscription_state, const char* reason);
BELLESIP_EXPORT void belle_sip_header_subscription_state_set_retry_after(belle_sip_header_subscription_state_t* subscription_state, int retry_after );
jehan's avatar
jehan committed
602 603 604 605 606 607 608


#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"
609

jehan's avatar
jehan committed
610
/******************************
611
 * Refer-To header object inherits from header_address
jehan's avatar
jehan committed
612 613 614
 *
 ******************************/
 typedef struct _belle_sip_header_refer_to belle_sip_header_refer_to_t;
615
 BELLESIP_EXPORT belle_sip_header_refer_to_t* belle_sip_header_refer_to_new(void);
jehan's avatar
jehan committed
616 617 618 619 620
 BELLESIP_EXPORT belle_sip_header_refer_to_t* belle_sip_header_refer_to_parse(const char* refer_to) ;
 BELLESIP_EXPORT belle_sip_header_refer_to_t* belle_sip_header_refer_to_create(const belle_sip_header_address_t *address);
#define BELLE_SIP_HEADER_REFER_TO(t) BELLE_SIP_CAST(t,belle_sip_header_refer_to_t)
#define BELLE_SIP_REFER_TO "Refer-To"

jehan's avatar
jehan committed
621
 /******************************
622
  * Referred-by header object inherits from header_address
jehan's avatar
jehan committed
623 624 625
  *
  ******************************/
  typedef struct _belle_sip_header_referred_by belle_sip_header_referred_by_t;
626
  BELLESIP_EXPORT belle_sip_header_referred_by_t* belle_sip_header_referred_by_new(void);
jehan's avatar
jehan committed
627 628 629 630 631 632
  BELLESIP_EXPORT belle_sip_header_referred_by_t* belle_sip_header_referred_by_parse(const char* referred_by) ;
  BELLESIP_EXPORT belle_sip_header_referred_by_t* belle_sip_header_referred_by_create(const belle_sip_header_address_t *address);
 #define BELLE_SIP_HEADER_REFERRED_BY(t) BELLE_SIP_CAST(t,belle_sip_header_referred_by_t)
 #define BELLE_SIP_REFERRED_BY "Referred-By"

  /******************************
633
   * Replace header object inherits from parameters
jehan's avatar
jehan committed
634 635 636
   *
   ******************************/
typedef struct _belle_sip_header_replaces belle_sip_header_replaces_t;
637
BELLESIP_EXPORT belle_sip_header_replaces_t* belle_sip_header_replaces_new(void);
jehan's avatar
jehan committed
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
BELLESIP_EXPORT belle_sip_header_replaces_t* belle_sip_header_replaces_parse(const char* replaces) ;

BELLESIP_EXPORT belle_sip_header_replaces_t* belle_sip_header_replaces_create(const char* call_id,const char* from_tag,const char* to_tag);
/*
 * Creates a Eeplaces header from an escaped value that can be found in Referred-by header
 * @param escaped_replace ex : 12345%40192.168.118.3%3Bto-tag%3D12345%3Bfrom-tag%3D5FFE-3994
 * @return a newly allocated Replace header
 * */
BELLESIP_EXPORT belle_sip_header_replaces_t* belle_sip_header_replaces_create2(const char* escaped_replace);
BELLESIP_EXPORT const char* belle_sip_header_replaces_get_call_id(const belle_sip_header_replaces_t* obj);
BELLESIP_EXPORT const char* belle_sip_header_replaces_get_from_tag(const belle_sip_header_replaces_t* obj);
BELLESIP_EXPORT const char* belle_sip_header_replaces_get_to_tag(const belle_sip_header_replaces_t* obj);
BELLESIP_EXPORT void belle_sip_header_replaces_set_call_id(belle_sip_header_replaces_t* obj, const char* callid);
BELLESIP_EXPORT void belle_sip_header_replaces_set_from_tag(belle_sip_header_replaces_t* obj,const char* from_tag);
BELLESIP_EXPORT void belle_sip_header_replaces_set_to_tag(belle_sip_header_replaces_t* obj,const char* to_tag);
653 654 655 656 657
/*return a newly allocated string with the content of the header value in escaped form.
 * <br> Purpose of this function is to be used to set Refer-To uri header Replaces
 * @param obj Replaces object
 * @return newly allocated string ex: 12345%40192.168.118.3%3Bto-tag%3D12345%3Bfrom-tag%3D5FFE-3994*/
BELLESIP_EXPORT char* belle_sip_header_replaces_value_to_escaped_string(const belle_sip_header_replaces_t* obj);
jehan's avatar
jehan committed
658 659 660
#define BELLE_SIP_HEADER_REPLACES(t) BELLE_SIP_CAST(t,belle_sip_header_replaces_t)
#define BELLE_SIP_REPLACES "Replaces"

Simon Morlat's avatar
Simon Morlat committed
661 662 663
/*******
 * Date header
 *******/
jehan's avatar
jehan committed
664

Simon Morlat's avatar
Simon Morlat committed
665 666
typedef struct belle_sip_header_date belle_sip_header_date_t;

667
BELLESIP_EXPORT belle_sip_header_date_t* belle_sip_header_date_new(void);
Simon Morlat's avatar
Simon Morlat committed
668 669 670 671 672 673 674 675 676 677 678 679 680 681
BELLESIP_EXPORT belle_sip_header_date_t* belle_sip_header_date_parse(const char* date) ;

BELLESIP_EXPORT belle_sip_header_date_t* belle_sip_header_date_create_from_time(const time_t *utc_time);

BELLESIP_EXPORT time_t belle_sip_header_date_get_time(belle_sip_header_date_t *obj);

BELLESIP_EXPORT void belle_sip_header_date_set_time(belle_sip_header_date_t *obj, const time_t *utc_time);

BELLESIP_EXPORT const char * belle_sip_header_date_get_date(const belle_sip_header_date_t *obj);

BELLESIP_EXPORT void belle_sip_header_date_set_date(belle_sip_header_date_t *obj, const char *date);

#define BELLE_SIP_HEADER_DATE(obj)	BELLE_SIP_CAST(obj,belle_sip_header_date_t)
#define BELLE_SIP_DATE "Date"
682

jehan's avatar
jehan committed
683
/******************************
jehan's avatar
jehan committed
684
* P-Preferred-Identity header object inherent from header_address
jehan's avatar
jehan committed
685 686 687 688
*
******************************/
typedef struct _belle_sip_header_p_preferred_identity belle_sip_header_p_preferred_identity_t;

689
BELLESIP_EXPORT belle_sip_header_p_preferred_identity_t* belle_sip_header_p_preferred_identity_new(void);
jehan's avatar
jehan committed
690 691 692 693 694 695 696 697

BELLESIP_EXPORT belle_sip_header_p_preferred_identity_t* belle_sip_header_p_preferred_identity_parse(const char* p_preferred_identity) ;

BELLESIP_EXPORT belle_sip_header_p_preferred_identity_t* belle_sip_header_p_preferred_identity_create(const belle_sip_header_address_t *address);

#define BELLE_SIP_HEADER_P_PREFERRED_IDENTITY(t) BELLE_SIP_CAST(t,belle_sip_header_p_preferred_identity_t)
#define BELLE_SIP_P_PREFERRED_IDENTITY "P-Preferred-Identity"

jehan's avatar
jehan committed
698 699 700 701 702 703
/******************************
* Privacy header object inherent from header
*
******************************/
typedef struct _belle_sip_header_privacy belle_sip_header_privacy_t;

704
BELLESIP_EXPORT belle_sip_header_privacy_t* belle_sip_header_privacy_new(void);
jehan's avatar
jehan committed
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719

BELLESIP_EXPORT belle_sip_header_privacy_t* belle_sip_header_privacy_parse(const char* privacy) ;

BELLESIP_EXPORT belle_sip_header_privacy_t* belle_sip_header_privacy_create(const char* privacy);

BELLESIP_EXPORT void belle_sip_header_privacy_add_privacy(belle_sip_header_privacy_t* privacy, const char* value);

BELLESIP_EXPORT void belle_sip_header_privacy_set_privacy(belle_sip_header_privacy_t* privacy, belle_sip_list_t* privacy_values);

BELLESIP_EXPORT belle_sip_list_t* belle_sip_header_privacy_get_privacy(const belle_sip_header_privacy_t* privacy);


#define BELLE_SIP_HEADER_PRIVACY(t) BELLE_SIP_CAST(t,belle_sip_header_privacy_t)
#define BELLE_SIP_PRIVACY "Privacy"

720 721 722 723 724 725

/******************************
* Event header object inherent from parameters
*
******************************/
typedef struct _belle_sip_header_event belle_sip_header_event_t;
726
BELLESIP_EXPORT belle_sip_header_event_t* belle_sip_header_event_new(void);
727 728 729 730 731 732 733 734 735
BELLESIP_EXPORT belle_sip_header_event_t* belle_sip_header_event_parse(const char* event) ;
BELLESIP_EXPORT belle_sip_header_event_t* belle_sip_header_event_create(const char* event);
BELLESIP_EXPORT const char* belle_sip_header_event_get_package_name(const belle_sip_header_event_t* event);
BELLESIP_EXPORT void belle_sip_header_event_set_package_name(belle_sip_header_event_t* event, const char* package_name);
BELLESIP_EXPORT const char* belle_sip_header_event_get_id(const belle_sip_header_event_t* event);
BELLESIP_EXPORT void belle_sip_header_event_set_id(belle_sip_header_event_t* event, const char* id);
#define BELLE_SIP_HEADER_EVENT(t) BELLE_SIP_CAST(t,belle_sip_header_event_t)
#define BELLE_SIP_EVENT "Event"

jehan's avatar
jehan committed
736 737 738 739 740 741

/******************************
 * Supported header object inherent from header
 *
 ******************************/
typedef struct _belle_sip_header_supported belle_sip_header_supported_t;
742
BELLESIP_EXPORT belle_sip_header_supported_t* belle_sip_header_supported_new(void);
jehan's avatar
jehan committed
743 744 745 746 747 748 749 750
BELLESIP_EXPORT belle_sip_header_supported_t* belle_sip_header_supported_parse(const char* supported) ;
BELLESIP_EXPORT belle_sip_header_supported_t* belle_sip_header_supported_create(const char* supported);
BELLESIP_EXPORT void belle_sip_header_supported_add_supported(belle_sip_header_supported_t* supported, const char* value);
BELLESIP_EXPORT void belle_sip_header_supported_set_supported(belle_sip_header_supported_t* supported, belle_sip_list_t* supported_values);
BELLESIP_EXPORT belle_sip_list_t* belle_sip_header_supported_get_supported(const belle_sip_header_supported_t* supported);
#define BELLE_SIP_HEADER_SUPPORTED(t) BELLE_SIP_CAST(t,belle_sip_header_supported_t)
#define BELLE_SIP_SUPPORTED "Supported"

751 752 753 754 755
/******************************
 * Content Disposition header object inherent from header
 *
 ******************************/
typedef struct _belle_sip_header_content_disposition belle_sip_header_content_disposition_t;
756
BELLESIP_EXPORT belle_sip_header_content_disposition_t* belle_sip_header_content_disposition_new(void);
757 758 759 760
BELLESIP_EXPORT belle_sip_header_content_disposition_t* belle_sip_header_content_disposition_parse (const char* content_disposition) ;
BELLESIP_EXPORT belle_sip_header_content_disposition_t* belle_sip_header_content_disposition_create (const char* content_disposition);
BELLESIP_EXPORT const char* belle_sip_header_content_disposition_get_content_disposition(const belle_sip_header_content_disposition_t* content_disposition);
BELLESIP_EXPORT void belle_sip_header_content_disposition_set_content_disposition(belle_sip_header_content_disposition_t* obj,const char* content_disposition);
761 762 763 764 765 766 767 768
#define BELLE_SIP_HEADER_CONTENT_DISPOSITION(t) BELLE_SIP_CAST(t,belle_sip_header_content_disposition_t)
#define BELLE_SIP_CONTENT_DISPOSITION "Content-Disposition"

/******************************
 * Accept header object inherent from parameters
 *
 ******************************/
typedef struct _belle_sip_header_accept belle_sip_header_accept_t;
769
BELLESIP_EXPORT belle_sip_header_accept_t* belle_sip_header_accept_new(void);
770 771 772 773 774 775 776 777 778 779
BELLESIP_EXPORT belle_sip_header_accept_t* belle_sip_header_accept_parse (const char* accept) ;
BELLESIP_EXPORT belle_sip_header_accept_t* belle_sip_header_accept_create (const char* type,const char* sub_type) ;
BELLESIP_EXPORT belle_sip_header_accept_t* belle_sip_header_accept_parse (const char* accept) ;
BELLESIP_EXPORT const char*	belle_sip_header_accept_get_type(const belle_sip_header_accept_t* accept);
BELLESIP_EXPORT void belle_sip_header_accept_set_type(belle_sip_header_accept_t* accept,const char* type);
BELLESIP_EXPORT const char*	belle_sip_header_accept_get_subtype(const belle_sip_header_accept_t* accept);
BELLESIP_EXPORT void belle_sip_header_accept_set_subtype(belle_sip_header_accept_t* accept,const char* sub_type);
#define BELLE_SIP_HEADER_ACCEPT(t) BELLE_SIP_CAST(t,belle_sip_header_accept_t)
#define BELLE_SIP_ACCEPT "Accept"

jehan's avatar
jehan committed
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796
/******************************
 * Reason header object inherent from parameters
 *
 ******************************/
typedef struct _belle_sip_header_reason belle_sip_header_reason_t;
BELLESIP_EXPORT belle_sip_header_reason_t* belle_sip_header_reason_new(void);
BELLESIP_EXPORT belle_sip_header_reason_t* belle_sip_header_reason_parse (const char* reason) ;
BELLESIP_EXPORT const char*	belle_sip_header_reason_get_protocol(const belle_sip_header_reason_t* reason);
BELLESIP_EXPORT void belle_sip_header_reason_set_protocol(belle_sip_header_reason_t* reason,const char* protocol);
BELLESIP_EXPORT int	belle_sip_header_reason_get_cause(const belle_sip_header_reason_t* reason);
BELLESIP_EXPORT void belle_sip_header_reason_set_cause(belle_sip_header_reason_t* reason,int cause);
BELLESIP_EXPORT void belle_sip_header_reason_set_text(belle_sip_header_reason_t* reason,const char* text);
BELLESIP_EXPORT const char*	belle_sip_header_reason_get_text(const belle_sip_header_reason_t* reason);

#define BELLE_SIP_HEADER_REASON(t) BELLE_SIP_CAST(t,belle_sip_header_reason_t)
#define BELLE_SIP_REASON "Reason"

797

jehan's avatar
jehan committed
798
/******************************
jehan's avatar
jehan committed
799
 * Authentication-Info header inherit from header
jehan's avatar
jehan committed
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825
 *
 ******************************/
typedef struct _belle_sip_header_authentication_info belle_sip_header_authentication_info_t;

BELLESIP_EXPORT belle_sip_header_authentication_info_t* belle_sip_header_authentication_info_new(void);
BELLESIP_EXPORT belle_sip_header_authentication_info_t* belle_sip_header_authentication_info_parse(const char* authentication_info );
BELLESIP_EXPORT const char*	belle_sip_header_authentication_info_get_next_nonce(const belle_sip_header_authentication_info_t* authentication_info );
BELLESIP_EXPORT void belle_sip_header_authentication_info_set_next_nonce(belle_sip_header_authentication_info_t* authentication_info, const char* next_nonce);

/*limited to a sinle value*/
BELLESIP_EXPORT const char*	belle_sip_header_authentication_info_get_qop(const belle_sip_header_authentication_info_t* authentication_info);
BELLESIP_EXPORT void belle_sip_header_authentication_info_set_qop(belle_sip_header_authentication_info_t* authentication_info, const char* qop);

BELLESIP_EXPORT const char*	belle_sip_header_authentication_info_get_rsp_auth(const belle_sip_header_authentication_info_t* rsp_auth);
BELLESIP_EXPORT void belle_sip_header_authentication_info_set_rsp_auth(belle_sip_header_authentication_info_t* authentication_info, const char* rsp_auth);

BELLESIP_EXPORT const char* belle_sip_header_authentication_info_get_cnonce(const belle_sip_header_authentication_info_t* authentication_info);
BELLESIP_EXPORT void belle_sip_header_authentication_info_set_cnonce(belle_sip_header_authentication_info_t* authentication_info, const char* cNonce);

BELLESIP_EXPORT void belle_sip_header_authentication_info_set_nonce_count(belle_sip_header_authentication_info_t* authentication_info, int nonceCount);
BELLESIP_EXPORT int	belle_sip_header_authentication_info_get_nonce_count(const belle_sip_header_authentication_info_t* authentication_info);


#define BELLE_SIP_HEADER_AUTHENTICATION_INFO(t) BELLE_SIP_CAST(t,belle_sip_header_authentication_info_t)
#define BELLE_SIP_AUTHENTICATION_INFO "Authentication-Info"

826 827 828
BELLE_SIP_END_DECLS


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