SNode.C
Loading...
Searching...
No Matches
SocketContextUpgradeFactory.h
Go to the documentation of this file.
1/*
2 * snode.c - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORY_H
21#define WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORY_H
22
23#include "web/http/SocketContextUpgradeFactory.h" // IWYU pragma: export
24
25namespace web::http::server {
26 class Request;
27 class Response;
28} // namespace web::http::server
29
30#ifndef DOXYGEN_SHOULD_SKIP_THIS
31
32#include <string> // for string
33
34#endif /* DOXYGEN_SHOULD_SKIP_THIS */
35
36namespace web::http::server {
37
38 class SocketContextUpgradeFactory
39 : public web::http::SocketContextUpgradeFactory<web::http::server::Request, web::http::server::Response> {
40 public:
41 using Resquest = web::http::server::Request;
42 using Reponse = web::http::server::Response;
43
44 protected:
45 SocketContextUpgradeFactory();
46
47 public:
48 void checkRefCount() final;
49
50 static void link(const std::string& upgradeContextName, SocketContextUpgradeFactory* (*linkedPlugin)());
51
52 friend class SocketContextUpgradeFactorySelector;
53 };
54
55} // namespace web::http::server
56
57extern template class web::http::SocketContextUpgradeFactory<web::http::server::Request, web::http::server::Response>;
58
59#endif // WEB_HTTP_SERVER_SOCKETCONTEXTUPGRADEFACTORY_H
virtual void stop()=0
virtual void start()=0
void onSourceData(const char *chunk, std::size_t chunkLen) override
Definition Response.cpp:405
Response(SocketContext *socketContext)
Definition Response.cpp:50
SocketContext * getSocketContext() const
Definition Response.cpp:432
void onSourceConnect(core::pipe::Source *source) override
Definition Response.cpp:391
Response & status(int statusCode)
Definition Response.cpp:80
void send(const std::string &chunk)
Definition Response.cpp:202
void send(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:191
Response & setTrailer(const std::string &field, const std::string &value, bool overwrite=true)
Definition Response.cpp:172
Response & set(const std::map< std::string, std::string > &headers, bool overwrite=true)
Definition Response.cpp:98
Response & set(const std::string &field, const std::string &value, bool overwrite=true)
Definition Response.cpp:106
void upgrade(const std::shared_ptr< Request > &request, const std::function< void(const std::string &)> &status)
Definition Response.cpp:222
Response & type(const std::string &type)
Definition Response.cpp:152
void onSourceError(int errnum) override
Definition Response.cpp:417
Response & sendFragment(const std::string &chunk)
Definition Response.cpp:364
Response & cookie(const std::string &name, const std::string &value, const std::map< std::string, std::string > &options={})
Definition Response.cpp:156
Response & append(const std::string &field, const std::string &value)
Definition Response.cpp:86
void sendStatus(int statusCode)
Definition Response.cpp:210
Response & sendFragment(const char *chunk, std::size_t chunkLen)
Definition Response.cpp:346
void onSourceEof() override
Definition Response.cpp:409
void sendFile(const std::string &file, const std::function< void(int)> &callback)
Definition Response.cpp:270
Response & clearCookie(const std::string &name, const std::map< std::string, std::string > &options={})
Definition Response.cpp:162
const std::string & header(const std::string &field)
Definition Response.cpp:428
#define to_hex_str(int_val)
Definition Request.cpp:49