TrustCore SDK NanoTAP API reference  version 3.0
mtypes.h
Go to the documentation of this file.
1 
15 /*------------------------------------------------------------------*/
16 
17 #ifndef __MTYPES_HEADER__
18 #define __MTYPES_HEADER__
19 
20 
21 #ifndef __ENABLE_MOCANA_BASIC_TYPES_OVERRIDE__
22 
23 typedef unsigned char ubyte;
25 typedef unsigned short ubyte2;
26 #if ((__SIZEOF_LONG__ == 4) && (__SIZEOF_INT__ != 4))
27 
28 typedef unsigned long ubyte4;
29 #else
30 
31 typedef unsigned int ubyte4;
32 #endif
33 
35 typedef signed char sbyte;
37 typedef signed short sbyte2;
38 #if ((__SIZEOF_LONG__ == 4) && (__SIZEOF_INT__ != 4))
39 
40 typedef signed long sbyte4;
41 #else
42 
43 typedef signed int sbyte4;
44 #endif
45 
46 
47 #endif
48 
49 /* gcc 2.95 does not define __LONG_LONG_MAX__ and __LONG_MAX__ as built-in
50 This code forces the use of long long for all GCC -- using limits.h does
51 not seem to work (__LONG_LONG_MAX__ is still undefined) */
52 #if defined (__GNUC__)
53 
57 #if !defined(__LONG_LONG_MAX__)
58 #define __LONG_LONG_MAX__ 9223372036854775807LL
59 #endif
60 
61 #if !defined(__LONG_MAX__)
62 #define __LONG_MAX__ 2147483647L
63 #endif
64 
68 #endif /* __GNUC__ */
69 
70 #if defined(__ARMCC_VERSION) || defined (__RTOS_WIN32__) || defined (__RTOS_VXWORKS__) || defined( __ENABLE_MOCANA_64_BIT__) || defined(__LP64__) || (defined(__LONG_LONG_MAX__) && __LONG_LONG_MAX__ > __LONG_MAX__ && !defined(__MOCANA_MAX_INT_32__) ) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
71 
75 #define __MOCANA_MAX_INT__ (64)
76 
80 #if defined( _MSC_VER)
81 
82 typedef unsigned __int64 ubyte8;
84 typedef signed __int64 sbyte8;
85 #else
86 
87 typedef unsigned long long ubyte8;
89 typedef signed long long sbyte8;
90 #endif
91 
92 
95 typedef struct ubyte16
96 {
97  /* @brief Upper 8-byte (64-bit) field */
98  ubyte8 upper64;
99  /* @brief Lower 8-byte (64-bit) field */
100  ubyte8 lower64;
101 } ubyte16;
102 
103 
104 #else
105 
109 #define __MOCANA_MAX_INT__ (32)
110 
116 typedef struct
117 {
122 
123 } ubyte8;
124 
127 typedef struct ubyte16
128 {
137 } ubyte16;
138 
139 #endif /* __ENABLE_MOCANA_64_BIT__ */
140 
144 #if __LONG_MAX__ == __INT_MAX__
145 typedef ubyte4 usize;
146 #else
147 typedef ubyte8 usize;
148 #endif
149 
157 
161 typedef void* BulkCtx;
166 /* Intentionally not a real pointer--used in pointer math */
170 #if defined(__RTOS_WIN32__) && defined(_WIN64)
171 typedef unsigned __int64 uintptr;
172 #else
173 typedef usize uintptr;
174 #endif
175 
182 #ifdef __ENABLE_MOCANA_IPV6__
183 typedef struct moc_ipaddr
184 {
185  ubyte2 family; /* AF_INET or AF_INET6 */
186  union
187  {
188  ubyte4 addr6[5]; /* IPv6 (128 bits); in network byte order
189  (with trailing scope id in host byte order) */
190  ubyte4 addr; /* IPv4 (32 bits); in host byte order */
191  } uin;
192 
193 } *MOC_IP_ADDRESS, MOC_IP_ADDRESS_S;
194 #else
195 #ifndef __ENABLE_MOCANA_NETWORK_TYPES_OVERRIDE__
196 /* KJW - Make 64-bit safe, avoid 'long' */
197 typedef ubyte4 MOC_IP_ADDRESS;
198 #endif
199 #define MOC_IP_ADDRESS_S MOC_IP_ADDRESS
200 #endif
201 
208 typedef struct
209 {
221  ubyte node[6];
222 } MOC_UUID;
223 
224 typedef enum dataType
225 {
226  DATA_TYPE_UNDEFINED = 0,
227  DATA_TYPE_PASSWORD,
228  DATA_TYPE_CERT,
229  DATA_TYPE_KEY,
230  DATA_TYPE_OBJECT
231 } dataType;
232 
233 typedef enum dataEncoding
234 {
235  DATA_ENCODE_UNDEFINED = 0,
236  DATA_ENCODE_PLAINTEXT,
237  DATA_ENCODE_SHA1,
238  DATA_ENCODE_SHA256,
239  DATA_ENCODE_DER,
240  DATA_ENCODE_PEM,
241  DATA_ENCODE_BYTE_BUFFER
242 } dataEncoding;
243 
244 #ifdef __RTOS_WIN32__
245 #include <basetsd.h>
246 #ifndef __MINGW32__
247 typedef SSIZE_T ssize_t;
248 #endif /* !__MINGW32__ */
249 #endif /* __RTOS_WIN32__ */
250 
251 #endif /* __MTYPES_HEADER__ */
Definition: mtypes.h:208
signed char sbyte
Default signed 1-byte type.
Definition: mtypes.h:35
ubyte4 w2
2nd 4-byte word
Definition: mtypes.h:132
signed short sbyte2
Default signed 2-byte type.
Definition: mtypes.h:37
ubyte clockSeqHigh
Definition: mtypes.h:217
signed int sbyte4
Default signed 4-byte type.
Definition: mtypes.h:43
ubyte clockSeqLow
Definition: mtypes.h:219
ubyte2 timeHigh
Definition: mtypes.h:215
ubyte4 w1
1st 4-byte word
Definition: mtypes.h:130
ubyte4 upper32
Upper 4-byte (32-bit) field.
Definition: mtypes.h:119
ubyte4 w3
3rd 4-byte word
Definition: mtypes.h:134
ubyte4 timeLow
Definition: mtypes.h:211
ubyte4 lower32
Lower 4-byte (32-bit) field.
Definition: mtypes.h:121
sbyte byteBoolean
One-byte boolean type.
Definition: mtypes.h:154
ubyte2 timeMid
Definition: mtypes.h:213
Unsigned 16-byte type.
Definition: mtypes.h:127
unsigned int ubyte4
Default unsigned 4-byte type.
Definition: mtypes.h:31
sbyte4 intBoolean
Integer boolean type.
Definition: mtypes.h:156
Unsigned 8-byte type.
Definition: mtypes.h:116
ubyte4 w4
4th 4-byte word
Definition: mtypes.h:136
unsigned short ubyte2
Default unsigned 2-byte type.
Definition: mtypes.h:25
unsigned char ubyte
Default unsigned 1-byte type.
Definition: mtypes.h:23