blob: b43661f72dee422c693f729839b744ff11b831fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#ifndef TOTP_XENDIAN_H
#define TOTP_XENDIAN_H
/* This header grabs the htobe64() and co. functions in a more
cross-platform manner. In general you will find these functions in
<sys/endian.h>, however Linux and OpenBSD include them in <endian.h>.
To make things even better this header doesn’t exist on MacOS so we
need to define wrapper macros for the htonXX() functions from
<arpa/inet.h>. */
#if defined(__OpenBSD__) || defined(__linux__)
# include <endian.h>
#elif defined(__APPLE__)
# include <arpa/inet.h>
# define htobe32(x) htonl(x)
# define htobe64(x) htonll(x)
#else
# include <sys/endian.h>
#endif
#endif /* !TOTP_XENDIAN_H */
|