ccRTP
private.h
Go to the documentation of this file.
1// Copyright (C) 1999-2005 Open Source Telecom Corporation.
2// Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3// Copyright (C) 2015 Cherokees of Idaho.
4//
5// This program is free software; you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation; either version 2 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18//
19// As a special exception to the GNU General Public License, permission is
20// granted for additional uses of the text contained in its release
21// of ccRTP.
22//
23// The exception is that, if you link the ccRTP library with other
24// files to produce an executable, this does not by itself cause the
25// resulting executable to be covered by the GNU General Public License.
26// Your use of that executable is in no way restricted on account of
27// linking the ccRTP library code into it.
28//
29// This exception does not however invalidate any other reasons why
30// the executable file might be covered by the GNU General Public License.
31//
32// This exception applies only to the code released under the
33// name ccRTP. If you copy code from other releases into a copy of
34// ccRTP, as the General Public License permits, the exception does
35// not apply to the code that you add in this way. To avoid misleading
36// anyone as to the status of such modified files, you must delete
37// this exception notice from them.
38//
39// If you write modifications of your own for ccRTP, it is your choice
40// whether to permit this exception to apply to your modifications.
41// If you do not wish that, delete this exception notice.
42
52// This is for the main page in Doxygen documentation
57// This will make doxygen to generate example descriptions
87#ifndef CCXX_RTP_PRIVATE_H_
88#define CCXX_RTP_PRIVATE_H_
89
90#include <commoncpp/config.h>
91#include <commoncpp/thread.h>
92#include <commoncpp/socket.h>
93#include <commoncpp/udp.h>
94#include <commoncpp/process.h>
95#include <commoncpp/export.h>
96
97#include <ccrtp-config.h>
98
99#undef PACKAGE
100#undef VERSION
101
102// This is only of interest for developers, so it is included only if
103// --with-nana flag is given to configure
104#ifdef HAVE_LIBNANA
105# include "nana.h"
106# include "DL.h"
107#else
108# define I(e) /* empty */
109# define DL(e) /* empty */
110# define VDL(e) /* empty */
111#endif
112
113NAMESPACE_COMMONCPP
114
115#ifdef _MSWINDOWS_
116
117#ifndef timeradd
118#define timeradd(a, b, result) \
119{ \
120 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
121 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
122 if ( (result)->tv_usec >= 1000000 ) { \
123 (result)->tv_sec++; (result)->tv_usec -= 1000000ul; \
124 } \
125}
126#endif
127
128#ifndef timersub
129#define timersub(a, b, result) \
130{ \
131 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
132 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
133 if ( (result)->tv_usec < 0 ) { \
134 (result)->tv_sec--; (result)->tv_usec += 1000000ul; \
135 } \
136}
137#endif
138
139#endif // WIN32
140
141// Number of seconds ellapsed from 1900 to 1970
142const uint32 NTP_EPOCH_OFFSET = static_cast<uint32>(2208992400ul);
143
144uint32 random32();
145uint16 random16();
146
147END_NAMESPACE
148
149#endif // ifndef CCXX_RTP_PRIVATE_H_
150
uint32 random32()
uint16 random16()
NAMESPACE_COMMONCPP const uint32 NTP_EPOCH_OFFSET
Definition private.h:142