17 #include <boost/asio.hpp>
18 #include <boost/bind/bind.hpp>
51 Receiver(
const std::string& iface,
const std::string& address,
52 short port, uint64_t tsi,
53 boost::asio::io_context& io_context,
54 const std::string& source_address =
"");
73 void enable_ipsec( uint32_t spi,
const std::string& aes_key);
80 std::vector<std::shared_ptr<LibFlute::File>>
file_list();
99 void stop() { _running =
false; }
102 void handle_receive_from(
const boost::system::error_code& error,
105 boost::asio::ip::udp::socket _socket;
106 boost::asio::ip::udp::endpoint _sender_endpoint;
119 enum { max_length = 65536 };
120 char _data[max_length];
122 std::unique_ptr<LibFlute::FileDeliveryTable> _fdt;
126 uint32_t _fdt_in_progress_instance_id = 0xFFFFFFFF;
127 std::map<uint64_t, std::shared_ptr<LibFlute::File>> _files;
128 std::mutex _files_mutex;
129 std::string _mcast_address;
133 bool _running =
true;
137 std::shared_ptr<std::atomic<bool>> _alive = std::make_shared<std::atomic<bool>>(
true);
void register_completion_callback(completion_callback_t cb)
Register a callback for file reception notifications.
Receiver(const std::string &iface, const std::string &address, short port, uint64_t tsi, boost::asio::io_context &io_context, const std::string &source_address="")
Default constructor.
void remove_file_with_content_location(const std::string &cl)
Remove a file from the list that matches the passed content location.
virtual ~Receiver()
Destructor.
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.
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...