[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r27766 - in libmicrohttpd/src: include microspdy testspdy
From: |
gnunet |
Subject: |
[GNUnet-SVN] r27766 - in libmicrohttpd/src: include microspdy testspdy |
Date: |
Fri, 5 Jul 2013 17:15:55 +0200 |
Author: andreyu
Date: 2013-07-05 17:15:55 +0200 (Fri, 05 Jul 2013)
New Revision: 27766
Modified:
libmicrohttpd/src/include/microspdy.h
libmicrohttpd/src/microspdy/applicationlayer.c
libmicrohttpd/src/microspdy/daemon.h
libmicrohttpd/src/testspdy/test_misc.c
Log:
spdy: init library changed
Modified: libmicrohttpd/src/include/microspdy.h
===================================================================
--- libmicrohttpd/src/include/microspdy.h 2013-07-05 14:25:04 UTC (rev
27765)
+++ libmicrohttpd/src/include/microspdy.h 2013-07-05 15:15:55 UTC (rev
27766)
@@ -298,6 +298,27 @@
/**
+ * SPDY IO sybsystem flags used by SPDY_init() and SPDY_deinit().<p>
+ *
+ * The values are used internally as flags, that is why they must be
+ * powers of 2.
+ */
+enum SPDY_IO_SUBSYSTEM
+{
+
+ /**
+ * No subsystem. For internal use.
+ */
+ SPDY_IO_SUBSYSTEM_NONE = 0,
+
+ /**
+ * Default TLS implementation provided by openSSL/libssl.
+ */
+ SPDY_IO_SUBSYSTEM_OPENSSL = 1,
+};
+
+
+/**
* SPDY daemon options. Passed in the varargs portion of
* SPDY_start_daemon to customize the daemon. Each option must
* be followed by a value of a specific type.<p>
@@ -514,7 +535,6 @@
SPDY_RESPONSE_RESULT_STREAM_CLOSED = 2,
};
-
/**
* Callback for serious error condition. The default action is to print
* an error message and abort().
@@ -736,12 +756,16 @@
* and possibly other stuff needed by the lib. Currently the call
* always returns SPDY_YES.
*
+ * @param enum SPDY_IO_SUBSYSTEM io_subsystem the IO subsystem that will
+ * be initialized. Several can be used with bitwise OR. If no
+ * parameter is set, the default openssl subsystem will be used.
* @return SPDY_YES if the library was correctly initialized and its
* functions can be used now;
* SPDY_NO on error
*/
int
-SPDY_init (void);
+(SPDY_init) (enum SPDY_IO_SUBSYSTEM io_subsystem, ...);
+#define SPDY_init() SPDY_init(SPDY_IO_SUBSYSTEM_OPENSSL)
/**
@@ -750,7 +774,7 @@
* SPDY_init. Currently the function does not do anything.
*/
void
-SPDY_deinit (void);
+SPDY_deinit ();
/**
@@ -1295,5 +1319,4 @@
SPDY_PingCallback rttcb,
void * rttcb_cls);
-
#endif
Modified: libmicrohttpd/src/microspdy/applicationlayer.c
===================================================================
--- libmicrohttpd/src/microspdy/applicationlayer.c 2013-07-05 14:25:04 UTC
(rev 27765)
+++ libmicrohttpd/src/microspdy/applicationlayer.c 2013-07-05 15:15:55 UTC
(rev 27766)
@@ -233,13 +233,24 @@
int
-SPDY_init ()
+(SPDY_init) (enum SPDY_IO_SUBSYSTEM io_subsystem, ...)
{
SPDYF_ASSERT(SPDYF_BUFFER_SIZE >= SPDY_MAX_SUPPORTED_FRAME_SIZE,
"Buffer size is less than max supported frame size!");
SPDYF_ASSERT(SPDY_MAX_SUPPORTED_FRAME_SIZE >= 32,
"Max supported frame size must be bigger than the minimal
value!");
- SPDYF_openssl_global_init();
+ SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized,
+ "SPDY_init must be called only once per program or after
SPDY_deinit");
+
+ if(SPDY_IO_SUBSYSTEM_OPENSSL & io_subsystem)
+ {
+ SPDYF_openssl_global_init();
+ spdyf_io_initialized |= SPDY_IO_SUBSYSTEM_OPENSSL;
+ }
+
+ SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized,
+ "SPDY_init could not find even one IO subsystem");
+
return SPDY_YES;
}
@@ -247,9 +258,13 @@
void
SPDY_deinit ()
{
+ SPDYF_ASSERT(SPDY_IO_SUBSYSTEM_NONE != spdyf_io_initialized,
+ "SPDY_init has not been called!");
+
//currently nothing to be freed/deinited
//SPDYF_openssl_global_deinit doesn't do anything now
//SPDYF_openssl_global_deinit();
+ spdyf_io_initialized = SPDY_IO_SUBSYSTEM_NONE;
}
@@ -317,6 +332,11 @@
struct SPDY_Daemon *daemon;
va_list valist;
+ if(SPDY_IO_SUBSYSTEM_NONE == spdyf_io_initialized)
+ {
+ SPDYF_DEBUG("library not initialized");
+ return NULL;
+ }
if(NULL == certfile)
{
SPDYF_DEBUG("certfile is NULL");
Modified: libmicrohttpd/src/microspdy/daemon.h
===================================================================
--- libmicrohttpd/src/microspdy/daemon.h 2013-07-05 14:25:04 UTC (rev
27765)
+++ libmicrohttpd/src/microspdy/daemon.h 2013-07-05 15:15:55 UTC (rev
27766)
@@ -29,6 +29,12 @@
/**
+ * Global flags containing the initialized IO subsystems.
+ */
+enum SPDY_IO_SUBSYSTEM spdyf_io_initialized;
+
+
+/**
* Start a SPDDY webserver on the given port.
*
* @param port port to bind to
Modified: libmicrohttpd/src/testspdy/test_misc.c
===================================================================
--- libmicrohttpd/src/testspdy/test_misc.c 2013-07-05 14:25:04 UTC (rev
27765)
+++ libmicrohttpd/src/testspdy/test_misc.c 2013-07-05 15:15:55 UTC (rev
27766)
@@ -193,8 +193,6 @@
int maxfd = -1;
struct SPDY_Daemon *daemon;
- SPDY_init();
-
daemon = SPDY_start_daemon(port,
DATA_DIR
"cert-and-key.pem",
DATA_DIR
"cert-and-key.pem",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r27766 - in libmicrohttpd/src: include microspdy testspdy,
gnunet <=