rippled
Version.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 RIPPLED_RIPPLE_RPC_HANDLERS_VERSION_H
21 #define RIPPLED_RIPPLE_RPC_HANDLERS_VERSION_H
22 
23 #include <ripple/rpc/impl/RPCHelpers.h>
24 
25 namespace ripple {
26 namespace RPC {
27 
29 {
30 public:
32  : apiVersion_(c.apiVersion), betaEnabled_(c.app.config().BETA_RPC_API)
33  {
34  }
35 
36  Status
38  {
39  return Status::OK;
40  }
41 
42  template <class Object>
43  void
44  writeResult(Object& obj)
45  {
47  }
48 
49  static char const*
50  name()
51  {
52  return "version";
53  }
54 
55  static Role
56  role()
57  {
58  return Role::USER;
59  }
60 
61  static Condition
63  {
64  return NO_CONDITION;
65  }
66 
67 private:
68  unsigned int apiVersion_;
70 };
71 
72 } // namespace RPC
73 } // namespace ripple
74 
75 #endif
ripple::RPC::VersionHandler::VersionHandler
VersionHandler(JsonContext &c)
Definition: Version.h:31
ripple::RPC::JsonContext
Definition: Context.h:53
ripple::RPC::VersionHandler::condition
static Condition condition()
Definition: Version.h:62
ripple::RPC::VersionHandler
Definition: Version.h:28
ripple::RPC::VersionHandler::role
static Role role()
Definition: Version.h:56
ripple::RPC::Status::OK
static constexpr Code OK
Definition: Status.h:46
ripple::Role::USER
@ USER
ripple::RPC::VersionHandler::apiVersion_
unsigned int apiVersion_
Definition: Version.h:68
ripple::RPC::NO_CONDITION
@ NO_CONDITION
Definition: Handler.h:40
ripple::RPC::VersionHandler::name
static char const * name()
Definition: Version.h:50
ripple::RPC::VersionHandler::betaEnabled_
bool betaEnabled_
Definition: Version.h:69
ripple::RPC::Condition
Condition
Definition: Handler.h:39
ripple::RPC::Status
Status represents the results of an operation that might fail.
Definition: Status.h:39
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::RPC::VersionHandler::writeResult
void writeResult(Object &obj)
Definition: Version.h:44
ripple::Role
Role
Indicates the level of administrative permission to grant.
Definition: Role.h:43
ripple::RPC::VersionHandler::check
Status check()
Definition: Version.h:37
ripple::RPC::setVersion
void setVersion(Object &parent, unsigned int apiVersion, bool betaEnabled)
Definition: RPCHelpers.h:253