aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2019-02-11 13:47:45 +0000
committerGerrit Code Review <gerrit@fd.io>2019-02-11 13:47:45 +0000
commit86d5757be30d1d696b85cbc22e471158b9a19090 (patch)
treeef0444349176ffdd7dce4ada1a95406d97250b88
parent6248a13f86d0f04051539321ae63c910cd533a0e (diff)
parent4c8876424cca41c8ce8ce67c1c0a394932cbdd58 (diff)
Merge "[HICN-46] Remove warnings libtransport on windows"
-rw-r--r--libtransport/cmake/Modules/DefaultConfiguration.cmake8
-rw-r--r--libtransport/src/hicn/transport/CMakeLists.txt10
-rw-r--r--libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc6
-rw-r--r--libtransport/src/hicn/transport/core/memif_connector.h1
-rw-r--r--libtransport/src/hicn/transport/core/name.cc2
-rw-r--r--libtransport/src/hicn/transport/core/packet.cc18
-rw-r--r--libtransport/src/hicn/transport/core/packet.h2
-rw-r--r--libtransport/src/hicn/transport/core/portal.h1
-rw-r--r--libtransport/src/hicn/transport/core/prefix.cc2
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc14
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.cc4
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_options_default_values.h3
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_producer.cc10
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_producer.h2
-rw-r--r--libtransport/src/hicn/transport/portability/win_portability.h12
-rw-r--r--libtransport/src/hicn/transport/protocols/raaqm.cc6
-rw-r--r--libtransport/src/hicn/transport/protocols/raaqm_data_path.cc10
-rw-r--r--libtransport/src/hicn/transport/protocols/rate_estimation.cc4
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc69
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.h2
-rw-r--r--libtransport/src/hicn/transport/protocols/vegas.cc17
-rw-r--r--libtransport/src/hicn/transport/protocols/vegas_rto_estimator.cc4
-rw-r--r--libtransport/src/hicn/transport/utils/identity.cc8
-rw-r--r--libtransport/src/hicn/transport/utils/signer.cc9
-rw-r--r--libtransport/src/hicn/transport/utils/signer.h2
-rw-r--r--libtransport/src/hicn/transport/utils/string_tokenizer.cc2
-rw-r--r--libtransport/src/hicn/transport/utils/verifier.cc2
27 files changed, 127 insertions, 103 deletions
diff --git a/libtransport/cmake/Modules/DefaultConfiguration.cmake b/libtransport/cmake/Modules/DefaultConfiguration.cmake
index bf00bf5e1..f0d535251 100644
--- a/libtransport/cmake/Modules/DefaultConfiguration.cmake
+++ b/libtransport/cmake/Modules/DefaultConfiguration.cmake
@@ -21,9 +21,11 @@ option(COMPILE_TESTS "Compile functional tests" OFF)
# Compilation flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fpermissive")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fpermissive")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fpermissive")
+if (NOT WIN32)
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fpermissive")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -fpermissive")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -fpermissive")
+endif ()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
diff --git a/libtransport/src/hicn/transport/CMakeLists.txt b/libtransport/src/hicn/transport/CMakeLists.txt
index 92330c10b..c0481ad6f 100644
--- a/libtransport/src/hicn/transport/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/CMakeLists.txt
@@ -35,7 +35,15 @@ list(APPEND LIBTRANSPORT_INCLUDE_DIRS
${CMAKE_CURRENT_BINARY_DIR}/../..
)
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+
+if (NOT WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
+else ()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200")
+ if (CMAKE_BUILD_TYPE EQUAL "RELEASE")
+ set(CMAKE_SHARED_LINKER_FLAGS "/NODEFAULTLIB:\"MSVCRTD\"" )
+ endif ()
+endif ()
if (ANDROID_API)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -isystem -lm")
endif()
diff --git a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc
index e8b38cd7b..9dc3b63bb 100644
--- a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc
+++ b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc
@@ -65,9 +65,13 @@ void HicnForwarderInterface::registerRoute(Prefix &prefix) {
}
// Fill remaining payload fields
+#ifndef _WIN32
strcpy(route_to_self->symbolic_or_connid, identifier);
+#else
+ strcpy_s(route_to_self->symbolic_or_connid, strlen(route_to_self->symbolic_or_connid), identifier);
+#endif
route_to_self->cost = 1;
- route_to_self->len = prefix.getPrefixLength();
+ route_to_self->len = (uint8_t) prefix.getPrefixLength();
// Allocate and fill the header
route_to_self->command_id = ADD_ROUTE;
diff --git a/libtransport/src/hicn/transport/core/memif_connector.h b/libtransport/src/hicn/transport/core/memif_connector.h
index ff838930f..6e76b78da 100644
--- a/libtransport/src/hicn/transport/core/memif_connector.h
+++ b/libtransport/src/hicn/transport/core/memif_connector.h
@@ -47,6 +47,7 @@ typedef struct memif_connection memif_connection_t;
class MemifConnector : public Connector {
typedef void *memif_conn_handle_t;
+
public:
MemifConnector(PacketReceivedCallback &&receive_callback,
OnReconnect &&on_reconnect_callback,
diff --git a/libtransport/src/hicn/transport/core/name.cc b/libtransport/src/hicn/transport/core/name.cc
index 10c45eb08..ba3e9e825 100644
--- a/libtransport/src/hicn/transport/core/name.cc
+++ b/libtransport/src/hicn/transport/core/name.cc
@@ -67,7 +67,7 @@ Name::Name(const std::string &uri) {
try {
seq_number = tokenizer.nextToken();
- } catch (errors::TokenizerException &e) {
+ } catch (errors::TokenizerException) {
seq_number = "0";
}
diff --git a/libtransport/src/hicn/transport/core/packet.cc b/libtransport/src/hicn/transport/core/packet.cc
index cbfe082d3..761668116 100644
--- a/libtransport/src/hicn/transport/core/packet.cc
+++ b/libtransport/src/hicn/transport/core/packet.cc
@@ -32,7 +32,8 @@ namespace core {
const core::Name Packet::base_name("0::0|0");
Packet::Packet(Format format)
- : packet_(utils::MemBuf::create(getHeaderSizeFromFormat(format, 256)).release()),
+ : packet_(utils::MemBuf::create(getHeaderSizeFromFormat(format, 256))
+ .release()),
packet_start_(packet_->writableData()),
header_head_(packet_.get()),
payload_head_(nullptr),
@@ -50,15 +51,14 @@ Packet::Packet(MemBufPtr &&buffer)
header_head_(packet_.get()),
payload_head_(nullptr),
format_(getFormatFromBuffer(packet_start_)) {
-
int signature_size = 0;
if (_is_ah(format_)) {
- signature_size = getSignatureSize();
+ signature_size = (uint32_t)getSignatureSize();
}
auto header_size = getHeaderSizeFromFormat(format_, signature_size);
- auto payload_length = packet_->length() - header_size;
+ auto payload_length = packet_->length() - header_size - signature_size;
if (!payload_length) {
return;
@@ -69,7 +69,7 @@ Packet::Packet(MemBufPtr &&buffer)
if (payload_length) {
auto payload = packet_->cloneOne();
payload_head_ = payload.get();
- payload_head_->advance(header_size);
+ payload_head_->advance(header_size + signature_size);
payload_head_->append(payload_length);
packet_->prependChain(std::move(payload));
packet_->append(header_size);
@@ -283,10 +283,10 @@ void Packet::setSignatureSize(std::size_t size_bytes) {
packet_->append(size_bytes);
}
-uint8_t * Packet::getSignature() const {
- uint8_t * signature;
- int ret = hicn_packet_get_signature(
- format_, (hicn_header_t *)packet_start_, &signature);
+uint8_t *Packet::getSignature() const {
+ uint8_t *signature;
+ int ret = hicn_packet_get_signature(format_, (hicn_header_t *)packet_start_,
+ &signature);
if (ret < 0) {
throw errors::RuntimeException("Packet without Authentication Header.");
diff --git a/libtransport/src/hicn/transport/core/packet.h b/libtransport/src/hicn/transport/core/packet.h
index 038676540..49a558333 100644
--- a/libtransport/src/hicn/transport/core/packet.h
+++ b/libtransport/src/hicn/transport/core/packet.h
@@ -133,7 +133,7 @@ class Packet : public std::enable_shared_from_this<Packet> {
std::size_t getSignatureSize() const;
- uint8_t * getSignature() const;
+ uint8_t *getSignature() const;
void setSignatureTimestamp(const uint64_t &timestamp);
diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h
index e26e490ad..0932b56c6 100644
--- a/libtransport/src/hicn/transport/core/portal.h
+++ b/libtransport/src/hicn/transport/core/portal.h
@@ -255,7 +255,6 @@ class Portal {
private:
TRANSPORT_ALWAYS_INLINE void processIncomingMessages(
Packet::MemBufPtr &&packet_buffer) {
-
bool is_stopped = io_service_.stopped();
if (TRANSPORT_EXPECT_FALSE(is_stopped)) {
return;
diff --git a/libtransport/src/hicn/transport/core/prefix.cc b/libtransport/src/hicn/transport/core/prefix.cc
index 575bcc2ed..74d1466ac 100644
--- a/libtransport/src/hicn/transport/core/prefix.cc
+++ b/libtransport/src/hicn/transport/core/prefix.cc
@@ -155,7 +155,7 @@ Prefix &Prefix::setNetwork(std::string &network) {
}
Name Prefix::makeRandomName() const {
- srand(time(nullptr));
+ srand((unsigned int)time(nullptr));
if (ip_address_.family == AF_INET6) {
std::default_random_engine eng((std::random_device())());
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
index 84c80dad7..740e03c3c 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
@@ -51,7 +51,7 @@ RTCProducerSocket::RTCProducerSocket(asio::io_service &io_service)
nack_payload->append(NACK_HEADER_SIZE);
nack_->appendPayload(std::move(nack_payload));
lastStats_ = std::chrono::steady_clock::now();
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
prodLabel_ = ((rand() % 255) << 24UL);
}
@@ -68,7 +68,7 @@ RTCProducerSocket::RTCProducerSocket()
nack_payload->append(NACK_HEADER_SIZE);
nack_->appendPayload(std::move(nack_payload));
lastStats_ = std::chrono::steady_clock::now();
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
prodLabel_ = ((rand() % 255) << 24UL);
}
@@ -117,7 +117,7 @@ void RTCProducerSocket::produce(const uint8_t *buf, size_t buffer_size) {
return;
}
- updateStats(buffer_size + headerSize_ + TIMESTAMP_LEN);
+ updateStats((uint32_t)(buffer_size + headerSize_ + TIMESTAMP_LEN));
ContentObject content_object(flowName_.setSuffix(currentSeg_));
@@ -148,10 +148,10 @@ void RTCProducerSocket::onInterest(Interest::Ptr &&interest) {
// XXX
// packetsProductionRate_ is modified by another thread in updateStats
// this should be safe since I just read here. but, you never know.
- max_gap =
- floor((double)((double)((double)lifetime *
- INTEREST_LIFETIME_REDUCTION_FACTOR / 1000.0) *
- (double)packetsProductionRate_));
+ max_gap = (uint32_t)floor(
+ (double)((double)((double)lifetime * INTEREST_LIFETIME_REDUCTION_FACTOR /
+ 1000.0) *
+ (double)packetsProductionRate_));
if (interestSeg < currentSeg_ || interestSeg > (max_gap + currentSeg_)) {
sendNack(*interest);
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
index 89411e92c..eacaf932b 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
@@ -507,11 +507,11 @@ int ConsumerSocket::getSocketOption(int socket_option_key,
uint32_t &socket_option_value) {
switch (socket_option_key) {
case GeneralTransportOptions::INPUT_BUFFER_SIZE:
- socket_option_value = input_buffer_size_;
+ socket_option_value = (uint32_t)input_buffer_size_;
return SOCKET_OPTION_GET;
case GeneralTransportOptions::OUTPUT_BUFFER_SIZE:
- socket_option_value = output_buffer_size_;
+ socket_option_value = (uint32_t)output_buffer_size_;
return SOCKET_OPTION_GET;
case GeneralTransportOptions::MAX_INTEREST_RETX:
diff --git a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
index b4ff44f1e..f9cbb5a44 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
@@ -27,7 +27,8 @@ namespace default_values {
const uint32_t interest_lifetime = 1001; // milliseconds
const uint32_t never_expire_time = HICN_MAX_LIFETIME;
-const uint32_t content_object_expiry_time = never_expire_time; // milliseconds -> 50 seconds
+const uint32_t content_object_expiry_time =
+ never_expire_time; // milliseconds -> 50 seconds
const uint32_t content_object_packet_size = 1500; // The ethernet MTU
const uint32_t producer_socket_input_buffer_size = 150000; // Interests
const uint32_t producer_socket_output_buffer_size = 150000; // Content Object
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.cc b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
index ab9de4a95..66c656924 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
@@ -314,7 +314,7 @@ uint32_t ProducerSocket::produce(Name content_name, const uint8_t *buf,
if (packaged_segments == number_of_segments - 1) {
content_object->appendPayload(&buf[bytes_segmented],
buffer_size - bytes_segmented);
- bytes_segmented += buffer_size - bytes_segmented;
+ bytes_segmented += (int)(buffer_size - bytes_segmented);
if (is_last && making_manifest_) {
is_last_manifest = true;
@@ -325,7 +325,7 @@ uint32_t ProducerSocket::produce(Name content_name, const uint8_t *buf,
} else {
content_object->appendPayload(&buf[bytes_segmented],
free_space_for_content);
- bytes_segmented += free_space_for_content;
+ bytes_segmented += (int)(free_space_for_content);
}
if (making_manifest_) {
@@ -716,15 +716,15 @@ int ProducerSocket::getSocketOption(int socket_option_key,
uint32_t &socket_option_value) {
switch (socket_option_key) {
case GeneralTransportOptions::INPUT_BUFFER_SIZE:
- socket_option_value = input_buffer_capacity_;
+ socket_option_value = (int)input_buffer_capacity_;
return SOCKET_OPTION_GET;
case GeneralTransportOptions::OUTPUT_BUFFER_SIZE:
- socket_option_value = output_buffer_.getLimit();
+ socket_option_value = (uint32_t)output_buffer_.getLimit();
return SOCKET_OPTION_GET;
case GeneralTransportOptions::DATA_PACKET_SIZE:
- socket_option_value = data_packet_size_;
+ socket_option_value = (uint32_t)data_packet_size_;
return SOCKET_OPTION_GET;
case GeneralTransportOptions::CONTENT_OBJECT_EXPIRY_TIME:
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.h b/libtransport/src/hicn/transport/interfaces/socket_producer.h
index bd7d3f35f..d51464b77 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.h
@@ -223,7 +223,7 @@ class ProducerSocket : public Socket<BasePortal>,
HashAlgorithm hash_algorithm_;
utils::CryptoSuite crypto_suite_;
- //std::unique_ptr<utils::Identity> identity_;
+ // std::unique_ptr<utils::Identity> identity_;
// utils::Signer& signer_;
// buffers
diff --git a/libtransport/src/hicn/transport/portability/win_portability.h b/libtransport/src/hicn/transport/portability/win_portability.h
index f1d6e2b0e..ca262144b 100644
--- a/libtransport/src/hicn/transport/portability/win_portability.h
+++ b/libtransport/src/hicn/transport/portability/win_portability.h
@@ -19,14 +19,18 @@
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <parc/windows/parc_Utils.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
#include <windows.h>
#include <winsock2.h>
#include <ws2ipdef.h>
#include <ws2tcpip.h>
+#include <fcntl.h>
+#include <io.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
#include <algorithm>
#define __ORDER_LITTLE_ENDIAN__ 0x41424344UL
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());
diff --git a/libtransport/src/hicn/transport/utils/identity.cc b/libtransport/src/hicn/transport/utils/identity.cc
index 1b2fd4828..d84129537 100644
--- a/libtransport/src/hicn/transport/utils/identity.cc
+++ b/libtransport/src/hicn/transport/utils/identity.cc
@@ -51,7 +51,7 @@ Identity::Identity(const std::string &keystore_name,
signer_ = std::make_shared<Signer>(signer);
- signature_length_ = parcSigner_GetSignatureSize(signer);
+ signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer);
parcSigner_Release(&signer);
parcIdentityFile_Release(&identity_file);
@@ -72,8 +72,8 @@ Identity Identity::generateIdentity(const std::string &subject_name) {
unsigned int validity_days = 30;
CryptoSuite suite = CryptoSuite::RSA_SHA256;
- return utils::Identity(keystore_name, keystore_password, suite, key_length,
- validity_days, subject_name);
+ return utils::Identity(keystore_name, keystore_password, suite,
+ (unsigned int)key_length, validity_days, subject_name);
}
Identity::Identity(std::string &file_name, std::string &password,
@@ -92,7 +92,7 @@ Identity::Identity(std::string &file_name, std::string &password,
signer_ = std::make_shared<Signer>(signer);
- signature_length_ = parcSigner_GetSignatureSize(signer);
+ signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer);
parcSigner_Release(&signer);
parcIdentityFile_Release(&identity_file);
diff --git a/libtransport/src/hicn/transport/utils/signer.cc b/libtransport/src/hicn/transport/utils/signer.cc
index 9c06a051c..22bdf54d0 100644
--- a/libtransport/src/hicn/transport/utils/signer.cc
+++ b/libtransport/src/hicn/transport/utils/signer.cc
@@ -117,7 +117,7 @@ void Signer::sign(Packet &packet) {
utils::CryptoHasher hasher(parcSigner_GetCryptoHasher(signer_));
hasher.init();
hasher.updateBytes(hicn_packet, header_len + sign_len_bytes);
- //hasher.updateBytes(zeros, sign_len_bytes);
+ // hasher.updateBytes(zeros, sign_len_bytes);
for (utils::MemBuf *current = payload_chain; current != header_chain;
current = current->next()) {
@@ -126,7 +126,9 @@ void Signer::sign(Packet &packet) {
utils::CryptoHash hash = hasher.finalize();
- PARCSignature *signature = parcSigner_SignDigest(this->signer_, hash.hash_, packet.getSignature(), sign_len_bytes);
+ PARCSignature *signature =
+ parcSigner_SignDigest(this->signer_, hash.hash_, packet.getSignature(),
+ (uint32_t)sign_len_bytes);
PARCBuffer *buffer = parcSignature_GetSignature(signature);
size_t bytes_len = parcBuffer_Remaining(buffer);
@@ -140,10 +142,9 @@ void Signer::sign(Packet &packet) {
} else if (format & HFO_INET6) {
memcpy(hicn_packet, &header_copy, sizeof(hicn_v6_hdr_t));
}
-
}
-PARCKeyStore * Signer::getKeyStore() {
+PARCKeyStore *Signer::getKeyStore() {
return parcSigner_GetKeyStore(this->signer_);
}
diff --git a/libtransport/src/hicn/transport/utils/signer.h b/libtransport/src/hicn/transport/utils/signer.h
index 10b1bfe8c..6afb9544c 100644
--- a/libtransport/src/hicn/transport/utils/signer.h
+++ b/libtransport/src/hicn/transport/utils/signer.h
@@ -60,7 +60,7 @@ class Signer {
*/
void sign(Packet &packet);
- PARCKeyStore * getKeyStore();
+ PARCKeyStore *getKeyStore();
private:
PARCSigner *signer_;
diff --git a/libtransport/src/hicn/transport/utils/string_tokenizer.cc b/libtransport/src/hicn/transport/utils/string_tokenizer.cc
index 9d1911080..a280a3c43 100644
--- a/libtransport/src/hicn/transport/utils/string_tokenizer.cc
+++ b/libtransport/src/hicn/transport/utils/string_tokenizer.cc
@@ -30,7 +30,7 @@ bool StringTokenizer::hasMoreTokens() {
}
std::string StringTokenizer::nextToken() {
- unsigned long pos = str_.find(delimiter_);
+ unsigned long pos = (unsigned long)str_.find(delimiter_);
bool token_found = std::string::npos != pos;
diff --git a/libtransport/src/hicn/transport/utils/verifier.cc b/libtransport/src/hicn/transport/utils/verifier.cc
index 49cbe3b36..bc460b821 100644
--- a/libtransport/src/hicn/transport/utils/verifier.cc
+++ b/libtransport/src/hicn/transport/utils/verifier.cc
@@ -125,7 +125,7 @@ int Verifier::verify(const Packet &packet) {
PARCKeyId *key_id = parcKeyId_Create(buffer);
parcBuffer_Release(&buffer);
- int ah_payload_len = header_chain->next()->length();
+ int ah_payload_len = (int)(header_chain->next()->length());
uint8_t *signature = header_chain->next()->writableData();
// Reset fields that should not appear in the signature