1d4afb5ceSopenharmony_ci# Lws Protocol bindings for Secure Streams
2d4afb5ceSopenharmony_ci
3d4afb5ceSopenharmony_ciThis directory contains the code wiring up normal lws protocols
4d4afb5ceSopenharmony_cito Secure Streams.
5d4afb5ceSopenharmony_ci
6d4afb5ceSopenharmony_ci## The lws_protocols callback
7d4afb5ceSopenharmony_ci
8d4afb5ceSopenharmony_ciThis is the normal lws struct lws_protocols callback that handles events and
9d4afb5ceSopenharmony_citraffic on the lws protocol being supported.
10d4afb5ceSopenharmony_ci
11d4afb5ceSopenharmony_ciThe various events and traffic are converted into calls using the Secure
12d4afb5ceSopenharmony_ciStreams api, and Secure Streams events.
13d4afb5ceSopenharmony_ci
14d4afb5ceSopenharmony_ci## The connect_munge helper
15d4afb5ceSopenharmony_ci
16d4afb5ceSopenharmony_ciDifferent protocols have different semantics in the arguments to the client
17d4afb5ceSopenharmony_ciconnect function, this protocol-specific helper is called to munge the
18d4afb5ceSopenharmony_ciconnect_info struct to match the details of the protocol selected.
19d4afb5ceSopenharmony_ci
20d4afb5ceSopenharmony_ciThe `ss->policy->aux` string is used to hold protocol-specific information
21d4afb5ceSopenharmony_cipassed in the from the policy, eg, the URL path or websockets subprotocol
22d4afb5ceSopenharmony_ciname.
23d4afb5ceSopenharmony_ci
24d4afb5ceSopenharmony_ci## The (library-private) ss_pcols export
25d4afb5ceSopenharmony_ci
26d4afb5ceSopenharmony_ciEach protocol binding exports two things to other parts of lws (they
27d4afb5ceSopenharmony_ciare not exported to user code)
28d4afb5ceSopenharmony_ci
29d4afb5ceSopenharmony_ci - a struct lws_protocols, including a pointer to the callback
30d4afb5ceSopenharmony_ci
31d4afb5ceSopenharmony_ci - a struct ss_pcols describing how secure_streams should use, including
32d4afb5ceSopenharmony_ci   a pointer to the related connect_munge helper.
33d4afb5ceSopenharmony_ci
34d4afb5ceSopenharmony_ciIn ./lib/core-net/vhost.c, enabled protocols are added to vhost protcols
35d4afb5ceSopenharmony_cilists so they may be used.  And in ./lib/secure-streams/secure-streams.c,
36d4afb5ceSopenharmony_cienabled struct ss_pcols are listed and checked for matches when the user
37d4afb5ceSopenharmony_cicreates a new Secure Stream.
38d4afb5ceSopenharmony_ci
39