12c593315Sopenharmony_ci/* 22c593315Sopenharmony_ci * nghttp2 - HTTP/2 C Library 32c593315Sopenharmony_ci * 42c593315Sopenharmony_ci * Copyright (c) 2015 Tatsuhiro Tsujikawa 52c593315Sopenharmony_ci * 62c593315Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining 72c593315Sopenharmony_ci * a copy of this software and associated documentation files (the 82c593315Sopenharmony_ci * "Software"), to deal in the Software without restriction, including 92c593315Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish, 102c593315Sopenharmony_ci * distribute, sublicense, and/or sell copies of the Software, and to 112c593315Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to 122c593315Sopenharmony_ci * the following conditions: 132c593315Sopenharmony_ci * 142c593315Sopenharmony_ci * The above copyright notice and this permission notice shall be 152c593315Sopenharmony_ci * included in all copies or substantial portions of the Software. 162c593315Sopenharmony_ci * 172c593315Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 182c593315Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 192c593315Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 202c593315Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 212c593315Sopenharmony_ci * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 222c593315Sopenharmony_ci * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 232c593315Sopenharmony_ci * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 242c593315Sopenharmony_ci */ 252c593315Sopenharmony_ci#ifndef SHRPX_WORKER_PROCESS_H 262c593315Sopenharmony_ci#define SHRPX_WORKER_PROCESS_H 272c593315Sopenharmony_ci 282c593315Sopenharmony_ci#include "shrpx.h" 292c593315Sopenharmony_ci 302c593315Sopenharmony_ci#include <vector> 312c593315Sopenharmony_ci#include <array> 322c593315Sopenharmony_ci 332c593315Sopenharmony_ci#include "shrpx_connection_handler.h" 342c593315Sopenharmony_ci#ifdef ENABLE_HTTP3 352c593315Sopenharmony_ci# include "shrpx_quic.h" 362c593315Sopenharmony_ci#endif // ENABLE_HTTP3 372c593315Sopenharmony_ci 382c593315Sopenharmony_cinamespace shrpx { 392c593315Sopenharmony_ci 402c593315Sopenharmony_ciclass ConnectionHandler; 412c593315Sopenharmony_ci 422c593315Sopenharmony_cistruct WorkerProcessConfig { 432c593315Sopenharmony_ci // IPC socket to read event from main process 442c593315Sopenharmony_ci int ipc_fd; 452c593315Sopenharmony_ci // IPC socket to tell that a worker process is ready for service. 462c593315Sopenharmony_ci int ready_ipc_fd; 472c593315Sopenharmony_ci // IPv4 or UNIX domain socket, or -1 if not used 482c593315Sopenharmony_ci int server_fd; 492c593315Sopenharmony_ci // IPv6 socket, or -1 if not used 502c593315Sopenharmony_ci int server_fd6; 512c593315Sopenharmony_ci#ifdef ENABLE_HTTP3 522c593315Sopenharmony_ci // CID prefixes for the new worker process. 532c593315Sopenharmony_ci std::vector<std::array<uint8_t, SHRPX_QUIC_CID_PREFIXLEN>> cid_prefixes; 542c593315Sopenharmony_ci // IPC socket to read forwarded QUIC UDP datagram from the current 552c593315Sopenharmony_ci // worker process. 562c593315Sopenharmony_ci int quic_ipc_fd; 572c593315Sopenharmony_ci // Lingering worker processes which were created before this worker 582c593315Sopenharmony_ci // process to forward QUIC UDP datagram during reload. 592c593315Sopenharmony_ci std::vector<QUICLingeringWorkerProcess> quic_lingering_worker_processes; 602c593315Sopenharmony_ci#endif // ENABLE_HTTP3 612c593315Sopenharmony_ci}; 622c593315Sopenharmony_ci 632c593315Sopenharmony_ciint worker_process_event_loop(WorkerProcessConfig *wpconf); 642c593315Sopenharmony_ci 652c593315Sopenharmony_ci} // namespace shrpx 662c593315Sopenharmony_ci 672c593315Sopenharmony_ci#endif // SHRPX_WORKER_PROCESS_H 68