aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/protocols/rtc.h
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn/transport/protocols/rtc.h')
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.h106
1 files changed, 52 insertions, 54 deletions
diff --git a/libtransport/src/hicn/transport/protocols/rtc.h b/libtransport/src/hicn/transport/protocols/rtc.h
index 2b9ed10a6..9e1731e96 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.h
+++ b/libtransport/src/hicn/transport/protocols/rtc.h
@@ -15,12 +15,12 @@
#pragma once
-#include <queue>
#include <map>
+#include <queue>
#include <unordered_map>
+#include <hicn/transport/protocols/datagram_reassembly.h>
#include <hicn/transport/protocols/protocol.h>
-#include <hicn/transport/protocols/reassembly.h>
#include <hicn/transport/protocols/rtc_data_path.h>
// algorithm state
@@ -35,26 +35,27 @@
#define HICN_TIMESTAMP_SIZE 8 // bytes
#define HICN_RTC_INTEREST_LIFETIME 1000 // ms
-//rtt measurement
-//normal interests for data goes from 0 to
-//HICN_MIN_PROBE_SEQ, the rest is reserverd for
-//probes
+// rtt measurement
+// normal interests for data goes from 0 to
+// HICN_MIN_PROBE_SEQ, the rest is reserverd for
+// probes
#define HICN_MIN_PROBE_SEQ 0xefffffff
#define HICN_MAX_PROBE_SEQ 0xffffffff
// controller constant
-#define HICN_ROUND_LEN 200 // ms interval of time on which
- // we take decisions / measurements
+#define HICN_ROUND_LEN \
+ 200 // ms interval of time on which
+ // we take decisions / measurements
#define HICN_MAX_RTX 10
#define HICN_MAX_RTX_SIZE 1024
#define HICN_MAX_RTX_MAX_AGE 10000
-#define HICN_MIN_RTT_WIN 30 // rounds
-#define HICN_MIN_INTER_ARRIVAL_GAP 100 //ms
+#define HICN_MIN_RTT_WIN 30 // rounds
+#define HICN_MIN_INTER_ARRIVAL_GAP 100 // ms
// cwin
#define HICN_INITIAL_CWIN 1 // packets
#define HICN_INITIAL_CWIN_MAX 100000 // packets
-#define HICN_MIN_CWIN 10 // packets
+#define HICN_MIN_CWIN 10 // packets
#define HICN_WIN_INCREASE_FACTOR 1.5
#define HICN_WIN_DECREASE_FACTOR 0.9
@@ -70,30 +71,23 @@
#define HICN_MICRO_IN_A_SEC 1000000
#define HICN_MILLI_IN_A_SEC 1000
-
namespace transport {
namespace protocol {
-enum packetState {
- sent_,
- nacked_,
- received_,
- timeout1_,
- timeout2_,
- lost_
-};
+enum packetState { sent_, nacked_, received_, timeout1_, timeout2_, lost_ };
typedef enum packetState packetState_t;
struct sentInterest {
uint64_t transmissionTime;
- uint32_t sequence; //sequence number of the interest sent
- //to handle seq % buffer_size
- packetState_t state; //see packet state
+ uint32_t sequence; // sequence number of the interest sent
+ // to handle seq % buffer_size
+ packetState_t state; // see packet state
};
-class RTCTransportProtocol : public TransportProtocol, public Reassembly {
+class RTCTransportProtocol : public TransportProtocol,
+ public DatagramReassembly {
public:
RTCTransportProtocol(interface::ConsumerSocket *icnet_socket);
@@ -133,11 +127,16 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
bool onNack(const ContentObject &content_object, bool rtx);
void onContentObject(Interest::Ptr &&interest,
ContentObject::Ptr &&content_object) override;
- void returnContentToApplication(const ContentObject &content_object);
+ void onPacketDropped(Interest::Ptr &&interest,
+ ContentObject::Ptr &&content_object) override {}
+ void onReassemblyFailed(std::uint32_t missing_segment) override {}
TRANSPORT_ALWAYS_INLINE virtual void reassemble(
ContentObject::Ptr &&content_object) override {
- returnContentToApplication(*content_object);
+ auto read_buffer = content_object->getPayload();
+ read_buffer->trimStart(HICN_TIMESTAMP_SIZE);
+ Reassembly::read_buffer_ = std::move(read_buffer);
+ Reassembly::notifyApplication();
}
// controller var
@@ -151,36 +150,36 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
// names/packets var
uint32_t actualSegment_;
uint32_t inflightInterestsCount_;
- //map seq to rtx
+ // map seq to rtx
std::map<uint32_t, uint8_t> interestRetransmissions_;
bool rtx_timer_used_;
std::unique_ptr<asio::steady_timer> rtx_timer_;
std::vector<sentInterest> inflightInterests_;
- uint32_t lastSegNacked_; //indicates the segment id in the last received
- // past Nack. we do not ask for retransmissions
- //for samething that is older than this value.
- uint32_t lastReceived_; //segment of the last content object received
- //indicates the base of the window on the client
- uint64_t lastReceivedTime_; //time at which we recevied the
- //lastReceived_ packet
-
- //sentinel
- //if all packets in the window get lost we need something that
- //wakes up our consumer socket. Interest timeouts set to 1 sec
- //expire too late. This timers expire much sooner and if it
- //detects that all the interest in the window may be lost
- //it sends all of them again
+ uint32_t lastSegNacked_; // indicates the segment id in the last received
+ // past Nack. we do not ask for retransmissions
+ // for samething that is older than this value.
+ uint32_t lastReceived_; // segment of the last content object received
+ // indicates the base of the window on the client
+ uint64_t lastReceivedTime_; // time at which we recevied the
+ // lastReceived_ packet
+
+ // sentinel
+ // if all packets in the window get lost we need something that
+ // wakes up our consumer socket. Interest timeouts set to 1 sec
+ // expire too late. This timers expire much sooner and if it
+ // detects that all the interest in the window may be lost
+ // it sends all of them again
std::unique_ptr<asio::steady_timer> sentinel_timer_;
- uint64_t lastEvent_; //time at which we removed a pending
- //interest from the window
+ uint64_t lastEvent_; // time at which we removed a pending
+ // interest from the window
std::unordered_map<uint32_t, uint8_t> packets_in_window_;
- //rtt probes
- //the RTC transport tends to overestimate the RTT
- //du to the production time on the server side
- //once per second we send an interest for wich we know
- //we will get a nack. This nack will keep our estimation
- //close to the reality
+ // rtt probes
+ // the RTC transport tends to overestimate the RTT
+ // du to the production time on the server side
+ // once per second we send an interest for wich we know
+ // we will get a nack. This nack will keep our estimation
+ // close to the reality
std::unique_ptr<asio::steady_timer> probe_timer_;
uint64_t time_sent_probe_;
uint32_t probe_seq_number_;
@@ -203,10 +202,10 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
uint32_t rounds_;
uint32_t roundsWithoutNacks_;
- //we keep track of up two paths (if only one path is in use
- //the two values in the vector will be the same)
- //position 0 stores the path with minRTT
- //position 1 stores the path with maxRTT
+ // we keep track of up two paths (if only one path is in use
+ // the two values in the vector will be the same)
+ // position 0 stores the path with minRTT
+ // position 1 stores the path with maxRTT
uint32_t producerPathLabels_[2];
std::unordered_map<uint32_t, std::shared_ptr<RTCDataPath>> pathTable_;
@@ -219,7 +218,6 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
unsigned protocolState_;
bool initied;
- TransportStatistics stats_;
};
} // namespace protocol