diff options
author | Angelo Mantellini <manangel@cisco.com> | 2019-02-10 12:49:21 +0100 |
---|---|---|
committer | Angelo Mantellini <manangel@cisco.com> | 2019-02-11 14:32:16 +0100 |
commit | 4c8876424cca41c8ce8ce67c1c0a394932cbdd58 (patch) | |
tree | 03ce5e673a9409b35ba7abf65e1740309ef44653 /libtransport/src/hicn/transport/protocols | |
parent | 731e1188262be87d962f5694022fc74928d889b0 (diff) |
[HICN-46] Remove warnings libtransport on windows
Change-Id: I09456770dcbca979491cdcadb310eab95a0dea17
Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/protocols')
7 files changed, 58 insertions, 54 deletions
diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc index cd22ecfdc..3e04689e9 100644 --- a/libtransport/src/hicn/transport/protocols/raaqm.cc +++ b/libtransport/src/hicn/transport/protocols/raaqm.cc @@ -272,7 +272,7 @@ void RaaqmTransportProtocol::updateRtt(uint64_t segment) { rtt = std::chrono::duration_cast<std::chrono::microseconds>(duration); if (this->rate_estimator_) { - this->rate_estimator_->onRttUpdate(rtt.count()); + this->rate_estimator_->onRttUpdate((double)rtt.count()); } cur_path_->insertNewRtt(rtt.count()); cur_path_->smoothTimer(); @@ -405,8 +405,8 @@ void RaaqmTransportProtocol::afterContentReception( updatePathTable(content_object); increaseWindow(); updateRtt(interest.getName().getSuffix()); - this->rate_estimator_->onDataReceived((int)content_object.payloadSize() + - content_object.headerSize()); + this->rate_estimator_->onDataReceived( + (int)(content_object.payloadSize() + content_object.headerSize())); // Set drop probablility and window size accordingly RAAQM(); } diff --git a/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc b/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc index 2e7aa531a..ef26eabb5 100644 --- a/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc +++ b/libtransport/src/hicn/transport/protocols/raaqm_data_path.cc @@ -95,13 +95,13 @@ RaaqmDataPath &RaaqmDataPath::smoothTimer() { return *this; } -double RaaqmDataPath::getRtt() { return rtt_; } +double RaaqmDataPath::getRtt() { return (double)rtt_; } double RaaqmDataPath::getAverageRtt() { return average_rtt_; } -double RaaqmDataPath::getRttMax() { return rtt_max_; } +double RaaqmDataPath::getRttMax() { return (double)rtt_max_; } -double RaaqmDataPath::getRttMin() { return rtt_min_; } +double RaaqmDataPath::getRttMin() { return (double)rtt_min_; } unsigned RaaqmDataPath::getSampleValue() { return samples_; } @@ -140,7 +140,9 @@ bool RaaqmDataPath::newPropagationDelayAvailable() { return r; } -unsigned int RaaqmDataPath::getPropagationDelay() { return prop_delay_; } +unsigned int RaaqmDataPath::getPropagationDelay() { + return (unsigned int)prop_delay_; +} bool RaaqmDataPath::isStale() { TimePoint now = std::chrono::steady_clock::now(); diff --git a/libtransport/src/hicn/transport/protocols/rate_estimation.cc b/libtransport/src/hicn/transport/protocols/rate_estimation.cc index b603ec200..a0bb69153 100644 --- a/libtransport/src/hicn/transport/protocols/rate_estimation.cc +++ b/libtransport/src/hicn/transport/protocols/rate_estimation.cc @@ -41,7 +41,7 @@ void *Timer(void *data) { dat_rtt = estimator->rtt_; my_avg_win = estimator->avg_win_; my_avg_rtt = estimator->avg_rtt_; - my_win_change = estimator->win_change_; + my_win_change = (int)(estimator->win_change_); number_of_packets = estimator->number_of_packets_; max_packet_size = estimator->max_packet_size_; estimator->avg_rtt_ = estimator->rtt_; @@ -208,7 +208,7 @@ void SimpleEstimator::onDownloadFinished() { auto delay = std::chrono::duration_cast<Microseconds>(end - this->start_time_).count(); if (observer_) { - observer_->notifyDownloadTime(delay); + observer_->notifyDownloadTime((double)delay); } if (!this->estimated_) { // Assuming all packets carry max_packet_size_ bytes of data diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc index b8c754c35..dbf1c1bd1 100644 --- a/libtransport/src/hicn/transport/protocols/rtc.cc +++ b/libtransport/src/hicn/transport/protocols/rtc.cc @@ -142,11 +142,9 @@ void RTCTransportProtocol::reset() { protocolState_ = HICN_RTC_NORMAL_STATE; producerPathLabel_ = 0; - socket_->setSocketOption( - GeneralTransportOptions::INTEREST_LIFETIME, - (uint32_t) - HICN_RTC_INTEREST_LIFETIME); - // XXX this should bedone by the application + socket_->setSocketOption(GeneralTransportOptions::INTEREST_LIFETIME, + (uint32_t)HICN_RTC_INTEREST_LIFETIME); + // XXX this should bedone by the application } uint32_t max(uint32_t a, uint32_t b) { @@ -164,9 +162,10 @@ uint32_t min(uint32_t a, uint32_t b) { } void RTCTransportProtocol::checkRound() { - uint32_t duration = std::chrono::duration_cast<std::chrono::milliseconds>( - std::chrono::steady_clock::now() - lastRoundBegin_) - .count(); + uint32_t duration = + (uint32_t)std::chrono::duration_cast<std::chrono::milliseconds>( + std::chrono::steady_clock::now() - lastRoundBegin_) + .count(); if (duration >= HICN_ROUND_LEN) { lastRoundBegin_ = std::chrono::steady_clock::now(); updateStats(duration); // update stats and window @@ -214,9 +213,9 @@ void RTCTransportProtocol::updateDelayStats( void RTCTransportProtocol::updateStats(uint32_t round_duration) { if (receivedBytes_ != 0) { - double bytesPerSec = (double)(receivedBytes_ * - ((double) HICN_MILLI_IN_A_SEC / - (double)round_duration)); + double bytesPerSec = + (double)(receivedBytes_ * + ((double)HICN_MILLI_IN_A_SEC / (double)round_duration)); estimatedBw_ = (estimatedBw_ * HICN_ESTIMATED_BW_ALPHA) + ((1 - HICN_ESTIMATED_BW_ALPHA) * bytesPerSec); } @@ -259,12 +258,11 @@ void RTCTransportProtocol::updateStats(uint32_t round_duration) { if (avgPacketSize_ == 0) avgPacketSize_ = HICN_INIT_PACKET_SIZE; - uint32_t BDP = - ceil((estimatedBw_ * (double)((double)minRtt_ / - (double)HICN_MILLI_IN_A_SEC) * - HICN_BANDWIDTH_SLACK_FACTOR) / - avgPacketSize_); - uint32_t BW = ceil(estimatedBw_); + uint32_t BDP = (uint32_t)ceil( + (estimatedBw_ * (double)((double)minRtt_ / (double)HICN_MILLI_IN_A_SEC) * + HICN_BANDWIDTH_SLACK_FACTOR) / + avgPacketSize_); + uint32_t BW = (uint32_t)ceil(estimatedBw_); computeMaxWindow(BW, BDP); // bound also by interest lifitime* production rate @@ -304,11 +302,11 @@ void RTCTransportProtocol::computeMaxWindow(uint32_t productionRate, uint32_t interestLifetime = default_values::interest_lifetime; socket_->getSocketOption(GeneralTransportOptions::INTEREST_LIFETIME, interestLifetime); - uint32_t maxWaintingInterest = ceil( + uint32_t maxWaintingInterest = (uint32_t)ceil( (productionRate / avgPacketSize_) * (double)((double)(interestLifetime * - HICN_INTEREST_LIFETIME_REDUCTION_FACTOR) / - (double) HICN_MILLI_IN_A_SEC)); + HICN_INTEREST_LIFETIME_REDUCTION_FACTOR) / + (double)HICN_MILLI_IN_A_SEC)); if (currentState_ == HICN_RTC_SYNC_STATE) { // in this case we do not limit the window with the BDP, beacuse most likly @@ -319,7 +317,8 @@ void RTCTransportProtocol::computeMaxWindow(uint32_t productionRate, // currentState = RTC_NORMAL_STATE if (BDPWin != 0) { - maxCWin_ = ceil((double)BDPWin + ((double)BDPWin / 10.0)); // BDP + 10% + maxCWin_ = + (uint32_t)ceil((double)BDPWin + ((double)BDPWin / 10.0)); // BDP + 10% } else { maxCWin_ = min(maxWaintingInterest, maxCWin_); } @@ -329,9 +328,11 @@ void RTCTransportProtocol::updateWindow() { if (currentState_ == HICN_RTC_SYNC_STATE) return; if (currentCWin_ < maxCWin_ * 0.7) { - currentCWin_ = min(maxCWin_, currentCWin_ * HICN_WIN_INCREASE_FACTOR); + currentCWin_ = + min(maxCWin_, (uint32_t)(currentCWin_ * HICN_WIN_INCREASE_FACTOR)); } else if (currentCWin_ > maxCWin_) { - currentCWin_ = max(currentCWin_ * HICN_WIN_DECREASE_FACTOR, HICN_MIN_CWIN); + currentCWin_ = + max((uint32_t)(currentCWin_ * HICN_WIN_DECREASE_FACTOR), HICN_MIN_CWIN); } } @@ -340,8 +341,8 @@ void RTCTransportProtocol::decreaseWindow() { if (currentState_ == HICN_RTC_NORMAL_STATE) return; if (gotFutureNack_ == 1) - currentCWin_ = - min((currentCWin_ - 1), ceil((double)maxCWin_ * 0.66)); // 2/3 + currentCWin_ = min((currentCWin_ - 1), + (uint32_t)ceil((double)maxCWin_ * 0.66)); // 2/3 else currentCWin_--; @@ -357,7 +358,8 @@ void RTCTransportProtocol::increaseWindow() { currentCWin_ = currentCWin_ + 1; // exponential } else { currentCWin_ = min( - maxCWin_, ceil(currentCWin_ + (1.0 / (double)currentCWin_))); // linear + maxCWin_, + (uint32_t)ceil(currentCWin_ + (1.0 / (double)currentCWin_))); // linear } } @@ -542,7 +544,7 @@ void RTCTransportProtocol::onNack(const ContentObject &content_object) { void RTCTransportProtocol::onContentObject( Interest::Ptr &&interest, ContentObject::Ptr &&content_object) { - uint32_t payload_size = content_object->getPayload().length(); + uint32_t payload_size = (uint32_t)content_object->getPayload().length(); uint32_t segmentNumber = content_object->getName().getSuffix(); uint32_t pkt = segmentNumber & modMask_; @@ -558,17 +560,16 @@ void RTCTransportProtocol::onContentObject( } else { receivedData_++; - avgPacketSize_ = - (HICN_ESTIMATED_PACKET_SIZE * avgPacketSize_) + - ((1 - HICN_ESTIMATED_PACKET_SIZE) * - content_object->getPayload().length()); + avgPacketSize_ = (HICN_ESTIMATED_PACKET_SIZE * avgPacketSize_) + + ((1 - HICN_ESTIMATED_PACKET_SIZE) * + content_object->getPayload().length()); if (inflightInterests_[pkt].retransmissions == 0) { inflightInterestsCount_--; // we count only non retransmitted data in order to take into accunt only // the transmition rate of the producer - receivedBytes_ += - content_object->headerSize() + content_object->payloadSize(); + receivedBytes_ += (uint32_t)(content_object->headerSize() + + content_object->payloadSize()); updateDelayStats(*content_object); } @@ -585,7 +586,7 @@ void RTCTransportProtocol::returnContentToUser( Array a = content_object.getPayload(); uint8_t *start = ((uint8_t *)a.data()) + HICN_TIMESTAMP_SIZE; - unsigned size = a.length() - HICN_TIMESTAMP_SIZE; + unsigned size = (unsigned)(a.length() - HICN_TIMESTAMP_SIZE); // set offset between hICN and RTP packets uint16_t rtp_seq = ntohs(*(((uint16_t *)start) + 1)); diff --git a/libtransport/src/hicn/transport/protocols/rtc.h b/libtransport/src/hicn/transport/protocols/rtc.h index 589c95c36..61590fc8e 100644 --- a/libtransport/src/hicn/transport/protocols/rtc.h +++ b/libtransport/src/hicn/transport/protocols/rtc.h @@ -29,7 +29,7 @@ // packet constants #define HICN_INIT_PACKET_SIZE 1300 // bytes -#define HICN_PACKET_HEADER_SIZE 60 // bytes ipv6+tcp +#define HICN_PACKET_HEADER_SIZE 60 // bytes ipv6+tcp #define HICN_NACK_HEADER_SIZE 8 // bytes #define HICN_TIMESTAMP_SIZE 8 // bytes #define HICN_RTC_INTEREST_LIFETIME 1000 // ms diff --git a/libtransport/src/hicn/transport/protocols/vegas.cc b/libtransport/src/hicn/transport/protocols/vegas.cc index 1431020a6..f99eb83e0 100644 --- a/libtransport/src/hicn/transport/protocols/vegas.cc +++ b/libtransport/src/hicn/transport/protocols/vegas.cc @@ -122,7 +122,7 @@ void VegasTransportProtocol::resume() { void VegasTransportProtocol::sendInterest(std::uint64_t next_suffix) { auto interest = getInterest(); - socket_->network_name_.setSuffix(next_suffix); + socket_->network_name_.setSuffix((uint32_t)next_suffix); interest->setName(socket_->network_name_); interest->setLifetime(uint32_t(socket_->interest_lifetime_)); @@ -244,7 +244,7 @@ void VegasTransportProtocol::changeInterestLifetime(uint64_t segment) { std::chrono::milliseconds lifetime = std::chrono::duration_cast<std::chrono::milliseconds>(rto); - socket_->interest_lifetime_ = lifetime.count(); + socket_->interest_lifetime_ = (int)lifetime.count(); } void VegasTransportProtocol::returnContentToUser() { @@ -291,7 +291,8 @@ void VegasTransportProtocol::onManifest( suffix_queue_.push(_it->first); } - next_manifest_interval_ = manifest->getSuffixList().size(); + next_manifest_interval_ = + (unsigned short)manifest->getSuffixList().size(); if (manifest->isFinalManifest()) { suffix_queue_completed_ = true; @@ -364,8 +365,8 @@ void VegasTransportProtocol::onContentObject( auto dt = std::chrono::duration_cast<TimeDuration>(now - socket_->t0_); if (dt.count() > socket_->timer_interval_milliseconds_) { socket_->on_timer_expires_(*socket_, byte_count_, dt, - current_window_size_, retx_count_, - std::round(average_rtt_)); + (float)current_window_size_, retx_count_, + (uint32_t)std::round(average_rtt_)); socket_->t0_ = std::chrono::steady_clock::now(); } } @@ -427,7 +428,7 @@ bool VegasTransportProtocol::verifyContentObject( bool ret = false; if (download_with_manifest_) { - auto it = suffix_hash_map_.find(segment); + auto it = suffix_hash_map_.find((const unsigned int)segment); if (it != suffix_hash_map_.end()) { auto hash_type = static_cast<utils::CryptoHashType>(it->second.second); auto data_packet_digest = content_object.computeDigest(it->second.second); @@ -533,7 +534,7 @@ void VegasTransportProtocol::copyContent(const ContentObject &content_object) { void VegasTransportProtocol::reassemble() { uint64_t index = last_reassembled_segment_; - auto it = receive_buffer_.find(index); + auto it = receive_buffer_.find((const unsigned int)index); while (it != receive_buffer_.end()) { if (it->second->getPayloadType() == PayloadType::CONTENT_OBJECT) { @@ -542,7 +543,7 @@ void VegasTransportProtocol::reassemble() { } index = ++last_reassembled_segment_; - it = receive_buffer_.find(index); + it = receive_buffer_.find((const unsigned int)index); } } diff --git a/libtransport/src/hicn/transport/protocols/vegas_rto_estimator.cc b/libtransport/src/hicn/transport/protocols/vegas_rto_estimator.cc index f5f797bbe..a61fd05f0 100644 --- a/libtransport/src/hicn/transport/protocols/vegas_rto_estimator.cc +++ b/libtransport/src/hicn/transport/protocols/vegas_rto_estimator.cc @@ -26,10 +26,10 @@ namespace protocol { using namespace interface; RtoEstimator::RtoEstimator(Duration min_rto) - : smoothed_rtt_(RtoEstimator::getInitialRtt().count()), + : smoothed_rtt_((double)RtoEstimator::getInitialRtt().count()), rtt_variation_(0), first_measurement_(true), - last_rto_(min_rto.count()) {} + last_rto_((double)min_rto.count()) {} void RtoEstimator::addMeasurement(Duration rtt) { double duration = static_cast<double>(rtt.count()); |