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 {
00047 #endif
00048 
00053   typedef struct sdp_bandwidth sdp_bandwidth_t;
00054 
00059   struct sdp_bandwidth
00060   {
00061     char *b_bwtype;             
00062     char *b_bandwidth;          
00063   };
00064 
00069   int sdp_bandwidth_init (sdp_bandwidth_t ** elem);
00074   void sdp_bandwidth_free (sdp_bandwidth_t * elem);
00075 
00080   typedef struct sdp_time_descr sdp_time_descr_t;
00081 
00086   struct sdp_time_descr
00087   {
00088     char *t_start_time;            
00089     char *t_stop_time;             
00090     osip_list_t r_repeats;        
00091   };
00092 
00097   int sdp_time_descr_init (sdp_time_descr_t ** elem);
00102   void sdp_time_descr_free (sdp_time_descr_t * elem);
00103 
00108   typedef struct sdp_key sdp_key_t;
00109 
00114   struct sdp_key
00115   {
00116     char *k_keytype;    
00117     char *k_keydata;    
00118   };
00119 
00124   int sdp_key_init (sdp_key_t ** elem);
00129   void sdp_key_free (sdp_key_t * elem);
00130 
00135   typedef struct sdp_attribute sdp_attribute_t;
00136 
00141   struct sdp_attribute
00142   {
00143     char *a_att_field;          
00144     char *a_att_value;          
00145   };
00146 
00151   int sdp_attribute_init (sdp_attribute_t ** elem);
00156   void sdp_attribute_free (sdp_attribute_t * elem);
00157 
00158 
00163   typedef struct sdp_connection sdp_connection_t;
00164 
00169   struct sdp_connection
00170   {
00171     char *c_nettype;             
00172     char *c_addrtype;            
00173     char *c_addr;                
00174     char *c_addr_multicast_ttl;  
00175     char *c_addr_multicast_int;  
00176   };
00177 
00182   int sdp_connection_init (sdp_connection_t ** elem);
00187   void sdp_connection_free (sdp_connection_t * elem);
00188 
00193   typedef struct sdp_media sdp_media_t;
00194 
00199   struct sdp_media
00200   {
00201     char *m_media;              
00202     char *m_port;               
00203     char *m_number_of_port;     
00204     char *m_proto;              
00205     osip_list_t m_payloads;    
00207     char *i_info;               
00208     osip_list_t c_connections; 
00209     osip_list_t b_bandwidths;  
00210     osip_list_t a_attributes;  
00211     sdp_key_t *k_key;           
00212   };
00213 
00218   int sdp_media_init (sdp_media_t ** elem);
00223   void sdp_media_free (sdp_media_t * elem);
00224 
00229   typedef struct sdp_message sdp_message_t;
00230 
00235   struct sdp_message
00236   {
00237     char *v_version;            
00238     char *o_username;           
00239     char *o_sess_id;            
00240     char *o_sess_version;       
00241     char *o_nettype;            
00242     char *o_addrtype;           
00243     char *o_addr;               
00244     char *s_name;               
00245     char *i_info;               
00246     char *u_uri;                
00247     osip_list_t e_emails;      
00248     osip_list_t p_phones;      
00249     sdp_connection_t *c_connection;   
00250     osip_list_t b_bandwidths;  
00251     osip_list_t t_descrs;      
00252     char *z_adjustments;        
00253     sdp_key_t *k_key;           
00254     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 
00688 
00689 #endif

Generated on Wed Feb 13 01:03:29 2008 for libosip by  doxygen 1.5.4