rippled
Loading...
Searching...
No Matches
Role.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_ROLE_H_INCLUDED
21#define RIPPLE_SERVER_ROLE_H_INCLUDED
22
23#include <xrpl/beast/net/IPEndpoint.h>
24#include <xrpl/json/json_value.h>
25#include <xrpl/resource/ResourceManager.h>
26#include <xrpl/server/Handoff.h>
27#include <xrpl/server/Port.h>
28
29#include <boost/asio/ip/network_v4.hpp>
30#include <boost/asio/ip/network_v6.hpp>
31#include <boost/utility/string_view.hpp>
32
33#include <string>
34#include <vector>
35
36namespace ripple {
37
45
54Role
56 Role const& required,
57 Port const& port,
58 Json::Value const& params,
59 beast::IP::Endpoint const& remoteIp,
60 std::string_view user);
61
62Resource::Consumer
64 Resource::Manager& manager,
65 beast::IP::Endpoint const& remoteAddress,
66 Role const& role,
69
73bool
74isUnlimited(Role const& role);
75
83bool
85 beast::IP::Address const& remoteIp,
88
90forwardedFor(http_request_type const& request);
91
92} // namespace ripple
93
94#endif
Represents a JSON value.
Definition json_value.h:149
A version-independent IP address and port combination.
Definition IPEndpoint.h:38
boost::asio::ip::address Address
Definition IPAddress.h:39
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
Resource::Consumer requestInboundEndpoint(Resource::Manager &manager, beast::IP::Endpoint const &remoteAddress, Role const &role, std::string_view user, std::string_view forwardedFor)
Definition Role.cpp:142
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Definition Role.cpp:125
std::string_view forwardedFor(http_request_type const &request)
Definition Role.cpp:262
boost::beast::http::request< boost::beast::http::dynamic_body > http_request_type
Definition Handoff.h:33
Role
Indicates the level of administrative permission to grant.
Definition Role.h:44
Role requestRole(Role const &required, Port const &port, Json::Value const &params, beast::IP::Endpoint const &remoteIp, std::string_view user)
Return the allowed privilege role.
Definition Role.cpp:95
bool ipAllowed(beast::IP::Address const &remoteIp, std::vector< boost::asio::ip::network_v4 > const &nets4, std::vector< boost::asio::ip::network_v6 > const &nets6)
True if remoteIp is in any of adminIp.
Definition Role.cpp:46