1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-23 00:00:06 +01:00
libwebsockets/lib
Andy Green 5c0b0450f2 client: bind and drop protocol like server
HTTP server protocols have had for a while LWS_CALLBACK_HTTP_DROP/BIND_PROTOCOL
callbacks that mark when a wsi is attched to a protocol and detached.

It turns out this is generally useful for everything to know when a wsi is
joining a protocol and definitively completely finished with a protocol.

Particularly with client wsi where you provided the userdata externally, this
makes a clear point to free() it on the protocol binding being dropped.

This patch adds protocol bind / unbind callbacks to the role definition and
lets them operate on all roles.  For the various roles

HTTP server: LWS_CALLBACK_HTTP_BIND/DROP_PROTOCOL as before
HTTP client: LWS_CALLBACK_CLIENT_HTTP_BIND/DROP_PROTOCOL
ws server:   LWS_CALLBACK_WS_SERVER_BIND/DROP_PROTOCOL
ws client:   LWS_CALLBACK_WS_CLIENT_BIND/DROP_PROTOCOL
raw file:    LWS_CALLBACK_RAW_FILE_BIND/DROP_PROTOCOL
raw skt:     LWS_CALLBACK_RAW_SKT_BIND/DROP_PROTOCOL
2018-08-18 14:11:29 +08:00
..
core client: bind and drop protocol like server 2018-08-18 14:11:29 +08:00
event-libs libwebsockets.h: clean out some boilerplate better put in core/private.h 2018-08-16 19:10:32 +08:00
misc libwebsockets.h: clean out some boilerplate better put in core/private.h 2018-08-16 19:10:32 +08:00
plat libwebsockets.h: clean out some boilerplate better put in core/private.h 2018-08-16 19:10:32 +08:00
roles client: bind and drop protocol like server 2018-08-18 14:11:29 +08:00
tls libwebsockets.h: clean out some boilerplate better put in core/private.h 2018-08-16 19:10:32 +08:00
libwebsockets.h client: bind and drop protocol like server 2018-08-18 14:11:29 +08:00
README.md refactor: core code in lib/core and private-libwebsockets.h to core/private.h 2018-05-03 10:49:36 +08:00

Library sources layout

Code that goes in the libwebsockets library itself lives down ./lib

Path Sources
lib/core Core lws code related to generic fd and wsi servicing and management
lib/event-libs Code containing optional event-lib specific adaptations
lib/misc Code for various mostly optional miscellaneous features
lib/plat Platform-specific adaptation code
lib/roles Code for specific optional wsi roles, eg, http/1, h2, ws, raw, etc
lib/tls Code supporting the various TLS libraries
libwebsockets.h Public API header for the whole of lws