From 6d7704c1b497341fd6dd3c27e3f64d0db062ccc2 Mon Sep 17 00:00:00 2001 From: Mauro Sardara Date: Mon, 4 Feb 2019 11:06:18 +0100 Subject: [HICN-11] Rework on transport protocols improving components modularity Change-Id: I6683ec5b494238dc93591c103d25275e89b9f267 Signed-off-by: Mauro Sardara --- libtransport/src/hicn/transport/protocols/raaqm.h | 79 +++++++++++++++++------ 1 file changed, 61 insertions(+), 18 deletions(-) (limited to 'libtransport/src/hicn/transport/protocols/raaqm.h') diff --git a/libtransport/src/hicn/transport/protocols/raaqm.h b/libtransport/src/hicn/transport/protocols/raaqm.h index 6ca410251..09d22cd4f 100644 --- a/libtransport/src/hicn/transport/protocols/raaqm.h +++ b/libtransport/src/hicn/transport/protocols/raaqm.h @@ -15,65 +15,108 @@ #pragma once +#include +#include #include #include -#include -#include +#include +#include + +#include +#include namespace transport { namespace protocol { -class RaaqmTransportProtocol : public VegasTransportProtocol { +class RaaqmTransportProtocol + : public TransportProtocol, + public BaseReassembly, + public CWindowProtocol, + public BaseReassembly::ContentReassembledCallback { public: - RaaqmTransportProtocol(interface::BaseSocket *icnet_socket); + RaaqmTransportProtocol(interface::ConsumerSocket *icnet_socket); ~RaaqmTransportProtocol(); - void start(utils::SharableVector &content_buffer) override; + int start() override; + + void resume() override; + + void reset() override; protected: - void copyContent(const ContentObject &content_object) override; + static constexpr uint32_t buffer_size = + 1 << interface::default_values::log_2_default_buffer_size; + static constexpr uint16_t mask = buffer_size - 1; + using PathTable = + std::unordered_map>; + + void increaseWindow() override; + void decreaseWindow() override; + + virtual void afterContentReception(const Interest &interest, + const ContentObject &content_object); + virtual void afterDataUnsatisfied(uint64_t segment); + + virtual void updateStats(uint32_t suffix, uint64_t rtt, + utils::TimePoint &now); private: void init(); - void afterContentReception(const Interest &interest, - const ContentObject &content_object) override; + void onContentObject(Interest::Ptr &&i, ContentObject::Ptr &&c) override; - void afterDataUnsatisfied(uint64_t segment) override; + void onContentSegment(Interest::Ptr &&interest, + ContentObject::Ptr &&content_object); - void increaseWindow() override; + void onTimeout(Interest::Ptr &&i) override; - void updateRtt(uint64_t segment); + virtual void scheduleNextInterests() override; - void decreaseWindow() override; + void sendInterest(std::uint64_t next_suffix); - void changeInterestLifetime(uint64_t segment) override; + void sendInterest(Interest::Ptr &&interest); - void onTimeout(Interest::Ptr &&interest) override; + void onContentReassembled(std::error_code ec) override; + + void updateRtt(uint64_t segment); void RAAQM(); void updatePathTable(const ContentObject &content_object); - void check_drop_probability(); + void checkDropProbability(); - void check_for_stale_paths(); + void checkForStalePaths(); void printRtt(); + protected: + // Congestion window management + double current_window_size_; + // Protocol management + uint64_t interests_in_flight_; + std::array interest_retransmissions_; + std::array interest_timepoints_; + std::queue interest_to_retransmit_; + + private: /** * Current download path */ - std::shared_ptr cur_path_; + RaaqmDataPath *cur_path_; /** * Hash table for path: each entry is a pair path ID(key) - path object */ - std::unordered_map> path_table_; + PathTable path_table_; + + // TimePoints for statistic + utils::TimePoint t0_; bool set_interest_filter_; + // for rate-estimation at packet level IcnRateEstimator *rate_estimator_; -- cgit 1.2.3-korg