00001 /* Copyright (C) 2001 Carsten Griwodz 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MNRTP_SOCKETS_H 00025 #define MNRTP_SOCKETS_H 00026 00027 #include <stdio.h> 00028 #include <MNUDPSocket.h> 00029 #include <MNSocket.h> 00030 #include <MNString.h> 00031 #include <sdp/TransportTypes.h> 00032 00033 class MNUDPClientSocket; 00034 00042 struct RTPSockets 00043 { 00044 /* Bit definitions for the factory mode */ 00045 static const u_int32_t DEFAULT = 0; 00046 static const u_int32_t RTCP_FAIL_OK = 1; 00047 static const u_int32_t FIXED_PORT = 2; 00048 static const u_int32_t SERVER = 0; 00049 static const u_int32_t CLIENT = 1; 00050 00051 typedef u_int32_t FactoryMode; 00052 00053 u_int32_t caller_role; 00054 RTSP::TransportTypes transport_protocol; 00055 MNSocket* rtp; 00056 MNSocket* rtcp; 00057 MNString client_hostname; 00058 00059 private: 00060 MNSelector* _main_selector; 00061 00062 public: 00063 RTPSockets( ); 00064 RTPSockets( MNSelector* sel ); 00065 RTPSockets( const RTPSockets* orig ); 00066 RTPSockets( MNSocket* rtp, MNSocket* rtcp ); 00067 00068 RTPSockets& operator=( const RTPSockets* orig ); 00069 00070 inline bool isSet( ) const { 00071 return (rtp != NULL); 00072 } 00073 00074 inline int port( ) const { 00075 return rtp->port(); 00076 } 00077 00078 static RTPSockets* factory( int& port, 00079 int limit, 00080 FactoryMode m = RTPSockets::DEFAULT); 00081 00109 static bool factory( RTPSockets* pair, 00110 int& port, 00111 int limit, 00112 FactoryMode m = RTPSockets::DEFAULT); 00113 }; 00114 00115 #endif /* MNRTP_SOCKETS_H */ 00116