add some helper routines to the peer list lookup;

pull/86/head
Bryan Biedenkapp 11 months ago
parent cb335cffed
commit b1f10a87ab

@ -152,6 +152,20 @@ PeerListLookup::Mode PeerListLookup::getMode() const
return m_mode;
}
/* Gets the entire peer ID table. */
std::vector<PeerId> PeerListLookup::tableAsList() const
{
std::vector<PeerId> ret = std::vector<PeerId>();
std::lock_guard<std::mutex> lock(m_mutex);
for (auto entry : m_table) {
ret.push_back(entry.second);
}
return ret;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------

@ -110,19 +110,19 @@ namespace lookups
/**
* @brief Peer ID.
*/
__READONLY_PROPERTY_PLAIN(uint32_t, peerId);
__PROPERTY_PLAIN(uint32_t, peerId);
/**
* @breif Peer Alias
*/
__READONLY_PROPERTY_PLAIN(std::string, peerAlias);
__PROPERTY_PLAIN(std::string, peerAlias);
/**
* @brief Per Peer Password.
*/
__READONLY_PROPERTY_PLAIN(std::string, peerPassword);
__PROPERTY_PLAIN(std::string, peerPassword);
/**
* @brief Flag indicating if the peer participates in peer link and should be sent configuration.
*/
__READONLY_PROPERTY_PLAIN(bool, peerLink);
__PROPERTY_PLAIN(bool, peerLink);
/**
* @brief Flag indicating if the peer is default.
*/
@ -221,6 +221,17 @@ namespace lookups
*/
Mode getMode() const;
/**
* @brief Gets the entire peer ID table.
* @returns std::unordered_map<uint32_t, PeerId>
*/
std::unordered_map<uint32_t, PeerId> table() const { return m_table; }
/**
* @brief Gets the entire peer ID table.
* @returns std::vector<PeerId>
*/
std::vector<PeerId> tableAsList() const;
protected:
bool m_acl;

Loading…
Cancel
Save

Powered by TurnKey Linux.