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

osip_negotiation.h

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_NEGOC_H_
00022 #define _SDP_NEGOC_H_
00023 
00024 #include <osipparser2/sdp_message.h>
00025 
00026 
00040 #ifdef __cplusplus
00041 extern "C"
00042 {
00043 #endif
00044 
00054   typedef struct osip_negotiation_ctx osip_negotiation_ctx_t;
00055 
00060   struct osip_negotiation_ctx
00061   {
00062     void *mycontext;            
00063     sdp_message_t *remote;      
00064     sdp_message_t *local;       
00065   };
00066 
00071   int osip_negotiation_ctx_init (osip_negotiation_ctx_t ** ctx);
00076   void osip_negotiation_ctx_free (osip_negotiation_ctx_t * ctx);
00077 
00083   int osip_negotiation_ctx_set_mycontext (osip_negotiation_ctx_t * ctx,
00084                                           void *value);
00089   void *osip_negotiation_ctx_get_mycontext (osip_negotiation_ctx_t * ctx);
00090 
00098   int osip_negotiation_ctx_set_local_sdp (osip_negotiation_ctx_t * ctx,
00099                                           sdp_message_t * sdp);
00104   sdp_message_t *osip_negotiation_ctx_get_local_sdp (osip_negotiation_ctx_t *
00105                                                      ctx);
00111   int osip_negotiation_ctx_set_remote_sdp (osip_negotiation_ctx_t * ctx,
00112                                            sdp_message_t * sdp);
00117   sdp_message_t *osip_negotiation_ctx_get_remote_sdp (osip_negotiation_ctx_t *
00118                                                       ctx);
00119 
00120 
00135   typedef struct osip_negotiation osip_negotiation_t;
00136 
00141   struct osip_negotiation
00142   {
00143 
00144     char *o_username;               
00145     char *o_session_id;             
00146     char *o_session_version;        
00147     char *o_nettype;                
00148     char *o_addrtype;               
00149     char *o_addr;                   
00151     char *c_nettype;                
00152     char *c_addrtype;               
00153     char *c_addr;                   
00154     char *c_addr_multicast_ttl;     
00155     char *c_addr_multicast_int;     
00157     osip_list_t *audio_codec;       
00158     osip_list_t *video_codec;       
00159     osip_list_t *other_codec;       
00161     int (*fcn_set_info) (void *, sdp_message_t *);   
00162     int (*fcn_set_uri) (void *, sdp_message_t *);    
00164     int (*fcn_set_emails) (void *, sdp_message_t *); 
00165     int (*fcn_set_phones) (void *, sdp_message_t *); 
00166     int (*fcn_set_attributes) (void *, sdp_message_t *, int); 
00167     int (*fcn_accept_audio_codec) (void *, char *, char *, int, char *); 
00168     int (*fcn_accept_video_codec) (void *, char *, char *, int, char *); 
00169     int (*fcn_accept_other_codec) (void *, char *, char *, char *, char *); 
00170     char *(*fcn_get_audio_port) (void *, int);   
00171     char *(*fcn_get_video_port) (void *, int);   
00172     char *(*fcn_get_other_port) (void *, int);   
00174   };
00175 
00176 
00181   int osip_negotiation_init (osip_negotiation_t ** conf_out);
00186   void osip_negotiation_free (osip_negotiation_t * conf);
00187 
00192   int osip_negotiation_set_o_username (osip_negotiation_t *, char *tmp);
00198   int osip_negotiation_set_o_session_id (osip_negotiation_t *, char *tmp);
00204   int osip_negotiation_set_o_session_version (osip_negotiation_t *,
00205                                               char *tmp);
00210   int osip_negotiation_set_o_nettype (osip_negotiation_t *, char *tmp);
00215   int osip_negotiation_set_o_addrtype (osip_negotiation_t *, char *tmp);
00220   int osip_negotiation_set_o_addr (osip_negotiation_t *, char *tmp);
00221 
00226   int osip_negotiation_set_c_nettype (osip_negotiation_t *, char *tmp);
00231   int osip_negotiation_set_c_addrtype (osip_negotiation_t *, char *tmp);
00236   int osip_negotiation_set_c_addr (osip_negotiation_t *, char *tmp);
00241   int osip_negotiation_set_c_addr_multicast_ttl (osip_negotiation_t *,
00242                                                  char *tmp);
00247   int osip_negotiation_set_c_addr_multicast_int (osip_negotiation_t *,
00248                                                  char *tmp);
00249 
00264   int osip_negotiation_add_support_for_audio_codec (osip_negotiation_t *,
00265                                                     char *payload,
00266                                                     char *number_of_port,
00267                                                     char *proto,
00268                                                     char *c_nettype,
00269                                                     char *c_addrtype,
00270                                                     char *c_addr,
00271                                                     char
00272                                                     *c_addr_multicast_ttl,
00273                                                     char
00274                                                     *c_addr_multicast_int,
00275                                                     char *a_rtpmap);
00290   int osip_negotiation_add_support_for_video_codec (osip_negotiation_t *,
00291                                                     char *payload,
00292                                                     char *number_of_port,
00293                                                     char *proto,
00294                                                     char *c_nettype,
00295                                                     char *c_addrtype,
00296                                                     char *c_addr,
00297                                                     char
00298                                                     *c_addr_multicast_ttl,
00299                                                     char
00300                                                     *c_addr_multicast_int,
00301                                                     char *a_rtpmap);
00316   int osip_negotiation_add_support_for_other_codec (osip_negotiation_t *,
00317                                                     char *payload,
00318                                                     char *number_of_port,
00319                                                     char *proto,
00320                                                     char *c_nettype,
00321                                                     char *c_addrtype,
00322                                                     char *c_addr,
00323                                                     char
00324                                                     *c_addr_multicast_ttl,
00325                                                     char
00326                                                     *c_addr_multicast_int,
00327                                                     char *a_rtpmap);
00328 
00329 #ifndef DOXYGEN
00330 
00333   int osip_negotiation_remove_audio_payloads (osip_negotiation_t * config);
00337   int osip_negotiation_remove_video_payloads (osip_negotiation_t * config);
00341   int osip_negotiation_remove_other_payloads (osip_negotiation_t * config);
00342 #endif
00343 
00349   int osip_negotiation_set_fcn_set_info (osip_negotiation_t *,
00350                                          int (*fcn) (osip_negotiation_ctx_t *,
00351                                                      sdp_message_t *));
00357   int osip_negotiation_set_fcn_set_uri (osip_negotiation_t *,
00358                                         int (*fcn) (osip_negotiation_ctx_t *,
00359                                                     sdp_message_t *));
00365   int osip_negotiation_set_fcn_set_emails (osip_negotiation_t *,
00366                                            int (*fcn) (osip_negotiation_ctx_t
00367                                                        *, sdp_message_t *));
00373   int osip_negotiation_set_fcn_set_phones (osip_negotiation_t *,
00374                                            int (*fcn) (osip_negotiation_ctx_t
00375                                                        *, sdp_message_t *));
00381   int
00382     osip_negotiation_set_fcn_set_attributes (osip_negotiation_t *,
00383                                              int (*fcn)
00384                                              (osip_negotiation_ctx_t *,
00385                                               sdp_message_t *, int));
00391   int
00392     osip_negotiation_set_fcn_accept_audio_codec (osip_negotiation_t *,
00393                                                  int (*fcn)
00394                                                  (osip_negotiation_ctx_t *,
00395                                                   char *, char *, int,
00396                                                   char *));
00402   int
00403     osip_negotiation_set_fcn_accept_video_codec (osip_negotiation_t *,
00404                                                  int (*fcn)
00405                                                  (osip_negotiation_ctx_t *,
00406                                                   char *, char *, int,
00407                                                   char *));
00413   int
00414     osip_negotiation_set_fcn_accept_other_codec (osip_negotiation_t *,
00415                                                  int (*fcn)
00416                                                  (osip_negotiation_ctx_t *,
00417                                                   char *, char *, char *,
00418                                                   char *));
00424   int osip_negotiation_set_fcn_get_audio_port (osip_negotiation_t *,
00425                                                char
00426                                                *(*fcn) (osip_negotiation_ctx_t
00427                                                         *, int));
00433   int osip_negotiation_set_fcn_get_video_port (osip_negotiation_t *,
00434                                                char
00435                                                *(*fcn) (osip_negotiation_ctx_t
00436                                                         *, int));
00442   int osip_negotiation_set_fcn_get_other_port (osip_negotiation_t *,
00443                                                char
00444                                                *(*fcn) (osip_negotiation_ctx_t
00445                                                         *, int));
00446 
00460   int osip_negotiation_ctx_execute_negotiation (osip_negotiation_t *,
00461                                                 osip_negotiation_ctx_t * ctx);
00462 
00469   int osip_negotiation_sdp_build_offer (osip_negotiation_t *,
00470                                         osip_negotiation_ctx_t * ctx,
00471                                         sdp_message_t ** sdp,
00472                                         char *audio_port, char *video_port);
00476   int __osip_negotiation_sdp_build_offer (osip_negotiation_t *,
00477                                           osip_negotiation_ctx_t * ctx,
00478                                           sdp_message_t ** sdp,
00479                                           char *audio_port, char *video_port,
00480                                           char *audio_codec,
00481                                           char *video_codec);
00482 
00486   int osip_negotiation_sdp_message_put_on_hold (sdp_message_t * sdp);
00487 
00491   int osip_negotiation_sdp_message_put_off_hold (sdp_message_t * sdp);
00492 
00499 #ifdef __cplusplus
00500 }
00501 #endif
00502 
00503 #endif /*_SDP_NEGOC_H_ */

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