introduce internal extensions array
authorAndy Green <andy@warmcat.com>
Sun, 6 Mar 2011 13:15:32 +0000 (13:15 +0000)
committerAndy Green <andy@warmcat.com>
Sun, 6 Mar 2011 13:15:32 +0000 (13:15 +0000)
Signed-off-by: Andy Green <andy@warmcat.com>
lib/Makefile.am
lib/Makefile.in
lib/extension.c [new file with mode: 0644]
lib/libwebsockets.h
test-server/test-client.c
test-server/test-ping.c
test-server/test-server-extpoll.c
test-server/test-server.c

index 3100645..3c17de6 100644 (file)
@@ -6,13 +6,15 @@ dist_libwebsockets_la_SOURCES=libwebsockets.c \
                                libwebsockets.h \
                                base64-decode.c \
                                client-handshake.c \
+                               extension.c \
                                private-libwebsockets.h
 if LIBCRYPTO
 else
 dist_libwebsockets_la_SOURCES += md5.c sha-1.c
 endif
 
-libwebsockets_la_CFLAGS:=-rdynamic -fPIC -Wall -Werror -std=gnu99 -pedantic -c -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
+libwebsockets_la_CFLAGS:=-rdynamic -fPIC -Wall -Werror -std=gnu99 -pedantic -c \
+       -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
 libwebsockets_la_LDFLAGS=-version-info 0:3
 
 all-local:
index 33be33f..be10d3d 100644 (file)
@@ -73,13 +73,14 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
 libwebsockets_la_LIBADD =
 am__dist_libwebsockets_la_SOURCES_DIST = libwebsockets.c handshake.c \
        parsers.c libwebsockets.h base64-decode.c client-handshake.c \
-       private-libwebsockets.h md5.c sha-1.c
+       extension.c private-libwebsockets.h md5.c sha-1.c
 @LIBCRYPTO_FALSE@am__objects_1 = libwebsockets_la-md5.lo \
 @LIBCRYPTO_FALSE@      libwebsockets_la-sha-1.lo
 dist_libwebsockets_la_OBJECTS = libwebsockets_la-libwebsockets.lo \
        libwebsockets_la-handshake.lo libwebsockets_la-parsers.lo \
        libwebsockets_la-base64-decode.lo \
-       libwebsockets_la-client-handshake.lo $(am__objects_1)
+       libwebsockets_la-client-handshake.lo \
+       libwebsockets_la-extension.lo $(am__objects_1)
 libwebsockets_la_OBJECTS = $(dist_libwebsockets_la_OBJECTS)
 libwebsockets_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libwebsockets_la_CFLAGS) \
@@ -220,9 +221,11 @@ top_srcdir = @top_srcdir@
 lib_LTLIBRARIES = libwebsockets.la
 include_HEADERS = libwebsockets.h
 dist_libwebsockets_la_SOURCES = libwebsockets.c handshake.c parsers.c \
-       libwebsockets.h base64-decode.c client-handshake.c \
+       libwebsockets.h base64-decode.c client-handshake.c extension.c \
        private-libwebsockets.h $(am__append_1)
-libwebsockets_la_CFLAGS := -rdynamic -fPIC -Wall -Werror -std=gnu99 -pedantic -c -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
+libwebsockets_la_CFLAGS := -rdynamic -fPIC -Wall -Werror -std=gnu99 -pedantic -c \
+       -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
+
 libwebsockets_la_LDFLAGS = -version-info 0:3
 all: all-am
 
@@ -300,6 +303,7 @@ distclean-compile:
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-base64-decode.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-client-handshake.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-extension.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-handshake.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-libwebsockets.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-md5.Plo@am__quote@
@@ -362,6 +366,13 @@ libwebsockets_la-client-handshake.lo: client-handshake.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-client-handshake.lo `test -f 'client-handshake.c' || echo '$(srcdir)/'`client-handshake.c
 
+libwebsockets_la-extension.lo: extension.c
+@am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-extension.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-extension.Tpo -c -o libwebsockets_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c
+@am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libwebsockets_la-extension.Tpo $(DEPDIR)/libwebsockets_la-extension.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='extension.c' object='libwebsockets_la-extension.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@  $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-extension.lo `test -f 'extension.c' || echo '$(srcdir)/'`extension.c
+
 libwebsockets_la-md5.lo: md5.c
 @am__fastdepCC_TRUE@   $(LIBTOOL)  --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-md5.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-md5.Tpo -c -o libwebsockets_la-md5.lo `test -f 'md5.c' || echo '$(srcdir)/'`md5.c
 @am__fastdepCC_TRUE@   $(am__mv) $(DEPDIR)/libwebsockets_la-md5.Tpo $(DEPDIR)/libwebsockets_la-md5.Plo
diff --git a/lib/extension.c b/lib/extension.c
new file mode 100644 (file)
index 0000000..16d62d9
--- /dev/null
@@ -0,0 +1,7 @@
+#include "private-libwebsockets.h"
+
+struct libwebsocket_extension libwebsocket_internal_extensions[] = {
+       { /* terminator */
+               NULL, NULL, 0
+       }
+};
index 21b99b1..23adf3a 100644 (file)
@@ -631,6 +631,8 @@ extern void
 libwebsocket_close_and_free_session(struct libwebsocket_context *context,
                               struct libwebsocket *wsi, enum lws_close_status);
 
+extern struct libwebsocket_extension libwebsocket_internal_extensions[];
+
 #ifdef WIN32
 #ifdef __cplusplus
 }
index 0f67c12..90341d8 100644 (file)
@@ -227,8 +227,8 @@ int main(int argc, char **argv)
         */
 
        context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
-                                             protocols, NULL,
-                                             NULL, NULL, -1, -1, 0);
+                               protocols, libwebsocket_internal_extensions,
+                                                        NULL, NULL, -1, -1, 0);
        if (context == NULL) {
                fprintf(stderr, "Creating libwebsocket context failed\n");
                return 1;
index 7bbaf24..672f62c 100644 (file)
@@ -401,7 +401,8 @@ int main(int argc, char **argv)
                                screen_width = w.ws_col;
 
        context = libwebsocket_create_context(CONTEXT_PORT_NO_LISTEN, NULL,
-                                             protocols, NULL,
+                                             protocols,
+                                             libwebsocket_internal_extensions,
                                              NULL, NULL, -1, -1, 0);
        if (context == NULL) {
                fprintf(stderr, "Creating libwebsocket context failed\n");
index 023ee96..3616f55 100644 (file)
@@ -474,7 +474,7 @@ int main(int argc, char **argv)
                cert_path = key_path = NULL;
 
        context = libwebsocket_create_context(port, interface, protocols,
-                                       NULL,
+                                       libwebsocket_internal_extensions,
                                        cert_path, key_path, -1, -1, opts);
        if (context == NULL) {
                fprintf(stderr, "libwebsocket init failed\n");
index 1035fe5..5b2bf00 100644 (file)
@@ -426,7 +426,7 @@ int main(int argc, char **argv)
                cert_path = key_path = NULL;
 
        context = libwebsocket_create_context(port, interface, protocols,
-                               NULL,
+                               libwebsocket_internal_extensions,
                                cert_path, key_path, -1, -1, opts);
        if (context == NULL) {
                fprintf(stderr, "libwebsocket init failed\n");