|
wired
libc-free QUIC/HTTP3 SDK in C for x86_64-linux
|
Selects and runs one of this SDK's four server drivers (single-process, multi-process fork, AF_XDP, multi-thread fan-out) from --workers/ --ifindex/--cores/--pin-core command-line flags, the exact same exclusive-combination rules examples/word_list's driver_select hand-rolled. More...
#include "app/http3/server/srvboot/srvboot.h"#include "app/http3/server/srvrun/srvrun.h"#include "app/http3/server/srvthreads/srvthreads.h"#include "app/http3/server/srvworkers/srvworkers.h"#include "app/http3/server/srvxdp/srvxdp.h"Go to the source code of this file.
Data Structures | |
| struct | wired_srvdriver_opt |
| Resolved driver selection and its knobs, filled entirely by wired_srvdriver_parse from argv (or by hand for a caller that skips CLI parsing). More... | |
Enumerations | |
| enum | wired_srvdriver_kind { WIRED_SRVDRIVER_PLAIN = 0 , WIRED_SRVDRIVER_WORKERS , WIRED_SRVDRIVER_XDP , WIRED_SRVDRIVER_THREADS } |
| Which of the four run paths wired_srvdriver_run takes. More... | |
Functions | |
| int | wired_srvdriver_parse (int argc, char **argv, wired_srvdriver_opt *opt) |
| Parse --port/--workers/--ifindex/--queue/--ip/--skb-mode/ --cores/--control-core/--pin-core from argv into *opt, applying the same exclusive-combination rules as examples/word_list's driver_select: --workers cannot combine with --cores or --ifindex; --pin-core cannot combine with --workers (use its own --pin-cores) or --cores (use --control-core). | |
| int | wired_srvdriver_run (wired_srvboot_id *id, wired_srvrun_handler h, wired_srvrun_obs obs, const wired_srvdriver_opt *opt) |
| Dispatch to the driver selected by opt->kind, binding/serving on opt->port: WIRED_SRVDRIVER_PLAIN -> wired_server_run_opt (opt->pin_core applied first) WIRED_SRVDRIVER_WORKERS -> wired_srvworkers_run WIRED_SRVDRIVER_XDP -> wired_srvxdp_open + wired_server_run_opt + wired_srvxdp_print_stats + wired_srvxdp_close WIRED_SRVDRIVER_THREADS -> wired_srvthreads_run. | |
Selects and runs one of this SDK's four server drivers (single-process, multi-process fork, AF_XDP, multi-thread fan-out) from --workers/ --ifindex/--cores/--pin-core command-line flags, the exact same exclusive-combination rules examples/word_list's driver_select hand-rolled.
Only the CLI-driven decision of WHICH driver to run and its dispatch are here; each driver's own knobs (wired_srvworkers_opt, wired_srvxdp_cfg, wired_srvthreads_opt) are unchanged and still directly usable by a caller that wants to build one by hand instead of parsing argv.
| enum wired_srvdriver_kind |
Which of the four run paths wired_srvdriver_run takes.
| int wired_srvdriver_parse | ( | int | argc, |
| char ** | argv, | ||
| wired_srvdriver_opt * | opt ) |
Parse --port/--workers/--ifindex/--queue/--ip/--skb-mode/ --cores/--control-core/--pin-core from argv into *opt, applying the same exclusive-combination rules as examples/word_list's driver_select: --workers cannot combine with --cores or --ifindex; --pin-core cannot combine with --workers (use its own --pin-cores) or --cores (use --control-core).
--ifindex alone still composes with --cores (AF_XDP multi-queue mode: worker i serves queue i) – this is why XDP has no dedicated flag of its own, only --ifindex deciding WIRED_SRVDRIVER_XDP when --cores is absent.
opt->port/run/workers/threads are populated only for the fields this parses; a caller that also wants qlog/keylog paths, app callbacks (wt_on_datagram, etc.), or cert-reload paths sets those directly on opt->run and the wired_srvrun_obs it passes to wired_srvdriver_run separately.
| argc | argument count |
| argv | argument vector |
| opt | destination; left untouched if an exclusive-combination conflict is detected before any field is written, but zeroed (and possibly partially filled) on a value-parse failure past that point (e.g. --cores present but unparseable) – always re-check the return value, never trust opt's contents after a 0 return |
| int wired_srvdriver_run | ( | wired_srvboot_id * | id, |
| wired_srvrun_handler | h, | ||
| wired_srvrun_obs | obs, | ||
| const wired_srvdriver_opt * | opt ) |
Dispatch to the driver selected by opt->kind, binding/serving on opt->port: WIRED_SRVDRIVER_PLAIN -> wired_server_run_opt (opt->pin_core applied first) WIRED_SRVDRIVER_WORKERS -> wired_srvworkers_run WIRED_SRVDRIVER_XDP -> wired_srvxdp_open + wired_server_run_opt + wired_srvxdp_print_stats + wired_srvxdp_close WIRED_SRVDRIVER_THREADS -> wired_srvthreads_run.
qlog/keylog paths in obs are passed through for PLAIN/XDP/THREADS; WORKERS silently drops them (multiple forked processes writing the same qlog/ keylog file would interleave, matching examples/word_list's existing run_workers behavior).
| id | the fixed server identity, passed through to the selected driver |
| h | the application's request responder |
| obs | qlog/keylog/cert-reload paths (cert-reload is the caller's own concern via wired_certreload_load_or_selfsigned, not this function's) |
| opt | the resolved selection from wired_srvdriver_parse (or built by hand); opt->port is the port bound/served, see wired_srvdriver_opt's doc |