diff options
8 files changed, 37 insertions, 25 deletions
diff --git a/hicn-light/src/io/udpConnection.c b/hicn-light/src/io/udpConnection.c index 3faf2bfac..c3e6d32ac 100644 --- a/hicn-light/src/io/udpConnection.c +++ b/hicn-light/src/io/udpConnection.c @@ -19,8 +19,10 @@ * NB The Send() function may overflow the output buffer * */ -#include <sys/uio.h> +#ifndef _WIN32 +#include <sys/uio.h> +#endif #include <errno.h> #include <src/config.h> #include <stdio.h> @@ -266,6 +268,7 @@ static bool _sendCommandResponse(IoOperations *ops, struct iovec *message){ parcAssertNotNull(message, "Parameter message must be non-null"); _UdpState *udpConnState = (_UdpState *)ioOperations_GetClosure(ops); +#ifndef _WIN32 // Perform connect before to establish association between this peer and // the remote peer. This is required to use writev. // Connection association can be changed at any time. @@ -283,7 +286,16 @@ static bool _sendCommandResponse(IoOperations *ops, struct iovec *message){ if (writeLength < 0) { return false; } - +#else + ssize_t writeLength = write(udpConnState->udpListenerSocket, message[0].iov_base, (unsigned int)message[0].iov_len); + if (writeLength < 0) { + return false; + } + writeLength = write(udpConnState->udpListenerSocket, message[0].iov_base, (unsigned int)message[0].iov_len); + if (writeLength < 0) { + return false; + } +#endif return true; } diff --git a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc index 1c8060906..515f88c5b 100644 --- a/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc +++ b/libtransport/src/hicn/transport/core/hicn_forwarder_interface.cc @@ -78,8 +78,8 @@ std::unique_ptr<RouteToSelfCommand> createCommandRoute( #ifndef _WIN32 strcpy(command->symbolic_or_connid, identifier); #else - strcpy_s(route_to_self->symbolic_or_connid, - strlen(route_to_self->symbolic_or_connid), identifier); + strcpy_s(command->symbolic_or_connid, + strlen(command->symbolic_or_connid), identifier); #endif command->cost = 1; command->len = (uint8_t)prefix_length; @@ -99,8 +99,8 @@ std::unique_ptr<DeleteSelfConnectionCommand> createCommandDeleteConnection() { #ifndef _WIN32 strcpy(command->symbolic_or_connid, identifier); #else - strcpy_s(route_to_self->symbolic_or_connid, - strlen(route_to_self->symbolic_or_connid), identifier); + strcpy_s(command->symbolic_or_connid, + strlen(command->symbolic_or_connid), identifier); #endif return command; @@ -122,7 +122,7 @@ void HicnForwarderInterface::connect(bool is_consumer) { connector_.connect(); } void HicnForwarderInterface::registerRoute(Prefix &prefix) { auto command = - createCommandRoute(prefix.toSockaddr(), prefix.getPrefixLength()) + createCommandRoute(prefix.toSockaddr(), (uint8_t)prefix.getPrefixLength()) .release(); send((uint8_t *)command, sizeof(RouteToSelfCommand), [command]() { delete command; }); diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.h b/libtransport/src/hicn/transport/interfaces/socket_consumer.h index a50aeb583..ceed53954 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_consumer.h +++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.h @@ -430,11 +430,11 @@ class ConsumerSocket : public BaseSocket { 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_; break; case GeneralTransportOptions::OUTPUT_BUFFER_SIZE: - socket_option_value = output_buffer_size_; + socket_option_value = (uint32_t)output_buffer_size_; break; case GeneralTransportOptions::MAX_INTEREST_RETX: diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.h b/libtransport/src/hicn/transport/interfaces/socket_producer.h index 1fdbabe2e..d3738dc59 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_producer.h +++ b/libtransport/src/hicn/transport/interfaces/socket_producer.h @@ -331,15 +331,15 @@ class ProducerSocket : public Socket<BasePortal>, uint32_t &socket_option_value) { switch (socket_option_key) { case GeneralTransportOptions::INPUT_BUFFER_SIZE: - socket_option_value = input_buffer_capacity_; + socket_option_value = (uint32_t)input_buffer_capacity_; break; case GeneralTransportOptions::OUTPUT_BUFFER_SIZE: - socket_option_value = output_buffer_.getLimit(); + socket_option_value = (uint32_t)output_buffer_.getLimit(); break; case GeneralTransportOptions::DATA_PACKET_SIZE: - socket_option_value = data_packet_size_; + socket_option_value = (uint32_t)data_packet_size_; break; case GeneralTransportOptions::CONTENT_OBJECT_EXPIRY_TIME: diff --git a/libtransport/src/hicn/transport/protocols/indexing_manager.h b/libtransport/src/hicn/transport/protocols/indexing_manager.h index 888b17d9d..c692695a3 100644 --- a/libtransport/src/hicn/transport/protocols/indexing_manager.h +++ b/libtransport/src/hicn/transport/protocols/indexing_manager.h @@ -122,7 +122,7 @@ class IncrementalIndexManager : public IndexVerificationManager { public: IncrementalIndexManager(interface::ConsumerSocket *icn_socket) : socket_(icn_socket), - final_suffix_(std::numeric_limits<uint64_t>::max()), + final_suffix_(std::numeric_limits<uint32_t>::max()), next_download_suffix_(0), next_reassembly_suffix_(0), verification_manager_( @@ -134,7 +134,7 @@ class IncrementalIndexManager : public IndexVerificationManager { virtual ~IncrementalIndexManager() {} TRANSPORT_ALWAYS_INLINE virtual void reset() override { - final_suffix_ = std::numeric_limits<uint64_t>::max(); + final_suffix_ = std::numeric_limits<uint32_t>::max(); next_download_suffix_ = 0; next_reassembly_suffix_ = 0; } @@ -157,7 +157,7 @@ class IncrementalIndexManager : public IndexVerificationManager { } TRANSPORT_ALWAYS_INLINE virtual bool isFinalSuffixDiscovered() override { - return final_suffix_ != std::numeric_limits<uint64_t>::max(); + return final_suffix_ != std::numeric_limits<uint32_t>::max(); } TRANSPORT_ALWAYS_INLINE virtual uint32_t getFinalSuffix() override { @@ -182,9 +182,9 @@ class IncrementalIndexManager : public IndexVerificationManager { protected: interface::ConsumerSocket *socket_; - uint64_t final_suffix_; - uint64_t next_download_suffix_; - uint64_t next_reassembly_suffix_; + uint32_t final_suffix_; + uint32_t next_download_suffix_; + uint32_t next_reassembly_suffix_; std::unique_ptr<VerificationManager> verification_manager_; }; diff --git a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc index 1afb4eaac..2d7d8de3e 100644 --- a/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc +++ b/libtransport/src/hicn/transport/protocols/manifest_indexing_manager.cc @@ -111,7 +111,7 @@ bool ManifestIndexManager::onManifest( // Send as many manifest as required for filling window. do { segment_count += segments_in_manifest; - next_manifest_ += segments_in_manifest; + next_manifest_ += (uint32_t)segments_in_manifest; Interest::Ptr interest = getPacket(); name.setSuffix(next_manifest_); @@ -156,7 +156,7 @@ bool ManifestIndexManager::onContentObject( bool ret = false; - 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); diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc index f5eb48bd8..cd3a6cb85 100644 --- a/libtransport/src/hicn/transport/protocols/raaqm.cc +++ b/libtransport/src/hicn/transport/protocols/raaqm.cc @@ -151,7 +151,7 @@ void RaaqmTransportProtocol::afterContentReception( increaseWindow(); updateRtt(interest.getName().getSuffix()); this->rate_estimator_->onDataReceived((int)content_object.payloadSize() + - content_object.headerSize()); + (int)content_object.headerSize()); // Set drop probablility and window size accordingly RAAQM(); } @@ -468,7 +468,7 @@ void RaaqmTransportProtocol::sendInterest(std::uint64_t next_suffix) { auto interest = getPacket(); core::Name *name; socket_->getSocketOption(GeneralTransportOptions::NETWORK_NAME, &name); - name->setSuffix(next_suffix); + name->setSuffix((uint32_t)next_suffix); interest->setName(*name); uint32_t interest_lifetime; @@ -522,7 +522,7 @@ void RaaqmTransportProtocol::updateRtt(uint64_t segment) { now - interest_timepoints_[segment & mask]); // Update stats - updateStats(segment, rtt.count(), now); + updateStats((uint32_t)segment, rtt.count(), now); if (this->rate_estimator_) { this->rate_estimator_->onRttUpdate((double)rtt.count()); diff --git a/libtransport/src/hicn/transport/protocols/reassembly.cc b/libtransport/src/hicn/transport/protocols/reassembly.cc index 36cfb89a7..53180935c 100644 --- a/libtransport/src/hicn/transport/protocols/reassembly.cc +++ b/libtransport/src/hicn/transport/protocols/reassembly.cc @@ -41,7 +41,7 @@ void BaseReassembly::reassemble(ContentObject::Ptr &&content_object) { content_object->getName().getSuffix(), std::move(content_object))); } - auto it = received_packets_.find(index_); + auto it = received_packets_.find((const unsigned int)index_); while (it != received_packets_.end()) { if (it->second->getPayloadType() == PayloadType::CONTENT_OBJECT) { copyContent(*it->second); @@ -49,7 +49,7 @@ void BaseReassembly::reassemble(ContentObject::Ptr &&content_object) { } index_ = index_manager_->getNextReassemblySegment(); - it = received_packets_.find(index_); + it = received_packets_.find((const unsigned int)index_); } } |