Seafire-Routing/seafire/routing/routing-table.hxx

51 lines
954 B
C++
Raw Permalink Normal View History

2025-03-07 02:25:54 +01:00
#ifndef seafire__routing__routing_table_hxx_
#define seafire__routing__routing_table_hxx_
#include <seafire/routing/endpoint.hxx>
2025-03-07 22:13:09 +01:00
#include <seafire/routing/parameters.hxx>
2025-03-07 02:25:54 +01:00
#include <seafire/routing/route.hxx>
#include <seafire/server/request-handler.hxx>
#include <list>
#include <optional>
#include <string>
#include <vector>
namespace seafire::routing
{
class routing_table_t
{
public:
struct find_result_t
{
2025-03-07 22:13:09 +01:00
host_parameters_t host_params;
route_parameters_t route_params;
2025-03-07 02:25:54 +01:00
server::request_handler_t const& handler;
};
explicit
routing_table_t(std::vector<endpoint_t>);
std::vector<endpoint_t> const&
endpoints() const;
std::optional<find_result_t>
2025-03-07 22:13:09 +01:00
find_route(std::string const&, std::string const&) const;
2025-03-07 02:25:54 +01:00
private:
2025-03-07 22:13:09 +01:00
static
bool
match_host(std::string const&, std::string const&);
2025-03-07 02:25:54 +01:00
2025-03-07 22:13:09 +01:00
std::vector<endpoint_t> endpoints_;
2025-03-07 02:25:54 +01:00
};
} // namespace seafire::routing
#endif