aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/core')
-rw-r--r--libtransport/src/core/fec.cc4
-rw-r--r--libtransport/src/core/global_configuration.cc3
-rw-r--r--libtransport/src/core/interest.cc2
-rw-r--r--libtransport/src/core/io_module.cc4
-rw-r--r--libtransport/src/core/portal.cc4
-rw-r--r--libtransport/src/core/prefix.cc8
-rw-r--r--libtransport/src/core/rs.cc21
-rw-r--r--libtransport/src/core/rs.h2
8 files changed, 33 insertions, 15 deletions
diff --git a/libtransport/src/core/fec.cc b/libtransport/src/core/fec.cc
index 134198b9e..0ce9625a2 100644
--- a/libtransport/src/core/fec.cc
+++ b/libtransport/src/core/fec.cc
@@ -55,13 +55,15 @@
* https://gcc.gnu.org/bugzilla//show_bug.cgi?id=88059
*/
#ifndef __clang__
+#ifndef _WIN32
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#endif
+#endif
/*
* compatibility stuff
*/
-#ifdef MSDOS /* but also for others, e.g. sun... */
+#if defined (MSDOS) || defined (_WIN32) /* but also for others, e.g. sun... */
#define NEED_BCOPY
#define bcmp(a,b,n) memcmp(a,b,n)
#endif
diff --git a/libtransport/src/core/global_configuration.cc b/libtransport/src/core/global_configuration.cc
index e0b6c040a..3e37a30a4 100644
--- a/libtransport/src/core/global_configuration.cc
+++ b/libtransport/src/core/global_configuration.cc
@@ -32,7 +32,7 @@ bool GlobalConfiguration::parseTransportConfig(const std::string& path) {
try {
cfg.readFile(path.c_str());
} catch (const FileIOException& fioex) {
- TRANSPORT_LOGE("I/O error while reading file.");
+ TRANSPORT_LOGE("I/O error while reading file: %s", fioex.what());
return false;
} catch (const ParseException& pex) {
TRANSPORT_LOGE("Parse error at %s:%d - %s", pex.getFile(), pex.getLine(),
@@ -67,6 +67,7 @@ void GlobalConfiguration::parseConfiguration(const std::string& path) {
// Check if an environment variable with the configuration path exists. COnf
// variable comes first.
std::unique_lock<std::mutex> lck(cp_mtx_);
+
if (const char* env_c = std::getenv(GlobalConfiguration::conf_file)) {
parseTransportConfig(env_c);
} else if (!path.empty()) {
diff --git a/libtransport/src/core/interest.cc b/libtransport/src/core/interest.cc
index 06cbe9f81..b4a74762d 100644
--- a/libtransport/src/core/interest.cc
+++ b/libtransport/src/core/interest.cc
@@ -175,7 +175,7 @@ void Interest::encodeSuffixes() {
// We assume interest does not hold signature for the moment.
auto int_manifest_header =
(InterestManifestHeader *)(writableData() + headerSize());
- int_manifest_header->n_suffixes = suffix_set_.size();
+ int_manifest_header->n_suffixes = (uint32_t)suffix_set_.size();
std::size_t additional_length =
int_manifest_header->n_suffixes * sizeof(uint32_t);
diff --git a/libtransport/src/core/io_module.cc b/libtransport/src/core/io_module.cc
index fef0c1504..7c2ec2cab 100644
--- a/libtransport/src/core/io_module.cc
+++ b/libtransport/src/core/io_module.cc
@@ -13,12 +13,16 @@
* limitations under the License.
*/
+#ifndef _WIN32
#include <dlfcn.h>
+#endif
#include <hicn/transport/core/io_module.h>
#include <hicn/transport/utils/log.h>
#ifdef ANDROID
#include <io_modules/udp/hicn_forwarder_module.h>
+#elif _WIN32
+#include <hicn/util/windows/windows_utils.h>
#endif
#include <deque>
diff --git a/libtransport/src/core/portal.cc b/libtransport/src/core/portal.cc
index d1d26c5b7..33335e542 100644
--- a/libtransport/src/core/portal.cc
+++ b/libtransport/src/core/portal.cc
@@ -33,6 +33,8 @@ static const constexpr char default_module[] = "";
static const constexpr char default_module[] = "hicnlight_module.dylib";
#elif defined(LINUX)
static const constexpr char default_module[] = "hicnlight_module.so";
+#elif defined(WINDOWS)
+static const constexpr char default_module[] = "hicnlight_module.lib";
#endif
IoModuleConfiguration Portal::conf_;
@@ -69,6 +71,8 @@ std::string getIoModulePath(const std::string& name,
std::string extension = ".so";
#elif defined(MACINTOSH)
std::string extension = ".dylib";
+#elif defined(WINDOWS)
+ std::string extension = ".lib";
#else
#error "Platform not supported.";
#endif
diff --git a/libtransport/src/core/prefix.cc b/libtransport/src/core/prefix.cc
index 1e2b2ed9d..d598cff75 100644
--- a/libtransport/src/core/prefix.cc
+++ b/libtransport/src/core/prefix.cc
@@ -69,7 +69,7 @@ Prefix::Prefix(const core::Name &content_name, uint16_t prefix_length) {
}
ip_prefix_ = content_name.toIpAddress();
- ip_prefix_.len = prefix_length;
+ ip_prefix_.len = (u8)prefix_length;
ip_prefix_.family = family;
}
@@ -95,7 +95,7 @@ void Prefix::buildPrefix(std::string &prefix, uint16_t prefix_length,
throw errors::InvalidIpAddressException();
}
- ip_prefix_.len = prefix_length;
+ ip_prefix_.len = (u8)prefix_length;
ip_prefix_.family = family;
}
@@ -123,7 +123,7 @@ std::unique_ptr<Sockaddr> Prefix::toSockaddr() const {
uint16_t Prefix::getPrefixLength() const { return ip_prefix_.len; }
Prefix &Prefix::setPrefixLength(uint16_t prefix_length) {
- ip_prefix_.len = prefix_length;
+ ip_prefix_.len = (u8)prefix_length;
return *this;
}
@@ -228,7 +228,7 @@ Name Prefix::getRandomName() const {
size_t size = (size_t)ceil((float)addr_len / 8.0);
uint8_t *buffer = (uint8_t *)malloc(sizeof(uint8_t) * size);
- RAND_bytes(buffer, size);
+ RAND_bytes(buffer, (int)size);
int j = 0;
for (uint8_t i = (uint8_t)ceil((float)ip_prefix_.len / 8.0);
diff --git a/libtransport/src/core/rs.cc b/libtransport/src/core/rs.cc
index 44b5852e5..33270736d 100644
--- a/libtransport/src/core/rs.cc
+++ b/libtransport/src/core/rs.cc
@@ -70,8 +70,8 @@ bool BlockCode::addSymbol(const fec::buffer &packet, uint32_t i,
}
void BlockCode::encode() {
- gf *data[n_];
- std::uint16_t old_values[k_];
+ gf **data = new gf*[k_];
+ uint32_t *old_values = new uint32_t[k_];
uint32_t base = operator[](0).first;
// Set packet length in first 2 bytes
@@ -93,9 +93,10 @@ void BlockCode::encode() {
uint16_t *length = reinterpret_cast<uint16_t *>(packet->writableData());
old_values[i] = *length;
- *length = htons(packet->length() - LEN_SIZE_BYTES);
+ *length = htons(u_short(packet->length() - LEN_SIZE_BYTES));
data[i] = packet->writableData();
+
}
// Finish to fill source block with the buffers to hold the repair symbols
@@ -121,7 +122,7 @@ void BlockCode::encode() {
TRANSPORT_LOGD("Calling encode with max_buffer_size_ = %zu",
max_buffer_size_);
for (uint32_t i = k_; i < n_; i++) {
- fec_encode(code_, data, data[i], i, max_buffer_size_ + LEN_SIZE_BYTES);
+ fec_encode(code_, data, data[i], i, (int)(max_buffer_size_ + LEN_SIZE_BYTES));
}
// Restore original content of buffer space used to store the length
@@ -138,11 +139,13 @@ void BlockCode::encode() {
TRANSPORT_LOGD("Produced repair symbol of size = %zu", packet->length());
packet->prepend(sizeof(fec_header));
}
+ delete [] data;
+ delete [] old_values;
}
void BlockCode::decode() {
- gf *data[k_];
- uint32_t index[k_];
+ gf **data = new gf*[k_];
+ uint32_t *index = new uint32_t[k_];
for (uint32_t i = 0; i < k_; i++) {
auto &packet = operator[](i).second;
@@ -161,7 +164,7 @@ void BlockCode::decode() {
packet->ensureCapacityAndFillUnused(max_buffer_size_, 0);
uint16_t *length = reinterpret_cast<uint16_t *>(packet->writableData());
- *length = htons(packet->length() - LEN_SIZE_BYTES);
+ *length = htons(u_short(packet->length() - LEN_SIZE_BYTES));
} else {
TRANSPORT_LOGD("DECODE SYMBOL - index %u - Current buffer size: %zu",
index[i], packet->length());
@@ -169,12 +172,14 @@ void BlockCode::decode() {
}
data[i] = packet->writableData();
+ delete [] data;
+ delete [] index;
}
// We decode the source block
TRANSPORT_LOGD("Calling decode with max_buffer_size_ = %zu",
max_buffer_size_);
- fec_decode(code_, data, reinterpret_cast<int *>(index), max_buffer_size_);
+ fec_decode(code_, data, reinterpret_cast<int *>(index), (int)max_buffer_size_);
// Find the index in the block for recovered packets
for (uint32_t i = 0; i < k_; i++) {
diff --git a/libtransport/src/core/rs.h b/libtransport/src/core/rs.h
index d630bd233..9a8c43e4d 100644
--- a/libtransport/src/core/rs.h
+++ b/libtransport/src/core/rs.h
@@ -14,7 +14,9 @@
* limitations under the License.
*/
+#ifndef _WIN32
#include <arpa/inet.h>
+#endif
#include <hicn/transport/utils/membuf.h>
#include <protocols/fec_base.h>