Fabcoin Core  0.16.2
P2P Digital Currency
Whisper.h
Go to the documentation of this file.
1 /*
2  This file is part of cpp-ethereum.
3 
4  cpp-ethereum is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  cpp-ethereum is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16 */
24 #pragma once
25 #include <libdevcrypto/Common.h>
26 #include "WhisperFace.h"
27 
28 namespace dev
29 {
30 
31 class WebThreeDirect;
32 
33 namespace shh
34 {
35 class Interface;
36 }
37 
38 namespace rpc
39 {
40 
41 class Whisper: public WhisperFace
42 {
43 public:
44  // TODO: init with whisper interface instead of webthreedirect
45  Whisper(WebThreeDirect& _web3, std::vector<dev::KeyPair> const& _accounts);
46  virtual RPCModules implementedModules() const override
47  {
48  return RPCModules{RPCModule{"shh", "1.0"}};
49  }
50 
51  virtual void setIdentities(std::vector<dev::KeyPair> const& _ids);
52  std::map<dev::Public, dev::Secret> const& ids() const { return m_ids; }
53 
54  virtual bool shh_post(Json::Value const& _json) override;
55  virtual std::string shh_newIdentity() override;
56  virtual bool shh_hasIdentity(std::string const& _identity) override;
57  virtual std::string shh_newGroup(std::string const& _id, std::string const& _who) override;
58  virtual std::string shh_addToGroup(std::string const& _group, std::string const& _who) override;
59  virtual std::string shh_newFilter(Json::Value const& _json) override;
60  virtual bool shh_uninstallFilter(std::string const& _filterId) override;
61  virtual Json::Value shh_getFilterChanges(std::string const& _filterId) override;
62  virtual Json::Value shh_getMessages(std::string const& _filterId) override;
63 
64 private:
65  shh::Interface* shh() const;
66 
68  std::map<dev::Public, dev::Secret> m_ids;
69  std::map<unsigned, dev::Public> m_watches;
70 };
71 
72 }
73 }
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition: Arith256.cpp:15
std::vector< RPCModule > RPCModules
Definition: ModularServer.h:50
WebThreeDirect & m_web3
Definition: Whisper.h:67
Main API hub for interfacing with Web 3 components.
Definition: WebThree.h:119
virtual RPCModules implementedModules() const override
Definition: Whisper.h:46
Config::Value_type Value
std::map< dev::Public, dev::Secret > const & ids() const
Definition: Whisper.h:52
std::map< unsigned, dev::Public > m_watches
Definition: Whisper.h:69
std::map< dev::Public, dev::Secret > m_ids
Definition: Whisper.h:68