Add adobe authentication support
[rtmpdump.git] / librtmp / bytes.h
blob8c6e80d0e303709343a01e8cf6e854653a12f943
1 /*
2 * Copyright (C) 2005-2008 Team XBMC
3 * http://www.xbmc.org
4 * Copyright (C) 2008-2009 Andrej Stepanchuk
5 * Copyright (C) 2009-2010 Howard Chu
7 * This file is part of librtmp.
9 * librtmp is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as
11 * published by the Free Software Foundation; either version 2.1,
12 * or (at your option) any later version.
14 * librtmp is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with librtmp see the file COPYING. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23 * http://www.gnu.org/copyleft/lgpl.html
26 #ifndef __BYTES_H__
27 #define __BYTES_H__
29 #include <stdint.h>
31 #ifdef _WIN32
32 /* Windows is little endian only */
33 #define __LITTLE_ENDIAN 1234
34 #define __BIG_ENDIAN 4321
35 #define __BYTE_ORDER __LITTLE_ENDIAN
36 #define __FLOAT_WORD_ORDER __BYTE_ORDER
38 typedef unsigned char uint8_t;
40 #else /* !_WIN32 */
42 #include <sys/param.h>
44 #if defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
45 #define __BYTE_ORDER BYTE_ORDER
46 #endif
48 #if defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN)
49 #define __BIG_ENDIAN BIG_ENDIAN
50 #endif
52 #if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
53 #define __LITTLE_ENDIAN LITTLE_ENDIAN
54 #endif
56 #endif /* !_WIN32 */
58 /* define default endianness */
59 #ifndef __LITTLE_ENDIAN
60 #define __LITTLE_ENDIAN 1234
61 #endif
63 #ifndef __BIG_ENDIAN
64 #define __BIG_ENDIAN 4321
65 #endif
67 #ifndef __BYTE_ORDER
68 #warning "Byte order not defined on your system, assuming little endian!"
69 #define __BYTE_ORDER __LITTLE_ENDIAN
70 #endif
72 /* ok, we assume to have the same float word order and byte order if float word order is not defined */
73 #ifndef __FLOAT_WORD_ORDER
74 #warning "Float word order not defined, assuming the same as byte order!"
75 #define __FLOAT_WORD_ORDER __BYTE_ORDER
76 #endif
78 #if !defined(__BYTE_ORDER) || !defined(__FLOAT_WORD_ORDER)
79 #error "Undefined byte or float word order!"
80 #endif
82 #if __FLOAT_WORD_ORDER != __BIG_ENDIAN && __FLOAT_WORD_ORDER != __LITTLE_ENDIAN
83 #error "Unknown/unsupported float word order!"
84 #endif
86 #if __BYTE_ORDER != __BIG_ENDIAN && __BYTE_ORDER != __LITTLE_ENDIAN
87 #error "Unknown/unsupported byte order!"
88 #endif
90 #endif