libosip  4.0.0
sdp_message.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 
21 #ifndef _SDP_H_
22 #define _SDP_H_
23 
24 #ifdef ENABLE_MPATROL
25 #include <mpatrol.h>
26 #endif
27 
28 #include <osipparser2/osip_list.h>
29 
30 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
53 
58  struct sdp_bandwidth {
59  char *b_bwtype;
60  char *b_bandwidth;
61  };
62 
67  int sdp_bandwidth_init (sdp_bandwidth_t ** elem);
72  void sdp_bandwidth_free (sdp_bandwidth_t * elem);
73 
79 
84  struct sdp_time_descr {
85  char *t_start_time;
86  char *t_stop_time;
88  };
89 
100 
105  typedef struct sdp_key sdp_key_t;
106 
111  struct sdp_key {
112  char *k_keytype;
113  char *k_keydata;
114  };
115 
120  int sdp_key_init (sdp_key_t ** elem);
125  void sdp_key_free (sdp_key_t * elem);
126 
132 
137  struct sdp_attribute {
138  char *a_att_field;
139  char *a_att_value;
140  };
141 
146  int sdp_attribute_init (sdp_attribute_t ** elem);
151  void sdp_attribute_free (sdp_attribute_t * elem);
152 
153 
159 
164  struct sdp_connection {
165  char *c_nettype;
166  char *c_addrtype;
167  char *c_addr;
168  char *c_addr_multicast_ttl;
170  char *c_addr_multicast_int;
172  };
173 
184 
189  typedef struct sdp_media sdp_media_t;
190 
195  struct sdp_media {
196  char *m_media;
197  char *m_port;
199  char *m_proto;
202  char *i_info;
210  };
211 
216  int sdp_media_init (sdp_media_t ** elem);
221  void sdp_media_free (sdp_media_t * elem);
222 
227  typedef struct sdp_message sdp_message_t;
228 
233  struct sdp_message {
234  char *v_version;
235  char *o_username;
236  char *o_sess_id;
238  char *o_nettype;
239  char *o_addrtype;
240  char *o_addr;
241  char *s_name;
242  char *i_info;
243  char *u_uri;
256  };
257 
258 
259 
264  int sdp_message_init (sdp_message_t ** sdp);
270  int sdp_message_parse (sdp_message_t * sdp, const char *buf);
276  int sdp_message_to_str (sdp_message_t * sdp, char **dest);
281  void sdp_message_free (sdp_message_t * sdp);
287  int sdp_message_clone (sdp_message_t * sdp, sdp_message_t ** dest);
288 
294  int sdp_message_v_version_set (sdp_message_t * sdp, char *value);
310  int sdp_message_o_origin_set (sdp_message_t * sdp, char *username, char *sess_id, char *sess_version, char *nettype, char *addrtype, char *addr);
346  int sdp_message_s_name_set (sdp_message_t * sdp, char *value);
358  int sdp_message_i_info_set (sdp_message_t * sdp, int pos_media, char *value);
364  char *sdp_message_i_info_get (sdp_message_t * sdp, int pos_media);
370  int sdp_message_u_uri_set (sdp_message_t * sdp, char *value);
375  char *sdp_message_u_uri_get (sdp_message_t * sdp);
381  int sdp_message_e_email_add (sdp_message_t * sdp, char *value);
386 #define sdp_e_email_get sdp_message_e_email_get
387 
392  char *sdp_message_e_email_get (sdp_message_t * sdp, int pos);
398  int sdp_message_p_phone_add (sdp_message_t * sdp, char *value);
404  char *sdp_message_p_phone_get (sdp_message_t * sdp, int pos);
415  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);
416 #ifndef DOXYGEN
417 /* this method should be internal only... */
418  sdp_connection_t *sdp_message_connection_get (sdp_message_t * sdp, int pos_media, int pos);
419 #endif
420 
426  char *sdp_message_c_nettype_get (sdp_message_t * sdp, int pos_media, int pos);
433  char *sdp_message_c_addrtype_get (sdp_message_t * sdp, int pos_media, int pos);
440  char *sdp_message_c_addr_get (sdp_message_t * sdp, int pos_media, int pos);
447  char *sdp_message_c_addr_multicast_ttl_get (sdp_message_t * sdp, int pos_media, int pos);
454  char *sdp_message_c_addr_multicast_int_get (sdp_message_t * sdp, int pos_media, int pos);
462  int sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media, char *bwtype, char *bandwidth);
469  sdp_bandwidth_t *sdp_message_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
476  char *sdp_message_b_bwtype_get (sdp_message_t * sdp, int pos_media, int pos);
483  char *sdp_message_b_bandwidth_get (sdp_message_t * sdp, int pos_media, int pos);
490  int sdp_message_t_time_descr_add (sdp_message_t * sdp, char *start, char *stop);
496  char *sdp_message_t_start_time_get (sdp_message_t * sdp, int pos_td);
502  char *sdp_message_t_stop_time_get (sdp_message_t * sdp, int pos_td);
509  int sdp_message_r_repeat_add (sdp_message_t * sdp, int pos_time_descr, char *value);
516  char *sdp_message_r_repeat_get (sdp_message_t * sdp, int pos_time_descr, int pos_repeat);
522  int sdp_message_z_adjustments_set (sdp_message_t * sdp, char *value);
535  int sdp_message_k_key_set (sdp_message_t * sdp, int pos_media, char *keytype, char *keydata);
541  char *sdp_message_k_keytype_get (sdp_message_t * sdp, int pos_media);
547  char *sdp_message_k_keydata_get (sdp_message_t * sdp, int pos_media);
555  int sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media, char *att_field, char *att_value);
562  int sdp_message_a_attribute_del (sdp_message_t * sdp, int pos_media, char *att_field);
570  int sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media, char *att_field, int pos_attr);
577  sdp_attribute_t *sdp_message_attribute_get (sdp_message_t * sdp, int pos_media, int pos);
584  char *sdp_message_a_att_field_get (sdp_message_t * sdp, int pos_media, int pos);
591  char *sdp_message_a_att_value_get (sdp_message_t * sdp, int pos_media, int pos);
597  int sdp_message_endof_media (sdp_message_t * sdp, int pos);
606  int sdp_message_m_media_add (sdp_message_t * sdp, char *media, char *port, char *number_of_port, char *proto);
612  char *sdp_message_m_media_get (sdp_message_t * sdp, int pos_media);
618  char *sdp_message_m_port_get (sdp_message_t * sdp, int pos_media);
625  int sdp_message_m_port_set (sdp_message_t * sdp, int pos_media, char *port);
631  char *sdp_message_m_number_of_port_get (sdp_message_t * sdp, int pos_media);
637  char *sdp_message_m_proto_get (sdp_message_t * sdp, int pos_media);
644  int sdp_message_m_payload_add (sdp_message_t * sdp, int pos_media, char *payload);
651  char *sdp_message_m_payload_get (sdp_message_t * sdp, int pos_media, int pos);
658  int sdp_message_m_payload_del (sdp_message_t * sdp, int pos_media, int pos);
659 
660 
664 #ifdef __cplusplus
665 }
666 #endif
667 #endif