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
26#include <boost/asio/ip/address.hpp>
27#include <boost/asio/ip/network_v4.hpp>
28#include <boost/asio/ip/network_v6.hpp>
29#include <boost/beast/core/string.hpp>
30#include <boost/beast/websocket/option.hpp>
31
32#include <cstdint>
33#include <memory>
34#include <optional>
35#include <set>
36#include <string>
37
38namespace boost {
39namespace asio {
40namespace ssl {
41class context;
42}
43} // namespace asio
44} // namespace boost
45
46namespace ripple {
47
49struct Port
50{
51 explicit Port() = default;
52
54 boost::asio::ip::address ip;
69 boost::beast::websocket::permessage_deflate pmd_options;
71
72 // How many incoming connections are allowed on this
73 // port in the range [0, 65535] where 0 means unlimited.
74 int limit = 0;
75
76 // Websocket disconnects if send queue exceeds this limit
78
79 // Returns `true` if any websocket protocols are specified
80 bool
81 websockets() const;
82
83 // Returns `true` if any secure protocols are specified
84 bool
85 secure() const;
86
87 // Returns a string containing the list of protocols
89 protocols() const;
90};
91
93operator<<(std::ostream& os, Port const& p);
94
95//------------------------------------------------------------------------------
96
122
123void
124parse_Port(ParsedPort& port, Section const& section, std::ostream& log);
125
126} // namespace ripple
127
128#endif
Holds a collection of configuration values.
Definition BasicConfig.h:45
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
void parse_Port(ParsedPort &port, Section const &section, std::ostream &log)
Definition Port.cpp:214
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
Definition base_uint.h:647
ParsedPort()=default
std::string ssl_ciphers
Definition Port.h:110
boost::beast::websocket::permessage_deflate pmd_options
Definition Port.h:111
std::optional< std::uint16_t > port
Definition Port.h:116
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
Definition Port.h:117
std::string user
Definition Port.h:103
std::string ssl_key
Definition Port.h:107
std::uint16_t ws_queue_limit
Definition Port.h:113
std::vector< boost::asio::ip::network_v6 > secure_gateway_nets_v6
Definition Port.h:120
std::set< std::string, boost::beast::iless > protocol
Definition Port.h:102
std::string admin_password
Definition Port.h:106
std::string name
Definition Port.h:101
std::string ssl_chain
Definition Port.h:109
std::string password
Definition Port.h:104
std::vector< boost::asio::ip::network_v6 > admin_nets_v6
Definition Port.h:118
std::string ssl_cert
Definition Port.h:108
std::string admin_user
Definition Port.h:105
std::optional< boost::asio::ip::address > ip
Definition Port.h:115
std::vector< boost::asio::ip::network_v4 > secure_gateway_nets_v4
Definition Port.h:119
Configuration information for a Server listening port.
Definition Port.h:50
std::uint16_t port
Definition Port.h:55
Port()=default
std::string ssl_chain
Definition Port.h:67
bool secure() const
Definition Port.cpp:46
std::string password
Definition Port.h:62
std::vector< boost::asio::ip::network_v6 > admin_nets_v6
Definition Port.h:58
bool websockets() const
std::set< std::string, boost::beast::iless > protocol
Definition Port.h:56
std::string protocols() const
Definition Port.cpp:53
std::string ssl_cert
Definition Port.h:66
int limit
Definition Port.h:74
std::string ssl_key
Definition Port.h:65
std::vector< boost::asio::ip::network_v6 > secure_gateway_nets_v6
Definition Port.h:60
std::string admin_user
Definition Port.h:63
std::string user
Definition Port.h:61
std::vector< boost::asio::ip::network_v4 > secure_gateway_nets_v4
Definition Port.h:59
boost::asio::ip::address ip
Definition Port.h:54
std::shared_ptr< boost::asio::ssl::context > context
Definition Port.h:70
std::uint16_t ws_queue_limit
Definition Port.h:77
std::string ssl_ciphers
Definition Port.h:68
std::string admin_password
Definition Port.h:64
std::string name
Definition Port.h:53
std::vector< boost::asio::ip::network_v4 > admin_nets_v4
Definition Port.h:57
boost::beast::websocket::permessage_deflate pmd_options
Definition Port.h:69