rippled
Source.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_PEERFINDER_SOURCE_H_INCLUDED
21 #define RIPPLE_PEERFINDER_SOURCE_H_INCLUDED
22 
23 #include <ripple/peerfinder/PeerfinderManager.h>
24 #include <boost/system/error_code.hpp>
25 
26 namespace ripple {
27 namespace PeerFinder {
28 
37 class Source
38 {
39 public:
41  struct Results
42  {
43  explicit Results() = default;
44 
45  // error_code on a failure
46  boost::system::error_code error;
47 
48  // list of fetched endpoints
50  };
51 
52  virtual ~Source()
53  {
54  }
55  virtual std::string const&
56  name() = 0;
57  virtual void
59  {
60  }
61  virtual void
62  fetch(Results& results, beast::Journal journal) = 0;
63 };
64 
65 } // namespace PeerFinder
66 } // namespace ripple
67 
68 #endif
std::string
STL class.
ripple::PeerFinder::Source::name
virtual std::string const & name()=0
std::vector< beast::IP::Endpoint >
ripple::PeerFinder::Source
A static or dynamic source of peer addresses.
Definition: Source.h:37
ripple::PeerFinder::Source::Results::addresses
IPAddresses addresses
Definition: Source.h:49
ripple::PeerFinder::Source::cancel
virtual void cancel()
Definition: Source.h:58
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::PeerFinder::Source::Results::error
boost::system::error_code error
Definition: Source.h:46
ripple::PeerFinder::Source::Results::Results
Results()=default
ripple::PeerFinder::Source::~Source
virtual ~Source()
Definition: Source.h:52
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::PeerFinder::Source::fetch
virtual void fetch(Results &results, beast::Journal journal)=0
ripple::PeerFinder::Source::Results
The results of a fetch.
Definition: Source.h:41