libosip 3.6.0

sdp_message.h

Go to the documentation of this file.
00001 /*
00002   The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
00003   Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Aymeric MOIZARD jack@atosc.org
00004   
00005   This library is free software; you can redistribute it and/or
00006   modify it under the terms of the GNU Lesser General Public
00007   License as published by the Free Software Foundation; either
00008   version 2.1 of the License, or (at your option) any later version.
00009   
00010   This library is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013   Lesser General Public License for more details.
00014   
00015   You should have received a copy of the GNU Lesser General Public
00016   License along with this library; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 
00021 #ifndef _SDP_H_
00022 #define _SDP_H_
00023 
00024 #ifdef ENABLE_MPATROL
00025 #include <mpatrol.h>
00026 #endif
00027 
00028 #include <osipparser2/osip_list.h>
00029 
00030 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif
00047 
00052         typedef struct sdp_bandwidth sdp_bandwidth_t;
00053 
00058         struct sdp_bandwidth {
00059                 char *b_bwtype;                 
00060                 char *b_bandwidth;              
00061         };
00062 
00067         int sdp_bandwidth_init(sdp_bandwidth_t ** elem);
00072         void sdp_bandwidth_free(sdp_bandwidth_t * elem);
00073 
00078         typedef struct sdp_time_descr sdp_time_descr_t;
00079 
00084         struct sdp_time_descr {
00085                 char *t_start_time;                
00086                 char *t_stop_time;                 
00087                 osip_list_t r_repeats;    
00088         };
00089 
00094         int sdp_time_descr_init(sdp_time_descr_t ** elem);
00099         void sdp_time_descr_free(sdp_time_descr_t * elem);
00100 
00105         typedef struct sdp_key sdp_key_t;
00106 
00111         struct sdp_key {
00112                 char *k_keytype;
00113                 char *k_keydata;
00114         };
00115 
00120         int sdp_key_init(sdp_key_t ** elem);
00125         void sdp_key_free(sdp_key_t * elem);
00126 
00131         typedef struct sdp_attribute sdp_attribute_t;
00132 
00137         struct sdp_attribute {
00138                 char *a_att_field;              
00139                 char *a_att_value;              
00140         };
00141 
00146         int sdp_attribute_init(sdp_attribute_t ** elem);
00151         void sdp_attribute_free(sdp_attribute_t * elem);
00152 
00153 
00158         typedef struct sdp_connection sdp_connection_t;
00159 
00164         struct sdp_connection {
00165                 char *c_nettype;                 
00166                 char *c_addrtype;                
00167                 char *c_addr;                    
00168                 char *c_addr_multicast_ttl;
00170                 char *c_addr_multicast_int;
00172         };
00173 
00178         int sdp_connection_init(sdp_connection_t ** elem);
00183         void sdp_connection_free(sdp_connection_t * elem);
00184 
00189         typedef struct sdp_media sdp_media_t;
00190 
00195         struct sdp_media {
00196                 char *m_media;                  
00197                 char *m_port;                   
00198                 char *m_number_of_port; 
00199                 char *m_proto;                  
00200                 osip_list_t m_payloads;
00202                 char *i_info;                   
00203                 osip_list_t c_connections;
00205                 osip_list_t b_bandwidths;
00207                 osip_list_t a_attributes;
00209                 sdp_key_t *k_key;               
00210         };
00211 
00216         int sdp_media_init(sdp_media_t ** elem);
00221         void sdp_media_free(sdp_media_t * elem);
00222 
00227         typedef struct sdp_message sdp_message_t;
00228 
00233         struct sdp_message {
00234                 char *v_version;                
00235                 char *o_username;               
00236                 char *o_sess_id;                
00237                 char *o_sess_version;   
00238                 char *o_nettype;                
00239                 char *o_addrtype;               
00240                 char *o_addr;                   
00241                 char *s_name;                   
00242                 char *i_info;                   
00243                 char *u_uri;                    
00244                 osip_list_t e_emails;  
00245                 osip_list_t p_phones;  
00246                 sdp_connection_t *c_connection;
00248                 osip_list_t b_bandwidths;
00250                 osip_list_t t_descrs;  
00251                 char *z_adjustments;    
00252                 sdp_key_t *k_key;               
00253                 osip_list_t a_attributes;
00255                 osip_list_t m_medias;  
00256         };
00257 
00258 
00259 
00264         int sdp_message_init(sdp_message_t ** sdp);
00270         int sdp_message_parse(sdp_message_t * sdp, const char *buf);
00276         int sdp_message_to_str(sdp_message_t * sdp, char **dest);
00281         void sdp_message_free(sdp_message_t * sdp);
00287         int sdp_message_clone(sdp_message_t * sdp, sdp_message_t ** dest);
00288 
00294         int sdp_message_v_version_set(sdp_message_t * sdp, char *value);
00299         char *sdp_message_v_version_get(sdp_message_t * sdp);
00310         int sdp_message_o_origin_set(sdp_message_t * sdp, char *username,
00311                                                                  char *sess_id, char *sess_version,
00312                                                                  char *nettype, char *addrtype, char *addr);
00317         char *sdp_message_o_username_get(sdp_message_t * sdp);
00322         char *sdp_message_o_sess_id_get(sdp_message_t * sdp);
00327         char *sdp_message_o_sess_version_get(sdp_message_t * sdp);
00332         char *sdp_message_o_nettype_get(sdp_message_t * sdp);
00337         char *sdp_message_o_addrtype_get(sdp_message_t * sdp);
00342         char *sdp_message_o_addr_get(sdp_message_t * sdp);
00348         int sdp_message_s_name_set(sdp_message_t * sdp, char *value);
00353         char *sdp_message_s_name_get(sdp_message_t * sdp);
00360         int sdp_message_i_info_set(sdp_message_t * sdp, int pos_media, char *value);
00366         char *sdp_message_i_info_get(sdp_message_t * sdp, int pos_media);
00372         int sdp_message_u_uri_set(sdp_message_t * sdp, char *value);
00377         char *sdp_message_u_uri_get(sdp_message_t * sdp);
00383         int sdp_message_e_email_add(sdp_message_t * sdp, char *value);
00388 #define sdp_e_email_get sdp_message_e_email_get
00389 
00394         char *sdp_message_e_email_get(sdp_message_t * sdp, int pos);
00400         int sdp_message_p_phone_add(sdp_message_t * sdp, char *value);
00406         char *sdp_message_p_phone_get(sdp_message_t * sdp, int pos);
00417         int sdp_message_c_connection_add(sdp_message_t * sdp, int pos_media,
00418                                                                          char *nettype, char *addrtype,
00419                                                                          char *addr, char *addr_multicast_ttl,
00420                                                                          char *addr_multicast_int);
00421 #ifndef DOXYGEN
00422 /* this method should be internal only... */
00423         sdp_connection_t *sdp_message_connection_get(sdp_message_t * sdp,
00424                                                                                                  int pos_media, int pos);
00425 #endif
00426 
00432         char *sdp_message_c_nettype_get(sdp_message_t * sdp, int pos_media, int pos);
00439         char *sdp_message_c_addrtype_get(sdp_message_t * sdp, int pos_media, int pos);
00446         char *sdp_message_c_addr_get(sdp_message_t * sdp, int pos_media, int pos);
00453         char *sdp_message_c_addr_multicast_ttl_get(sdp_message_t * sdp,
00454                                                                                            int pos_media, int pos);
00461         char *sdp_message_c_addr_multicast_int_get(sdp_message_t * sdp,
00462                                                                                            int pos_media, int pos);
00470         int sdp_message_b_bandwidth_add(sdp_message_t * sdp, int pos_media,
00471                                                                         char *bwtype, char *bandwidth);
00478         sdp_bandwidth_t *sdp_message_bandwidth_get(sdp_message_t * sdp,
00479                                                                                            int pos_media, int pos);
00486         char *sdp_message_b_bwtype_get(sdp_message_t * sdp, int pos_media, int pos);
00493         char *sdp_message_b_bandwidth_get(sdp_message_t * sdp, int pos_media, int pos);
00500         int sdp_message_t_time_descr_add(sdp_message_t * sdp, char *start, char *stop);
00506         char *sdp_message_t_start_time_get(sdp_message_t * sdp, int pos_td);
00512         char *sdp_message_t_stop_time_get(sdp_message_t * sdp, int pos_td);
00519         int sdp_message_r_repeat_add(sdp_message_t * sdp, int pos_time_descr,
00520                                                                  char *value);
00527         char *sdp_message_r_repeat_get(sdp_message_t * sdp, int pos_time_descr,
00528                                                                    int pos_repeat);
00534         int sdp_message_z_adjustments_set(sdp_message_t * sdp, char *value);
00539         char *sdp_message_z_adjustments_get(sdp_message_t * sdp);
00547         int sdp_message_k_key_set(sdp_message_t * sdp, int pos_media,
00548                                                           char *keytype, char *keydata);
00554         char *sdp_message_k_keytype_get(sdp_message_t * sdp, int pos_media);
00560         char *sdp_message_k_keydata_get(sdp_message_t * sdp, int pos_media);
00568         int sdp_message_a_attribute_add(sdp_message_t * sdp, int pos_media,
00569                                                                         char *att_field, char *att_value);
00576         int sdp_message_a_attribute_del(sdp_message_t * sdp, int pos_media,
00577                                                                         char *att_field);
00585         int sdp_message_a_attribute_del_at_index(sdp_message_t * sdp,
00586                                                                                          int pos_media, char *att_field,
00587                                                                                          int pos_attr);
00594         sdp_attribute_t *sdp_message_attribute_get(sdp_message_t * sdp,
00595                                                                                            int pos_media, int pos);
00602         char *sdp_message_a_att_field_get(sdp_message_t * sdp, int pos_media, int pos);
00609         char *sdp_message_a_att_value_get(sdp_message_t * sdp, int pos_media, int pos);
00615         int sdp_message_endof_media(sdp_message_t * sdp, int pos);
00624         int sdp_message_m_media_add(sdp_message_t * sdp, char *media,
00625                                                                 char *port, char *number_of_port, char *proto);
00631         char *sdp_message_m_media_get(sdp_message_t * sdp, int pos_media);
00637         char *sdp_message_m_port_get(sdp_message_t * sdp, int pos_media);
00644         int sdp_message_m_port_set(sdp_message_t * sdp, int pos_media, char *port);
00650         char *sdp_message_m_number_of_port_get(sdp_message_t * sdp, int pos_media);
00656         char *sdp_message_m_proto_get(sdp_message_t * sdp, int pos_media);
00663         int sdp_message_m_payload_add(sdp_message_t * sdp, int pos_media,
00664                                                                   char *payload);
00671         char *sdp_message_m_payload_get(sdp_message_t * sdp, int pos_media, int pos);
00678         int sdp_message_m_payload_del(sdp_message_t * sdp, int pos_media, int pos);
00679 
00680 
00684 #ifdef __cplusplus
00685 }
00686 #endif
00687 #endif