My Project 1.7.4
C++ Distributed Hash Table
Public Types | Public Member Functions | Static Public Member Functions | List of all members
dht::SecureDht Class Referencefinal
Inheritance diagram for dht::SecureDht:
Inheritance graph
[legend]
Collaboration diagram for dht::SecureDht:
Collaboration graph
[legend]

Public Types

typedef std::function< void(bool)> SignatureCheckCallback
 
using Config = SecureDhtConfig
 
- Public Types inherited from dht::DhtInterface
using Status = NodeStatus
 
using NodeExport = dht::NodeExport
 

Public Member Functions

 SecureDht (std::unique_ptr< DhtInterface > dht, Config config)
 
InfoHash getId () const
 
PkId getLongId () const
 
ValueType secureType (ValueType &&type)
 
ValueType secureType (const ValueType &type)
 
void registerType (const ValueType &type)
 
void registerType (ValueType &&type)
 
void registerInsecureType (const ValueType &type)
 
void get (const InfoHash &id, GetCallback cb, DoneCallback donecb={}, Value::Filter &&={}, Where &&w={})
 
void get (const InfoHash &id, GetCallback cb, DoneCallbackSimple donecb={}, Value::Filter &&f={}, Where &&w={})
 
void get (const InfoHash &key, GetCallbackSimple cb, DoneCallback donecb={}, Value::Filter &&f={}, Where &&w={})
 
void get (const InfoHash &key, GetCallbackSimple cb, DoneCallbackSimple donecb, Value::Filter &&f={}, Where &&w={})
 
void putSigned (const InfoHash &hash, Sp< Value > val, DoneCallback callback, bool permanent=false)
 
void putSigned (const InfoHash &hash, Value &&v, DoneCallback callback, bool permanent=false)
 
void putEncrypted (const InfoHash &hash, const InfoHash &to, Sp< Value > val, DoneCallback callback, bool permanent=false)
 
void putEncrypted (const InfoHash &hash, const InfoHash &to, Value &&v, DoneCallback callback, bool permanent=false)
 
void sign (Value &v) const
 
Value encrypt (Value &v, const crypto::PublicKey &to) const
 
Value decrypt (const Value &v)
 
void findCertificate (const InfoHash &node, std::function< void(const Sp< crypto::Certificate >)> cb)
 
void findPublicKey (const InfoHash &node, std::function< void(const Sp< const crypto::PublicKey >)> cb)
 
const Sp< crypto::CertificateregisterCertificate (const InfoHash &node, const Blob &cert)
 
void registerCertificate (Sp< crypto::Certificate > &cert)
 
const Sp< crypto::CertificategetCertificate (const InfoHash &node) const
 
const Sp< const crypto::PublicKeygetPublicKey (const InfoHash &node) const
 
void setLocalCertificateStore (CertificateStoreQuery &&query_method)
 
void shutdown (ShutdownCallback cb)
 
void dumpTables () const
 
const InfoHashgetNodeId () const
 
std::pair< size_t, size_t > getStoreSize () const
 
std::string getStorageLog () const
 
std::string getStorageLog (const InfoHash &h) const
 
void setStorageLimit (size_t limit=DEFAULT_STORAGE_LIMIT)
 
std::vector< NodeExportexportNodes ()
 
std::vector< ValuesExport > exportValues () const
 
void importValues (const std::vector< ValuesExport > &v)
 
NodeStats getNodesStats (sa_family_t af) const
 
std::vector< unsigned > getNodeMessageStats (bool in=false)
 
std::string getRoutingTablesLog (sa_family_t af) const
 
std::string getSearchesLog (sa_family_t af) const
 
std::string getSearchLog (const InfoHash &h, sa_family_t af=AF_UNSPEC) const
 
std::vector< SockAddrgetPublicAddress (sa_family_t family=0)
 
time_point periodic (const uint8_t *buf, size_t buflen, const SockAddr &sa)
 
time_point periodic (const uint8_t *buf, size_t buflen, const sockaddr *from, socklen_t fromlen)
 
NodeStatus getStatus (sa_family_t af) const
 
NodeStatus getStatus () const
 
bool isRunning (sa_family_t af=0) const
 
const ValueTypegetType (ValueType::Id type_id) const
 
void insertNode (const InfoHash &id, const SockAddr &sa)
 
void insertNode (const InfoHash &id, const sockaddr *sa, socklen_t salen)
 
void insertNode (const NodeExport &n)
 
void pingNode (const sockaddr *sa, socklen_t salen, DoneCallbackSimple &&cb={})
 
void query (const InfoHash &key, QueryCallback cb, DoneCallback done_cb={}, Query &&q={})
 
void query (const InfoHash &key, QueryCallback cb, DoneCallbackSimple done_cb={}, Query &&q={})
 
std::vector< Sp< Value > > getLocal (const InfoHash &key, Value::Filter f=Value::AllFilter()) const
 
Sp< ValuegetLocalById (const InfoHash &key, Value::Id vid) const
 
void put (const InfoHash &key, Sp< Value > v, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false)
 
void put (const InfoHash &key, const Sp< Value > &v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false)
 
void put (const InfoHash &key, Value &&v, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false)
 
void put (const InfoHash &key, Value &&v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false)
 
std::vector< Sp< Value > > getPut (const InfoHash &h)
 
Sp< ValuegetPut (const InfoHash &h, const Value::Id &vid)
 
bool cancelPut (const InfoHash &h, const Value::Id &vid)
 
size_t listen (const InfoHash &key, ValueCallback, Value::Filter={}, Where={})
 
size_t listen (const InfoHash &key, GetCallback cb, Value::Filter={}, Where w={})
 
size_t listen (const InfoHash &key, GetCallbackSimple cb, Value::Filter f={}, Where w={})
 
bool cancelListen (const InfoHash &h, size_t token)
 
void connectivityChanged (sa_family_t af)
 
void connectivityChanged ()
 
void forwardAllMessages (bool forward)
 
void setPushNotificationToken (const std::string &token="")
 
void pushNotificationReceived (const std::map< std::string, std::string > &notification)
 
void setLoggers (LogMethod error=NOLOG, LogMethod warn=NOLOG, LogMethod debug=NOLOG)
 
void setLogFilter (const InfoHash &f)
 
virtual NodeStatus getStatus (sa_family_t af) const =0
 
virtual NodeStatus getStatus () const =0
 
virtual const InfoHashgetNodeId () const =0
 
virtual void shutdown (ShutdownCallback cb)=0
 
virtual bool isRunning (sa_family_t af=0) const =0
 
virtual void registerType (const ValueType &type)=0
 
virtual const ValueTypegetType (ValueType::Id type_id) const =0
 
virtual void insertNode (const InfoHash &id, const SockAddr &)=0
 
virtual void insertNode (const InfoHash &id, const sockaddr *sa, socklen_t salen)=0
 
virtual void insertNode (const NodeExport &n)=0
 
virtual void pingNode (const sockaddr *, socklen_t, DoneCallbackSimple &&cb={})=0
 
virtual time_point periodic (const uint8_t *buf, size_t buflen, const SockAddr &)=0
 
virtual time_point periodic (const uint8_t *buf, size_t buflen, const sockaddr *from, socklen_t fromlen)=0
 
virtual void get (const InfoHash &key, GetCallback cb, DoneCallback donecb={}, Value::Filter &&f={}, Where &&w={})=0
 
virtual void get (const InfoHash &key, GetCallback cb, DoneCallbackSimple donecb={}, Value::Filter &&f={}, Where &&w={})=0
 
virtual void get (const InfoHash &key, GetCallbackSimple cb, DoneCallback donecb={}, Value::Filter &&f={}, Where &&w={})=0
 
virtual void get (const InfoHash &key, GetCallbackSimple cb, DoneCallbackSimple donecb, Value::Filter &&f={}, Where &&w={})=0
 
virtual void query (const InfoHash &key, QueryCallback cb, DoneCallback done_cb={}, Query &&q={})=0
 
virtual void query (const InfoHash &key, QueryCallback cb, DoneCallbackSimple done_cb={}, Query &&q={})=0
 
virtual std::vector< Sp< Value > > getLocal (const InfoHash &key, Value::Filter f=Value::AllFilter()) const =0
 
virtual Sp< ValuegetLocalById (const InfoHash &key, Value::Id vid) const =0
 
virtual void put (const InfoHash &key, Sp< Value >, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false)=0
 
virtual void put (const InfoHash &key, const Sp< Value > &v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false)=0
 
virtual void put (const InfoHash &key, Value &&v, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false)=0
 
virtual void put (const InfoHash &key, Value &&v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false)=0
 
virtual std::vector< Sp< Value > > getPut (const InfoHash &)=0
 
virtual Sp< ValuegetPut (const InfoHash &, const Value::Id &)=0
 
virtual bool cancelPut (const InfoHash &, const Value::Id &)=0
 
virtual size_t listen (const InfoHash &, GetCallback, Value::Filter={}, Where w={})=0
 
virtual size_t listen (const InfoHash &key, GetCallbackSimple cb, Value::Filter f={}, Where w={})=0
 
virtual size_t listen (const InfoHash &, ValueCallback, Value::Filter={}, Where w={})=0
 
virtual bool cancelListen (const InfoHash &, size_t token)=0
 
virtual void connectivityChanged (sa_family_t)=0
 
virtual void connectivityChanged ()=0
 
virtual std::vector< NodeExportexportNodes ()=0
 
virtual std::vector< ValuesExport > exportValues () const =0
 
virtual void importValues (const std::vector< ValuesExport > &)=0
 
virtual NodeStats getNodesStats (sa_family_t af) const =0
 
virtual std::string getStorageLog () const =0
 
virtual std::string getStorageLog (const InfoHash &) const =0
 
virtual std::string getRoutingTablesLog (sa_family_t) const =0
 
virtual std::string getSearchesLog (sa_family_t) const =0
 
virtual std::string getSearchLog (const InfoHash &, sa_family_t af=AF_UNSPEC) const =0
 
virtual void dumpTables () const =0
 
virtual std::vector< unsigned > getNodeMessageStats (bool in=false)=0
 
virtual void setStorageLimit (size_t limit=DEFAULT_STORAGE_LIMIT)=0
 
virtual std::pair< size_t, size_t > getStoreSize () const =0
 
virtual std::vector< SockAddrgetPublicAddress (sa_family_t family=0)=0
 
virtual void setLoggers (LogMethod error=NOLOG, LogMethod warn=NOLOG, LogMethod debug=NOLOG)
 
virtual void setLogFilter (const InfoHash &f)
 
virtual void setPushNotificationToken (const std::string &)
 
virtual void pushNotificationReceived (const std::map< std::string, std::string > &data)=0
 

Static Public Member Functions

static dht::ConfiggetConfig (SecureDht::Config &conf)
 

Additional Inherited Members

- Protected Attributes inherited from dht::DhtInterface
bool logFilerEnable_ {}
 
InfoHash logFiler_ {}
 
Logger DHT_LOG
 

Detailed Description

Definition at line 33 of file securedht.h.

Member Typedef Documentation

◆ Config

Definition at line 38 of file securedht.h.

◆ SignatureCheckCallback

typedef std::function<void(bool)> dht::SecureDht::SignatureCheckCallback

Definition at line 36 of file securedht.h.

Constructor & Destructor Documentation

◆ SecureDht() [1/2]

dht::SecureDht::SecureDht ( )
inline

Definition at line 48 of file securedht.h.

◆ SecureDht() [2/2]

dht::SecureDht::SecureDht ( std::unique_ptr< DhtInterface dht,
Config  config 
)

s, s6: bound socket descriptors for IPv4 and IPv6, respectively. For the Dht to be initialised, at least one of them must be >= 0. id: the identity to use for the crypto layer and to compute our own hash on the Dht.

Member Function Documentation

◆ cancelListen()

bool dht::SecureDht::cancelListen ( const InfoHash h,
size_t  token 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 287 of file securedht.h.

◆ cancelPut()

bool dht::SecureDht::cancelPut ( const InfoHash ,
const Value::Id &   
)
inlinevirtual

Stop any put/announce operation at the given location, for the value with the given id.

Implements dht::DhtInterface.

Definition at line 278 of file securedht.h.

◆ connectivityChanged() [1/2]

void dht::SecureDht::connectivityChanged ( )
inlinevirtual

Implements dht::DhtInterface.

Definition at line 293 of file securedht.h.

◆ connectivityChanged() [2/2]

void dht::SecureDht::connectivityChanged ( sa_family_t  )
inlinevirtual

Inform the DHT of lower-layer connectivity changes. This will cause the DHT to assume a public IP address change. The DHT will recontact neighbor nodes, re-register for listen ops etc.

Implements dht::DhtInterface.

Definition at line 290 of file securedht.h.

◆ dumpTables()

void dht::SecureDht::dumpTables ( ) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 154 of file securedht.h.

◆ exportNodes()

std::vector< NodeExport > dht::SecureDht::exportNodes ( )
inlinevirtual

Get the list of good nodes for local storage saving purposes The list is ordered to minimize the back-to-work delay.

Implements dht::DhtInterface.

Definition at line 170 of file securedht.h.

◆ exportValues()

std::vector< ValuesExport > dht::SecureDht::exportValues ( ) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 173 of file securedht.h.

◆ forwardAllMessages()

void dht::SecureDht::forwardAllMessages ( bool  forward)
inline

Definition at line 297 of file securedht.h.

◆ get() [1/4]

void dht::SecureDht::get ( const InfoHash id,
GetCallback  cb,
DoneCallback  donecb = {},
Value::Filter &&  = {},
Where &&  w = {} 
)
virtual

"Secure" get(), that will check the signature of signed data, and decrypt encrypted data. If the signature can't be checked, or if the data can't be decrypted, it is not returned. Public, non-signed & non-encrypted data is retransmitted as-is.

Implements dht::DhtInterface.

◆ get() [2/4]

void dht::SecureDht::get ( const InfoHash id,
GetCallback  cb,
DoneCallbackSimple  donecb = {},
Value::Filter &&  f = {},
Where &&  w = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 93 of file securedht.h.

◆ get() [3/4]

void dht::SecureDht::get ( const InfoHash key,
GetCallbackSimple  cb,
DoneCallback  donecb = {},
Value::Filter &&  f = {},
Where &&  w = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 96 of file securedht.h.

◆ get() [4/4]

void dht::SecureDht::get ( const InfoHash key,
GetCallbackSimple  cb,
DoneCallbackSimple  donecb,
Value::Filter &&  f = {},
Where &&  w = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 99 of file securedht.h.

◆ getConfig()

static dht::Config & dht::SecureDht::getConfig ( SecureDht::Config conf)
inlinestatic

Definition at line 40 of file securedht.h.

◆ getId()

InfoHash dht::SecureDht::getId ( ) const
inline

Definition at line 60 of file securedht.h.

◆ getLocal()

std::vector< Sp< Value > > dht::SecureDht::getLocal ( const InfoHash key,
Value::Filter  f = Value::AllFilter() 
) const
inlinevirtual

Get locally stored data for the given hash.

Implements dht::DhtInterface.

Definition at line 233 of file securedht.h.

◆ getLocalById()

Sp< Value > dht::SecureDht::getLocalById ( const InfoHash key,
Value::Id  vid 
) const
inlinevirtual

Get locally stored data for the given key and value id.

Implements dht::DhtInterface.

Definition at line 236 of file securedht.h.

◆ getLongId()

PkId dht::SecureDht::getLongId ( ) const
inline

Definition at line 63 of file securedht.h.

◆ getNodeId()

const InfoHash & dht::SecureDht::getNodeId ( ) const
inlinevirtual

Get the ID of the node.

Implements dht::DhtInterface.

Definition at line 157 of file securedht.h.

◆ getNodeMessageStats()

std::vector< unsigned > dht::SecureDht::getNodeMessageStats ( bool  in = false)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 182 of file securedht.h.

◆ getNodesStats()

NodeStats dht::SecureDht::getNodesStats ( sa_family_t  af) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 179 of file securedht.h.

◆ getPublicAddress()

std::vector< SockAddr > dht::SecureDht::getPublicAddress ( sa_family_t  family = 0)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 194 of file securedht.h.

◆ getPut() [1/2]

std::vector< Sp< Value > > dht::SecureDht::getPut ( const InfoHash )
inlinevirtual

Get data currently being put at the given hash.

Implements dht::DhtInterface.

Definition at line 272 of file securedht.h.

◆ getPut() [2/2]

Sp< Value > dht::SecureDht::getPut ( const InfoHash ,
const Value::Id &   
)
inlinevirtual

Get data currently being put at the given hash with the given id.

Implements dht::DhtInterface.

Definition at line 275 of file securedht.h.

◆ getRoutingTablesLog()

std::string dht::SecureDht::getRoutingTablesLog ( sa_family_t  af) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 185 of file securedht.h.

◆ getSearchesLog()

std::string dht::SecureDht::getSearchesLog ( sa_family_t  af) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 188 of file securedht.h.

◆ getSearchLog()

std::string dht::SecureDht::getSearchLog ( const InfoHash h,
sa_family_t  af = AF_UNSPEC 
) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 191 of file securedht.h.

◆ getStatus() [1/2]

NodeStatus dht::SecureDht::getStatus ( ) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 206 of file securedht.h.

◆ getStatus() [2/2]

NodeStatus dht::SecureDht::getStatus ( sa_family_t  af) const
inlinevirtual

Get the current status of the node for the given family.

Implements dht::DhtInterface.

Definition at line 203 of file securedht.h.

◆ getStorageLog() [1/2]

std::string dht::SecureDht::getStorageLog ( ) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 161 of file securedht.h.

◆ getStorageLog() [2/2]

std::string dht::SecureDht::getStorageLog ( const InfoHash h) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 164 of file securedht.h.

◆ getStoreSize()

std::pair< size_t, size_t > dht::SecureDht::getStoreSize ( ) const
inlinevirtual

Returns the total memory usage of stored values and the number of stored values.

Implements dht::DhtInterface.

Definition at line 158 of file securedht.h.

◆ getType()

const ValueType & dht::SecureDht::getType ( ValueType::Id  type_id) const
inlinevirtual

Implements dht::DhtInterface.

Definition at line 212 of file securedht.h.

◆ importValues()

void dht::SecureDht::importValues ( const std::vector< ValuesExport > &  v)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 176 of file securedht.h.

◆ insertNode() [1/3]

void dht::SecureDht::insertNode ( const InfoHash id,
const SockAddr  
)
inlinevirtual

Insert a node in the main routing table. The node is not pinged, so this should be used to bootstrap efficiently from previously known nodes.

Implements dht::DhtInterface.

Definition at line 215 of file securedht.h.

◆ insertNode() [2/3]

void dht::SecureDht::insertNode ( const InfoHash id,
const sockaddr *  sa,
socklen_t  salen 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 218 of file securedht.h.

◆ insertNode() [3/3]

void dht::SecureDht::insertNode ( const NodeExport n)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 221 of file securedht.h.

◆ isRunning()

bool dht::SecureDht::isRunning ( sa_family_t  af = 0) const
inlinevirtual

Returns true if the node is running (have access to an open socket).

af: address family. If non-zero, will return true if the node is running for the provided family.

Implements dht::DhtInterface.

Definition at line 209 of file securedht.h.

◆ listen() [1/3]

size_t dht::SecureDht::listen ( const InfoHash ,
GetCallback  ,
Value::Filter  = {},
Where  w = {} 
)
virtual

Listen on the network for any changes involving a specified hash. The node will register to receive updates from relevent nodes when new values are added or removed.

Returns
a token to cancel the listener later.

Implements dht::DhtInterface.

◆ listen() [2/3]

size_t dht::SecureDht::listen ( const InfoHash key,
GetCallbackSimple  cb,
Value::Filter  f = {},
Where  w = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 284 of file securedht.h.

◆ listen() [3/3]

size_t dht::SecureDht::listen ( const InfoHash key,
ValueCallback  ,
Value::Filter  = {},
Where  = {} 
)
virtual

Implements dht::DhtInterface.

◆ periodic() [1/2]

time_point dht::SecureDht::periodic ( const uint8_t *  buf,
size_t  buflen,
const SockAddr sa 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 197 of file securedht.h.

◆ periodic() [2/2]

time_point dht::SecureDht::periodic ( const uint8_t *  buf,
size_t  buflen,
const sockaddr *  from,
socklen_t  fromlen 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 200 of file securedht.h.

◆ pingNode()

void dht::SecureDht::pingNode ( const sockaddr *  sa,
socklen_t  salen,
DoneCallbackSimple &&  cb = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 224 of file securedht.h.

◆ pushNotificationReceived()

void dht::SecureDht::pushNotificationReceived ( const std::map< std::string, std::string > &  notification)
inlinevirtual

Call linked callback with push_notification

Parameters
notificationto process

Implements dht::DhtInterface.

Definition at line 309 of file securedht.h.

◆ put() [1/4]

void dht::SecureDht::put ( const InfoHash key,
const Sp< Value > &  v,
DoneCallbackSimple  cb,
time_point  created = time_point::max(),
bool  permanent = false 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 247 of file securedht.h.

◆ put() [2/4]

void dht::SecureDht::put ( const InfoHash key,
Sp< Value ,
DoneCallback  cb = nullptr,
time_point  created = time_point::max(),
bool  permanent = false 
)
inlinevirtual

Announce a value on all available protocols (IPv4, IPv6).

The operation will start as soon as the node is connected to the network. The done callback will be called once, when the first announce succeeds, or fails.

Implements dht::DhtInterface.

Definition at line 239 of file securedht.h.

◆ put() [3/4]

void dht::SecureDht::put ( const InfoHash key,
Value &&  v,
DoneCallback  cb = nullptr,
time_point  created = time_point::max(),
bool  permanent = false 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 256 of file securedht.h.

◆ put() [4/4]

void dht::SecureDht::put ( const InfoHash key,
Value &&  v,
DoneCallbackSimple  cb,
time_point  created = time_point::max(),
bool  permanent = false 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 264 of file securedht.h.

◆ putEncrypted() [1/2]

void dht::SecureDht::putEncrypted ( const InfoHash hash,
const InfoHash to,
Sp< Value val,
DoneCallback  callback,
bool  permanent = false 
)

Will sign the data using our private key, encrypt it using the recipient' public key, and put it in the DHT. The operation will be immediate if the recipient' public key is known (otherwise it will be retrived first).

◆ putEncrypted() [2/2]

void dht::SecureDht::putEncrypted ( const InfoHash hash,
const InfoHash to,
Value &&  v,
DoneCallback  callback,
bool  permanent = false 
)
inline

Definition at line 117 of file securedht.h.

◆ putSigned() [1/2]

void dht::SecureDht::putSigned ( const InfoHash hash,
Sp< Value val,
DoneCallback  callback,
bool  permanent = false 
)

Will take ownership of the value, sign it using our private key and put it in the DHT.

◆ putSigned() [2/2]

void dht::SecureDht::putSigned ( const InfoHash hash,
Value &&  v,
DoneCallback  callback,
bool  permanent = false 
)
inline

Definition at line 107 of file securedht.h.

◆ query() [1/2]

void dht::SecureDht::query ( const InfoHash key,
QueryCallback  cb,
DoneCallback  done_cb = {},
Query &&  q = {} 
)
inlinevirtual

Similar to Dht::get, but sends a Query to filter data remotely.

Parameters
keythe key for which to query data for.
cba function called when new values are found on the network. It should return false to stop the operation.
done_cba function called when the operation is complete. cb and done_cb won't be called again afterward.
qa query used to filter values on the remotes before they send a response.

Implements dht::DhtInterface.

Definition at line 227 of file securedht.h.

◆ query() [2/2]

void dht::SecureDht::query ( const InfoHash key,
QueryCallback  cb,
DoneCallbackSimple  done_cb = {},
Query &&  q = {} 
)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 230 of file securedht.h.

◆ registerInsecureType()

void dht::SecureDht::registerInsecureType ( const ValueType type)
inline

Definition at line 82 of file securedht.h.

◆ registerType() [1/2]

void dht::SecureDht::registerType ( const ValueType type)
inlinevirtual

Implements dht::DhtInterface.

Definition at line 74 of file securedht.h.

◆ registerType() [2/2]

void dht::SecureDht::registerType ( ValueType &&  type)
inline

Definition at line 78 of file securedht.h.

◆ secureType()

ValueType dht::SecureDht::secureType ( const ValueType type)
inline

Definition at line 69 of file securedht.h.

◆ setLocalCertificateStore()

void dht::SecureDht::setLocalCertificateStore ( CertificateStoreQuery &&  query_method)
inline

Allows to set a custom callback called by the library to find a locally-stored certificate. The search key used is the public key ID, so there may be multiple certificates retured, signed with the same private key.

Definition at line 144 of file securedht.h.

◆ setLogFilter()

void dht::SecureDht::setLogFilter ( const InfoHash f)
inlinevirtual

Only print logs related to the given InfoHash (if given), or disable filter (if zeroes).

Reimplemented from dht::DhtInterface.

Definition at line 324 of file securedht.h.

◆ setLoggers()

void dht::SecureDht::setLoggers ( LogMethod  error = NOLOG,
LogMethod  warn = NOLOG,
LogMethod  debug = NOLOG 
)
inlinevirtual

Enable or disable logging of DHT internal messages

Reimplemented from dht::DhtInterface.

Definition at line 313 of file securedht.h.

◆ setPushNotificationToken()

void dht::SecureDht::setPushNotificationToken ( const std::string &  token = "")
inlinevirtual

Reimplemented from dht::DhtInterface.

Definition at line 301 of file securedht.h.

◆ setStorageLimit()

void dht::SecureDht::setStorageLimit ( size_t  limit = DEFAULT_STORAGE_LIMIT)
inlinevirtual

Set the in-memory storage limit in bytes

Implements dht::DhtInterface.

Definition at line 167 of file securedht.h.

◆ shutdown()

void dht::SecureDht::shutdown ( ShutdownCallback  cb)
inlinevirtual

SecureDht to Dht proxy

Implements dht::DhtInterface.

Definition at line 151 of file securedht.h.

◆ sign()

void dht::SecureDht::sign ( Value v) const

Take ownership of the value and sign it using our private key.


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