adds this to the bottom of whats there: // Copyright (c) 2017-2025 Lethean (https://lt.hn) // // Licensed under the European Union Public Licence (EUPL) version 1.2. // You may obtain a copy of the licence at: // // https://joinup.ec.europa.eu/software/page/eupl/licence-eupl // // The EUPL is a copyleft licence that is compatible with the MIT/X11 // licence used by the original projects; the MIT terms are therefore // considered “grandfathered” under the EUPL for this code. // // SPDX‑License‑Identifier: EUPL-1.2 //
95 lines
3.4 KiB
C++
95 lines
3.4 KiB
C++
// Copyright (c) 2014-2018 Zano Project
|
||
// Copyright (c) 2014-2018 The Louisdor Project
|
||
// Copyright (c) 2012-2013 The Boolberry developers
|
||
// Copyright (c) 2017-2025 Lethean (https://lt.hn)
|
||
//
|
||
// Licensed under the European Union Public Licence (EUPL) version 1.2.
|
||
// You may obtain a copy of the licence at:
|
||
//
|
||
// https://joinup.ec.europa.eu/software/page/eupl/licence-eupl
|
||
//
|
||
// The EUPL is a copyleft licence that is compatible with the MIT/X11
|
||
// licence used by the original projects; the MIT terms are therefore
|
||
// considered “grandfathered” under the EUPL for this code.
|
||
//
|
||
// SPDX‑License‑Identifier: EUPL-1.2
|
||
//
|
||
|
||
#pragma once
|
||
|
||
#include <boost/uuid/uuid.hpp>
|
||
#include "net/net_utils_base.h"
|
||
#include "p2p_protocol_defs.h"
|
||
|
||
namespace nodetool
|
||
{
|
||
|
||
typedef boost::uuids::uuid uuid;
|
||
typedef boost::uuids::uuid net_connection_id;
|
||
|
||
template<class t_connection_context>
|
||
struct i_p2p_endpoint
|
||
{
|
||
virtual bool relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context, std::list<epee::net_utils::connection_context_base>& relayed_peers) = 0;
|
||
virtual bool invoke_command_to_peer(int command, const std::string& req_buff, std::string& resp_buff, const epee::net_utils::connection_context_base& context)=0;
|
||
virtual bool invoke_notify_to_peer(int command, const std::string& req_buff, const epee::net_utils::connection_context_base& context)=0;
|
||
virtual bool drop_connection(const epee::net_utils::connection_context_base& context)=0;
|
||
virtual void request_callback(const epee::net_utils::connection_context_base& context)=0;
|
||
virtual uint64_t get_connections_count()=0;
|
||
virtual void get_connections(std::list<t_connection_context>& connections) = 0;
|
||
virtual void for_each_connection(std::function<bool(t_connection_context&, peerid_type)> f)=0;
|
||
virtual bool block_ip(uint32_t adress)=0;
|
||
virtual bool add_ip_fail(uint32_t adress)=0;
|
||
virtual bool is_stop_signal_sent() = 0;
|
||
};
|
||
|
||
template<class t_connection_context>
|
||
struct p2p_endpoint_stub: public i_p2p_endpoint<t_connection_context>
|
||
{
|
||
virtual bool relay_notify_to_all(int command, const std::string& data_buff, const epee::net_utils::connection_context_base& context, std::list<epee::net_utils::connection_context_base>& relayed_peers)
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool invoke_command_to_peer(int command, const std::string& req_buff, std::string& resp_buff, const epee::net_utils::connection_context_base& context)
|
||
{
|
||
return false;
|
||
}
|
||
virtual bool invoke_notify_to_peer(int command, const std::string& req_buff, const epee::net_utils::connection_context_base& context)
|
||
{
|
||
return true;
|
||
}
|
||
virtual bool drop_connection(const epee::net_utils::connection_context_base& context)
|
||
{
|
||
return false;
|
||
}
|
||
virtual void request_callback(const epee::net_utils::connection_context_base& context)
|
||
{
|
||
|
||
}
|
||
virtual void for_each_connection(std::function<bool(t_connection_context&,peerid_type)> f)
|
||
{
|
||
|
||
}
|
||
|
||
virtual uint64_t get_connections_count()
|
||
{
|
||
return false;
|
||
}
|
||
virtual void get_connections(std::list<t_connection_context>& connections)
|
||
{
|
||
|
||
}
|
||
virtual bool block_ip(uint32_t adress)
|
||
{
|
||
return true;
|
||
}
|
||
virtual bool add_ip_fail(uint32_t adress)
|
||
{
|
||
return true;
|
||
}
|
||
virtual bool is_stop_signal_sent()
|
||
{
|
||
return false;
|
||
}
|
||
};
|
||
}
|