summaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-02-10 13:34:22 +0100
committerAngelo Mantellini <manangel@cisco.com>2019-02-10 14:23:51 +0100
commit1ac41cb08281bf5460dfea5fc40ff6f8e14873a1 (patch)
tree3926983e45afa7e805cca1429fc3452c57a5b6c3 /hicn-light
parent13ec18b4b3ec8455daad674a0c0e616885b83608 (diff)
[HICN-49] Remove warnings hicn-light on windows
Change-Id: I106713c285ad5cc47cb5ae3aaf9c837685156e36 Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/CMakeLists.txt4
-rw-r--r--hicn-light/src/command_line/controller/hicnLightControl_main.c21
-rw-r--r--hicn-light/src/command_line/daemon/hicnLightDaemon_main.c14
-rw-r--r--hicn-light/src/config/commandOps.c2
-rw-r--r--hicn-light/src/config/commandParser.c4
-rw-r--r--hicn-light/src/config/configuration.c2
-rw-r--r--hicn-light/src/config/controlRemoveRoute.c8
-rw-r--r--hicn-light/src/config/controlState.c2
-rw-r--r--hicn-light/src/core/forwarder.c2
-rw-r--r--hicn-light/src/core/mapMe.c9
-rw-r--r--hicn-light/src/core/message.c8
-rw-r--r--hicn-light/src/core/nameBitvector.c10
-rw-r--r--hicn-light/src/io/udpConnection.c2
-rw-r--r--hicn-light/src/io/udpListener.c11
-rw-r--r--hicn-light/src/platforms/windows/win_portability.h11
-rw-r--r--hicn-light/src/processor/fib.c2
-rw-r--r--hicn-light/src/processor/fibEntry.c2
-rw-r--r--hicn-light/src/socket/api.h3
-rw-r--r--hicn-light/src/strategies/loadBalancer.c6
-rw-r--r--hicn-light/src/strategies/loadBalancerWithPD.c10
-rw-r--r--hicn-light/src/strategies/rnd.c8
-rw-r--r--hicn-light/src/strategies/rndSegment.c8
22 files changed, 71 insertions, 78 deletions
diff --git a/hicn-light/CMakeLists.txt b/hicn-light/CMakeLists.txt
index c8579c70b..7df740b4c 100644
--- a/hicn-light/CMakeLists.txt
+++ b/hicn-light/CMakeLists.txt
@@ -21,7 +21,9 @@ include( detectCacheSize )
if(NOT WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
-endif()
+else ()
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996")
+endif ()
if(ANDROID_API)
message("############ Detected cross compile for $ENV{CMAKE_SYSTEM_NAME}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ANDROID_C_FLAGS}")
diff --git a/hicn-light/src/command_line/controller/hicnLightControl_main.c b/hicn-light/src/command_line/controller/hicnLightControl_main.c
index ff1a20ab0..3d6f0bdbf 100644
--- a/hicn-light/src/command_line/controller/hicnLightControl_main.c
+++ b/hicn-light/src/command_line/controller/hicnLightControl_main.c
@@ -81,7 +81,6 @@ typedef struct controller_main_state {
} ControlMainState;
static void _printRed(const char *output) {
-
#ifndef _WIN32
printf("\033[0;31m%s", output);
#else
@@ -95,15 +94,13 @@ static void _printRed(const char *output) {
printf("%s", output);
SetConsoleTextAttribute(hConsole, currentConsoleAttr);
#endif
-
}
static void _printWhite(const char *output) {
-
#ifndef _WIN32
- printf("\033[0m%s", output);
+ printf("\033[0m%s", output);
#else
- HANDLE hConsole = NULL;
+ HANDLE hConsole = NULL;
WORD currentConsoleAttr;
CONSOLE_SCREEN_BUFFER_INFO csbi;
SetConsoleTextAttribute(hConsole, 7);
@@ -113,7 +110,6 @@ static void _printWhite(const char *output) {
printf("%s", output);
SetConsoleTextAttribute(hConsole, currentConsoleAttr);
#endif
-
}
static void _displayForwarderLogo(void) {
@@ -125,7 +121,9 @@ static void _displayForwarderLogo(void) {
_printWhite(" / _ \\ / // __// _ \\___/ // // _ `// _ \\/ __/\n");
_printRed("/_/ /____/(_)/_/ \\___/ ");
_printWhite("/_//_//_/ \\__//_//_/ /_//_/ \\_, //_//_/\\__/\n");
- _printWhite(" /___/ \n");
+ _printWhite(
+ " /___/ "
+ "\n");
printf("\n");
}
@@ -207,8 +205,8 @@ struct iovec *_writeAndReadMessage(ControlState *state, struct iovec *msg) {
if (write(sockfd, msg[0].iov_base, (unsigned int)msg[0].iov_len) < 0 ||
write(sockfd, msg[1].iov_base, (unsigned int)msg[1].iov_len) < 0) {
#else
- if (send(sockfd, msg[0].iov_base, msg[0].iov_len, 0) == SOCKET_ERROR ||
- send(sockfd, msg[1].iov_base, msg[1].iov_len, 0) == SOCKET_ERROR) {
+ if (send(sockfd, msg[0].iov_base, (int)msg[0].iov_len, 0) == SOCKET_ERROR ||
+ send(sockfd, msg[1].iov_base, (int)msg[1].iov_len, 0) == SOCKET_ERROR) {
#endif
printf("\nError while sending the Message: cannot write on socket \n");
exit(EXIT_FAILURE);
@@ -219,7 +217,7 @@ struct iovec *_writeAndReadMessage(ControlState *state, struct iovec *msg) {
#ifndef _WIN32
if (write(sockfd, msg[0].iov_base, msg[0].iov_len) < 0) {
#else
- int result = send(sockfd, msg[0].iov_base, msg[0].iov_len, 0);
+ int result = send(sockfd, msg[0].iov_base, (int)msg[0].iov_len, 0);
if (result == SOCKET_ERROR) {
#endif
printf("\nError while sending the Message: cannot write on socket \n");
@@ -233,7 +231,8 @@ struct iovec *_writeAndReadMessage(ControlState *state, struct iovec *msg) {
header_control_message *headerResponse =
(header_control_message *)parcMemory_AllocateAndClear(
sizeof(header_control_message));
- if (recv(sockfd, headerResponse, sizeof(header_control_message), 0) < 0) {
+ if (recv(sockfd, (char *)headerResponse, sizeof(header_control_message), 0) <
+ 0) {
printf("\nError in Receiving the Message \n");
exit(EXIT_FAILURE);
}
diff --git a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
index 533bb9cf0..dac8ee89f 100644
--- a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
+++ b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
@@ -37,7 +37,6 @@
#include <src/core/forwarder.h>
static void _printRed(const char *output) {
-
#ifndef _WIN32
printf("\033[0;31m%s", output);
#else
@@ -45,21 +44,19 @@ static void _printRed(const char *output) {
WORD currentConsoleAttr;
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(hConsole, &csbi))
- currentConsoleAttr = csbi.wAttributes;
+ currentConsoleAttr = csbi.wAttributes;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, 4);
printf("%s", output);
SetConsoleTextAttribute(hConsole, currentConsoleAttr);
#endif
-
}
static void _printWhite(const char *output) {
-
#ifndef _WIN32
- printf("\033[0m%s", output);
+ printf("\033[0m%s", output);
#else
- HANDLE hConsole = NULL;
+ HANDLE hConsole = NULL;
WORD currentConsoleAttr;
CONSOLE_SCREEN_BUFFER_INFO csbi;
if (GetConsoleScreenBufferInfo(hConsole, &csbi))
@@ -69,7 +66,6 @@ static void _printWhite(const char *output) {
printf("%s", output);
SetConsoleTextAttribute(hConsole, currentConsoleAttr);
#endif
-
}
static void _displayForwarderLogo(void) {
@@ -81,7 +77,9 @@ static void _displayForwarderLogo(void) {
_printWhite(" / _ \\ / // __// _ \\___/ // // _ `// _ \\/ __/\n");
_printRed("/_/ /____/(_)/_/ \\___/ ");
_printWhite("/_//_//_/ \\__//_//_/ /_//_/ \\_, //_//_/\\__/\n");
- _printWhite(" /___/ \n");
+ _printWhite(
+ " /___/ "
+ "\n");
printf("\n");
}
diff --git a/hicn-light/src/config/commandOps.c b/hicn-light/src/config/commandOps.c
index 2f7ebe49d..28d3369e1 100644
--- a/hicn-light/src/config/commandOps.c
+++ b/hicn-light/src/config/commandOps.c
@@ -24,9 +24,11 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#else
+#ifndef _WIN32
extern int errno;
#endif
#endif
+#endif
#include <parc/algol/parc_Memory.h>
#include <parc/assert/parc_Assert.h>
diff --git a/hicn-light/src/config/commandParser.c b/hicn-light/src/config/commandParser.c
index 9a947d8b7..9759d2e37 100644
--- a/hicn-light/src/config/commandParser.c
+++ b/hicn-light/src/config/commandParser.c
@@ -35,9 +35,11 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#else
+#ifndef _WIN32
extern int errno;
#endif
#endif
+#endif
struct command_parser {
// key = command, value = CommandOps
@@ -122,7 +124,7 @@ static PARCList *parseStringIntoTokens(const char *originalString) {
char *tofree =
parcMemory_StringDuplicate(originalString, strlen(originalString) + 1);
char *string = tofree;
-
+
token = strtok(string, " \t\n");
while (token != NULL) {
if (strlen(token) > 0) {
diff --git a/hicn-light/src/config/configuration.c b/hicn-light/src/config/configuration.c
index 71616cd78..1a41a9642 100644
--- a/hicn-light/src/config/configuration.c
+++ b/hicn-light/src/config/configuration.c
@@ -285,7 +285,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
// send response
header_control_message *header = request[0].iov_base;
header->messageType = RESPONSE_LIGHT;
- header->length = payloadSize;
+ header->length = (unsigned)payloadSize;
struct iovec *response =
parcMemory_AllocateAndClear(sizeof(struct iovec) * 2);
diff --git a/hicn-light/src/config/controlRemoveRoute.c b/hicn-light/src/config/controlRemoveRoute.c
index f654718f8..c4efb04df 100644
--- a/hicn-light/src/config/controlRemoveRoute.c
+++ b/hicn-light/src/config/controlRemoveRoute.c
@@ -16,14 +16,14 @@
#include <src/config.h>
#include <ctype.h>
+#include <parc/algol/parc_List.h>
+#include <parc/algol/parc_Memory.h>
+#include <parc/algol/parc_Network.h>
+#include <parc/assert/parc_Assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#include <parc/assert/parc_Assert.h>
-#include <parc/algol/parc_List.h>
-#include <parc/algol/parc_Memory.h>
-#include <parc/algol/parc_Network.h>
#include <src/utils/address.h>
diff --git a/hicn-light/src/config/controlState.c b/hicn-light/src/config/controlState.c
index 96c0529ed..c3b7d535b 100644
--- a/hicn-light/src/config/controlState.c
+++ b/hicn-light/src/config/controlState.c
@@ -55,7 +55,7 @@ int controlState_connectToFwdDeamon() {
int sockfd;
struct sockaddr_in servaddr;
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ if ((sockfd = (int)socket(AF_INET, SOCK_STREAM, 0)) < 0) {
printf("\nSocket Creation Failed \n");
exit(EXIT_FAILURE);
}
diff --git a/hicn-light/src/core/forwarder.c b/hicn-light/src/core/forwarder.c
index f3af85d6c..bceb206a3 100644
--- a/hicn-light/src/core/forwarder.c
+++ b/hicn-light/src/core/forwarder.c
@@ -201,7 +201,7 @@ Forwarder *forwarder_Create(Logger *logger) {
forwarder->hicnSocketHelper = hicn_create();
if (forwarder->hicnSocketHelper == NULL) return NULL;
#endif /* __APPLE__ */
- /* ignore child */
+ /* ignore child */
#ifndef _WIN32
signal(SIGCHLD, SIG_IGN);
diff --git a/hicn-light/src/core/mapMe.c b/hicn-light/src/core/mapMe.c
index 16e631c0f..d5ed08bfb 100644
--- a/hicn-light/src/core/mapMe.c
+++ b/hicn-light/src/core/mapMe.c
@@ -65,8 +65,7 @@
#define WARN(mapme, fmt, ...) \
LOG(mapme, PARCLogLevel_Warning, fmt, ##__VA_ARGS__)
-#define ERROR(mapme, fmt, ...) \
- LOG(mapme, PARCLogLevel_Error, fmt, ##__VA_ARGS__)
+#define ERR(mapme, fmt, ...) LOG(mapme, PARCLogLevel_Error, fmt, ##__VA_ARGS__)
#define INFO(mapme, fmt, ...) LOG(mapme, PARCLogLevel_Info, fmt, ##__VA_ARGS__)
#define DEBUG(mapme, fmt, ...) \
LOG(mapme, PARCLogLevel_Debug, fmt, ##__VA_ARGS__)
@@ -234,14 +233,14 @@ static Message *mapMe_createMessage(const MapMe *mapme, const Name *name,
hicn_prefix_t prefix;
int rc = hicn_prefix_from_name(name, &prefix);
if (rc < 0) {
- ERROR(mapme, "[MAP-Me] Failed to create lib's name");
+ ERR(mapme, "[MAP-Me] Failed to create lib's name");
goto ERR_NAME;
}
INFO(mapme, "[MAP-Me] Creating MAP-Me packet");
size_t len = hicn_mapme_create_packet(icmp_pkt, &prefix, params);
if (len != 0) {
- ERROR(mapme, "[MAP-Me] Failed to create mapme packet through lib");
+ ERR(mapme, "[MAP-Me] Failed to create mapme packet through lib");
goto ERR_CREATE;
}
@@ -268,7 +267,7 @@ static Message *mapMe_createAckMessage(const MapMe *mapme,
size_t len = hicn_mapme_create_ack(icmp_pkt, params);
if (len != size) {
- ERROR(mapme, "[MAP-Me] Failed to create mapme ack packet through lib");
+ ERR(mapme, "[MAP-Me] Failed to create mapme ack packet through lib");
return NULL;
}
diff --git a/hicn-light/src/core/message.c b/hicn-light/src/core/message.c
index 6c0e916d2..9b807aebc 100644
--- a/hicn-light/src/core/message.c
+++ b/hicn-light/src/core/message.c
@@ -66,7 +66,7 @@ Message *message_CreateFromEventBuffer(PARCEventBuffer *data, size_t dataLength,
message->logger = logger_Acquire(logger);
message->receiveTime = receiveTime;
message->ingressConnectionId = ingressConnectionId;
- message->length = dataLength;
+ message->length = (unsigned int)dataLength;
message->messageHead = parcMemory_AllocateAndClear(dataLength);
parcAssertNotNull(message->messageHead,
@@ -173,7 +173,7 @@ bool message_IsWldrNotification(const Message *message) {
void message_ResetWldrLabel(Message *message) {
parcAssertNotNull(message, "Parameter must be non-null");
- return messageHandler_ResetWldrLabel(message->messageHead);
+ messageHandler_ResetWldrLabel(message->messageHead);
}
unsigned message_GetWldrLabel(const Message *message) {
@@ -207,7 +207,7 @@ Message *message_CreateWldrNotification(Message *original, uint16_t expected,
message->refcount = 1;
message->logger = logger_Acquire(original->logger);
- message->length = messageHandler_GetICMPPacketSize(
+ message->length = (unsigned int)messageHandler_GetICMPPacketSize(
messageHandler_GetIPPacketType(original->messageHead));
message->messageHead = parcMemory_AllocateAndClear(message->length);
parcAssertNotNull(message->messageHead,
@@ -246,7 +246,7 @@ uint32_t message_GetPathLabel(const Message *message) {
void message_SetPathLabel(Message *message, uint32_t label) {
parcAssertNotNull(message, "Parameter must be non-null");
- return messageHandler_SetPathLabel(message->messageHead, label);
+ messageHandler_SetPathLabel(message->messageHead, label);
}
void message_UpdatePathLabel(Message *message, uint8_t outFace) {
diff --git a/hicn-light/src/core/nameBitvector.c b/hicn-light/src/core/nameBitvector.c
index c93f63292..28ea513c4 100644
--- a/hicn-light/src/core/nameBitvector.c
+++ b/hicn-light/src/core/nameBitvector.c
@@ -209,7 +209,7 @@ bool nameBitvector_StartsWith(const NameBitvector *name,
bool nameBitvector_testBit(const NameBitvector *name, uint8_t pos) {
if (pos == WIDTH) pos = 127;
- uint8_t final_pos = WIDTH - name->len;
+ uint8_t final_pos = (uint8_t)(WIDTH - name->len);
// the bit to test is inside the name/prefix len
if (pos > final_pos) {
@@ -262,9 +262,9 @@ uint8_t nameBitvector_firstDiff(const NameBitvector *a,
uint8_t res = 0;
uint64_t diff = a->bits[1] ^ b->bits[1];
if (diff)
- res = 64 + _diff_bit_log2(diff);
+ res = (uint8_t)(64 + _diff_bit_log2(diff));
else
- res = _diff_bit_log2(a->bits[0] ^ b->bits[0]);
+ res = (uint8_t)_diff_bit_log2(a->bits[0] ^ b->bits[0]);
// res is computed over the bitvector which is composed by 128 bit all the
// times however the prefixes may be diffrent just because the have different
@@ -275,9 +275,9 @@ uint8_t nameBitvector_firstDiff(const NameBitvector *a,
uint8_t len_diff;
if (a->len < b->len)
- len_diff = WIDTH - a->len;
+ len_diff = (uint8_t)(WIDTH - a->len);
else
- len_diff = WIDTH - b->len;
+ len_diff = (uint8_t)(WIDTH - b->len);
if (len_diff > res) res = len_diff;
diff --git a/hicn-light/src/io/udpConnection.c b/hicn-light/src/io/udpConnection.c
index 2aa6edc51..6c2e35392 100644
--- a/hicn-light/src/io/udpConnection.c
+++ b/hicn-light/src/io/udpConnection.c
@@ -273,7 +273,7 @@ static bool _send(IoOperations *ops, const Address *dummy, Message *message) {
ssize_t writeLength =
sendto(udpConnState->udpListenerSocket, message_FixedHeader(message),
- message_Length(message), 0, udpConnState->peerAddress,
+ (int)message_Length(message), 0, udpConnState->peerAddress,
udpConnState->peerAddressLength);
if (writeLength < 0) {
diff --git a/hicn-light/src/io/udpListener.c b/hicn-light/src/io/udpListener.c
index 3264e70fa..6c2947c66 100644
--- a/hicn-light/src/io/udpListener.c
+++ b/hicn-light/src/io/udpListener.c
@@ -81,7 +81,7 @@ ListenerOps *udpListener_CreateInet6(Forwarder *forwarder,
udp->localAddress = addressCreateFromInet6(&sin6);
udp->id = forwarder_GetNextConnectionId(forwarder);
- udp->udp_socket = socket(AF_INET6, SOCK_DGRAM, 0);
+ udp->udp_socket = (SocketType)socket(AF_INET6, SOCK_DGRAM, 0);
parcAssertFalse(udp->udp_socket < 0, "Error opening UDP socket: (%d) %s",
errno, strerror(errno));
@@ -164,7 +164,7 @@ ListenerOps *udpListener_CreateInet(Forwarder *forwarder,
udp->localAddress = addressCreateFromInet(&sin);
udp->id = forwarder_GetNextConnectionId(forwarder);
- udp->udp_socket = socket(AF_INET, SOCK_DGRAM, 0);
+ udp->udp_socket = (SocketType)socket(AF_INET, SOCK_DGRAM, 0);
parcAssertFalse(udp->udp_socket < 0, "Error opening UDP socket: (%d) %s",
errno, strerror(errno));
@@ -314,12 +314,11 @@ static size_t _peekMessageLength(UdpListener *udp, int fd,
// Also returns the socket information for the remote peer
ssize_t res = recvfrom(
- fd, fixedHeader, messageHandler_GetIPHeaderLength(IPv6), MSG_PEEK,
+ fd, fixedHeader, (int)messageHandler_GetIPHeaderLength(IPv6), MSG_PEEK,
(struct sockaddr *)peerIpAddress, peerIpAddressLengthPtr);
if (res == messageHandler_GetIPHeaderLength(IPv6)) {
- packetLength =
- messageHandler_GetTotalPacketLength(fixedHeader);
+ packetLength = messageHandler_GetTotalPacketLength(fixedHeader);
} else {
if (res < 0) {
printf("error while readin packet\n");
@@ -446,7 +445,7 @@ static Message *_readMessage(UdpListener *udp, int fd, size_t packetLength,
AddressPair *pair) {
uint8_t *msgBuffer = parcMemory_AllocateAndClear(packetLength);
- ssize_t readLength = read(fd, msgBuffer, packetLength);
+ ssize_t readLength = read(fd, msgBuffer, (unsigned int)packetLength);
Message *message = NULL;
diff --git a/hicn-light/src/platforms/windows/win_portability.h b/hicn-light/src/platforms/windows/win_portability.h
index e4e32b35a..5c25f4bb2 100644
--- a/hicn-light/src/platforms/windows/win_portability.h
+++ b/hicn-light/src/platforms/windows/win_portability.h
@@ -14,22 +14,13 @@
*/
#pragma once
-#define WIN32_LEAN_AND_MEAN
+#include <parc/windows/parc_Utils.h>
#include <afunix.h>
-#include <assert.h>
-#include <errno.h>
-#include <in6addr.h>
#include <io.h>
#include <iphlpapi.h>
#include <process.h>
#include <stdio.h>
-#include <windows.h>
-#include <winnt.h>
-#include <winsock2.h>
-#include <winternl.h>
-#include <ws2tcpip.h>
#pragma comment(lib, "IPHLPAPI.lib")
-#include <parc/windows/parc_Utils.h>
#ifndef in_port_t
#define in_port_t uint16_t
diff --git a/hicn-light/src/processor/fib.c b/hicn-light/src/processor/fib.c
index 33d31fd8a..c7b1e2de2 100644
--- a/hicn-light/src/processor/fib.c
+++ b/hicn-light/src/processor/fib.c
@@ -429,7 +429,7 @@ FibEntry *fib_Match(const FIB *fib, const Message *interestMessage) {
}
void _collectFibEntries(FibNode *n, int pos, FibEntryList *list) {
- if (n->pos < pos) {
+ if (n->pos < (unsigned)pos) {
fibEntryList_Append(list, n->entry);
_collectFibEntries(n->left, n->pos, list);
_collectFibEntries(n->right, n->pos, list);
diff --git a/hicn-light/src/processor/fibEntry.c b/hicn-light/src/processor/fibEntry.c
index bb877030f..6d741e312 100644
--- a/hicn-light/src/processor/fibEntry.c
+++ b/hicn-light/src/processor/fibEntry.c
@@ -137,7 +137,7 @@ void fibEntry_SetStrategy(FibEntry *fibEntry, strategy_type strategy) {
}
const NumberSet *nexthops = fibEntry_GetNexthops(fibEntry);
- unsigned size = fibEntry_NexthopCount(fibEntry);
+ unsigned size = (unsigned)fibEntry_NexthopCount(fibEntry);
for (unsigned i = 0; i < size; i++) {
fwdStrategyImpl->addNexthop(fwdStrategyImpl,
numberSet_GetItem(nexthops, i));
diff --git a/hicn-light/src/socket/api.h b/hicn-light/src/socket/api.h
index e1516ebe1..3a1ae92b4 100644
--- a/hicn-light/src/socket/api.h
+++ b/hicn-light/src/socket/api.h
@@ -34,8 +34,9 @@
#define BUFSIZE 4096
#define MAX_CONNECTIONS \
255 // We currently limit the number of connections we can establish
+#ifndef IF_NAMESIZE
#define IF_NAMESIZE 16
-
+#endif
/* hICN socket helper */
/** hICN configuration options */
diff --git a/hicn-light/src/strategies/loadBalancer.c b/hicn-light/src/strategies/loadBalancer.c
index 14e907770..5be6a0182 100644
--- a/hicn-light/src/strategies/loadBalancer.c
+++ b/hicn-light/src/strategies/loadBalancer.c
@@ -78,7 +78,7 @@ StrategyImpl *strategyLoadBalancer_Create() {
strategy->weights_sum = 0.0;
strategy->strategy_state = parcHashMap_Create();
strategy->nexthops = numberSet_Create();
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
StrategyImpl *impl = parcMemory_AllocateAndClear(sizeof(StrategyImpl));
parcAssertNotNull(impl, "parcMemory_AllocateAndClear(%zu) returned NULL",
@@ -170,7 +170,7 @@ static NumberSet *_strategyLoadBalancer_LookupNexthop(
unsigned in_connection = message_GetIngressConnectionId(interestMessage);
PARCUnsigned *in = parcUnsigned_Create(in_connection);
- unsigned mapSize = parcHashMap_Size(lb->strategy_state);
+ unsigned mapSize = (unsigned)parcHashMap_Size(lb->strategy_state);
NumberSet *outList = numberSet_Create();
if ((mapSize == 0) ||
@@ -211,7 +211,7 @@ static NumberSet *_strategyLoadBalancer_ReturnNexthops(StrategyImpl *strategy) {
unsigned _strategyLoadBalancer_CountNexthops(StrategyImpl *strategy) {
StrategyLoadBalancer *lb = (StrategyLoadBalancer *)strategy->context;
- return numberSet_Length(lb->nexthops);
+ return (unsigned)numberSet_Length(lb->nexthops);
}
static void _strategyLoadBalancer_resetState(StrategyImpl *strategy) {
diff --git a/hicn-light/src/strategies/loadBalancerWithPD.c b/hicn-light/src/strategies/loadBalancerWithPD.c
index 1aad8fd89..c9c1479a2 100644
--- a/hicn-light/src/strategies/loadBalancerWithPD.c
+++ b/hicn-light/src/strategies/loadBalancerWithPD.c
@@ -88,7 +88,7 @@ StrategyImpl *strategyLoadBalancerWithPD_Create() {
strategy->min_delay = INT_MAX;
strategy->strategy_state = parcHashMap_Create();
strategy->nexthops = numberSet_Create();
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
StrategyImpl *impl = parcMemory_AllocateAndClear(sizeof(StrategyImpl));
parcAssertNotNull(impl, "parcMemory_AllocateAndClear(%zu) returned NULL",
@@ -128,14 +128,14 @@ static void _update_Stats(StrategyLoadBalancerWithPD *strategy,
}
static void _sendProbes(StrategyLoadBalancerWithPD *strategy) {
- unsigned size = numberSet_Length(strategy->nexthops);
+ unsigned size = (unsigned)numberSet_Length(strategy->nexthops);
for (unsigned i = 0; i < size; i++) {
unsigned nhop = numberSet_GetItem(strategy->nexthops, i);
Connection *conn =
(Connection *)connectionTable_FindById(strategy->connTable, nhop);
if (conn != NULL) {
connection_Probe(conn);
- unsigned delay = connection_GetDelay(conn);
+ unsigned delay = (unsigned)connection_GetDelay(conn);
PARCUnsigned *cid = parcUnsigned_Create(nhop);
StrategyNexthopStateWithPD *elem =
(StrategyNexthopStateWithPD *)parcHashMap_Get(
@@ -249,7 +249,7 @@ static NumberSet *_strategyLoadBalancerWithPD_LookupNexthop(
unsigned in_connection = message_GetIngressConnectionId(interestMessage);
PARCUnsigned *in = parcUnsigned_Create(in_connection);
- unsigned mapSize = parcHashMap_Size(lb->strategy_state);
+ unsigned mapSize = (unsigned)parcHashMap_Size(lb->strategy_state);
NumberSet *outList = numberSet_Create();
if ((mapSize == 0) ||
@@ -294,7 +294,7 @@ static NumberSet *_strategyLoadBalancerWithPD_ReturnNexthops(
unsigned _strategyLoadBalancerWithPD_CountNexthops(StrategyImpl *strategy) {
StrategyLoadBalancerWithPD *lb =
(StrategyLoadBalancerWithPD *)strategy->context;
- return numberSet_Length(lb->nexthops);
+ return (unsigned)numberSet_Length(lb->nexthops);
}
static void _strategyLoadBalancerWithPD_resetState(StrategyImpl *strategy) {
diff --git a/hicn-light/src/strategies/rnd.c b/hicn-light/src/strategies/rnd.c
index 37f3f6f30..35b9e87c6 100644
--- a/hicn-light/src/strategies/rnd.c
+++ b/hicn-light/src/strategies/rnd.c
@@ -68,7 +68,7 @@ StrategyImpl *strategyRnd_Create() {
sizeof(StrategyRnd));
strategy->nexthops = numberSet_Create();
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
StrategyImpl *impl = parcMemory_AllocateAndClear(sizeof(StrategyImpl));
parcAssertNotNull(impl, "parcMemory_AllocateAndClear(%zu) returned NULL",
@@ -86,7 +86,7 @@ strategy_type _strategyRnd_GetStrategy(StrategyImpl *strategy) {
}
static int _select_Nexthop(StrategyRnd *strategy) {
- unsigned len = numberSet_Length(strategy->nexthops);
+ unsigned len = (unsigned)numberSet_Length(strategy->nexthops);
if (len == 0) {
return -1;
}
@@ -108,7 +108,7 @@ static NumberSet *_strategyRnd_LookupNexthop(StrategyImpl *strategy,
StrategyRnd *srnd = (StrategyRnd *)strategy->context;
unsigned in_connection = message_GetIngressConnectionId(interestMessage);
- unsigned nexthopSize = numberSet_Length(srnd->nexthops);
+ unsigned nexthopSize = (unsigned)numberSet_Length(srnd->nexthops);
NumberSet *out = numberSet_Create();
if ((nexthopSize == 0) ||
@@ -139,7 +139,7 @@ static NumberSet *_strategyRnd_ReturnNexthops(StrategyImpl *strategy) {
unsigned _strategyRnd_CountNexthops(StrategyImpl *strategy) {
StrategyRnd *srnd = (StrategyRnd *)strategy->context;
- return numberSet_Length(srnd->nexthops);
+ return (unsigned)numberSet_Length(srnd->nexthops);
}
static void _strategyRnd_AddNexthop(StrategyImpl *strategy,
diff --git a/hicn-light/src/strategies/rndSegment.c b/hicn-light/src/strategies/rndSegment.c
index 2000ed7b7..5ed9bf1a9 100644
--- a/hicn-light/src/strategies/rndSegment.c
+++ b/hicn-light/src/strategies/rndSegment.c
@@ -74,7 +74,7 @@ StrategyImpl *strategyRndSegment_Create() {
strategy->nexthops = numberSet_Create();
strategy->segmentName = NULL;
strategy->last_used_face = 0;
- srand(time(NULL));
+ srand((unsigned int)time(NULL));
StrategyImpl *impl = parcMemory_AllocateAndClear(sizeof(StrategyImpl));
parcAssertNotNull(impl, "parcMemory_AllocateAndClear(%zu) returned NULL",
@@ -93,7 +93,7 @@ strategy_type _strategyRndSegment_GetStrategy(StrategyImpl *strategy) {
}
static int _select_Nexthop(StrategyRndSegment *strategy) {
- unsigned len = numberSet_Length(strategy->nexthops);
+ unsigned len = (unsigned)numberSet_Length(strategy->nexthops);
if (len == 0) {
return -1;
}
@@ -115,7 +115,7 @@ static NumberSet *_strategyRndSegment_LookupNexthop(
StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context;
unsigned in_connection = message_GetIngressConnectionId(interestMessage);
- unsigned nexthopSize = numberSet_Length(srnd->nexthops);
+ unsigned nexthopSize = (unsigned)numberSet_Length(srnd->nexthops);
NumberSet *out = numberSet_Create();
if ((nexthopSize == 0) ||
@@ -168,7 +168,7 @@ static NumberSet *_strategyRndSegment_ReturnNexthops(StrategyImpl *strategy) {
unsigned _strategyRndSegment_CountNexthops(StrategyImpl *strategy) {
StrategyRndSegment *srnd = (StrategyRndSegment *)strategy->context;
- return numberSet_Length(srnd->nexthops);
+ return (unsigned)numberSet_Length(srnd->nexthops);
}
static void _strategyRndSegment_AddNexthop(StrategyImpl *strategy,