00001 // Copyright (C) 2001-2005 Federico Montesino Pouzols <fedemp@altern.org>. 00002 // 00003 // This program is free software; you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation; either version 2 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00016 // 00017 // As a special exception, you may use this file as part of a free software 00018 // library without restriction. Specifically, if other files instantiate 00019 // templates or use macros or inline functions from this file, or you compile 00020 // this file and link it with other files to produce an executable, this 00021 // file does not by itself cause the resulting executable to be covered by 00022 // the GNU General Public License. This exception does not however 00023 // invalidate any other reasons why the executable file might be covered by 00024 // the GNU General Public License. 00025 // 00026 // This exception applies only to the code released under the name GNU 00027 // ccRTP. If you copy code from other releases into a copy of GNU 00028 // ccRTP, as the General Public License permits, the exception does 00029 // not apply to the code that you add in this way. To avoid misleading 00030 // anyone as to the status of such modified files, you must delete 00031 // this exception notice from them. 00032 // 00033 // If you write modifications of your own for GNU ccRTP, it is your choice 00034 // whether to permit this exception to apply to your modifications. 00035 // If you do not wish that, delete this exception notice. 00036 // 00037 00038 #ifndef CCXX_RTP_BASE_H_ 00039 #define CCXX_RTP_BASE_H_ 00040 00041 #ifndef CCXX_SOCKET_H_ 00042 #include <cc++/config.h> 00043 #include <cc++/socket.h> 00044 #endif 00045 00046 #ifndef CCXX_PACKING 00047 #if defined(__GNUC__) 00048 #define CCXX_PACKED 00049 #elif !defined(__hpux) && !defined(_AIX) 00050 #define CCXX_PACKED 00051 #endif 00052 #endif 00053 00054 #ifdef CCXX_NAMESPACES 00055 namespace ost { 00056 #endif 00057 00065 00066 const uint8 CCRTP_VERSION = 2; 00067 00069 typedef uint32 microtimeout_t; 00070 00072 typedef uint32 nanotimeout_t; 00073 00081 __EXPORT timeval 00082 microtimeout2Timeval(microtimeout_t to); 00083 00091 inline microtimeout_t 00092 timeval2microtimeout(const timeval& t) 00093 { return ((t.tv_sec * 1000000ul) + t.tv_usec); } 00094 00103 inline microtimeout_t 00104 timevalDiff2microtimeout(const timeval& t1, const timeval& t2) 00105 { 00106 return ((t1.tv_sec - t2.tv_sec) * 1000000ul) + 00107 (t1.tv_usec - t2.tv_usec); 00108 } 00109 00111 const tpport_t DefaultRTPDataPort = 5004; 00112 00114 const tpport_t DefaultRTCPPort = 5005; 00115 00116 #ifndef HAVE_GETTIMEOFDAY 00117 #ifdef WIN32 00118 __EXPORT int 00119 gettimeofday(struct timeval *tv_, void *tz_); 00120 #endif 00121 #endif 00122 00123 #ifdef CCXX_NAMESPACES 00124 } 00125 #endif 00126 00127 #endif // ndef CCXX_RTP_BASE_H_ 00128