1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik/*
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik SSSD
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik Authors:
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik Lukas Slebodnik <lslebodn@redhat.com>
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik Copyright (C) 2013 Red Hat
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik This program is free software; you can redistribute it and/or modify
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik it under the terms of the GNU General Public License as published by
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik the Free Software Foundation; either version 3 of the License, or
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik (at your option) any later version.
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik This program is distributed in the hope that it will be useful,
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik but WITHOUT ANY WARRANTY; without even the implied warranty of
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik GNU General Public License for more details.
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik You should have received a copy of the GNU General Public License
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik along with this program. If not, see <http://www.gnu.org/licenses/>.
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik*/
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#ifndef SSS_ENDIAN_H_
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#define SSS_ENDIAN_H_
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#ifdef HAVE_ENDIAN_H
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# include <endian.h>
fa0938a6e3cb928602633c3da0b909deb269369dLukas Slebodnik#elif defined(HAVE_SYS_ENDIAN_H)
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# include <sys/endian.h>
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#endif /* !HAVE_ENDIAN_H && !HAVE_SYS_ENDIAN_H */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik/* Endianness-compatibility for systems running older versions of glibc */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#ifndef le32toh
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#ifndef HAVE_BYTESWAP_H
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#error missing le32toh and byteswap.h
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#else /* defined HAVE_BYTESWAP_H */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#include <byteswap.h>
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik/* support RHEL5 lack of definitions */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik/* Copied from endian.h on glibc 2.15 */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#ifdef __USE_BSD
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik/* Conversion interfaces. */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# if __BYTE_ORDER == __LITTLE_ENDIAN
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# define le32toh(x) (x)
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# define htole32(x) (x)
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# else
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# define le32toh(x) __bswap_32 (x)
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# define htole32(x) __bswap_32 (x)
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik# endif
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#endif /* __USE_BSD */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#endif /* HAVE_BYTESWAP_H */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#endif /* le32toh */
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik
1658c567191c35beaddffafdb079abe33248037bLukas Slebodnik#endif /* SSS_ENDIAN_H_ */