Skip to content
API Documentation
BastionGuard™
local_warning_server.hpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#pragma once
22#include <string>
23#include <thread>
24#include <libsoup/soup.h>
25#include <glib.h>
26
28public:
29 LocalWarningServer(int http_port = 81,
30 int https_port = 444,
31 const std::string& bind_address = "127.0.0.2",
32 const std::string& cert_file = "",
33 const std::string& key_file = "",
34 const std::string& page_warning_path = "");
36
37 void start();
38 void stop();
39
40private:
41 static void on_request(SoupServer*, SoupServerMessage*, const char*, GHashTable*, gpointer);
42
43 SoupServer* server_;
46 std::string bind_address_;
47 std::string cert_file_;
48 std::string key_file_;
49 std::string page_warning_path_;
51 GMainLoop* loop_;
52 std::thread loop_thread_;
53};
static void on_request(SoupServer *, SoupServerMessage *, const char *, GHashTable *, gpointer)
LocalWarningServer(int http_port=81, int https_port=444, const std::string &bind_address="127.0.0.2", const std::string &cert_file="", const std::string &key_file="", const std::string &page_warning_path="")