5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2008 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silcutil/Runtime Toolkit Interface
24 * The SILC Runtime Toolkit API is used to initialize and uninitialize the
25 * Runtime Toolkit. The application should call silc_runtime_init at the
26 * very start of the application and the silc_runtime_uninit at the very end
27 * of the application before it is exited.
34 /* Version check macro. Use this to check that package is of specific
35 version compile time. Use the __SILC_XXX_VERSION below in comparison.
38 #if __SILC_RUNTIME_VERSION < SILC_VERSION(1,2,0)
43 #define SILC_VERSION(a, b, c) (((a) << 24) + ((b) << 16) + ((c) << 8)
44 #endif /* !SILC_VERSION */
46 /* SILC Runtime Toolkit version */
47 @__RUNTIME_PACKAGE_VERSION@
49 /* Compilation time defines, for third-party software. Use these to check
50 in configuration/compilation time how the SILC Runtime Toolkit was
51 configured/compiled. */
56 #define SILC_SIZEOF_LONG_LONG @SILC_SIZEOF_LONG_LONG@
57 #define SILC_SIZEOF_LONG @SILC_SIZEOF_LONG@
58 #define SILC_SIZEOF_INT @SILC_SIZEOF_INT@
59 #define SILC_SIZEOF_SHORT @SILC_SIZEOF_SHORT@
60 #define SILC_SIZEOF_CHAR @SILC_SIZEOF_CHAR@
61 #define SILC_SIZEOF_VOID_P @SILC_SIZEOF_VOID_P@
73 #if defined(__EPOC32__) || defined(__SYMBIAN32__)
81 #if defined(__MACH__) && defined(__APPLE__)
93 /* Platform specific includes */
94 #if defined(SILC_WIN32)
95 #include <silcwin32.h>
98 #if defined(SILC_SYMBIAN)
99 #include <silcsymbian.h>
102 #if defined(HAVE_SILCDEFS_H)
104 /* Automatically generated configuration header. These are included only
105 when the SILC Runtime Toolkit itself is compiled. */
107 #include "silcdefs.h"
109 #include "../../symbian/silcdefs.h"
110 #endif /* SILC_SYMBIAN */
111 #include "silcdistdefs.h"
112 #include "silccompile.h"
116 /* Autodetect CPU so that inline assembly in headers are enabled */
118 #if defined(__i386__)
123 #endif /* __i386__ */
125 #if defined(__i486__)
130 #endif /* __i486__ */
132 #if defined(__i586__)
139 #endif /* __i586__ */
141 #if defined(__i686__)
150 #endif /* __i686__ */
152 #if defined(__x86_64__)
155 #endif /* __x86_64__ */
157 #if defined(__ia64__)
160 #endif /* __ia64__ */
162 #if defined(__ppc__) || defined(__ppc64__)
165 #endif /* __ppc__ || __ppc64__ */
167 #ifndef SILC_ALIGNMENT
168 #define SILC_ALIGNMENT SILC_SIZEOF_VOID_P
169 #endif /* SILC_ALIGNMENT */
171 #endif /* HAVE_SILCDEFS_H */
173 /* SILC Runtime Toolkit includes */
174 #include <silcerrno.h>
175 #include <silctypes.h>
176 #include <silcbitops.h>
177 #include <silcmutex.h>
178 #include <silcatomic.h>
179 #include <silcgetopt.h>
180 #include <silcstack.h>
181 #include <silcmemory.h>
182 #include <silclist.h>
183 #include <silcdlist.h>
184 #include <silcsnprintf.h>
185 #include <silctime.h>
186 #include <silctimer.h>
187 #include <silccond.h>
188 #include <silcglobal.h>
189 #include <silcthread.h>
190 #include <silcthreadqueue.h>
191 #include <silcschedule.h>
193 #include <silcfileutil.h>
195 #include <silcbuffer.h>
196 #include <silcbuffmt.h>
197 #include <silcasync.h>
198 #include <silcregex.h>
201 #include <silchashtable.h>
202 #include <silcstream.h>
204 #include <silcbase64.h>
205 #include <silcstrutil.h>
206 #include <silcutf8.h>
207 #include <silcstringprep.h>
208 #include <silcutil.h>
209 #include <silcconfig.h>
211 #include <silcsocketstream.h>
212 #include <silcfdstream.h>
213 #include <silcmime.h>
214 #include <silcrand.h>
216 /* Runtime Toolkit API */
218 /****f* silcutil/silc_runtime_init
222 * static inline void silc_runtime_init(void)
226 * Initializes the Runtime Toolkit. Application should call this as the
227 * very first call to the Runtime Toolkit. The function initializes some
228 * of the Toolkit features.
232 void silc_runtime_init(void)
234 /* For now we don't have much here. Strictly speaking, calling this
235 currently isn't required. But in the future we may have something that
236 really must be initialized at the very start. Even the Tls doesn't
237 actually require initialization since any routine using Tls currently
238 takes care of that. */
240 /* Initialize Tls for this thread (probably main process thread). */
241 silc_thread_tls_init();
244 /****f* silcutil/silc_runtime_uninit
248 * static inline void silc_runtime_uninit(void)
252 * Uninitializes the Runtime Toolkit. Application should call this as the
253 * very last call to the Runtime Toolkit. The function uninitializes and
254 * frees all allocated resources.
258 void silc_runtime_uninit(void)
260 /* Uninitialize the whole Tls system (not just one thread). */
261 silc_thread_tls_uninit();
268 #endif /* SILCRUNTIME_H */