libwebsockets/lib
Andy Green 16ab3185c4 replace per header mallocs with single malloc 3 level struct
This big patch replaces the malloc / realloc per header
approach used until now with a single three-level struct
that gets malloc'd during the header union phase and freed
in one go when we transition to a different union phase.

It's more expensive in that we malloc a bit more than 4Kbytes,
but it's a lot cheaper in terms of malloc, frees, heap fragmentation,
no reallocs, nothing to configure.  It also moves from arrays of
pointers (8 bytes on x86_64) to unsigned short offsets into the
data array, (2 bytes on all platforms).

The 3-level thing is all in one struct

 - array indexed by the header enum, pointing to first "fragment" index
	(ie, header type to fragment lookup, or 0 for none)

 - array of fragments indexes, enough for 2 x the number of known headers
	(fragment array... note that fragments can point to a "next"
	fragment if the same header is spread across multiple entries)

 - linear char array where the known header payload gets written
	(fragments point into null-terminated strings stored in here,
	only the known header content is stored)

http headers can legally be split over multiple headers of the same
name which should be concatenated.  This scheme does not linearly
conatenate them but uses a linked list in the fragment structs to
link them.  There are apis to get the total length and copy out a
linear, concatenated version to a buffer.

Signed-off-by: Andy Green <andy.green@linaro.org>
2013-02-11 11:10:57 +08:00
..
.gitignore Ignoring linux build files 2013-01-09 15:46:11 +08:00
base64-decode.c CMake support + fixed windows build. 2013-02-06 15:49:12 +09:00
client-handshake.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
client-parser.c throw out lws_websocket_related cruft 2013-02-11 00:34:43 +08:00
client.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
daemonize.c Fixed build on OSX. 2013-02-06 15:49:12 +09:00
extension-deflate-frame.c remove minimum frame size for deflate 2013-02-11 10:18:31 +08:00
extension-deflate-frame.h Separate compression levels for server and client, 2013-01-10 12:45:54 +08:00
extension-deflate-stream.c introduce logging api and convert all library output to use it 2013-01-10 22:16:37 +08:00
extension-deflate-stream.h remove fixed rx buffer allow definition per protocol 2013-02-08 13:16:07 +08:00
extension.c deprecate x google mux 2013-01-17 19:53:16 +08:00
getifaddrs.c introduce getifaddrs for toolchains without it 2013-01-12 20:39:47 +08:00
getifaddrs.h introduce getifaddrs for toolchains without it 2013-01-12 20:39:47 +08:00
handshake.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
libwebsockets.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
libwebsockets.h replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
Makefile.am stop O2 override 2013-02-11 09:31:43 +08:00
minilex.c add lexical parser for headers 2013-01-18 01:55:48 +08:00
output.c dont close in user callback wrapper let ancestor do it 2013-02-11 00:34:43 +08:00
parsers.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
private-libwebsockets.h replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
server-handshake.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
server.c replace per header mallocs with single malloc 3 level struct 2013-02-11 11:10:57 +08:00
sha-1.c Static variable is now const. 2013-01-09 15:14:31 +08:00