Added SILC HTTP Server API
[runtime.git] / lib / silcutil / silcruntime.h.in
index 9736eed5706e5111585004221561df167940ef8c..a458af67a64c32875e6eceb376a0bc5ac0fbbaf1 100644 (file)
 
 */
 
+/****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
 
@@ -40,6 +51,8 @@
    configured/compiled. */
 @__SILC_HAVE_PTHREAD@
 @__SILC_ENABLE_DEBUG@
+@__SILC_ENABLE_STACKTRACE@
+@__SILC_VA_COPY@
 
 /* Types */
 #define SILC_SIZEOF_LONG_LONG @SILC_SIZEOF_LONG_LONG@
@@ -88,12 +101,21 @@ extern "C" {
 #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 */
@@ -157,7 +179,23 @@ extern "C" {
 #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>
@@ -201,6 +239,56 @@ extern "C" {
 #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
 }