libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-stub.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2026 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * lws_stub - generalized API for spawning and communicating with root stubs
25 * via UDS and JSON-RPC
26 */
27
28#ifndef _LWS_STUB_H
29#define _LWS_STUB_H
30
31#if defined(LWS_WITH_STUB)
32
33struct lws_stub_config {
34 struct lws_context *cx;
35 struct lws_vhost *vh;
36 const char *stub_name; /* e.g. "distribution-client" */
37 const char *uds_path; /* e.g. "/var/run/lws-cert-dist-stub.sock" */
38 const struct lws_protocols *protocols; /* Protocol array for the UDS server vhost */
39 const void *extra_payload; /* Optional extra data to write to child stdin */
40 size_t extra_payload_len;
41};
42
43struct lws_stub_manager;
44
54LWS_VISIBLE LWS_EXTERN struct lws_stub_manager *
55lws_stub_spawn(const struct lws_stub_config *config);
56
69lws_stub_server_init(const struct lws_stub_config *config, char *secret_out, void *extra_out, size_t extra_len);
70
86lws_stub_request(struct lws_stub_manager *mgr,
87 const char *json,
88 const char * const *rx_paths,
89 size_t rx_paths_count,
90 signed char (*rx_cb)(struct lejp_ctx *ctx, char reason),
91 void (*raw_cb)(const char *in, size_t len, void *user),
92 void *user);
93
102lws_stub_destroy(struct lws_stub_manager **_mgr);
103
104
106lws_callback_stub_client(struct lws *wsi, enum lws_callback_reasons reason,
107 void *user, void *in, size_t len);
108
109#endif /* LWS_WITH_STUB */
110
111#endif /* _LWS_STUB_H */
lws_callback_reasons
#define LWS_EXTERN
#define LWS_VISIBLE