Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
dev::shh::WhisperHost Class Reference

#include <WhisperHost.h>

Inheritance diagram for dev::shh::WhisperHost:
[legend]
Collaboration diagram for dev::shh::WhisperHost:
[legend]

Public Member Functions

 WhisperHost (bool _storeMessagesInDB=false)
 
virtual ~WhisperHost ()
 
unsigned protocolVersion () const
 
void cleanup ()
 remove old messages More...
 
std::map< h256, Envelopeall () const
 
TopicBloomFilterHash bloom () const
 
virtual void inject (Envelope const &_e, WhisperPeer *_from=nullptr) override
 
virtual Topics const & fullTopics (unsigned _id) const override
 
virtual unsigned installWatch (Topics const &_filter) override
 
virtual void uninstallWatch (unsigned _watchId) override
 
virtual h256s peekWatch (unsigned _watchId) const override
 
virtual h256s checkWatch (unsigned _watchId) override
 
virtual h256s watchMessages (unsigned _watchId) override
 returns IDs of messages, which match specific watch criteria More...
 
virtual Envelope envelope (h256 _m) const override
 
- Public Member Functions inherited from dev::shh::Interface
virtual ~Interface ()
 
void post (bytes const &_payload, Topics _topics, unsigned _ttl=50, unsigned _workToProve=50)
 
void post (Public _to, bytes const &_payload, Topics _topics, unsigned _ttl=50, unsigned _workToProve=50)
 
void post (Secret const &_from, bytes const &_payload, Topics _topics, unsigned _ttl=50, unsigned _workToProve=50)
 
void post (Secret const &_from, Public _to, bytes const &_payload, Topics _topics, unsigned _ttl=50, unsigned _workToProve=50)
 

Protected Member Functions

virtual void doWork () override
 Called continuously following sleep for m_idleWaitMs. More...
 
void noteAdvertiseTopicsOfInterest ()
 
bool isWatched (Envelope const &_e) const
 
- Protected Member Functions inherited from dev::Worker
 Worker (std::string const &_name="anon", unsigned _idleWaitMs=30)
 
 Worker (Worker &&_m)
 Move-constructor. More...
 
Workeroperator= (Worker &&_m)
 Move-assignment. More...
 
virtual ~Worker ()
 
void setName (std::string _n)
 Allows changing worker name if work is stopped. More...
 
void startWorking ()
 Starts worker thread; causes startedWorking() to be called. More...
 
void stopWorking ()
 Stop worker thread; causes call to stopWorking(). More...
 
bool isWorking () const
 Returns if worker thread is present. More...
 
virtual void startedWorking ()
 Called after thread is started from startWorking(). More...
 
virtual void workLoop ()
 Overrides doWork(); should call shouldStop() often and exit when true. More...
 
bool shouldStop () const
 
virtual void doneWorking ()
 Called when is to be stopped, just prior to thread being joined. More...
 

Private Member Functions

virtual void onStarting () override
 
virtual void onStopping () override
 
void streamMessage (h256 _m, RLPStream &_s) const
 
void saveMessagesToBD ()
 
void loadMessagesFromBD ()
 

Private Attributes

dev::SharedMutex x_messages
 
std::map< h256, Envelopem_messages
 
std::multimap< unsigned, h256m_expiryQueue
 
dev::Mutex m_filterLock
 
std::map< h256, InstalledFilterm_filters
 
std::map< unsigned, ClientWatchm_watches
 
TopicBloomFilter m_bloom
 
bool m_storeMessagesInDB
 needed for tests and other special cases More...
 

Friends

class WhisperPeer
 

Detailed Description

Definition at line 46 of file WhisperHost.h.

Constructor & Destructor Documentation

WhisperHost::WhisperHost ( bool  _storeMessagesInDB = false)

Definition at line 33 of file WhisperHost.cpp.

Here is the call graph for this function:

WhisperHost::~WhisperHost ( )
virtual

Definition at line 38 of file WhisperHost.cpp.

Here is the call graph for this function:

Member Function Documentation

std::map<h256, Envelope> dev::shh::WhisperHost::all ( ) const
inline

Definition at line 55 of file WhisperHost.h.

TopicBloomFilterHash dev::shh::WhisperHost::bloom ( ) const
inline

Definition at line 56 of file WhisperHost.h.

Here is the call graph for this function:

h256s WhisperHost::checkWatch ( unsigned  _watchId)
overridevirtual

Implements dev::shh::Interface.

Definition at line 184 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WhisperHost::cleanup ( )

remove old messages

Definition at line 209 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WhisperHost::doWork ( )
overrideprotectedvirtual

Called continuously following sleep for m_idleWaitMs.

Reimplemented from dev::Worker.

Definition at line 202 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Envelope dev::shh::WhisperHost::envelope ( h256  _m) const
inlineoverridevirtual

Implements dev::shh::Interface.

Definition at line 65 of file WhisperHost.h.

Here is the call graph for this function:

virtual Topics const& dev::shh::WhisperHost::fullTopics ( unsigned  _id) const
inlineoverridevirtual

Implements dev::shh::Interface.

Definition at line 59 of file WhisperHost.h.

Here is the call graph for this function:

void WhisperHost::inject ( Envelope const &  _e,
WhisperPeer _from = nullptr 
)
overridevirtual

Implements dev::shh::Interface.

Definition at line 55 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned WhisperHost::installWatch ( shh::Topics const &  _t)
overridevirtual

Implements dev::shh::Interface.

Definition at line 114 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WhisperHost::isWatched ( Envelope const &  _e) const
protected

Definition at line 225 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WhisperHost::loadMessagesFromBD ( )
private

Definition at line 266 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WhisperHost::noteAdvertiseTopicsOfInterest ( )
protected

Definition at line 219 of file WhisperHost.cpp.

Here is the caller graph for this function:

virtual void dev::shh::WhisperHost::onStarting ( )
inlineoverrideprivatevirtual

Definition at line 73 of file WhisperHost.h.

Here is the call graph for this function:

virtual void dev::shh::WhisperHost::onStopping ( )
inlineoverrideprivatevirtual

Definition at line 74 of file WhisperHost.h.

Here is the call graph for this function:

virtual h256s dev::shh::WhisperHost::peekWatch ( unsigned  _watchId) const
inlineoverridevirtual

Implements dev::shh::Interface.

Definition at line 62 of file WhisperHost.h.

Here is the call graph for this function:

unsigned dev::shh::WhisperHost::protocolVersion ( ) const
inline

Definition at line 53 of file WhisperHost.h.

Here is the call graph for this function:

void WhisperHost::saveMessagesToBD ( )
private

Definition at line 237 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void WhisperHost::streamMessage ( h256  _m,
RLPStream _s 
) const
private

Definition at line 43 of file WhisperHost.cpp.

Here is the caller graph for this function:

void WhisperHost::uninstallWatch ( unsigned  _watchId)
overridevirtual

Implements dev::shh::Interface.

Definition at line 138 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

h256s WhisperHost::watchMessages ( unsigned  _watchId)
overridevirtual

returns IDs of messages, which match specific watch criteria

Implements dev::shh::Interface.

Definition at line 163 of file WhisperHost.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class WhisperPeer
friend

Definition at line 48 of file WhisperHost.h.

Member Data Documentation

TopicBloomFilter dev::shh::WhisperHost::m_bloom
private

Definition at line 86 of file WhisperHost.h.

std::multimap<unsigned, h256> dev::shh::WhisperHost::m_expiryQueue
private

Definition at line 81 of file WhisperHost.h.

dev::Mutex dev::shh::WhisperHost::m_filterLock
mutableprivate

Definition at line 83 of file WhisperHost.h.

std::map<h256, InstalledFilter> dev::shh::WhisperHost::m_filters
private

Definition at line 84 of file WhisperHost.h.

std::map<h256, Envelope> dev::shh::WhisperHost::m_messages
private

Definition at line 80 of file WhisperHost.h.

bool dev::shh::WhisperHost::m_storeMessagesInDB
private

needed for tests and other special cases

Definition at line 88 of file WhisperHost.h.

std::map<unsigned, ClientWatch> dev::shh::WhisperHost::m_watches
private

Definition at line 85 of file WhisperHost.h.

dev::SharedMutex dev::shh::WhisperHost::x_messages
mutableprivate

Definition at line 79 of file WhisperHost.h.


The documentation for this class was generated from the following files: