]>
git.proxmox.com Git - swtpm.git/blob - include/sys_dependencies.h
2 * sys_dependencies.h -- system specific includes and #defines
4 * (c) Copyright IBM Corporation 2018.
6 * Author: Stefan Berger <stefanb@us.ibm.com>
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
14 * Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * Neither the names of the IBM Corporation nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #ifndef SWTPM_SYS_DEPENDENCIES_H
39 #define SWTPM_SYS_DEPENDENCIES_H
41 #if !defined __OpenBSD__ && !defined __FreeBSD__ && !defined __NetBSD__ \
42 && !defined __APPLE__ && !defined __DragonFly__
47 #if defined __FreeBSD__ || defined __NetBSD__ || defined __DragonFly__
48 # include <sys/endian.h>
49 # include <netinet/in.h>
50 #elif defined __APPLE__
51 # include <libkern/OSByteOrder.h>
53 # define be16toh(x) OSSwapBigToHostInt16(x)
54 # define be32toh(x) OSSwapBigToHostInt32(x)
55 # define be64toh(x) OSSwapBigToHostInt64(x)
57 # define htobe16(x) OSSwapHostToBigInt16(x)
58 # define htobe32(x) OSSwapHostToBigInt32(x)
59 # define htobe64(x) OSSwapHostToBigInt64(x)
61 # define le16toh(x) OSSwapLittleToHostInt16(x)
62 # define le32toh(x) OSSwapLittleToHostInt32(x)
63 # define le64toh(x) OSSwapLittleToHostInt64(x)
65 # define htole16(x) OSSwapHostToLittleInt16(x)
66 # define htole32(x) OSSwapHostToLittleInt32(x)
67 # define htole64(x) OSSwapHostToLittleInt64(x)
73 #endif /* SWTPM_SYS_DEPENDENCIES_H */