17 #include <boost/asio.hpp>
18 #include <boost/bind/bind.hpp>
47 Receiver(
const std::string& iface,
const std::string& address,
48 short port, uint64_t tsi,
49 boost::asio::io_context& io_context);
62 void enable_ipsec( uint32_t spi,
const std::string& aes_key);
69 std::vector<std::shared_ptr<LibFlute::File>>
file_list();
88 void stop() { _running =
false; }
91 void handle_receive_from(
const boost::system::error_code& error,
93 boost::asio::ip::udp::socket _socket;
94 boost::asio::ip::udp::endpoint _sender_endpoint;
96 enum { max_length = 2048 };
97 char _data[max_length];
99 std::unique_ptr<LibFlute::FileDeliveryTable> _fdt;
100 std::map<uint64_t, std::shared_ptr<LibFlute::File>> _files;
101 std::mutex _files_mutex;
102 std::string _mcast_address;
106 bool _running =
true;
void register_completion_callback(completion_callback_t cb)
Register a callback for file reception notifications.
virtual ~Receiver()=default
Default destructor.
void remove_file_with_content_location(const std::string &cl)
Remove a file from the list that matches the passed content location.
std::vector< std::shared_ptr< LibFlute::File > > file_list()
List all current files.
void enable_ipsec(uint32_t spi, const std::string &aes_key)
Enable IPSEC ESP decryption of FLUTE payloads.
Receiver(const std::string &iface, const std::string &address, short port, uint64_t tsi, boost::asio::io_context &io_context)
Default constructor.
void remove_expired_files(unsigned max_age)
Remove files from the list that are older than max_age seconds.
std::function< void(std::shared_ptr< LibFlute::File >)> completion_callback_t
Definition of a file reception completion callback function that can be registered through ::register...