Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,230 +0,0 @@
1
-/*
2
- * convert/decode to/from ascii using various bases
3
- *
4
- * Copyright (C) 2008 iptelorg GmbH
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- *
18
- * Defines:
19
- *  BASE64_LOOKUP_TABLE - use small lookup tables for conversions (faster
20
- *                         in general)
21
- */
22
-/*!
23
- * \file
24
- * \brief Kamailio core :: convert/decode to/from ascii using various bases
25
- * \ingroup core
26
- * Module: \ref core
27
- */
28
-
29
-
30
-#include "basex.h"
31
-
32
-#ifdef BASE16_LOOKUP_TABLE
33
-#ifdef BASE16_LOOKUP_LARGE
34
-
35
-unsigned char _bx_hexdig_hi[256]={
36
-	'0', '0', '0', '0', '0', '0', '0', '0',
37
-	'0', '0', '0', '0', '0', '0', '0', '0',
38
-	'1', '1', '1', '1', '1', '1', '1', '1',
39
-	'1', '1', '1', '1', '1', '1', '1', '1',
40
-	'2', '2', '2', '2', '2', '2', '2', '2',
41
-	'2', '2', '2', '2', '2', '2', '2', '2',
42
-	'3', '3', '3', '3', '3', '3', '3', '3',
43
-	'3', '3', '3', '3', '3', '3', '3', '3',
44
-	'4', '4', '4', '4', '4', '4', '4', '4',
45
-	'4', '4', '4', '4', '4', '4', '4', '4',
46
-	'5', '5', '5', '5', '5', '5', '5', '5',
47
-	'5', '5', '5', '5', '5', '5', '5', '5',
48
-	'6', '6', '6', '6', '6', '6', '6', '6',
49
-	'6', '6', '6', '6', '6', '6', '6', '6',
50
-	'7', '7', '7', '7', '7', '7', '7', '7',
51
-	'7', '7', '7', '7', '7', '7', '7', '7',
52
-	'8', '8', '8', '8', '8', '8', '8', '8',
53
-	'8', '8', '8', '8', '8', '8', '8', '8',
54
-	'9', '9', '9', '9', '9', '9', '9', '9',
55
-	'9', '9', '9', '9', '9', '9', '9', '9',
56
-	'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
57
-	'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
58
-	'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B',
59
-	'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B',
60
-	'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C',
61
-	'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C',
62
-	'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D',
63
-	'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D',
64
-	'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E',
65
-	'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E',
66
-	'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F',
67
-	'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F'
68
-};
69
-
70
-unsigned char _bx_hexdig_low[256]={
71
-	'0', '1', '2', '3', '4', '5', '6', '7',
72
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
73
-	'0', '1', '2', '3', '4', '5', '6', '7',
74
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
75
-	'0', '1', '2', '3', '4', '5', '6', '7',
76
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
77
-	'0', '1', '2', '3', '4', '5', '6', '7',
78
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
79
-	'0', '1', '2', '3', '4', '5', '6', '7',
80
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
81
-	'0', '1', '2', '3', '4', '5', '6', '7',
82
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
83
-	'0', '1', '2', '3', '4', '5', '6', '7',
84
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
85
-	'0', '1', '2', '3', '4', '5', '6', '7',
86
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
87
-	'0', '1', '2', '3', '4', '5', '6', '7',
88
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
89
-	'0', '1', '2', '3', '4', '5', '6', '7',
90
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
91
-	'0', '1', '2', '3', '4', '5', '6', '7',
92
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
93
-	'0', '1', '2', '3', '4', '5', '6', '7',
94
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
95
-	'0', '1', '2', '3', '4', '5', '6', '7',
96
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
97
-	'0', '1', '2', '3', '4', '5', '6', '7',
98
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
99
-	'0', '1', '2', '3', '4', '5', '6', '7',
100
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
101
-	'0', '1', '2', '3', '4', '5', '6', '7',
102
-	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
103
-};
104
-
105
-unsigned char _bx_unhexdig256[256]={
106
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
107
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
108
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
109
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
110
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 
111
-0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xff, 0xff, 
112
-0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 
113
-0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
114
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
115
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c, 
116
-0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
117
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
118
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
119
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
120
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
121
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
122
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
123
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
124
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
125
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
126
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
127
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
128
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
129
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
130
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
131
-0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
132
-
133
-#else /* BASE16_LOOKUP_LARGE */
134
-
135
-unsigned char _bx_hexdig[16+1]="0123456789ABCDEF";
136
-
137
-unsigned char _bx_unhexdig32[32]={
138
-	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 
139
-	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c,
140
-	0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
141
-	0xff };
142
-
143
-#endif /*  BASE16_LOOKUP_LARGE */
144
-#endif /* BASE16_LOOKUP_TABLE */
145
-
146
-#ifdef BASE64_LOOKUP_TABLE
147
-
148
-#ifdef BASE64_LOOKUP_LARGE
149
-/* large lookup tables, 2.5 k */
150
-
151
-unsigned char _bx_b64_first[256];
152
-unsigned char _bx_b64_second[4][256];
153
-unsigned char _bx_b64_third[4][256];
154
-unsigned char _bx_b64_fourth[256];
155
-
156
-unsigned char _bx_ub64[256];
157
-
158
-#elif defined BASE64_LOOKUP_8K
159
-unsigned short _bx_b64_12[4096];
160
-unsigned char _bx_ub64[256];
161
-
162
-#else /*  BASE64_LOOKUP_LARGE */
163
-/* very small lookup, 65 bytes */
164
-
165
-unsigned char _bx_b64[64+1]=
166
-		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
167
-
168
-
169
-unsigned char _bx_ub64[0x54+1]={
170
-		                              0x3e, 0xff, 0xff, 0xff, 0x3f,
171
-		0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,
172
-		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02,
173
-		0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
174
-		0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
175
-		0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a,
176
-		0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
177
-		0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
178
-		0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff };
179
-
180
-#endif /*  BASE64_LOOKUP_LARGE */
181
-
182
-#endif /* BASE64_LOOKUP_TABLE */
183
-
184
-#define b64_enc_char(c) base64_enc_char(c)
185
-#define b64_dec_char(c) base64_dec_char(c)
186
-
187
-int init_basex()
188
-{
189
-#ifdef BASE64_LOOKUP_TABLE
190
-#if defined BASE64_LOOKUP_LARGE || defined BASE64_LOOKUP_8K
191
-	int r;
192
-#endif
193
-#ifdef BASE64_LOOKUP_LARGE
194
-	int i;
195
-	
196
-	/* encode tables */
197
-	for (r=0; r<256; r++)
198
-		_bx_b64_first[r]=b64_enc_char(((unsigned char)r)>>2);
199
-	for(i=0; i<4; i++){
200
-		for (r=0; r<256; r++)
201
-			_bx_b64_second[i][r]=
202
-					b64_enc_char((unsigned char)((i<<4)|(r>>4)));
203
-	}
204
-	for(i=0; i<4; i++){
205
-		for (r=0; r<256; r++)
206
-			_bx_b64_third[i][r]=
207
-				b64_enc_char((unsigned char)(((r<<2)&0x3f)|i));
208
-	}
209
-	for (r=0; r<256; r++)
210
-		_bx_b64_fourth[r]=b64_enc_char(((unsigned char)r&0x3f));
211
-	
212
-	/* decode */
213
-	for (r=0; r<256; r++)
214
-		_bx_ub64[r]=b64_dec_char((unsigned char)r);
215
-#elif defined BASE64_LOOKUP_8K
216
-	for (r=0; r< 4096; r++)
217
-#if defined __IS_LITTLE_ENDIAN
218
-		_bx_b64_12[r]=b64_enc_char(r>>6)|(b64_enc_char(r&0x3f)<<8);
219
-#elif defined __IS_BIG_ENDIAN /* __IS_LITTLE_ENDIAN */
220
-		_bx_b64_12[r]=(b64_enc_char(r>>6)<<8)|b64_enc_char(r&0x3f);
221
-#else /* __IS_LITTLE_ENDIAN */
222
-#error Neither __IS_LITTE_ENDIAN nor __IS_BIG_ENDIAN  defined
223
-#endif
224
-	/* decode */
225
-	for (r=0; r<256; r++)
226
-		_bx_ub64[r]=b64_dec_char((unsigned char)r);
227
-#endif
228
-#endif
229
-	return 0;
230
-}
Browse code

core Update headers, change "SIP-router" to "Kamailio", update doxygen file headers

Olle E. Johansson authored on 03/01/2015 14:15:58
Showing 1 changed files
... ...
@@ -21,7 +21,7 @@
21 21
  */
22 22
 /*!
23 23
  * \file
24
- * \brief SIP-router core :: convert/decode to/from ascii using various bases
24
+ * \brief Kamailio core :: convert/decode to/from ascii using various bases
25 25
  * \ingroup core
26 26
  * Module: \ref core
27 27
  */
Browse code

Core Removed history, svn $id$ and doxygen udpates on the .c files

Olle E. Johansson authored on 03/01/2015 09:53:17
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * convert/decode to/from ascii using various bases
5 3
  *
6 4
  * Copyright (C) 2008 iptelorg GmbH
... ...
@@ -16,15 +14,10 @@
16 14
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 15
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 16
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
- */
20
-/*
17
+ *
21 18
  * Defines:
22 19
  *  BASE64_LOOKUP_TABLE - use small lookup tables for conversions (faster
23 20
  *                         in general)
24
- *
25
- * History:
26
- * --------
27
- *  2008-06-11  created by andrei
28 21
  */
29 22
 /*!
30 23
  * \file
Browse code

- Doxygen updates on core files - Add project name to doxygen in Makefile

oej authored on 19/10/2009 20:35:43
Showing 1 changed files
... ...
@@ -28,7 +28,7 @@
28 28
  */
29 29
 /*!
30 30
  * \file
31
- * \brief SIP-router core :: 
31
+ * \brief SIP-router core :: convert/decode to/from ascii using various bases
32 32
  * \ingroup core
33 33
  * Module: \ref core
34 34
  */
Browse code

Adding doxygen template to all core .c files

Please fill in after the :: to explain the function of this file.

oej authored on 10/10/2009 13:54:13
Showing 1 changed files
... ...
@@ -26,6 +26,13 @@
26 26
  * --------
27 27
  *  2008-06-11  created by andrei
28 28
  */
29
+/*!
30
+ * \file
31
+ * \brief SIP-router core :: 
32
+ * \ingroup core
33
+ * Module: \ref core
34
+ */
35
+
29 36
 
30 37
 #include "basex.h"
31 38
 
Browse code

- added fast base64 and base16 encoders/decoders along with test program and some results

Andrei Pelinescu-Onciul authored on 01/07/2008 20:33:20
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,230 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * convert/decode to/from ascii using various bases
5
+ *
6
+ * Copyright (C) 2008 iptelorg GmbH
7
+ *
8
+ * Permission to use, copy, modify, and distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ */
20
+/*
21
+ * Defines:
22
+ *  BASE64_LOOKUP_TABLE - use small lookup tables for conversions (faster
23
+ *                         in general)
24
+ *
25
+ * History:
26
+ * --------
27
+ *  2008-06-11  created by andrei
28
+ */
29
+
30
+#include "basex.h"
31
+
32
+#ifdef BASE16_LOOKUP_TABLE
33
+#ifdef BASE16_LOOKUP_LARGE
34
+
35
+unsigned char _bx_hexdig_hi[256]={
36
+	'0', '0', '0', '0', '0', '0', '0', '0',
37
+	'0', '0', '0', '0', '0', '0', '0', '0',
38
+	'1', '1', '1', '1', '1', '1', '1', '1',
39
+	'1', '1', '1', '1', '1', '1', '1', '1',
40
+	'2', '2', '2', '2', '2', '2', '2', '2',
41
+	'2', '2', '2', '2', '2', '2', '2', '2',
42
+	'3', '3', '3', '3', '3', '3', '3', '3',
43
+	'3', '3', '3', '3', '3', '3', '3', '3',
44
+	'4', '4', '4', '4', '4', '4', '4', '4',
45
+	'4', '4', '4', '4', '4', '4', '4', '4',
46
+	'5', '5', '5', '5', '5', '5', '5', '5',
47
+	'5', '5', '5', '5', '5', '5', '5', '5',
48
+	'6', '6', '6', '6', '6', '6', '6', '6',
49
+	'6', '6', '6', '6', '6', '6', '6', '6',
50
+	'7', '7', '7', '7', '7', '7', '7', '7',
51
+	'7', '7', '7', '7', '7', '7', '7', '7',
52
+	'8', '8', '8', '8', '8', '8', '8', '8',
53
+	'8', '8', '8', '8', '8', '8', '8', '8',
54
+	'9', '9', '9', '9', '9', '9', '9', '9',
55
+	'9', '9', '9', '9', '9', '9', '9', '9',
56
+	'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
57
+	'A', 'A', 'A', 'A', 'A', 'A', 'A', 'A',
58
+	'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B',
59
+	'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B',
60
+	'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C',
61
+	'C', 'C', 'C', 'C', 'C', 'C', 'C', 'C',
62
+	'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D',
63
+	'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D',
64
+	'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E',
65
+	'E', 'E', 'E', 'E', 'E', 'E', 'E', 'E',
66
+	'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F',
67
+	'F', 'F', 'F', 'F', 'F', 'F', 'F', 'F'
68
+};
69
+
70
+unsigned char _bx_hexdig_low[256]={
71
+	'0', '1', '2', '3', '4', '5', '6', '7',
72
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
73
+	'0', '1', '2', '3', '4', '5', '6', '7',
74
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
75
+	'0', '1', '2', '3', '4', '5', '6', '7',
76
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
77
+	'0', '1', '2', '3', '4', '5', '6', '7',
78
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
79
+	'0', '1', '2', '3', '4', '5', '6', '7',
80
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
81
+	'0', '1', '2', '3', '4', '5', '6', '7',
82
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
83
+	'0', '1', '2', '3', '4', '5', '6', '7',
84
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
85
+	'0', '1', '2', '3', '4', '5', '6', '7',
86
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
87
+	'0', '1', '2', '3', '4', '5', '6', '7',
88
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
89
+	'0', '1', '2', '3', '4', '5', '6', '7',
90
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
91
+	'0', '1', '2', '3', '4', '5', '6', '7',
92
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
93
+	'0', '1', '2', '3', '4', '5', '6', '7',
94
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
95
+	'0', '1', '2', '3', '4', '5', '6', '7',
96
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
97
+	'0', '1', '2', '3', '4', '5', '6', '7',
98
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
99
+	'0', '1', '2', '3', '4', '5', '6', '7',
100
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
101
+	'0', '1', '2', '3', '4', '5', '6', '7',
102
+	'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
103
+};
104
+
105
+unsigned char _bx_unhexdig256[256]={
106
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
107
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
108
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
109
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
110
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 
111
+0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xff, 0xff, 
112
+0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 
113
+0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
114
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
115
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c, 
116
+0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
117
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
118
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
119
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
120
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
121
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
122
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
123
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
124
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
125
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
126
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
127
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
128
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
129
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
130
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
131
+0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
132
+
133
+#else /* BASE16_LOOKUP_LARGE */
134
+
135
+unsigned char _bx_hexdig[16+1]="0123456789ABCDEF";
136
+
137
+unsigned char _bx_unhexdig32[32]={
138
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 
139
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0x0b, 0x0c,
140
+	0x0d, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
141
+	0xff };
142
+
143
+#endif /*  BASE16_LOOKUP_LARGE */
144
+#endif /* BASE16_LOOKUP_TABLE */
145
+
146
+#ifdef BASE64_LOOKUP_TABLE
147
+
148
+#ifdef BASE64_LOOKUP_LARGE
149
+/* large lookup tables, 2.5 k */
150
+
151
+unsigned char _bx_b64_first[256];
152
+unsigned char _bx_b64_second[4][256];
153
+unsigned char _bx_b64_third[4][256];
154
+unsigned char _bx_b64_fourth[256];
155
+
156
+unsigned char _bx_ub64[256];
157
+
158
+#elif defined BASE64_LOOKUP_8K
159
+unsigned short _bx_b64_12[4096];
160
+unsigned char _bx_ub64[256];
161
+
162
+#else /*  BASE64_LOOKUP_LARGE */
163
+/* very small lookup, 65 bytes */
164
+
165
+unsigned char _bx_b64[64+1]=
166
+		"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
167
+
168
+
169
+unsigned char _bx_ub64[0x54+1]={
170
+		                              0x3e, 0xff, 0xff, 0xff, 0x3f,
171
+		0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d,
172
+		0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x02,
173
+		0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
174
+		0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
175
+		0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1a,
176
+		0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24,
177
+		0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e,
178
+		0x2f, 0x30, 0x31, 0x32, 0x33, 0xff, 0xff, 0xff, 0xff, 0xff };
179
+
180
+#endif /*  BASE64_LOOKUP_LARGE */
181
+
182
+#endif /* BASE64_LOOKUP_TABLE */
183
+
184
+#define b64_enc_char(c) base64_enc_char(c)
185
+#define b64_dec_char(c) base64_dec_char(c)
186
+
187
+int init_basex()
188
+{
189
+#ifdef BASE64_LOOKUP_TABLE
190
+#if defined BASE64_LOOKUP_LARGE || defined BASE64_LOOKUP_8K
191
+	int r;
192
+#endif
193
+#ifdef BASE64_LOOKUP_LARGE
194
+	int i;
195
+	
196
+	/* encode tables */
197
+	for (r=0; r<256; r++)
198
+		_bx_b64_first[r]=b64_enc_char(((unsigned char)r)>>2);
199
+	for(i=0; i<4; i++){
200
+		for (r=0; r<256; r++)
201
+			_bx_b64_second[i][r]=
202
+					b64_enc_char((unsigned char)((i<<4)|(r>>4)));
203
+	}
204
+	for(i=0; i<4; i++){
205
+		for (r=0; r<256; r++)
206
+			_bx_b64_third[i][r]=
207
+				b64_enc_char((unsigned char)(((r<<2)&0x3f)|i));
208
+	}
209
+	for (r=0; r<256; r++)
210
+		_bx_b64_fourth[r]=b64_enc_char(((unsigned char)r&0x3f));
211
+	
212
+	/* decode */
213
+	for (r=0; r<256; r++)
214
+		_bx_ub64[r]=b64_dec_char((unsigned char)r);
215
+#elif defined BASE64_LOOKUP_8K
216
+	for (r=0; r< 4096; r++)
217
+#if defined __IS_LITTLE_ENDIAN
218
+		_bx_b64_12[r]=b64_enc_char(r>>6)|(b64_enc_char(r&0x3f)<<8);
219
+#elif defined __IS_BIG_ENDIAN /* __IS_LITTLE_ENDIAN */
220
+		_bx_b64_12[r]=(b64_enc_char(r>>6)<<8)|b64_enc_char(r&0x3f);
221
+#else /* __IS_LITTLE_ENDIAN */
222
+#error Neither __IS_LITTE_ENDIAN nor __IS_BIG_ENDIAN  defined
223
+#endif
224
+	/* decode */
225
+	for (r=0; r<256; r++)
226
+		_bx_ub64[r]=b64_dec_char((unsigned char)r);
227
+#endif
228
+#endif
229
+	return 0;
230
+}