[Libwebsockets] [PATCH 02/11] introduce context->event_ops and the info->event selector

Alejandro Mery amery at geeks.cl
Tue Dec 16 00:36:23 CET 2014


Signed-off-by: Alejandro Mery <amery at geeks.cl>
---
 lib/libwebsockets.h         | 8 ++++++++
 lib/private-libwebsockets.h | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/lib/libwebsockets.h b/lib/libwebsockets.h
index 81d4ca9..e1de1a1 100644
--- a/lib/libwebsockets.h
+++ b/lib/libwebsockets.h
@@ -980,6 +980,13 @@ struct libwebsocket_extension {
 };
 #endif
 
+enum libwebsocket_event_backends {
+	LWS_EVENT_POLL,
+#ifdef LWS_USE_LIBEV
+	LWS_EVENT_LIBEV = 1,
+#endif
+};
+
 /**
  * struct lws_context_creation_info: parameters to create context with
  *
@@ -1042,6 +1049,7 @@ struct lws_context_creation_info {
 	int uid;
 	unsigned int options;
 	void *user;
+	enum libwebsocket_event_backends event;
 	int ka_time;
 	int ka_probes;
 	int ka_interval;
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index 975c671..b59ba30 100755
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -400,6 +400,11 @@ enum {
 struct libwebsocket_protocols;
 struct libwebsocket;
 
+struct lws_event_ops {
+	int (*init)(struct lws_context_creation_info *info,
+		    struct libwebsocket_context *context);
+};
+
 #ifdef LWS_USE_LIBEV
 struct lws_io_watcher {
 	struct ev_io watcher;
@@ -435,6 +440,8 @@ struct libwebsocket_context {
 #endif
 	} e;
 
+	struct lws_event_ops *event_ops;
+
 	int listen_port;
 	const char *iface;
 	char http_proxy_address[128];
-- 
2.2.0




More information about the Libwebsockets mailing list