rippled
Loading...
Searching...
No Matches
Port.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_SERVER_PORT_H_INCLUDED
21#define RIPPLE_SERVER_PORT_H_INCLUDED
22
23#include <xrpl/basics/BasicConfig.h>
24#include <xrpl/beast/net/IPEndpoint.h>
25#include <boost/asio/ip/address.hpp>
26#include <boost/asio/ip/network_v4.hpp>
27#include <boost/asio/ip/network_v6.hpp>
28#include <boost/beast/core/string.hpp>
29#include <boost/beast/websocket/option.hpp>
30#include <cstdint>
31#include <memory>
32#include <optional>
33#include <set>
34#include <string>
35#include <variant>
36
37namespace boost {
38namespace asio {
39namespace ssl {
40class context;
41}
42} // namespace asio
43} // namespace boost
44
45namespace ripple {
46
48struct Port
49{
50 explicit Port() = default;
51
53 boost::asio::ip::address ip;
68 boost::beast::websocket::permessage_deflate pmd_options;
70
71 // How many incoming connections are allowed on this
72 // port in the range [0, 65535] where 0 means unlimited.
73 int limit = 0;
74
75 // Websocket disconnects if send queue exceeds this limit
77
78 // Returns `true` if any websocket protocols are specified
79 bool
80 websockets() const;
81
82 // Returns `true` if any secure protocols are specified
83 bool
84 secure() const;
85
86 // Returns a string containing the list of protocols
88 protocols() const;
89};
90
92operator<<(std::ostream& os, Port const& p);
93
94//------------------------------------------------------------------------------
95
97{
98 explicit ParsedPort() = default;
99
110 boost::beast::websocket::permessage_deflate pmd_options;
111 int limit = 0;
113
120};
121
122void
123parse_Port(ParsedPort& port, Section const& section, std::ostream& log);
124
125} // namespace ripple
126
127#endif
Holds a collection of configuration values.
Definition: BasicConfig.h:46
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
void parse_Port(ParsedPort &port, Section const &section, std::ostream &log)
Definition: Port.cpp:199
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
Definition: base_uint.h:636
ParsedPort()=default
std::string ssl_ciphers
Definition: Port.h:109
boost::beast::websocket::permessage_deflate pmd_options
Definition: Port.h:110
std::optional< std::uint16_t > port
Definition: Port.h:115
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
Definition: Port.h:116
std::string user
Definition: Port.h:102
std::string ssl_key
Definition: Port.h:106
std::uint16_t ws_queue_limit
Definition: Port.h:112
std::vector< boost::asio::ip::network_v6 > secure_gateway_nets_v6
Definition: Port.h:119
std::set< std::string, boost::beast::iless > protocol
Definition: Port.h:101
std::string admin_password
Definition: Port.h:105
std::string name
Definition: Port.h:100
std::string ssl_chain
Definition: Port.h:108
std::string password
Definition: Port.h:103
std::vector< boost::asio::ip::network_v6 > admin_nets_v6
Definition: Port.h:117
std::string ssl_cert
Definition: Port.h:107
std::string admin_user
Definition: Port.h:104
std::optional< boost::asio::ip::address > ip
Definition: Port.h:114
std::vector< boost::asio::ip::network_v4 > secure_gateway_nets_v4
Definition: Port.h:118
Configuration information for a Server listening port.
Definition: Port.h:49
std::uint16_t port
Definition: Port.h:54
Port()=default
std::string ssl_chain
Definition: Port.h:66
bool secure() const
Definition: Port.cpp:31
std::string password
Definition: Port.h:61
std::vector< boost::asio::ip::network_v6 > admin_nets_v6
Definition: Port.h:57
bool websockets() const
std::set< std::string, boost::beast::iless > protocol
Definition: Port.h:55
std::string protocols() const
Definition: Port.cpp:38
std::string ssl_cert
Definition: Port.h:65
int limit
Definition: Port.h:73
std::string ssl_key
Definition: Port.h:64
std::vector< boost::asio::ip::network_v6 > secure_gateway_nets_v6
Definition: Port.h:59
std::string admin_user
Definition: Port.h:62
std::string user
Definition: Port.h:60
std::vector< boost::asio::ip::network_v4 > secure_gateway_nets_v4
Definition: Port.h:58
boost::asio::ip::address ip
Definition: Port.h:53
std::shared_ptr< boost::asio::ssl::context > context
Definition: Port.h:69
std::uint16_t ws_queue_limit
Definition: Port.h:76
std::string ssl_ciphers
Definition: Port.h:67
std::string admin_password
Definition: Port.h:63
std::string name
Definition: Port.h:52
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
Definition: Port.h:56
boost::beast::websocket::permessage_deflate pmd_options
Definition: Port.h:68