blob: 494dc0a41d504ed1338be7cd6e5592838a78a94d [file] [log] [blame]
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05001/*
Alexandre Lisionddd731e2014-01-31 11:50:08 -05002 Copyright (C) 2012 Werner Dittmann
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05003
4 This program is free software: you can redistribute it and/or modify
Alexandre Lisionddd731e2014-01-31 11:50:08 -05005 it under the terms of the GNU General Public License as published by
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05006 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef _OSSPECIFICS_H_
19#define _OSSPECIFICS_H_
20
21/**
22 * @file osSpecifics.h
23 * @brief Some functions to adapt to OS and/or compiler specific handling
24 * @defgroup GNU_ZRTP The GNU ZRTP C++ implementation
25 * @{
26 *
27 * This modules contains some functions that are either specific for a particular
28 * OS or use include files that are not common.
29 *
30 * This header file shall not #include system specific header files and shall also
31 * not use specific #ifdef stuff. Refer to @c osSpecifics.c for the OS specific
32 * #include, #ifdef and implementations.
33 *
34 * @author Werner Dittmann <Werner.Dittmann@t-online.de>
35 */
36
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -050037#if defined(__cplusplus)
38extern "C"
39{
40#endif
41/**
42 * Get surrent system time in milli-second.
43 *
44 * @return current time in ms.
45 */
46extern uint64_t zrtpGetTickCount();
47
48/**
49 * Convert a 32bit variable from network to host order.
50 *
51 * Replaces the macros found in @c inet.h or @c WinSock2.h. Use this function
52 * to avoid different includes freamed with @c #idef in the sources. Including
53 * @c WinSock2 will increase compile time and may lead to other subtle problems
54 * because @c WinSock2 also includes @c windows.h.
55 *
56 * @param net 32bit variable in network byte order.
57 *
58 * @return 32bit variable in host byte order.
59 */
60extern uint32_t zrtpNtohl (uint32_t net);
61
62/**
63 * Convert a 16bit variable from network to host order.
64 *
65 * @param net 16bit variable in network byte order.
66 *
67 * @return 16bit variable in host byte order.
68 *
69 * @sa zrtpNtohl()
70 */
71extern uint16_t zrtpNtohs (uint16_t net);
72
73/**
74 * Convert a 32bit variable from host to network order.
75 *
76 * @param host 32bit variable in host byte order.
77 *
78 * @return 32bit variable in network byte order.
79 *
80 * @sa zrtpNtohl()
81 */
82extern uint32_t zrtpHtonl (uint32_t host);
83
84/**
85 * Convert a 16bit variable from host to network order.
86 *
87 * @param host 16bit variable in host byte order.
88 *
89 * @return 16bit variable in network byte order.
90 *
91 * @sa zrtpNtohl()
92 */
93extern uint16_t zrtpHtons (uint16_t host);
94
95#if defined(__cplusplus)
96}
97#endif
98
99
100/**
101 * @}
102 */
103#endif