My Project: dht::SecureDht Class Reference

My Project 3.7.7 C++ Distributed Hash Table

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
dht::SecureDht Class Referencefinal
Inheritance diagram for dht::SecureDht:
[legend]
Collaboration diagram for dht::SecureDht:
[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, IdentityAnnouncedCb iacb={}, const std::shared_ptr< Logger > &l={})
InfoHash | getId () const
PkId | getLongId () const
Sp< crypto::PublicKey > | getPublicKey () const
ValueType | secureType (ValueType &&type)
ValueType | secureType (const ValueType &type)
void | registerType (const ValueType &type) override
void | registerType (ValueType &&type)
void | registerInsecureType (const ValueType &type)
void | get (const InfoHash &id, GetCallback cb, DoneCallback donecb={}, Value::Filter &&={}, Where &&w={}) override
void | get (const InfoHash &id, GetCallback cb, DoneCallbackSimple donecb={}, Value::Filter &&f={}, Where &&w={}) override
void | get (const InfoHash &key, GetCallbackSimple cb, DoneCallback donecb={}, Value::Filter &&f={}, Where &&w={}) override
void | get (const InfoHash &key, GetCallbackSimple cb, DoneCallbackSimple donecb, Value::Filter &&f={}, Where &&w={}) override
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 | putEncrypted (const InfoHash &hash, const crypto::PublicKey &to, Sp< Value > val, DoneCallback callback, bool permanent=false)
void | putEncrypted (const InfoHash &hash, const crypto::PublicKey &to, Value &&v, DoneCallback callback, bool permanent=false)
void | putEncrypted (const InfoHash &hash, const PkId &to, Sp< Value > val, 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, const std::function< void(const Sp< crypto::Certificate >)> &cb)
void | findPublicKey (const InfoHash &node, const std::function< void(const Sp< crypto::PublicKey >)> &cb)
void | findCertificate (const PkId &id, const std::function< void(const Sp< crypto::Certificate >)> &cb)
void | findPublicKey (const PkId &id, const std::function< void(const Sp< crypto::PublicKey >)> &cb)
void | registerCertificate (const Sp< crypto::Certificate > &cert)
Sp< crypto::Certificate > | getCertificate (const InfoHash &node) const
Sp< crypto::PublicKey > | getPublicKey (const InfoHash &node) const
Sp< crypto::Certificate > | getCertificate (const PkId &node) const
Sp< crypto::PublicKey > | getPublicKey (const PkId &node) const
void | setLocalCertificateStore (CertificateStoreQueryLegacy &&query_method)
void | setLocalCertificateStore (CertificateStoreQuery &&query_method)
void | setOnPublicAddressChanged (PublicAddressChangedCb cb) override
void | shutdown (ShutdownCallback cb, bool stop=false) override
void | dumpTables () const override
const InfoHash & | getNodeId () const override
std::pair< size_t, size_t > | getStoreSize () const override
std::pair< size_t, size_t > | getLocalStoreSize () const override
std::string | getStorageLog () const override
std::string | getStorageLog (const InfoHash &h) const override
void | setStorageLimit (size_t limit=0) override
size_t | getStorageLimit () const override
void | setLocalStorageLimit (size_t limit=0) override
size_t | getLocalStorageLimit () const override
std::vector< NodeExport > | exportNodes () const override
std::vector< ValuesExport > | exportValues () const override
void | importValues (const std::vector< ValuesExport > &v) override
NodeStats | getNodesStats (sa_family_t af) const override
NodeInfo | getNodeInfo ()
std::vector< unsigned > | getNodeMessageStats (bool in=false) override
std::string | getRoutingTablesLog (sa_family_t af) const override
std::string | getSearchesLog (sa_family_t af) const override
std::string | getSearchLog (const InfoHash &h, sa_family_t af=AF_UNSPEC) const override
std::vector< SockAddr > | getPublicAddress (sa_family_t family=0) override
time_point | periodic (const uint8_t *buf, size_t buflen, SockAddr sa, const time_point &now) override
time_point | periodic (const uint8_t *buf, size_t buflen, const sockaddr *from, socklen_t fromlen, const time_point &now) override
NodeStatus | updateStatus (sa_family_t af) override
NodeStatus | getStatus (sa_family_t af) const override
NodeStatus | getStatus () const override
net::DatagramSocket * | getSocket () const override
bool | isRunning (sa_family_t af=0) const override
const ValueType & | getType (ValueType::Id type_id) const override
void | addBootstrap (const std::string &host, const std::string &service) override
void | clearBootstrap () override
void | insertNode (const InfoHash &id, const SockAddr &sa) override
void | insertNode (const NodeExport &n) override
void | pingNode (SockAddr sa, DoneCallbackSimple &&cb={}) override
void | query (const InfoHash &key, QueryCallback cb, DoneCallback done_cb={}, Query &&q={}) override
void | query (const InfoHash &key, QueryCallback cb, DoneCallbackSimple done_cb={}, Query &&q={}) override
std::vector< Sp< Value > > | getLocal (const InfoHash &key, const Value::Filter &f={}) const override
Sp< Value > | getLocalById (const InfoHash &key, Value::Id vid) const override
void | put (const InfoHash &key, Sp< Value > v, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false) override
void | put (const InfoHash &key, const Sp< Value > &v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false) override
void | put (const InfoHash &key, Value &&v, DoneCallback cb=nullptr, time_point created=time_point::max(), bool permanent=false) override
void | put (const InfoHash &key, Value &&v, DoneCallbackSimple cb, time_point created=time_point::max(), bool permanent=false) override
std::vector< Sp< Value > > | getPut (const InfoHash &h) const override
Sp< Value > | getPut (const InfoHash &h, const Value::Id &vid) const override
bool | cancelPut (const InfoHash &h, const Value::Id &vid) override
size_t | listen (const InfoHash &key, ValueCallback, Value::Filter={}, Where={}) override
size_t | listen (const InfoHash &key, GetCallback cb, Value::Filter={}, Where w={}) override
size_t | listen (const InfoHash &key, GetCallbackSimple cb, Value::Filter f={}, Where w={}) override
bool | cancelListen (const InfoHash &h, size_t token) override
void | connectivityChanged (sa_family_t af) override
void | connectivityChanged () override
void | forwardAllMessages (bool forward)
void | setPushNotificationToken (const std::string &token="") override
PushNotificationResult | pushNotificationReceived (const std::map< std::string, std::string > &notification) override
void | setLogger (const std::shared_ptr< Logger > &logger) override
void | setLogFilter (const InfoHash &f) override
Public Member Functions inherited from dht::DhtInterface
| DhtInterface (const std::shared_ptr< Logger > &l)
void | addOnConnectedCallback (std::function< void()> cb)
virtual void | setPushNotificationTopic (const std::string &)
virtual void | setPushNotificationPlatform (const std::string &)

## Static Public Member Functions
static dht::Config | getConfig (const SecureDht::Config &conf)

## Additional Inherited Members
Protected Attributes inherited from dht::DhtInterface
std::shared_ptr< Logger > | logger_ {}
std::queue< std::function< void()> > | onConnectCallbacks_ {}

## Detailed Description

Definition at line 15 of file securedht.h.

## Member Typedef Documentation

## ◆ Config

using dht::SecureDht::Config = SecureDhtConfig

Definition at line 20 of file securedht.h.

## ◆ SignatureCheckCallback

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

Definition at line 18 of file securedht.h.

## Constructor & Destructor Documentation

## ◆ SecureDht()

dht::SecureDht::SecureDht | ( | std::unique_ptr< DhtInterface > | dht,
|  | Config | config,
|  | IdentityAnnouncedCb | iacb = {},
|  | const std::shared_ptr< Logger > & | l = {} )

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

## ◆ addBootstrap()

void dht::SecureDht::addBootstrap | ( | const std::string & | host,
|  | const std::string & | service )
| inlineoverridevirtual

Reimplemented from dht::DhtInterface.

Definition at line 236 of file securedht.h.

## ◆ cancelListen()

bool dht::SecureDht::cancelListen | ( | const InfoHash & | h,
|  | size_t | token )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 300 of file securedht.h.

## ◆ cancelPut()

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

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

Implements dht::DhtInterface.

Definition at line 292 of file securedht.h.

## ◆ clearBootstrap()

void dht::SecureDht::clearBootstrap | ( |  | ) |
| inlineoverridevirtual

Reimplemented from dht::DhtInterface.

Definition at line 240 of file securedht.h.

## ◆ connectivityChanged() [1/2]

void dht::SecureDht::connectivityChanged | ( |  | ) |
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 302 of file securedht.h.

## ◆ connectivityChanged() [2/2]

void dht::SecureDht::connectivityChanged | ( | sa_family_t |  | ) |
| inlineoverridevirtual

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 301 of file securedht.h.

## ◆ dumpTables()

void dht::SecureDht::dumpTables | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 180 of file securedht.h.

## ◆ exportNodes()

std::vector< NodeExport > dht::SecureDht::exportNodes | ( |  | ) | const
| inlineoverridevirtual

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 192 of file securedht.h.

## ◆ exportValues()

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

Implements dht::DhtInterface.

Definition at line 193 of file securedht.h.

## ◆ forwardAllMessages()

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

Definition at line 304 of file securedht.h.

## ◆ get() [1/4]

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

"Secure" get(), that will check the signature of signed data, and decrypt encrypted data. If the signature is unable to be checked, or if the data is unable to 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 = {} )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 77 of file securedht.h.

## ◆ get() [3/4]

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

Implements dht::DhtInterface.

Definition at line 85 of file securedht.h.

## ◆ get() [4/4]

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

Implements dht::DhtInterface.

Definition at line 93 of file securedht.h.

## ◆ getConfig()

dht::Config dht::SecureDht::getConfig | ( | const SecureDht::Config & | conf | ) |
| inlinestatic

Definition at line 22 of file securedht.h.

## ◆ getId()

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

Definition at line 43 of file securedht.h.

## ◆ getLocal()

std::vector< Sp< Value > > dht::SecureDht::getLocal | ( | const InfoHash & | key,
|  | const Value::Filter & | f = {} ) const
| inlineoverridevirtual

Get locally stored data for the given hash.

Implements dht::DhtInterface.

Definition at line 252 of file securedht.h.

## ◆ getLocalById()

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

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

Implements dht::DhtInterface.

Definition at line 256 of file securedht.h.

## ◆ getLocalStorageLimit()

size_t dht::SecureDht::getLocalStorageLimit | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 190 of file securedht.h.

## ◆ getLocalStoreSize()

std::pair< size_t, size_t > dht::SecureDht::getLocalStoreSize | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 184 of file securedht.h.

## ◆ getLongId()

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

Definition at line 44 of file securedht.h.

## ◆ getNodeId()

const InfoHash & dht::SecureDht::getNodeId | ( |  | ) | const
| inlineoverridevirtual

Get the ID of the DHT node.

Implements dht::DhtInterface.

Definition at line 181 of file securedht.h.

## ◆ getNodeInfo()

NodeInfo dht::SecureDht::getNodeInfo | ( |  | ) |
| inline

Definition at line 197 of file securedht.h.

## ◆ getNodeMessageStats()

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

Implements dht::DhtInterface.

Definition at line 213 of file securedht.h.

## ◆ getNodesStats()

NodeStats dht::SecureDht::getNodesStats | ( | sa_family_t | af | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 195 of file securedht.h.

## ◆ getPublicAddress()

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

Implements dht::DhtInterface.

Definition at line 220 of file securedht.h.

## ◆ getPublicKey()

Sp< crypto::PublicKey > dht::SecureDht::getPublicKey | ( |  | ) | const
| inline

Definition at line 45 of file securedht.h.

## ◆ getPut() [1/2]

std::vector< Sp< Value > > dht::SecureDht::getPut | ( | const InfoHash & |  | ) | const
| inlineoverridevirtual

Get data currently being put at the given hash.

Implements dht::DhtInterface.

Definition at line 290 of file securedht.h.

## ◆ getPut() [2/2]

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

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

Implements dht::DhtInterface.

Definition at line 291 of file securedht.h.

## ◆ getRoutingTablesLog()

std::string dht::SecureDht::getRoutingTablesLog | ( | sa_family_t | af | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 214 of file securedht.h.

## ◆ getSearchesLog()

std::string dht::SecureDht::getSearchesLog | ( | sa_family_t | af | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 215 of file securedht.h.

## ◆ getSearchLog()

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

Implements dht::DhtInterface.

Definition at line 216 of file securedht.h.

## ◆ getSocket()

net::DatagramSocket * dht::SecureDht::getSocket | ( |  | ) | const
| inlineoverridevirtual

Reimplemented from dht::DhtInterface.

Definition at line 233 of file securedht.h.

## ◆ getStatus() [1/2]

NodeStatus dht::SecureDht::getStatus | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 232 of file securedht.h.

## ◆ getStatus() [2/2]

NodeStatus dht::SecureDht::getStatus | ( | sa_family_t | af | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 231 of file securedht.h.

## ◆ getStorageLimit()

size_t dht::SecureDht::getStorageLimit | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 188 of file securedht.h.

## ◆ getStorageLog() [1/2]

std::string dht::SecureDht::getStorageLog | ( |  | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 185 of file securedht.h.

## ◆ getStorageLog() [2/2]

std::string dht::SecureDht::getStorageLog | ( | const InfoHash & | h | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 186 of file securedht.h.

## ◆ getStoreSize()

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

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

Implements dht::DhtInterface.

Definition at line 183 of file securedht.h.

## ◆ getType()

const ValueType & dht::SecureDht::getType | ( | ValueType::Id | type_id | ) | const
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 235 of file securedht.h.

## ◆ importValues()

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

Implements dht::DhtInterface.

Definition at line 194 of file securedht.h.

## ◆ insertNode() [1/2]

void dht::SecureDht::insertNode | ( | const InfoHash & | id,
|  | const SockAddr & | )
| inlineoverridevirtual

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 241 of file securedht.h.

## ◆ insertNode() [2/2]

void dht::SecureDht::insertNode | ( | const NodeExport & | n | ) |
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 242 of file securedht.h.

## ◆ isRunning()

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

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 234 of file securedht.h.

## ◆ listen() [1/3]

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

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 = {} )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 296 of file securedht.h.

## ◆ listen() [3/3]

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

Implements dht::DhtInterface.

## ◆ periodic() [1/2]

time_point dht::SecureDht::periodic | ( | const uint8_t * | buf,
|  | size_t | buflen,
|  | const sockaddr * | from,
|  | socklen_t | fromlen,
|  | const time_point & | now )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 225 of file securedht.h.

## ◆ periodic() [2/2]

time_point dht::SecureDht::periodic | ( | const uint8_t * | buf,
|  | size_t | buflen,
|  | SockAddr | sa,
|  | const time_point & | now )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 221 of file securedht.h.

## ◆ pingNode()

void dht::SecureDht::pingNode | ( | SockAddr | sa,
|  | DoneCallbackSimple && | cb = {} )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 243 of file securedht.h.

## ◆ pushNotificationReceived()

PushNotificationResult dht::SecureDht::pushNotificationReceived | ( | const std::map< std::string, std::string > & | notification | ) |
| inlineoverridevirtual

Call linked callback with push_notification

Parameters

  notification | to process

Implements dht::DhtInterface.

Definition at line 312 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 )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 265 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 )
| inlineoverridevirtual

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 257 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 )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 274 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 )
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 282 of file securedht.h.

## ◆ putEncrypted() [1/3]

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

Definition at line 131 of file securedht.h.

## ◆ putEncrypted() [2/3]

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() [3/3]

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

Definition at line 120 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 106 of file securedht.h.

## ◆ query() [1/2]

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

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

Parameters

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

Implements dht::DhtInterface.

Definition at line 244 of file securedht.h.

## ◆ query() [2/2]

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

Implements dht::DhtInterface.

Definition at line 248 of file securedht.h.

## ◆ registerInsecureType()

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

Definition at line 65 of file securedht.h.

## ◆ registerType() [1/2]

void dht::SecureDht::registerType | ( | const ValueType & | type | ) |
| inlineoverridevirtual

Implements dht::DhtInterface.

Definition at line 55 of file securedht.h.

## ◆ registerType() [2/2]

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

Definition at line 60 of file securedht.h.

## ◆ secureType()

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

Definition at line 49 of file securedht.h.

## ◆ setLocalCertificateStore() [1/2]

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

Definition at line 173 of file securedht.h.

## ◆ setLocalCertificateStore() [2/2]

void dht::SecureDht::setLocalCertificateStore | ( | CertificateStoreQueryLegacy && | 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 169 of file securedht.h.

## ◆ setLocalStorageLimit()

void dht::SecureDht::setLocalStorageLimit | ( | size_t | limit = 0 | ) |
| inlineoverridevirtual

Set the in-memory storage limit in bytes for locally stored values

Implements dht::DhtInterface.

Definition at line 189 of file securedht.h.

## ◆ setLogFilter()

void dht::SecureDht::setLogFilter | ( | const InfoHash & | f | ) |
| inlineoverridevirtual

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

Reimplemented from dht::DhtInterface.

Definition at line 326 of file securedht.h.

## ◆ setLogger()

void dht::SecureDht::setLogger | ( | const std::shared_ptr< Logger > & | logger | ) |
| inlineoverridevirtual

Reimplemented from dht::DhtInterface.

Definition at line 317 of file securedht.h.

## ◆ setOnPublicAddressChanged()

void dht::SecureDht::setOnPublicAddressChanged | ( | PublicAddressChangedCb | cb | ) |
| inlineoverridevirtual

Reimplemented from dht::DhtInterface.

Definition at line 174 of file securedht.h.

## ◆ setPushNotificationToken()

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

Reimplemented from dht::DhtInterface.

Definition at line 306 of file securedht.h.

## ◆ setStorageLimit()

void dht::SecureDht::setStorageLimit | ( | size_t | limit = 0 | ) |
| inlineoverridevirtual

Set the in-memory storage limit in bytes for remote values

Implements dht::DhtInterface.

Definition at line 187 of file securedht.h.

## ◆ shutdown()

void dht::SecureDht::shutdown | ( | ShutdownCallback | cb,
|  | bool | stop = false )
| inlineoverridevirtual

SecureDht to Dht proxy

Implements dht::DhtInterface.

Definition at line 179 of file securedht.h.

## ◆ sign()

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

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

## ◆ updateStatus()

NodeStatus dht::SecureDht::updateStatus | ( | sa_family_t | af | ) |
| inlineoverridevirtual

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

Reimplemented from dht::DhtInterface.

Definition at line 230 of file securedht.h.

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

- /home/noptrix/ba/blackarch/packages/opendht-c/src/opendht/include/opendht/securedht.h