1 /* integer of 8 bits */
2 typedef NETWIBDEF_TYPE_INT8 netwib_int8;
3 typedef NETWIBDEF_TYPE_UINT8 netwib_uint8;
4 
5 /* integer of 16 bits */
6 typedef NETWIBDEF_TYPE_INT16 netwib_int16;
7 typedef NETWIBDEF_TYPE_UINT16 netwib_uint16;
8 
9 /* integer of 32 bits */
10 typedef NETWIBDEF_TYPE_INT32 netwib_int32;
11 typedef NETWIBDEF_TYPE_UINT32 netwib_uint32;
12 
13 /* integer of 64 bits */
14 #if NETWIBDEF_TYPE_INT64_FAKE == 0
15   /* define the type */
16   typedef NETWIBDEF_TYPE_INT64 netwib_int64;
17   typedef NETWIBDEF_TYPE_UINT64 netwib_uint64;
18   #define NETWIB_INT64_FAKE 0
19 #else
20   /* define a fake structure allowing easy storage, but unusable for math */
21   typedef struct {
22     netwib_uint32 high;
23     netwib_uint32 low;
24   } netwib_uint64;
25   typedef netwib_uint64 netwib_int64;
26   #define NETWIB_INT64_FAKE 1
27 #endif
28 
29 /* maximum size integer on the computer */
30 #if NETWIB_INT64_FAKE == 0
31   typedef netwib_int64 netwib_intmax;
32   typedef netwib_uint64 netwib_uintmax;
33   #define NETWIB_INTMAX_BITS 64
34 #else
35   typedef netwib_int32 netwib_intmax;
36   typedef netwib_uint32 netwib_uintmax;
37   #define NETWIB_INTMAX_BITS 32
38 #endif
39 
40 /* size of pointers on the computer */
41 #if NETWIBDEF_ARCH_BITS == 32
42   typedef netwib_int32 netwib_intptr;
43   typedef netwib_uint32 netwib_uintptr;
44   #define NETWIB_INTPTR_BITS 32
45 #elif NETWIBDEF_ARCH_BITS == 64
46   typedef netwib_int64 netwib_intptr;
47   typedef netwib_uint64 netwib_uintptr;
48   #define NETWIB_INTPTR_BITS 64
49 #else
50   #error "Unknown value for NETWIBDEF_ARCH_BITS"
51 #endif
52 
53 /* char */
54 typedef char netwib_char;
55 
56 /* byte */
57 typedef unsigned char netwib_byte;
58 
59 /* pointer */
60 typedef void* netwib_ptr;
61 typedef const void* netwib_constptr;
62 
63 /* data */
64 typedef netwib_byte* netwib_data;
65 typedef const netwib_byte* netwib_constdata;
66 /* string */
67 typedef netwib_char* netwib_string;
68 typedef const netwib_char* netwib_conststring;
69 
70 /* boolean */
71 typedef enum {
72   NETWIB_FALSE = 0,
73   NETWIB_TRUE = !NETWIB_FALSE
74 } netwib_bool;
75 
76 /* comparison */
77 typedef enum {
78   NETWIB_CMP_LT = -1,
79   NETWIB_CMP_EQ = 0,
80   NETWIB_CMP_GT = +1
81 } netwib_cmp;
82 
83 /* netwib contains several enum. User can define its own values
84    starting from 10000 */
85 #define NETWIB_ENUM_USER_BEGIN 10000
86 
87 /*-------------------------------------------------------------*/
88 /***************************************************************
89  * Note about return values :                                  *
90  * Every function returns a "netwib_err" which indicates :     *
91  *   - NETWIB_ERR_OK  : everything went fine                   *
92  *   - NETWIB_ERR_xyz : something strange occurred...          *
93  ***************************************************************/
94 
95 /*-------------------------------------------------------------*/
96 /***************************************************************
97  * Note about parameters :                                     *
98  * Some functions can accept NULL as parameter. This indicates *
99  * the corresponding parameter is not needed.                  *
100  * However this special case needs resources and specific      *
101  * instruction paths. So, this is not supported for parameters *
102  * such as netwib_ring, netwib_ips, etc. If you think we       *
103  * missed one function needing this features, please contact   *
104  * us.                                                         *
105  ***************************************************************/
106