ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
base.h
Go to the documentation of this file.
1 // Copyright (C) 2001-2015 Federico Montesino Pouzols <fedemp@altern.org>.
2 //
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with GNU ccRTP. If not, see <http://www.gnu.org/licenses/>.
15 //
16 // As a special exception, you may use this file as part of a free software
17 // library without restriction. Specifically, if other files instantiate
18 // templates or use macros or inline functions from this file, or you compile
19 // this file and link it with other files to produce an executable, this
20 // file does not by itself cause the resulting executable to be covered by
21 // the GNU General Public License. This exception does not however
22 // invalidate any other reasons why the executable file might be covered by
23 // the GNU General Public License.
24 //
25 // This exception applies only to the code released under the name GNU
26 // ccRTP. If you copy code from other releases into a copy of GNU
27 // ccRTP, as the General Public License permits, the exception does
28 // not apply to the code that you add in this way. To avoid misleading
29 // anyone as to the status of such modified files, you must delete
30 // this exception notice from them.
31 //
32 // If you write modifications of your own for GNU ccRTP, it is your choice
33 // whether to permit this exception to apply to your modifications.
34 // If you do not wish that, delete this exception notice.
35 //
36 
37 #ifndef CCXX_RTP_BASE_H_
38 #define CCXX_RTP_BASE_H_
39 
40 #ifndef CCXX_SOCKET_H_
41 #include <commoncpp/config.h>
42 #include <commoncpp/socket.h>
43 #include <commoncpp/udp.h>
44 #endif
45 
46 #ifndef CCXX_PACKING
47 #if defined(__GNUC__)
48 #define CCXX_PACKED
49 #elif !defined(__hpux) && !defined(_AIX)
50 #define CCXX_PACKED
51 #endif
52 #endif
53 
54 NAMESPACE_COMMONCPP
55 
63 const uint8 CCRTP_VERSION = 2;
65 
67 typedef uint32 microtimeout_t;
68 
70 typedef uint32 nanotimeout_t;
71 
79 __EXPORT timeval
81 
89 inline microtimeout_t
90 timeval2microtimeout(const timeval& t)
91 { return ((t.tv_sec * 1000000ul) + t.tv_usec); }
92 
101 inline microtimeout_t
102 timevalDiff2microtimeout(const timeval& t1, const timeval& t2)
103 {
104  return ((t1.tv_sec - t2.tv_sec) * 1000000ul) +
105  (t1.tv_usec - t2.tv_usec);
106 }
107 
109 const tpport_t DefaultRTPDataPort = 5004;
110 
112 const tpport_t DefaultRTCPPort = 5005;
113 
114 END_NAMESPACE
115 
116 #endif // ndef CCXX_RTP_BASE_H_
117 
microtimeout_t timevalDiff2microtimeout(const timeval &t1, const timeval &t2)
Convert a time interval, expressed as the difference between two timeval values (t1-t2), into a microseconds counter.
Definition: base.h:102
const uint8 CCRTP_VERSION
RTP protocol version supported.
Definition: base.h:64
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:67
microtimeout_t timeval2microtimeout(const timeval &t)
Convert a time interval, expressed as a timeval value into a microseconds counter.
Definition: base.h:90
uint32 nanotimeout_t
Time interval expressed in nanoseconds.
Definition: base.h:70
#define __EXPORT
Definition: ZrtpCallback.h:40
const tpport_t DefaultRTCPPort
registered default RTCP transport port
Definition: base.h:112
const tpport_t DefaultRTPDataPort
registered default RTP data transport port
Definition: base.h:109
__EXPORT timeval microtimeout2Timeval(microtimeout_t to)
Convert a time interval, expressed as a microtimeout_t (number of microseconds), into a timeval value...
Definition: rtcppkt.cpp:76