aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2021-04-30 12:26:57 +0200
committerAngelo Mantellini <angelo.mantellini@cisco.com>2021-04-30 14:54:00 +0200
commit07133ac060c2af721941f7b47c52c075df3168ba (patch)
treea3a618442fc9f1adb5f1cf2e3d442c70fd787d2b /hicn-light/src
parent39e15ebb3805efb6c71a1dd16f18061cd86487cf (diff)
[HICN-703] Update windows-sdk and hicn code
Signed-off-by: Angelo Mantellini <@ngelo.mantellini@cisco.com> Change-Id: I05e4c92ce7de3640f0272afae127e1377862bd3e Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Diffstat (limited to 'hicn-light/src')
-rw-r--r--hicn-light/src/hicn/command_line/controller/CMakeLists.txt5
-rw-r--r--hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c1
-rw-r--r--hicn-light/src/hicn/command_line/daemon/CMakeLists.txt4
-rw-r--r--hicn-light/src/hicn/config/commandOps.c1
-rw-r--r--hicn-light/src/hicn/config/configurationListeners.c2
-rw-r--r--hicn-light/src/hicn/config/controlSetStrategy.c2
-rw-r--r--hicn-light/src/hicn/core/nameBitvector.c6
-rw-r--r--hicn-light/src/hicn/io/udpConnection.c2
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.c72
9 files changed, 53 insertions, 42 deletions
diff --git a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
index 949cace28..68caa7dc8 100644
--- a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
@@ -14,6 +14,11 @@
list(APPEND CONTROLLER_SRC
hicnLightControl_main.c
)
+
+if (WIN32)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"LIBCMT\"" )
+endif()
+
if (NOT DISABLE_EXECUTABLES)
build_executable(${HICN_LIGHT_CONTROL}
SOURCES ${CONTROLLER_SRC}
diff --git a/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c b/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
index 31b9674ca..e6a97c4e2 100644
--- a/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
+++ b/hicn-light/src/hicn/command_line/controller/hicnLightControl_main.c
@@ -16,6 +16,7 @@
#include <hicn/hicn-light/config.h>
#include <hicn/utils/utils.h>
+
#ifndef _WIN32
#include <arpa/inet.h>
#include <getopt.h>
diff --git a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
index 1ab8a4e6f..ce62b51e2 100644
--- a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
@@ -14,6 +14,10 @@
list(APPEND DAEMON_SRC
hicnLightDaemon_main.c
)
+if (WIN32)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:\"LIBCMT\"" )
+endif()
+
if (NOT DISABLE_EXECUTABLES)
build_executable(${HICN_LIGHT_DAEMON}
SOURCES ${DAEMON_SRC}
diff --git a/hicn-light/src/hicn/config/commandOps.c b/hicn-light/src/hicn/config/commandOps.c
index dd8e148d0..b00e48e2a 100644
--- a/hicn-light/src/hicn/config/commandOps.c
+++ b/hicn-light/src/hicn/config/commandOps.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+
#include <hicn/hicn-light/config.h>
#include <stdbool.h>
#include <stdint.h>
diff --git a/hicn-light/src/hicn/config/configurationListeners.c b/hicn-light/src/hicn/config/configurationListeners.c
index b862b98f4..31a0c4776 100644
--- a/hicn-light/src/hicn/config/configurationListeners.c
+++ b/hicn-light/src/hicn/config/configurationListeners.c
@@ -598,7 +598,7 @@ void configurationListeners_SetupAll(const Configuration *config, uint16_t port,
// Do not start on link address
char listenerName[SYMBOLIC_NAME_LEN];
-#ifdef __ANDROID__
+#if defined(__ANDROID__) || defined(_WIN32)
snprintf(listenerName, SYMBOLIC_NAME_LEN, "local_%zu", i);
#else
snprintf(listenerName, SYMBOLIC_NAME_LEN, "local_%ld", i);
diff --git a/hicn-light/src/hicn/config/controlSetStrategy.c b/hicn-light/src/hicn/config/controlSetStrategy.c
index 3229c1864..fe0ba84a0 100644
--- a/hicn-light/src/hicn/config/controlSetStrategy.c
+++ b/hicn-light/src/hicn/config/controlSetStrategy.c
@@ -228,7 +228,7 @@ static CommandReturn _controlSetStrategy_Execute(CommandParser *parser,
if(parcList_Size(args) > 4){
uint32_t index = 4; //first realted prefix
uint32_t addr_index = 0;
- setStrategyCommand->related_prefixes = parcList_Size(args) - 4;
+ setStrategyCommand->related_prefixes = (uint8_t)parcList_Size(args) - 4;
while(index < parcList_Size(args)){
const char *str = parcList_GetAtIndex(args, index);
char *rel_addr = (char *)malloc(sizeof(char) * (strlen(str) + 1));
diff --git a/hicn-light/src/hicn/core/nameBitvector.c b/hicn-light/src/hicn/core/nameBitvector.c
index cc13bf610..653560750 100644
--- a/hicn-light/src/hicn/core/nameBitvector.c
+++ b/hicn-light/src/hicn/core/nameBitvector.c
@@ -243,13 +243,13 @@ uint32_t nameBitvector_lpm(const NameBitvector *a,
prefix_len = (uint32_t)(BV_SIZE - (_diff_bit_log2(diff) + 1));
//printf("if 1 diff = %lu plen = %d\n", diff, prefix_len);
}else{
- prefix_len = BV_SIZE;
+ prefix_len = (uint32_t)BV_SIZE;
diff = a->bits[1] ^ b->bits[1];
if(diff){
- prefix_len += (BV_SIZE - (_diff_bit_log2(diff) + 1));
+ prefix_len += (uint32_t)(BV_SIZE - (_diff_bit_log2(diff) + 1));
//printf("if 2 diff = %lu plen = %d\n", diff, prefix_len);
}else{
- prefix_len += BV_SIZE;
+ prefix_len += (uint32_t)BV_SIZE;
}
}
diff --git a/hicn-light/src/hicn/io/udpConnection.c b/hicn-light/src/hicn/io/udpConnection.c
index cd3ccc84a..2747b7ef4 100644
--- a/hicn-light/src/hicn/io/udpConnection.c
+++ b/hicn-light/src/hicn/io/udpConnection.c
@@ -335,7 +335,7 @@ static bool _sendIOVBuffer(IoOperations *ops, struct iovec *message,
dataBuf[i].len = (ULONG)message[i].iov_len;
}
- int rc = WSASendTo(udpConnState->udpListenerSocket, dataBuf, size,
+ int rc = WSASendTo(udpConnState->udpListenerSocket, dataBuf, (DWORD)size,
&BytesSent, 0, (SOCKADDR *)udpConnState->peerAddress,
udpConnState->peerAddressLength, NULL, NULL);
free(dataBuf);
diff --git a/hicn-light/src/hicn/processor/fibEntry.c b/hicn-light/src/hicn/processor/fibEntry.c
index 30bcc1f9a..00e8dfa11 100644
--- a/hicn-light/src/hicn/processor/fibEntry.c
+++ b/hicn-light/src/hicn/processor/fibEntry.c
@@ -631,38 +631,38 @@ void fibEntry_ReceiveObjectMessage(const FibEntry *fibEntry,
continue;
if (connection_HasTag(conn, POLICY_TAG_WIRED)) {
fibEntry->policy_counters.wired.num_packets++;
- fibEntry->policy_counters.wired.num_bytes += msg_size;
- fibEntry->policy.stats.wired.latency = \
+ fibEntry->policy_counters.wired.num_bytes += (uint32_t)msg_size;
+ fibEntry->policy.stats.wired.latency = (float) (\
ALPHA * fibEntry->policy.stats.wired.latency + \
- (1 - ALPHA) * (double)rtt;
+ (1 - ALPHA) * (double)rtt);
fibEntry->policy_counters.wired.latency_idle = 0;
}
if (connection_HasTag(conn, POLICY_TAG_WIFI)) {
fibEntry->policy_counters.wifi.num_packets++;
- fibEntry->policy_counters.wifi.num_bytes += msg_size;
- fibEntry->policy.stats.wifi.latency = \
+ fibEntry->policy_counters.wifi.num_bytes += (uint32_t)msg_size;
+ fibEntry->policy.stats.wifi.latency = (float)(\
ALPHA * fibEntry->policy.stats.wifi.latency + \
- (1 - ALPHA) * (double)rtt;
+ (1 - ALPHA) * (double)rtt);
fibEntry->policy_counters.wifi.latency_idle = 0;
}
if (connection_HasTag(conn, POLICY_TAG_CELLULAR)) {
fibEntry->policy_counters.cellular.num_packets++;
- fibEntry->policy_counters.cellular.num_bytes += msg_size;
- fibEntry->policy.stats.cellular.latency = \
+ fibEntry->policy_counters.cellular.num_bytes += (uint32_t)msg_size;
+ fibEntry->policy.stats.cellular.latency = (float)(\
ALPHA * fibEntry->policy.stats.cellular.latency + \
- (1 - ALPHA) * (double)rtt;
+ (1 - ALPHA) * (double)rtt);
fibEntry->policy_counters.cellular.latency_idle = 0;
}
}
- fibEntry->policy.stats.all.latency = \
+ fibEntry->policy.stats.all.latency = (float)(\
ALPHA * fibEntry->policy.stats.all.latency + \
- (1 - ALPHA) * (double)rtt;
+ (1 - ALPHA) * (double)rtt);
fibEntry->policy_counters.all.latency_idle = 0;
fibEntry->policy_counters.all.num_packets++;
- fibEntry->policy_counters.all.num_bytes += msg_size;
+ fibEntry->policy_counters.all.num_bytes += (uint32_t)msg_size;
#endif /* WITH_POLICY */
@@ -716,17 +716,17 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
/* a) throughput */
if (fibEntry->policy_counters.wired.num_bytes > 0) {
- throughput = fibEntry->policy_counters.wired.num_bytes / \
- (now - fibEntry->policy_counters.last_update) ;
+ throughput = (float)(fibEntry->policy_counters.wired.num_bytes / \
+ (now - fibEntry->policy_counters.last_update)) ;
throughput = throughput * 8 / 1024;
if (throughput < 0)
throughput = 0;
} else {
throughput = 0;
}
- fibEntry->policy.stats.wired.throughput = \
+ fibEntry->policy.stats.wired.throughput = (float)(\
ALPHA * fibEntry->policy.stats.wired.throughput + \
- (1-ALPHA) * throughput;
+ (1-ALPHA) * throughput);
/* b) loss rate */
if ((fibEntry->policy_counters.wired.num_losses > 0) && \
@@ -737,9 +737,9 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
} else {
loss_rate = 0;
}
- fibEntry->policy.stats.wired.loss_rate = \
+ fibEntry->policy.stats.wired.loss_rate = (float)(\
ALPHA * fibEntry->policy.stats.wired.loss_rate + \
- (1-ALPHA) * loss_rate;
+ (1-ALPHA) * loss_rate);
/* Latency */
fibEntry->policy_counters.wired.latency_idle++;
@@ -763,17 +763,17 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
/* a) throughput */
if (fibEntry->policy_counters.wifi.num_bytes > 0) {
- throughput = fibEntry->policy_counters.wifi.num_bytes / \
- (now - fibEntry->policy_counters.last_update);
+ throughput = (float)(fibEntry->policy_counters.wifi.num_bytes / \
+ (now - fibEntry->policy_counters.last_update));
throughput = throughput * 8 / 1024;
if (throughput < 0)
throughput = 0;
} else {
throughput = 0;
}
- fibEntry->policy.stats.wifi.throughput = \
+ fibEntry->policy.stats.wifi.throughput = (float)( \
ALPHA * fibEntry->policy.stats.wifi.throughput + \
- (1-ALPHA) * throughput;
+ (1-ALPHA) * throughput);
/* b) loss rate */
if ((fibEntry->policy_counters.wifi.num_losses > 0) && \
@@ -784,9 +784,9 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
} else {
loss_rate = 0;
}
- fibEntry->policy.stats.wifi.loss_rate = \
+ fibEntry->policy.stats.wifi.loss_rate = (float)(\
ALPHA * fibEntry->policy.stats.wifi.loss_rate + \
- (1-ALPHA) * loss_rate;
+ (1-ALPHA) * loss_rate);
fibEntry->policy_counters.wifi.num_bytes = 0;
fibEntry->policy_counters.wifi.num_losses = 0;
@@ -796,17 +796,17 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
/* a) throughput */
if (fibEntry->policy_counters.cellular.num_bytes > 0) {
- throughput = fibEntry->policy_counters.cellular.num_bytes / \
- (now - fibEntry->policy_counters.last_update) ;
+ throughput = (float)(fibEntry->policy_counters.cellular.num_bytes / \
+ (now - fibEntry->policy_counters.last_update)) ;
throughput = throughput * 8 / 1024;
if (throughput < 0)
throughput = 0;
} else {
throughput = 0;
}
- fibEntry->policy.stats.cellular.throughput = \
+ fibEntry->policy.stats.cellular.throughput = (float)( \
ALPHA * fibEntry->policy.stats.cellular.throughput + \
- (1-ALPHA) * throughput;
+ (1-ALPHA) * throughput);
/* b) loss rate */
if ((fibEntry->policy_counters.cellular.num_losses > 0) && \
@@ -817,9 +817,9 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
} else {
loss_rate = 0;
}
- fibEntry->policy.stats.cellular.loss_rate = \
+ fibEntry->policy.stats.cellular.loss_rate = (float)( \
ALPHA * fibEntry->policy.stats.cellular.loss_rate + \
- (1-ALPHA) * loss_rate;
+ (1-ALPHA) * loss_rate);
fibEntry->policy_counters.cellular.num_bytes = 0;
fibEntry->policy_counters.cellular.num_losses = 0;
@@ -829,17 +829,17 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
/* a) throughput */
if (fibEntry->policy_counters.all.num_bytes > 0) {
- throughput = fibEntry->policy_counters.all.num_bytes / \
- (now - fibEntry->policy_counters.last_update);
+ throughput = (float)( fibEntry->policy_counters.all.num_bytes / \
+ (now - fibEntry->policy_counters.last_update));
throughput = throughput * 8 / 1024;
if (throughput < 0)
throughput = 0;
} else {
throughput = 0;
}
- fibEntry->policy.stats.all.throughput = \
+ fibEntry->policy.stats.all.throughput = (float)(\
ALPHA * fibEntry->policy.stats.all.throughput + \
- (1-ALPHA) * throughput;
+ (1-ALPHA) * throughput);
/* b) loss rate */
if ((fibEntry->policy_counters.all.num_losses > 0) && \
@@ -850,9 +850,9 @@ void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now) {
} else {
loss_rate = 0;
}
- fibEntry->policy.stats.all.loss_rate = \
+ fibEntry->policy.stats.all.loss_rate = (float)(\
ALPHA * fibEntry->policy.stats.all.loss_rate + \
- (1-ALPHA) * loss_rate;
+ (1-ALPHA) * loss_rate);
fibEntry->policy_counters.all.num_bytes = 0;
fibEntry->policy_counters.all.num_losses = 0;