Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

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  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,
00361                               char *value);
00367   char *sdp_message_i_info_get (sdp_message_t * sdp, int pos_media);
00373   int sdp_message_u_uri_set (sdp_message_t * sdp, char *value);
00378   char *sdp_message_u_uri_get (sdp_message_t * sdp);
00384   int sdp_message_e_email_add (sdp_message_t * sdp, char *value);
00389   #define sdp_e_email_get sdp_message_e_email_get
00390 
00395   char *sdp_message_e_email_get (sdp_message_t * sdp, int pos);
00401   int sdp_message_p_phone_add (sdp_message_t * sdp, char *value);
00407   char *sdp_message_p_phone_get (sdp_message_t * sdp, int pos);
00418   int sdp_message_c_connection_add (sdp_message_t * sdp, int pos_media,
00419                                     char *nettype, char *addrtype,
00420                                     char *addr, char *addr_multicast_ttl,
00421                                     char *addr_multicast_int);
00422 #ifndef DOXYGEN
00423 /* this method should be internal only... */
00424   sdp_connection_t *sdp_message_connection_get (sdp_message_t * sdp,
00425                                                 int pos_media, int pos);
00426 #endif
00427 
00433   char *sdp_message_c_nettype_get (sdp_message_t * sdp, int pos_media,
00434                                    int pos);
00441   char *sdp_message_c_addrtype_get (sdp_message_t * sdp, int pos_media,
00442                                     int pos);
00449   char *sdp_message_c_addr_get (sdp_message_t * sdp, int pos_media, int pos);
00456   char *sdp_message_c_addr_multicast_ttl_get (sdp_message_t * sdp,
00457                                               int pos_media, int pos);
00464   char *sdp_message_c_addr_multicast_int_get (sdp_message_t * sdp,
00465                                               int pos_media, int pos);
00473   int sdp_message_b_bandwidth_add (sdp_message_t * sdp, int pos_media,
00474                                    char *bwtype, char *bandwidth);
00481   sdp_bandwidth_t *sdp_message_bandwidth_get (sdp_message_t * sdp,
00482                                               int pos_media, int pos);
00489   char *sdp_message_b_bwtype_get (sdp_message_t * sdp, int pos_media,
00490                                   int pos);
00497   char *sdp_message_b_bandwidth_get (sdp_message_t * sdp, int pos_media,
00498                                      int pos);
00505   int sdp_message_t_time_descr_add (sdp_message_t * sdp, char *start,
00506                                     char *stop);
00512   char *sdp_message_t_start_time_get (sdp_message_t * sdp, int pos_td);
00518   char *sdp_message_t_stop_time_get (sdp_message_t * sdp, int pos_td);
00525   int sdp_message_r_repeat_add (sdp_message_t * sdp, int pos_time_descr,
00526                                 char *value);
00533   char *sdp_message_r_repeat_get (sdp_message_t * sdp, int pos_time_descr,
00534                                   int pos_repeat);
00540   int sdp_message_z_adjustments_set (sdp_message_t * sdp, char *value);
00545   char *sdp_message_z_adjustments_get (sdp_message_t * sdp);
00553   int sdp_message_k_key_set (sdp_message_t * sdp, int pos_media,
00554                              char *keytype, char *keydata);
00560   char *sdp_message_k_keytype_get (sdp_message_t * sdp, int pos_media);
00566   char *sdp_message_k_keydata_get (sdp_message_t * sdp, int pos_media);
00574   int sdp_message_a_attribute_add (sdp_message_t * sdp, int pos_media,
00575                                    char *att_field, char *att_value);
00582   int sdp_message_a_attribute_del (sdp_message_t * sdp, int pos_media, 
00583                                    char *att_field);
00591   int sdp_message_a_attribute_del_at_index (sdp_message_t * sdp, int pos_media, 
00592                                             char *att_field, int pos_attr);
00599   sdp_attribute_t *sdp_message_attribute_get (sdp_message_t * sdp,
00600                                               int pos_media, int pos);
00607   char *sdp_message_a_att_field_get (sdp_message_t * sdp, int pos_media,
00608                                      int pos);
00615   char *sdp_message_a_att_value_get (sdp_message_t * sdp, int pos_media,
00616                                      int pos);
00622   int sdp_message_endof_media (sdp_message_t * sdp, int pos);
00631   int sdp_message_m_media_add (sdp_message_t * sdp, char *media,
00632                                char *port, char *number_of_port, char *proto);
00638   char *sdp_message_m_media_get (sdp_message_t * sdp, int pos_media);
00644   char *sdp_message_m_port_get (sdp_message_t * sdp, int pos_media);
00651   int sdp_message_m_port_set (sdp_message_t * sdp, int pos_media, char *port);
00657   char *sdp_message_m_number_of_port_get (sdp_message_t * sdp, int pos_media);
00663   char *sdp_message_m_proto_get (sdp_message_t * sdp, int pos_media);
00670   int sdp_message_m_payload_add (sdp_message_t * sdp, int pos_media,
00671                                  char *payload);
00678   char *sdp_message_m_payload_get (sdp_message_t * sdp, int pos_media,
00679                                    int pos);
00686   int sdp_message_m_payload_del (sdp_message_t * sdp, int pos_media,
00687                                  int pos);
00688 
00689 
00693 #ifdef __cplusplus
00694 }
00695 #endif
00696 
00697 
00698 #endif

Generated on Tue Feb 22 00:59:47 2005 for libosip by  doxygen 1.4.1