/usr/include/osipparser2/sdp_message.h is in libosip2-dev 4.1.0-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 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 39 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | /*
The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SDP_H_
#define _SDP_H_
#ifdef ENABLE_MPATROL
#include <mpatrol.h>
#endif
#include <osipparser2/osip_list.h>
/**
* @file sdp_message.h
* @brief oSIP SDP parser Routines
*
* This is the SDP accessor and parser related API.
*/
/**
* @defgroup oSIP_SDP oSIP SDP parser Handling
* @ingroup osip2_sdp
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Structure for referencing bandwidth header.
* @var sdp_bandwidth_t
*/
typedef struct sdp_bandwidth sdp_bandwidth_t;
/**
* SDP bandwidth definition.
* @struct sdp_bandwidth
*/
struct sdp_bandwidth {
char *b_bwtype; /**< bandwidth type */
char *b_bandwidth; /**< bandwidth value */
};
/**
* Allocate a bandwidth element.
* @param elem The element to work on.
*/
int sdp_bandwidth_init (sdp_bandwidth_t ** elem);
/**
* Free a bandwidth element.
* @param elem The element to work on.
*/
void sdp_bandwidth_free (sdp_bandwidth_t * elem);
/**
* Structure for referencing time description header.
* @var sdp_time_descr_t
*/
typedef struct sdp_time_descr sdp_time_descr_t;
/**
* SDP Time description definition.
* @struct sdp_time_descr
*/
struct sdp_time_descr {
char *t_start_time; /**< start time */
char *t_stop_time; /**< stop time */
osip_list_t r_repeats; /**< repeat headers */
};
/**
* Allocate a time description element.
* @param elem The element to work on.
*/
int sdp_time_descr_init (sdp_time_descr_t ** elem);
/**
* Free a time description element.
* @param elem The element to work on.
*/
void sdp_time_descr_free (sdp_time_descr_t * elem);
/**
* Structure for referencing key header.
* @var sdp_key_t
*/
typedef struct sdp_key sdp_key_t;
/**
* SDP key definition.
* @struct sdp_key
*/
struct sdp_key {
char *k_keytype; /**< Key Type (prompt, clear, base64, uri) */
char *k_keydata; /**< key data */
};
/**
* Allocate a key element.
* @param elem The element to work on.
*/
int sdp_key_init (sdp_key_t ** elem);
/**
* Free a key element.
* @param elem The element to work on.
*/
void sdp_key_free (sdp_key_t * elem);
/**
* Structure for referencing an attribute header.
* @var sdp_attribute_t
*/
typedef struct sdp_attribute sdp_attribute_t;
/**
* SDP attribute definition.
* @struct sdp_attribute
*/
struct sdp_attribute {
char *a_att_field; /**< attribute field */
char *a_att_value; /**< attribute value (optional) */
};
/**
* Allocate an attribute element.
* @param elem The element to work on.
*/
int sdp_attribute_init (sdp_attribute_t ** elem);
/**
* Free a attribute element.
* @param elem The element to work on.
*/
void sdp_attribute_free (sdp_attribute_t * elem);
/**
* Structure for referencing a connection header.
* @var sdp_connection_t
*/
typedef struct sdp_connection sdp_connection_t;
/**
* SDP connection definition.
* @struct sdp_connection
*/
struct sdp_connection {
char *c_nettype; /**< Network Type */
char *c_addrtype; /**< Network Address Type */
char *c_addr; /**< Address */
char *c_addr_multicast_ttl;
/**< TTL value for multicast address */
char *c_addr_multicast_int;
/**< Number of multicast address */
};
/**
* Allocate a connection element.
* @param elem The element to work on.
*/
int sdp_connection_init (sdp_connection_t ** elem);
/**
* Free a connection element.
* @param elem The element to work on.
*/
void sdp_connection_free (sdp_connection_t * elem);
/**
* Structure for referencing a media header.
* @var sdp_media_t
*/
typedef struct sdp_media sdp_media_t;
/**
* SDP media definition.
* @struct sdp_media
*/
struct sdp_media {
char *m_media; /**< media type */
char *m_port; /**< port number */
char *m_number_of_port; /**< number of port */
char *m_proto; /**< protocol to be used */
osip_list_t m_payloads; /**< list of payloads (as strings) */
char *i_info; /**< information header */
osip_list_t c_connections;
/**< list of sdp_connection_t * */
osip_list_t b_bandwidths;
/**< list of sdp_bandwidth_t * */
osip_list_t a_attributes;
/**< list of sdp_attribute_t * */
sdp_key_t *k_key; /**< key informations */
};
/**
* Allocate a media element.
* @param elem The element to work on.
*/
int sdp_media_init (sdp_media_t ** elem);
/**
* Free a media element.
* @param elem The element to work on.
*/
void sdp_media_free (sdp_media_t * elem);
/**
* Structure for referencing a SDP packet.
* @var sdp_message_t
*/
typedef struct sdp_message sdp_message_t;
/**
* SDP message definition.
* @struct sdp_message
*/
struct sdp_message {
char *v_version; /**< version header */
char *o_username; /**< Username */
char *o_sess_id; /**< Identifier for session */
char *o_sess_version; /**< Version of session */
char *o_nettype; /**< Network type */
char *o_addrtype; /**< Address type */
char *o_addr; /**< Address */
char *s_name; /**< Subject header */
char *i_info; /**< Information header */
char *u_uri; /**< Uri header */
osip_list_t e_emails; /**< list of mail address */
osip_list_t p_phones; /**< list of phone numbers * */
sdp_connection_t *c_connection;
/**< Connection information */
osip_list_t b_bandwidths;
/**< list of bandwidth info (sdp_bandwidth_t) */
osip_list_t t_descrs; /**< list of time description (sdp_time_descr_t) */
char *z_adjustments; /**< Time adjustment header */
sdp_key_t *k_key; /**< Key information header */
osip_list_t a_attributes;
/**< list of global attributes (sdp_attribute_t) */
osip_list_t m_medias; /**< list of supported media (sdp_media_t) */
};
/**
* Allocate a SDP packet.
* @param sdp The element to work on.
*/
int sdp_message_init (sdp_message_t ** sdp);
/**
* Parse a SDP packet.
* @param sdp The element to work on.
* @param buf The buffer to parse.
*/
int sdp_message_parse (sdp_message_t * sdp, const char *buf);
/**
* Get a string representation of a SDP packet.
* @param sdp The element to work on.
* @param dest The resulting new allocated buffer.
*/
int sdp_message_to_str (sdp_message_t * sdp, char **dest);
/**
* Free a SDP packet.
* @param sdp The element to work on.
*/
void sdp_message_free (sdp_message_t * sdp);
/**
* Clone a SDP packet.
* @param sdp The element to work on.
* @param dest The cloned element.
*/
int sdp_message_clone (sdp_message_t * sdp, sdp_message_t ** dest);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_v_version_set (sdp_message_t * sdp, char *value);
/**
* Get the version ('v' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_v_version_get (sdp_message_t * sdp);
/**
* Set the origin field in a SDP packet.
* @param sdp The element to work on.
* @param username The token value.
* @param sess_id The token value.
* @param sess_version The token value.
* @param nettype The token value.
* @param addrtype The token value.
* @param addr The token value.
*/
int sdp_message_o_origin_set (sdp_message_t * sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr);
/**
* Get the username ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_username_get (sdp_message_t * sdp);
/**
* Get the session id ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_sess_id_get (sdp_message_t * sdp);
/**
* Get the session version ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_sess_version_get (sdp_message_t * sdp);
/**
* Get the nettype ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_nettype_get (sdp_message_t * sdp);
/**
* Get the addrtype ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_addrtype_get (sdp_message_t * sdp);
/**
* Get the addr ('o' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_o_addr_get (sdp_message_t * sdp);
/**
* Set the session name in a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_s_name_set (sdp_message_t * sdp, char *value);
/**
* Get the session name ('s' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_s_name_get (sdp_message_t * sdp);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param value The token value.
*/
int sdp_message_i_info_set (sdp_message_t * sdp, int pos_media, char *value);
/**
* Get the session info ('i' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
*/
char *sdp_message_i_info_get (sdp_message_t * sdp, int pos_media);
/**
* Set the session info in a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_u_uri_set (sdp_message_t * sdp, char *value);
/**
* Get the uri ('u' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_u_uri_get (sdp_message_t * sdp);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_e_email_add (sdp_message_t * sdp, char *value);
/**
* OBSOLETE: see sdp_message_e_email_get
* @def sdp_e_email_get
*/
#define sdp_e_email_get sdp_message_e_email_get
/**
* Get one of the email ('e' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos the index of the email line.
*/
char *sdp_message_e_email_get (sdp_message_t * sdp, int pos);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_p_phone_add (sdp_message_t * sdp, char *value);
/**
* Get one of the phone ('p' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos the index of the phone line.
*/
char *sdp_message_p_phone_get (sdp_message_t * sdp, int pos);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param nettype The token value.
* @param addrtype The token value.
* @param addr The token value.
* @param addr_multicast_ttl The token value.
* @param addr_multicast_int The token value.
*/
int sdp_message_c_connection_add (sdp_message_t * sdp, int pos_media, char *nettype, char *addrtype, char *addr, char *addr_multicast_ttl, char *addr_multicast_int);
#ifndef DOXYGEN
/* this method should be internal only... */
sdp_connection_t *sdp_message_connection_get (sdp_message_t * sdp, int pos_media, int pos);
#endif
/**
* Get the network type ('c' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the connection element list..
*/
char *sdp_message_c_nettype_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the address type ('c' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the connection element list..
*/
char *sdp_message_c_addrtype_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the address ('c' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the connection element list..
*/
char *sdp_message_c_addr_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the multicast ttl ('c' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the connection element list..
*/
char *sdp_message_c_addr_multicast_ttl_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the multicast int info ('c' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the connection element list..
*/
char *sdp_message_c_addr_multicast_int_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param bwtype The token value.
* @param bandwidth The token value.
*/
int sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media, char *bwtype, char *bandwidth);
/**
* Get the bandwidth ('b' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the bandwidth element list..
*/
sdp_bandwidth_t *sdp_message_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the bandwidth type ('b' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the bandwidth element list..
*/
char *sdp_message_b_bwtype_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the bandwidth value ('b' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The index in the bandwidth element list..
*/
char *sdp_message_b_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param start The token value.
* @param stop The token value.
*/
int sdp_message_t_time_descr_add (sdp_message_t * sdp, char *start, char *stop);
/**
* Get the start time value ('t' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_td The time description line number.
*/
char *sdp_message_t_start_time_get (sdp_message_t * sdp, int pos_td);
/**
* Get the stop time value ('t' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_td The time description line number.
*/
char *sdp_message_t_stop_time_get (sdp_message_t * sdp, int pos_td);
/**
* Set the repeat information ('r' field) in a SDP packet.
* @param sdp The element to work on.
* @param pos_time_descr index of t field.
* @param value The token value.
*/
int sdp_message_r_repeat_add (sdp_message_t * sdp, int pos_time_descr, char *value);
/**
* Get the repeat information ('r' field) in a SDP packet.
* @param sdp The element to work on.
* @param pos_time_descr index of t field.
* @param pos_repeat index of element in the 'r' field.
*/
char *sdp_message_r_repeat_get (sdp_message_t * sdp, int pos_time_descr, int pos_repeat);
/**
* Set the adjustments ('z' field) of a SDP packet.
* @param sdp The element to work on.
* @param value The token value.
*/
int sdp_message_z_adjustments_set (sdp_message_t * sdp, char *value);
/**
* Get the adjustments ('z' field) of a SDP packet.
* @param sdp The element to work on.
*/
char *sdp_message_z_adjustments_get (sdp_message_t * sdp);
/**
* Add a key in a SDP packet.
* @param sdp The element to work on.
* @param pos_media index of m field.
* @param keytype The token value.
* @param keydata The token value.
*/
int sdp_message_k_key_set (sdp_message_t * sdp, int pos_media, char *keytype, char *keydata);
/**
* Get the key type ('k' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
*/
char *sdp_message_k_keytype_get (sdp_message_t * sdp, int pos_media);
/**
* Get the key value ('k' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
*/
char *sdp_message_k_keydata_get (sdp_message_t * sdp, int pos_media);
/**
* Set the version in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param att_field The token value.
* @param att_value The token value.
*/
int sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media, char *att_field, char *att_value);
/**
* delete all attribute fields specified by att_field.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param att_field The value to remove.
*/
int sdp_message_a_attribute_del (sdp_message_t * sdp, int pos_media, char *att_field);
/**
* delete one specific attribute fields specified by att_field.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param att_field The value to remove.
* @param pos_attr The index of attribute to remove.
*/
int sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media, char *att_field, int pos_attr);
/**
* Get one of the attribute ('a' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The attribute line number.
*/
sdp_attribute_t *sdp_message_attribute_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the attribute name ('a' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The attribute line number.
*/
char *sdp_message_a_att_field_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Get the attribute value ('a' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The media line number.
* @param pos The attribute line number.
*/
char *sdp_message_a_att_value_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Check if there is more media lines a SDP packet.
* @param sdp The element to work on.
* @param pos The attribute line number.
*/
int sdp_message_endof_media (sdp_message_t * sdp, int pos);
/**
* Add a media line in a SDP packet.
* @param sdp The element to work on.
* @param media The token value.
* @param port The token value.
* @param number_of_port The token value.
* @param proto The token value.
*/
int sdp_message_m_media_add (sdp_message_t * sdp, char *media, char *port, char *number_of_port, char *proto);
/**
* Get the media type ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
*/
char *sdp_message_m_media_get (sdp_message_t * sdp, int pos_media);
/**
* Get the port number ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
*/
char *sdp_message_m_port_get (sdp_message_t * sdp, int pos_media);
/**
* Set the port number ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param port The new port to set (must be allocated with osip_malloc)
*/
int sdp_message_m_port_set (sdp_message_t * sdp, int pos_media, char *port);
/**
* Get the number of port ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
*/
char *sdp_message_m_number_of_port_get (sdp_message_t * sdp, int pos_media);
/**
* Get the protocol ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
*/
char *sdp_message_m_proto_get (sdp_message_t * sdp, int pos_media);
/**
* Set the payload in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param payload The token value.
*/
int sdp_message_m_payload_add (sdp_message_t * sdp, int pos_media, char *payload);
/**
* Get one of the payload number ('m' field) of a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param pos The i th payload element.
*/
char *sdp_message_m_payload_get (sdp_message_t * sdp, int pos_media, int pos);
/**
* Remove a payload in a SDP packet.
* @param sdp The element to work on.
* @param pos_media The line number.
* @param pos The position of the payload in the media line.
*/
int sdp_message_m_payload_del (sdp_message_t * sdp, int pos_media, int pos);
/** @} */
#ifdef __cplusplus
}
#endif
#endif
|