cordova-plugin-mserviceinterface-2.0 1.0.21 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +28 -28
- package/plugin.xml +153 -153
- package/src/android/CallbackProgressDialog.java +53 -53
- package/src/android/FileProvider.java +7 -7
- package/src/android/backgroundNotification.java +120 -120
- package/src/android/doubleogradle.gradle +5 -5
- package/src/android/mInterface.java +2087 -2066
- package/src/android/mInterfaceReceiver.java +59 -59
- package/src/android/mInterfaceService.java +749 -749
- package/src/android/mInterfaceUtil.java +1686 -1688
- package/src/android/res/xml/network_security_config.xml +8 -8
- package/src/android/res/xml/opener_paths.xml +16 -16
- package/src/ios/InternetConnection.h +64 -64
- package/src/ios/InternetConnection.m +242 -242
- package/src/ios/SSZipArchive.h +146 -146
- package/src/ios/SSZipArchive.m +1180 -1180
- package/src/ios/SSZipCommon.h +66 -66
- package/src/ios/UICKeyChainStore.h +64 -64
- package/src/ios/UICKeyChainStore.m +434 -434
- package/src/ios/XMLConverter.h +61 -61
- package/src/ios/XMLConverter.m +243 -243
- package/src/ios/ZipArchive.h +19 -19
- package/src/ios/aes/aes.h +270 -270
- package/src/ios/aes/aes_ni.c +687 -687
- package/src/ios/aes/aes_ni.h +59 -59
- package/src/ios/aes/aescrypt.c +301 -301
- package/src/ios/aes/aeskey.c +554 -554
- package/src/ios/aes/aesopt.h +776 -776
- package/src/ios/aes/aestab.c +418 -418
- package/src/ios/aes/aestab.h +173 -173
- package/src/ios/aes/brg_endian.h +127 -127
- package/src/ios/aes/brg_types.h +191 -191
- package/src/ios/aes/fileenc.c +145 -145
- package/src/ios/aes/fileenc.h +121 -121
- package/src/ios/aes/hmac.c +209 -209
- package/src/ios/aes/hmac.h +119 -119
- package/src/ios/aes/prng.c +155 -155
- package/src/ios/aes/prng.h +82 -82
- package/src/ios/aes/pwd2key.c +181 -181
- package/src/ios/aes/pwd2key.h +45 -45
- package/src/ios/aes/sha1.c +283 -283
- package/src/ios/aes/sha1.h +72 -72
- package/src/ios/mInterface.h +2 -0
- package/src/ios/mInterface.m +18 -1
- package/src/ios/minizip/crypt.c +146 -146
- package/src/ios/minizip/crypt.h +66 -66
- package/src/ios/minizip/ioapi.c +353 -353
- package/src/ios/minizip/ioapi.h +154 -154
- package/src/ios/minizip/ioapi_buf.c +452 -452
- package/src/ios/minizip/ioapi_buf.h +52 -52
- package/src/ios/minizip/ioapi_mem.c +167 -167
- package/src/ios/minizip/ioapi_mem.h +52 -52
- package/src/ios/minizip/minishared.c +292 -292
- package/src/ios/minizip/minishared.h +50 -50
- package/src/ios/minizip/unzip.c +2007 -2007
- package/src/ios/minizip/unzip.h +254 -254
- package/src/ios/minizip/zip.c +2007 -2007
- package/src/ios/minizip/zip.h +215 -215
- package/www/mInterface.js +3 -3
package/src/ios/aes/aestab.h
CHANGED
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
/*
|
|
2
|
-
---------------------------------------------------------------------------
|
|
3
|
-
Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved.
|
|
4
|
-
|
|
5
|
-
The redistribution and use of this software (with or without changes)
|
|
6
|
-
is allowed without the payment of fees or royalties provided that:
|
|
7
|
-
|
|
8
|
-
source code distributions include the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer;
|
|
10
|
-
|
|
11
|
-
binary distributions include the above copyright notice, this list
|
|
12
|
-
of conditions and the following disclaimer in their documentation.
|
|
13
|
-
|
|
14
|
-
This software is provided 'as is' with no explicit or implied warranties
|
|
15
|
-
in respect of its operation, including, but not limited to, correctness
|
|
16
|
-
and fitness for purpose.
|
|
17
|
-
---------------------------------------------------------------------------
|
|
18
|
-
Issue Date: 20/12/2007
|
|
19
|
-
|
|
20
|
-
This file contains the code for declaring the tables needed to implement
|
|
21
|
-
AES. The file aesopt.h is assumed to be included before this header file.
|
|
22
|
-
If there are no global variables, the definitions here can be used to put
|
|
23
|
-
the AES tables in a structure so that a pointer can then be added to the
|
|
24
|
-
AES context to pass them to the AES routines that need them. If this
|
|
25
|
-
facility is used, the calling program has to ensure that this pointer is
|
|
26
|
-
managed appropriately. In particular, the value of the t_dec(in,it) item
|
|
27
|
-
in the table structure must be set to zero in order to ensure that the
|
|
28
|
-
tables are initialised. In practice the three code sequences in aeskey.c
|
|
29
|
-
that control the calls to aes_init() and the aes_init() routine itself will
|
|
30
|
-
have to be changed for a specific implementation. If global variables are
|
|
31
|
-
available it will generally be preferable to use them with the precomputed
|
|
32
|
-
STATIC_TABLES option that uses static global tables.
|
|
33
|
-
|
|
34
|
-
The following defines can be used to control the way the tables
|
|
35
|
-
are defined, initialised and used in embedded environments that
|
|
36
|
-
require special features for these purposes
|
|
37
|
-
|
|
38
|
-
the 't_dec' construction is used to declare fixed table arrays
|
|
39
|
-
the 't_set' construction is used to set fixed table values
|
|
40
|
-
the 't_use' construction is used to access fixed table values
|
|
41
|
-
|
|
42
|
-
256 byte tables:
|
|
43
|
-
|
|
44
|
-
t_xxx(s,box) => forward S box
|
|
45
|
-
t_xxx(i,box) => inverse S box
|
|
46
|
-
|
|
47
|
-
256 32-bit word OR 4 x 256 32-bit word tables:
|
|
48
|
-
|
|
49
|
-
t_xxx(f,n) => forward normal round
|
|
50
|
-
t_xxx(f,l) => forward last round
|
|
51
|
-
t_xxx(i,n) => inverse normal round
|
|
52
|
-
t_xxx(i,l) => inverse last round
|
|
53
|
-
t_xxx(l,s) => key schedule table
|
|
54
|
-
t_xxx(i,m) => key schedule table
|
|
55
|
-
|
|
56
|
-
Other variables and tables:
|
|
57
|
-
|
|
58
|
-
t_xxx(r,c) => the rcon table
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
#if !defined( _AESTAB_H )
|
|
62
|
-
#define _AESTAB_H
|
|
63
|
-
|
|
64
|
-
#if defined(__cplusplus)
|
|
65
|
-
extern "C" {
|
|
66
|
-
#endif
|
|
67
|
-
|
|
68
|
-
#define t_dec(m,n) t_##m##n
|
|
69
|
-
#define t_set(m,n) t_##m##n
|
|
70
|
-
#define t_use(m,n) t_##m##n
|
|
71
|
-
|
|
72
|
-
#if defined(STATIC_TABLES)
|
|
73
|
-
# if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ ))
|
|
74
|
-
/* make tables far data to avoid using too much DGROUP space (PG) */
|
|
75
|
-
# define CONST const far
|
|
76
|
-
# else
|
|
77
|
-
# define CONST const
|
|
78
|
-
# endif
|
|
79
|
-
#else
|
|
80
|
-
# define CONST
|
|
81
|
-
#endif
|
|
82
|
-
|
|
83
|
-
#if defined(DO_TABLES)
|
|
84
|
-
# define EXTERN
|
|
85
|
-
#else
|
|
86
|
-
# define EXTERN extern
|
|
87
|
-
#endif
|
|
88
|
-
|
|
89
|
-
#if defined(_MSC_VER) && defined(TABLE_ALIGN)
|
|
90
|
-
#define ALIGN __declspec(align(TABLE_ALIGN))
|
|
91
|
-
#else
|
|
92
|
-
#define ALIGN
|
|
93
|
-
#endif
|
|
94
|
-
|
|
95
|
-
#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 )
|
|
96
|
-
# define XP_DIR __cdecl
|
|
97
|
-
#else
|
|
98
|
-
# define XP_DIR
|
|
99
|
-
#endif
|
|
100
|
-
|
|
101
|
-
#if defined(DO_TABLES) && defined(STATIC_TABLES)
|
|
102
|
-
#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e)
|
|
103
|
-
#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) }
|
|
104
|
-
EXTERN ALIGN CONST uint32_t t_dec(r,c)[RC_LENGTH] = rc_data(w0);
|
|
105
|
-
#else
|
|
106
|
-
#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256]
|
|
107
|
-
#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256]
|
|
108
|
-
EXTERN ALIGN CONST uint32_t t_dec(r,c)[RC_LENGTH];
|
|
109
|
-
#endif
|
|
110
|
-
|
|
111
|
-
#if defined( SBX_SET )
|
|
112
|
-
d_1(uint8_t, t_dec(s,box), sb_data, h0);
|
|
113
|
-
#endif
|
|
114
|
-
#if defined( ISB_SET )
|
|
115
|
-
d_1(uint8_t, t_dec(i,box), isb_data, h0);
|
|
116
|
-
#endif
|
|
117
|
-
|
|
118
|
-
#if defined( FT1_SET )
|
|
119
|
-
d_1(uint32_t, t_dec(f,n), sb_data, u0);
|
|
120
|
-
#endif
|
|
121
|
-
#if defined( FT4_SET )
|
|
122
|
-
d_4(uint32_t, t_dec(f,n), sb_data, u0, u1, u2, u3);
|
|
123
|
-
#endif
|
|
124
|
-
|
|
125
|
-
#if defined( FL1_SET )
|
|
126
|
-
d_1(uint32_t, t_dec(f,l), sb_data, w0);
|
|
127
|
-
#endif
|
|
128
|
-
#if defined( FL4_SET )
|
|
129
|
-
d_4(uint32_t, t_dec(f,l), sb_data, w0, w1, w2, w3);
|
|
130
|
-
#endif
|
|
131
|
-
|
|
132
|
-
#if defined( IT1_SET )
|
|
133
|
-
d_1(uint32_t, t_dec(i,n), isb_data, v0);
|
|
134
|
-
#endif
|
|
135
|
-
#if defined( IT4_SET )
|
|
136
|
-
d_4(uint32_t, t_dec(i,n), isb_data, v0, v1, v2, v3);
|
|
137
|
-
#endif
|
|
138
|
-
|
|
139
|
-
#if defined( IL1_SET )
|
|
140
|
-
d_1(uint32_t, t_dec(i,l), isb_data, w0);
|
|
141
|
-
#endif
|
|
142
|
-
#if defined( IL4_SET )
|
|
143
|
-
d_4(uint32_t, t_dec(i,l), isb_data, w0, w1, w2, w3);
|
|
144
|
-
#endif
|
|
145
|
-
|
|
146
|
-
#if defined( LS1_SET )
|
|
147
|
-
#if defined( FL1_SET )
|
|
148
|
-
#undef LS1_SET
|
|
149
|
-
#else
|
|
150
|
-
d_1(uint32_t, t_dec(l,s), sb_data, w0);
|
|
151
|
-
#endif
|
|
152
|
-
#endif
|
|
153
|
-
|
|
154
|
-
#if defined( LS4_SET )
|
|
155
|
-
#if defined( FL4_SET )
|
|
156
|
-
#undef LS4_SET
|
|
157
|
-
#else
|
|
158
|
-
d_4(uint32_t, t_dec(l,s), sb_data, w0, w1, w2, w3);
|
|
159
|
-
#endif
|
|
160
|
-
#endif
|
|
161
|
-
|
|
162
|
-
#if defined( IM1_SET )
|
|
163
|
-
d_1(uint32_t, t_dec(i,m), mm_data, v0);
|
|
164
|
-
#endif
|
|
165
|
-
#if defined( IM4_SET )
|
|
166
|
-
d_4(uint32_t, t_dec(i,m), mm_data, v0, v1, v2, v3);
|
|
167
|
-
#endif
|
|
168
|
-
|
|
169
|
-
#if defined(__cplusplus)
|
|
170
|
-
}
|
|
171
|
-
#endif
|
|
172
|
-
|
|
173
|
-
#endif
|
|
1
|
+
/*
|
|
2
|
+
---------------------------------------------------------------------------
|
|
3
|
+
Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved.
|
|
4
|
+
|
|
5
|
+
The redistribution and use of this software (with or without changes)
|
|
6
|
+
is allowed without the payment of fees or royalties provided that:
|
|
7
|
+
|
|
8
|
+
source code distributions include the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer;
|
|
10
|
+
|
|
11
|
+
binary distributions include the above copyright notice, this list
|
|
12
|
+
of conditions and the following disclaimer in their documentation.
|
|
13
|
+
|
|
14
|
+
This software is provided 'as is' with no explicit or implied warranties
|
|
15
|
+
in respect of its operation, including, but not limited to, correctness
|
|
16
|
+
and fitness for purpose.
|
|
17
|
+
---------------------------------------------------------------------------
|
|
18
|
+
Issue Date: 20/12/2007
|
|
19
|
+
|
|
20
|
+
This file contains the code for declaring the tables needed to implement
|
|
21
|
+
AES. The file aesopt.h is assumed to be included before this header file.
|
|
22
|
+
If there are no global variables, the definitions here can be used to put
|
|
23
|
+
the AES tables in a structure so that a pointer can then be added to the
|
|
24
|
+
AES context to pass them to the AES routines that need them. If this
|
|
25
|
+
facility is used, the calling program has to ensure that this pointer is
|
|
26
|
+
managed appropriately. In particular, the value of the t_dec(in,it) item
|
|
27
|
+
in the table structure must be set to zero in order to ensure that the
|
|
28
|
+
tables are initialised. In practice the three code sequences in aeskey.c
|
|
29
|
+
that control the calls to aes_init() and the aes_init() routine itself will
|
|
30
|
+
have to be changed for a specific implementation. If global variables are
|
|
31
|
+
available it will generally be preferable to use them with the precomputed
|
|
32
|
+
STATIC_TABLES option that uses static global tables.
|
|
33
|
+
|
|
34
|
+
The following defines can be used to control the way the tables
|
|
35
|
+
are defined, initialised and used in embedded environments that
|
|
36
|
+
require special features for these purposes
|
|
37
|
+
|
|
38
|
+
the 't_dec' construction is used to declare fixed table arrays
|
|
39
|
+
the 't_set' construction is used to set fixed table values
|
|
40
|
+
the 't_use' construction is used to access fixed table values
|
|
41
|
+
|
|
42
|
+
256 byte tables:
|
|
43
|
+
|
|
44
|
+
t_xxx(s,box) => forward S box
|
|
45
|
+
t_xxx(i,box) => inverse S box
|
|
46
|
+
|
|
47
|
+
256 32-bit word OR 4 x 256 32-bit word tables:
|
|
48
|
+
|
|
49
|
+
t_xxx(f,n) => forward normal round
|
|
50
|
+
t_xxx(f,l) => forward last round
|
|
51
|
+
t_xxx(i,n) => inverse normal round
|
|
52
|
+
t_xxx(i,l) => inverse last round
|
|
53
|
+
t_xxx(l,s) => key schedule table
|
|
54
|
+
t_xxx(i,m) => key schedule table
|
|
55
|
+
|
|
56
|
+
Other variables and tables:
|
|
57
|
+
|
|
58
|
+
t_xxx(r,c) => the rcon table
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
#if !defined( _AESTAB_H )
|
|
62
|
+
#define _AESTAB_H
|
|
63
|
+
|
|
64
|
+
#if defined(__cplusplus)
|
|
65
|
+
extern "C" {
|
|
66
|
+
#endif
|
|
67
|
+
|
|
68
|
+
#define t_dec(m,n) t_##m##n
|
|
69
|
+
#define t_set(m,n) t_##m##n
|
|
70
|
+
#define t_use(m,n) t_##m##n
|
|
71
|
+
|
|
72
|
+
#if defined(STATIC_TABLES)
|
|
73
|
+
# if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ ))
|
|
74
|
+
/* make tables far data to avoid using too much DGROUP space (PG) */
|
|
75
|
+
# define CONST const far
|
|
76
|
+
# else
|
|
77
|
+
# define CONST const
|
|
78
|
+
# endif
|
|
79
|
+
#else
|
|
80
|
+
# define CONST
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
#if defined(DO_TABLES)
|
|
84
|
+
# define EXTERN
|
|
85
|
+
#else
|
|
86
|
+
# define EXTERN extern
|
|
87
|
+
#endif
|
|
88
|
+
|
|
89
|
+
#if defined(_MSC_VER) && defined(TABLE_ALIGN)
|
|
90
|
+
#define ALIGN __declspec(align(TABLE_ALIGN))
|
|
91
|
+
#else
|
|
92
|
+
#define ALIGN
|
|
93
|
+
#endif
|
|
94
|
+
|
|
95
|
+
#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 )
|
|
96
|
+
# define XP_DIR __cdecl
|
|
97
|
+
#else
|
|
98
|
+
# define XP_DIR
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
#if defined(DO_TABLES) && defined(STATIC_TABLES)
|
|
102
|
+
#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e)
|
|
103
|
+
#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) }
|
|
104
|
+
EXTERN ALIGN CONST uint32_t t_dec(r,c)[RC_LENGTH] = rc_data(w0);
|
|
105
|
+
#else
|
|
106
|
+
#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256]
|
|
107
|
+
#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256]
|
|
108
|
+
EXTERN ALIGN CONST uint32_t t_dec(r,c)[RC_LENGTH];
|
|
109
|
+
#endif
|
|
110
|
+
|
|
111
|
+
#if defined( SBX_SET )
|
|
112
|
+
d_1(uint8_t, t_dec(s,box), sb_data, h0);
|
|
113
|
+
#endif
|
|
114
|
+
#if defined( ISB_SET )
|
|
115
|
+
d_1(uint8_t, t_dec(i,box), isb_data, h0);
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
#if defined( FT1_SET )
|
|
119
|
+
d_1(uint32_t, t_dec(f,n), sb_data, u0);
|
|
120
|
+
#endif
|
|
121
|
+
#if defined( FT4_SET )
|
|
122
|
+
d_4(uint32_t, t_dec(f,n), sb_data, u0, u1, u2, u3);
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
#if defined( FL1_SET )
|
|
126
|
+
d_1(uint32_t, t_dec(f,l), sb_data, w0);
|
|
127
|
+
#endif
|
|
128
|
+
#if defined( FL4_SET )
|
|
129
|
+
d_4(uint32_t, t_dec(f,l), sb_data, w0, w1, w2, w3);
|
|
130
|
+
#endif
|
|
131
|
+
|
|
132
|
+
#if defined( IT1_SET )
|
|
133
|
+
d_1(uint32_t, t_dec(i,n), isb_data, v0);
|
|
134
|
+
#endif
|
|
135
|
+
#if defined( IT4_SET )
|
|
136
|
+
d_4(uint32_t, t_dec(i,n), isb_data, v0, v1, v2, v3);
|
|
137
|
+
#endif
|
|
138
|
+
|
|
139
|
+
#if defined( IL1_SET )
|
|
140
|
+
d_1(uint32_t, t_dec(i,l), isb_data, w0);
|
|
141
|
+
#endif
|
|
142
|
+
#if defined( IL4_SET )
|
|
143
|
+
d_4(uint32_t, t_dec(i,l), isb_data, w0, w1, w2, w3);
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
#if defined( LS1_SET )
|
|
147
|
+
#if defined( FL1_SET )
|
|
148
|
+
#undef LS1_SET
|
|
149
|
+
#else
|
|
150
|
+
d_1(uint32_t, t_dec(l,s), sb_data, w0);
|
|
151
|
+
#endif
|
|
152
|
+
#endif
|
|
153
|
+
|
|
154
|
+
#if defined( LS4_SET )
|
|
155
|
+
#if defined( FL4_SET )
|
|
156
|
+
#undef LS4_SET
|
|
157
|
+
#else
|
|
158
|
+
d_4(uint32_t, t_dec(l,s), sb_data, w0, w1, w2, w3);
|
|
159
|
+
#endif
|
|
160
|
+
#endif
|
|
161
|
+
|
|
162
|
+
#if defined( IM1_SET )
|
|
163
|
+
d_1(uint32_t, t_dec(i,m), mm_data, v0);
|
|
164
|
+
#endif
|
|
165
|
+
#if defined( IM4_SET )
|
|
166
|
+
d_4(uint32_t, t_dec(i,m), mm_data, v0, v1, v2, v3);
|
|
167
|
+
#endif
|
|
168
|
+
|
|
169
|
+
#if defined(__cplusplus)
|
|
170
|
+
}
|
|
171
|
+
#endif
|
|
172
|
+
|
|
173
|
+
#endif
|
package/src/ios/aes/brg_endian.h
CHANGED
|
@@ -1,127 +1,127 @@
|
|
|
1
|
-
/*
|
|
2
|
-
---------------------------------------------------------------------------
|
|
3
|
-
Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved.
|
|
4
|
-
|
|
5
|
-
The redistribution and use of this software (with or without changes)
|
|
6
|
-
is allowed without the payment of fees or royalties provided that:
|
|
7
|
-
|
|
8
|
-
source code distributions include the above copyright notice, this
|
|
9
|
-
list of conditions and the following disclaimer;
|
|
10
|
-
|
|
11
|
-
binary distributions include the above copyright notice, this list
|
|
12
|
-
of conditions and the following disclaimer in their documentation.
|
|
13
|
-
|
|
14
|
-
This software is provided 'as is' with no explicit or implied warranties
|
|
15
|
-
in respect of its operation, including, but not limited to, correctness
|
|
16
|
-
and fitness for purpose.
|
|
17
|
-
---------------------------------------------------------------------------
|
|
18
|
-
Issue Date: 20/12/2007
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
#ifndef _BRG_ENDIAN_H
|
|
22
|
-
#define _BRG_ENDIAN_H
|
|
23
|
-
|
|
24
|
-
#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
|
|
25
|
-
#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
|
|
26
|
-
|
|
27
|
-
/* Include files where endian defines and byteswap functions may reside */
|
|
28
|
-
#if defined( __sun )
|
|
29
|
-
# include <sys/isa_defs.h>
|
|
30
|
-
#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
|
|
31
|
-
# include <sys/endian.h>
|
|
32
|
-
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
|
|
33
|
-
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) || \
|
|
34
|
-
defined(__pnacl__)
|
|
35
|
-
# include <machine/endian.h>
|
|
36
|
-
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
|
|
37
|
-
# if !defined( __MINGW32__ ) && !defined( _AIX )
|
|
38
|
-
# include <endian.h>
|
|
39
|
-
# if !defined( __BEOS__ )
|
|
40
|
-
# include <byteswap.h>
|
|
41
|
-
# endif
|
|
42
|
-
# endif
|
|
43
|
-
#endif
|
|
44
|
-
|
|
45
|
-
/* Now attempt to set the define for platform byte order using any */
|
|
46
|
-
/* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */
|
|
47
|
-
/* seem to encompass most endian symbol definitions */
|
|
48
|
-
|
|
49
|
-
#if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN )
|
|
50
|
-
# if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN
|
|
51
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
52
|
-
# elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN
|
|
53
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
54
|
-
# endif
|
|
55
|
-
#elif defined( BIG_ENDIAN )
|
|
56
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
57
|
-
#elif defined( LITTLE_ENDIAN )
|
|
58
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
59
|
-
#endif
|
|
60
|
-
|
|
61
|
-
#if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN )
|
|
62
|
-
# if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN
|
|
63
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
64
|
-
# elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN
|
|
65
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
66
|
-
# endif
|
|
67
|
-
#elif defined( _BIG_ENDIAN )
|
|
68
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
69
|
-
#elif defined( _LITTLE_ENDIAN )
|
|
70
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
71
|
-
#endif
|
|
72
|
-
|
|
73
|
-
#if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN )
|
|
74
|
-
# if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN
|
|
75
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
76
|
-
# elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN
|
|
77
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
78
|
-
# endif
|
|
79
|
-
#elif defined( __BIG_ENDIAN )
|
|
80
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
81
|
-
#elif defined( __LITTLE_ENDIAN )
|
|
82
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
83
|
-
#endif
|
|
84
|
-
|
|
85
|
-
#if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ )
|
|
86
|
-
# if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__
|
|
87
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
88
|
-
# elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__
|
|
89
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
90
|
-
# endif
|
|
91
|
-
#elif defined( __BIG_ENDIAN__ )
|
|
92
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
93
|
-
#elif defined( __LITTLE_ENDIAN__ )
|
|
94
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
95
|
-
#endif
|
|
96
|
-
|
|
97
|
-
/* if the platform byte order could not be determined, then try to */
|
|
98
|
-
/* set this define using common machine defines */
|
|
99
|
-
#if !defined(PLATFORM_BYTE_ORDER)
|
|
100
|
-
|
|
101
|
-
#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
|
|
102
|
-
defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
|
|
103
|
-
defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
|
|
104
|
-
defined( vax ) || defined( vms ) || defined( VMS ) || \
|
|
105
|
-
defined( __VMS ) || defined( _M_X64 )
|
|
106
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
107
|
-
|
|
108
|
-
#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
|
|
109
|
-
defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
|
|
110
|
-
defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
|
|
111
|
-
defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
|
|
112
|
-
defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
|
|
113
|
-
defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \
|
|
114
|
-
defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX )
|
|
115
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
116
|
-
|
|
117
|
-
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
|
|
118
|
-
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
119
|
-
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
|
|
120
|
-
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
121
|
-
#else
|
|
122
|
-
# error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order
|
|
123
|
-
#endif
|
|
124
|
-
|
|
125
|
-
#endif
|
|
126
|
-
|
|
127
|
-
#endif
|
|
1
|
+
/*
|
|
2
|
+
---------------------------------------------------------------------------
|
|
3
|
+
Copyright (c) 1998-2013, Brian Gladman, Worcester, UK. All rights reserved.
|
|
4
|
+
|
|
5
|
+
The redistribution and use of this software (with or without changes)
|
|
6
|
+
is allowed without the payment of fees or royalties provided that:
|
|
7
|
+
|
|
8
|
+
source code distributions include the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer;
|
|
10
|
+
|
|
11
|
+
binary distributions include the above copyright notice, this list
|
|
12
|
+
of conditions and the following disclaimer in their documentation.
|
|
13
|
+
|
|
14
|
+
This software is provided 'as is' with no explicit or implied warranties
|
|
15
|
+
in respect of its operation, including, but not limited to, correctness
|
|
16
|
+
and fitness for purpose.
|
|
17
|
+
---------------------------------------------------------------------------
|
|
18
|
+
Issue Date: 20/12/2007
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef _BRG_ENDIAN_H
|
|
22
|
+
#define _BRG_ENDIAN_H
|
|
23
|
+
|
|
24
|
+
#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */
|
|
25
|
+
#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */
|
|
26
|
+
|
|
27
|
+
/* Include files where endian defines and byteswap functions may reside */
|
|
28
|
+
#if defined( __sun )
|
|
29
|
+
# include <sys/isa_defs.h>
|
|
30
|
+
#elif defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
|
|
31
|
+
# include <sys/endian.h>
|
|
32
|
+
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
|
|
33
|
+
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ ) || \
|
|
34
|
+
defined(__pnacl__)
|
|
35
|
+
# include <machine/endian.h>
|
|
36
|
+
#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
|
|
37
|
+
# if !defined( __MINGW32__ ) && !defined( _AIX )
|
|
38
|
+
# include <endian.h>
|
|
39
|
+
# if !defined( __BEOS__ )
|
|
40
|
+
# include <byteswap.h>
|
|
41
|
+
# endif
|
|
42
|
+
# endif
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
/* Now attempt to set the define for platform byte order using any */
|
|
46
|
+
/* of the four forms SYMBOL, _SYMBOL, __SYMBOL & __SYMBOL__, which */
|
|
47
|
+
/* seem to encompass most endian symbol definitions */
|
|
48
|
+
|
|
49
|
+
#if defined( BIG_ENDIAN ) && defined( LITTLE_ENDIAN )
|
|
50
|
+
# if defined( BYTE_ORDER ) && BYTE_ORDER == BIG_ENDIAN
|
|
51
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
52
|
+
# elif defined( BYTE_ORDER ) && BYTE_ORDER == LITTLE_ENDIAN
|
|
53
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
54
|
+
# endif
|
|
55
|
+
#elif defined( BIG_ENDIAN )
|
|
56
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
57
|
+
#elif defined( LITTLE_ENDIAN )
|
|
58
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
59
|
+
#endif
|
|
60
|
+
|
|
61
|
+
#if defined( _BIG_ENDIAN ) && defined( _LITTLE_ENDIAN )
|
|
62
|
+
# if defined( _BYTE_ORDER ) && _BYTE_ORDER == _BIG_ENDIAN
|
|
63
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
64
|
+
# elif defined( _BYTE_ORDER ) && _BYTE_ORDER == _LITTLE_ENDIAN
|
|
65
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
66
|
+
# endif
|
|
67
|
+
#elif defined( _BIG_ENDIAN )
|
|
68
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
69
|
+
#elif defined( _LITTLE_ENDIAN )
|
|
70
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#if defined( __BIG_ENDIAN ) && defined( __LITTLE_ENDIAN )
|
|
74
|
+
# if defined( __BYTE_ORDER ) && __BYTE_ORDER == __BIG_ENDIAN
|
|
75
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
76
|
+
# elif defined( __BYTE_ORDER ) && __BYTE_ORDER == __LITTLE_ENDIAN
|
|
77
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
78
|
+
# endif
|
|
79
|
+
#elif defined( __BIG_ENDIAN )
|
|
80
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
81
|
+
#elif defined( __LITTLE_ENDIAN )
|
|
82
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
#if defined( __BIG_ENDIAN__ ) && defined( __LITTLE_ENDIAN__ )
|
|
86
|
+
# if defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __BIG_ENDIAN__
|
|
87
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
88
|
+
# elif defined( __BYTE_ORDER__ ) && __BYTE_ORDER__ == __LITTLE_ENDIAN__
|
|
89
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
90
|
+
# endif
|
|
91
|
+
#elif defined( __BIG_ENDIAN__ )
|
|
92
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
93
|
+
#elif defined( __LITTLE_ENDIAN__ )
|
|
94
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
95
|
+
#endif
|
|
96
|
+
|
|
97
|
+
/* if the platform byte order could not be determined, then try to */
|
|
98
|
+
/* set this define using common machine defines */
|
|
99
|
+
#if !defined(PLATFORM_BYTE_ORDER)
|
|
100
|
+
|
|
101
|
+
#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 ) || \
|
|
102
|
+
defined( __i386__ ) || defined( _M_I86 ) || defined( _M_IX86 ) || \
|
|
103
|
+
defined( __OS2__ ) || defined( sun386 ) || defined( __TURBOC__ ) || \
|
|
104
|
+
defined( vax ) || defined( vms ) || defined( VMS ) || \
|
|
105
|
+
defined( __VMS ) || defined( _M_X64 )
|
|
106
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
107
|
+
|
|
108
|
+
#elif defined( AMIGA ) || defined( applec ) || defined( __AS400__ ) || \
|
|
109
|
+
defined( _CRAY ) || defined( __hppa ) || defined( __hp9000 ) || \
|
|
110
|
+
defined( ibm370 ) || defined( mc68000 ) || defined( m68k ) || \
|
|
111
|
+
defined( __MRC__ ) || defined( __MVS__ ) || defined( __MWERKS__ ) || \
|
|
112
|
+
defined( sparc ) || defined( __sparc) || defined( SYMANTEC_C ) || \
|
|
113
|
+
defined( __VOS__ ) || defined( __TIGCC__ ) || defined( __TANDEM ) || \
|
|
114
|
+
defined( THINK_C ) || defined( __VMCMS__ ) || defined( _AIX )
|
|
115
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
116
|
+
|
|
117
|
+
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
|
|
118
|
+
# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
|
|
119
|
+
#elif 0 /* **** EDIT HERE IF NECESSARY **** */
|
|
120
|
+
# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
|
|
121
|
+
#else
|
|
122
|
+
# error Please edit lines 126 or 128 in brg_endian.h to set the platform byte order
|
|
123
|
+
#endif
|
|
124
|
+
|
|
125
|
+
#endif
|
|
126
|
+
|
|
127
|
+
#endif
|