*/
+/****h* silcutil/Runtime Toolkit Interface
+ *
+ * DESCRIPTION
+ *
+ * The SILC Runtime Toolkit API is used to initialize and uninitialize the
+ * Runtime Toolkit. The application should call silc_runtime_init at the
+ * very start of the application and the silc_runtime_uninit at the very end
+ * of the application before it is exited.
+ *
+ ***/
+
#ifndef SILCRUNTIME_H
#define SILCRUNTIME_H
configured/compiled. */
@__SILC_HAVE_PTHREAD@
@__SILC_ENABLE_DEBUG@
+@__SILC_ENABLE_STACKTRACE@
+@__SILC_VA_COPY@
/* Types */
#define SILC_SIZEOF_LONG_LONG @SILC_SIZEOF_LONG_LONG@
#include <silcsymbian.h>
#endif
-#if defined(HAVE_SILCDEFS_H)
+#ifndef DLLAPI
+#define DLLAPI
+#endif
+
+/* We except all systems to have these include files */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if defined(HAVE_RUNTIMEDEFS_H)
/* Automatically generated configuration header. These are included only
when the SILC Runtime Toolkit itself is compiled. */
#ifndef SILC_SYMBIAN
-#include "silcdefs.h"
+#include "runtimedefs.h"
#else
#include "../../symbian/silcdefs.h"
#endif /* SILC_SYMBIAN */
#define SILC_ALIGNMENT SILC_SIZEOF_VOID_P
#endif /* SILC_ALIGNMENT */
-#endif /* HAVE_SILCDEFS_H */
+#endif /* HAVE_RUNTIMEDEFS_H */
+
+/* Feature defines */
+#ifdef __SILC_HAVE_PTHREAD
+#undef SILC_THREADS
+#define SILC_THREADS 1
+#endif /* __SILC_HAVE_PTHREAD */
+
+#ifdef __SILC_ENABLE_DEBUG
+#undef SILC_DEBUG
+#define SILC_DEBUG 1
+#endif /* __SILC_ENABLE_DEBUG */
+
+#ifdef __SILC_ENABLE_STACKTRACE
+#undef SILC_STACKTRACE
+#define SILC_STACKTRACE 1
+#endif /* __SILC_ENABLE_STACKTRACE */
/* SILC Runtime Toolkit includes */
#include <silcerrno.h>
#include <silcfdstream.h>
#include <silcmime.h>
#include <silcrand.h>
+#include <silchttpserver.h>
+#include <silchttpphp.h>
+
+/* Runtime Toolkit API */
+
+/****f* silcutil/silc_runtime_init
+ *
+ * SYNOPSIS
+ *
+ * static inline void silc_runtime_init(void)
+ *
+ * DESCRIPTION
+ *
+ * Initializes the Runtime Toolkit. Application should call this as the
+ * very first call to the Runtime Toolkit. The function initializes some
+ * of the Toolkit features.
+ *
+ ***/
+static inline
+void silc_runtime_init(void)
+{
+ /* For now we don't have much here. Strictly speaking, calling this
+ currently isn't required. But in the future we may have something that
+ really must be initialized at the very start. Even the Tls doesn't
+ actually require initialization since any routine using Tls currently
+ takes care of that. */
+
+ /* Initialize Tls for this thread (probably main process thread). */
+ silc_thread_tls_init();
+}
+
+/****f* silcutil/silc_runtime_uninit
+ *
+ * SYNOPSIS
+ *
+ * static inline void silc_runtime_uninit(void)
+ *
+ * DESCRIPTION
+ *
+ * Uninitializes the Runtime Toolkit. Application should call this as the
+ * very last call to the Runtime Toolkit. The function uninitializes and
+ * frees all allocated resources.
+ *
+ ***/
+static inline
+void silc_runtime_uninit(void)
+{
+ /* Uninitialize the whole Tls system (not just one thread). */
+ silc_thread_tls_uninit();
+}
#ifdef __cplusplus
}