aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node_common.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-05-27 11:35:54 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-05-27 11:35:54 +0100
commit072102cfd23c47d36f4d51875026339a767f22ae (patch)
tree3005737650989527f71b2c742696e6dfb0a2a7f6 /src/p2p/net_node_common.h
parentMerge pull request #2015 (diff)
downloadmonero-072102cfd23c47d36f4d51875026339a767f22ae.tar.xz
abstracted nework addresses
All code which was using ip and port now uses a new IPv4 object, subclass of a new network_address class. This will allow easy addition of I2P addresses later (and also IPv6, etc). Both old style and new style peer lists are now sent in the P2P protocol, which is inefficient but allows peers using both codebases to talk to each other. This will be removed in the future. No other subclasses than IPv4 exist yet.
Diffstat (limited to 'src/p2p/net_node_common.h')
-rw-r--r--src/p2p/net_node_common.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/p2p/net_node_common.h b/src/p2p/net_node_common.h
index 6aba7aa24..42de2655d 100644
--- a/src/p2p/net_node_common.h
+++ b/src/p2p/net_node_common.h
@@ -51,10 +51,10 @@ namespace nodetool
virtual void request_callback(const epee::net_utils::connection_context_base& context)=0;
virtual uint64_t get_connections_count()=0;
virtual void for_each_connection(std::function<bool(t_connection_context&, peerid_type, uint32_t)> f)=0;
- virtual bool block_ip(uint32_t adress, time_t seconds = 0)=0;
- virtual bool unblock_ip(uint32_t adress)=0;
- virtual std::map<uint32_t, time_t> get_blocked_ips()=0;
- virtual bool add_ip_fail(uint32_t adress)=0;
+ virtual bool block_host(const epee::net_utils::network_address &address, time_t seconds = 0)=0;
+ virtual bool unblock_host(const epee::net_utils::network_address &address)=0;
+ virtual std::map<std::string, time_t> get_blocked_hosts()=0;
+ virtual bool add_host_fail(const epee::net_utils::network_address &address)=0;
};
template<class t_connection_context>
@@ -93,19 +93,19 @@ namespace nodetool
{
return false;
}
- virtual bool block_ip(uint32_t adress, time_t seconds)
+ virtual bool block_host(const epee::net_utils::network_address &address, time_t seconds)
{
return true;
}
- virtual bool unblock_ip(uint32_t adress)
+ virtual bool unblock_host(const epee::net_utils::network_address &address)
{
return true;
}
- virtual std::map<uint32_t, time_t> get_blocked_ips()
+ virtual std::map<std::string, time_t> get_blocked_hosts()
{
- return std::map<uint32_t, time_t>();
+ return std::map<std::string, time_t>();
}
- virtual bool add_ip_fail(uint32_t adress)
+ virtual bool add_host_fail(const epee::net_utils::network_address &address)
{
return true;
}