ccRTP
base.h
Go to the documentation of this file.
00001 // Copyright (C) 2001-2015 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 Lesser General Public License
00014 // along with GNU ccRTP.  If not, see <http://www.gnu.org/licenses/>.
00015 //
00016 // As a special exception, you may use this file as part of a free software
00017 // library without restriction.  Specifically, if other files instantiate
00018 // templates or use macros or inline functions from this file, or you compile
00019 // this file and link it with other files to produce an executable, this
00020 // file does not by itself cause the resulting executable to be covered by
00021 // the GNU General Public License.  This exception does not however
00022 // invalidate any other reasons why the executable file might be covered by
00023 // the GNU General Public License.
00024 //
00025 // This exception applies only to the code released under the name GNU
00026 // ccRTP.  If you copy code from other releases into a copy of GNU
00027 // ccRTP, as the General Public License permits, the exception does
00028 // not apply to the code that you add in this way.  To avoid misleading
00029 // anyone as to the status of such modified files, you must delete
00030 // this exception notice from them.
00031 //
00032 // If you write modifications of your own for GNU ccRTP, it is your choice
00033 // whether to permit this exception to apply to your modifications.
00034 // If you do not wish that, delete this exception notice.
00035 //
00036 
00037 #ifndef CCXX_RTP_BASE_H_
00038 #define CCXX_RTP_BASE_H_
00039 
00040 #ifndef CCXX_SOCKET_H_
00041 #include <commoncpp/config.h>
00042 #include <commoncpp/socket.h>
00043 #include <commoncpp/udp.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 NAMESPACE_COMMONCPP
00055 
00063 
00064 const uint8 CCRTP_VERSION = 2;
00065 
00067 typedef uint32 microtimeout_t;
00068 
00070 typedef uint32 nanotimeout_t;
00071 
00079 __EXPORT timeval
00080 microtimeout2Timeval(microtimeout_t to);
00081 
00089 inline microtimeout_t
00090 timeval2microtimeout(const timeval& t)
00091 { return ((t.tv_sec * 1000000ul) + t.tv_usec); }
00092 
00101 inline microtimeout_t
00102 timevalDiff2microtimeout(const timeval& t1, const timeval& t2)
00103 {
00104     return ((t1.tv_sec - t2.tv_sec) * 1000000ul) +
00105         (t1.tv_usec - t2.tv_usec);
00106 }
00107 
00109 const tpport_t DefaultRTPDataPort = 5004;
00110 
00112 const tpport_t DefaultRTCPPort = 5005;
00113 
00114 END_NAMESPACE
00115 
00116 #endif  // ndef CCXX_RTP_BASE_H_
00117