xref: /aosp_15_r20/external/libwebsockets/lib/secure-streams/protocols/README.md (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1*1c60b9acSAndroid Build Coastguard Worker# Lws Protocol bindings for Secure Streams
2*1c60b9acSAndroid Build Coastguard Worker
3*1c60b9acSAndroid Build Coastguard WorkerThis directory contains the code wiring up normal lws protocols
4*1c60b9acSAndroid Build Coastguard Workerto Secure Streams.
5*1c60b9acSAndroid Build Coastguard Worker
6*1c60b9acSAndroid Build Coastguard Worker## The lws_protocols callback
7*1c60b9acSAndroid Build Coastguard Worker
8*1c60b9acSAndroid Build Coastguard WorkerThis is the normal lws struct lws_protocols callback that handles events and
9*1c60b9acSAndroid Build Coastguard Workertraffic on the lws protocol being supported.
10*1c60b9acSAndroid Build Coastguard Worker
11*1c60b9acSAndroid Build Coastguard WorkerThe various events and traffic are converted into calls using the Secure
12*1c60b9acSAndroid Build Coastguard WorkerStreams api, and Secure Streams events.
13*1c60b9acSAndroid Build Coastguard Worker
14*1c60b9acSAndroid Build Coastguard Worker## The connect_munge helper
15*1c60b9acSAndroid Build Coastguard Worker
16*1c60b9acSAndroid Build Coastguard WorkerDifferent protocols have different semantics in the arguments to the client
17*1c60b9acSAndroid Build Coastguard Workerconnect function, this protocol-specific helper is called to munge the
18*1c60b9acSAndroid Build Coastguard Workerconnect_info struct to match the details of the protocol selected.
19*1c60b9acSAndroid Build Coastguard Worker
20*1c60b9acSAndroid Build Coastguard WorkerThe `ss->policy->aux` string is used to hold protocol-specific information
21*1c60b9acSAndroid Build Coastguard Workerpassed in the from the policy, eg, the URL path or websockets subprotocol
22*1c60b9acSAndroid Build Coastguard Workername.
23*1c60b9acSAndroid Build Coastguard Worker
24*1c60b9acSAndroid Build Coastguard Worker## The (library-private) ss_pcols export
25*1c60b9acSAndroid Build Coastguard Worker
26*1c60b9acSAndroid Build Coastguard WorkerEach protocol binding exports two things to other parts of lws (they
27*1c60b9acSAndroid Build Coastguard Workerare not exported to user code)
28*1c60b9acSAndroid Build Coastguard Worker
29*1c60b9acSAndroid Build Coastguard Worker - a struct lws_protocols, including a pointer to the callback
30*1c60b9acSAndroid Build Coastguard Worker
31*1c60b9acSAndroid Build Coastguard Worker - a struct ss_pcols describing how secure_streams should use, including
32*1c60b9acSAndroid Build Coastguard Worker   a pointer to the related connect_munge helper.
33*1c60b9acSAndroid Build Coastguard Worker
34*1c60b9acSAndroid Build Coastguard WorkerIn ./lib/core-net/vhost.c, enabled protocols are added to vhost protcols
35*1c60b9acSAndroid Build Coastguard Workerlists so they may be used.  And in ./lib/secure-streams/secure-streams.c,
36*1c60b9acSAndroid Build Coastguard Workerenabled struct ss_pcols are listed and checked for matches when the user
37*1c60b9acSAndroid Build Coastguard Workercreates a new Secure Stream.
38*1c60b9acSAndroid Build Coastguard Worker
39