diff options
51 files changed, 204 insertions, 304 deletions
diff --git a/cmake/Modules/BuildMacros.cmake b/cmake/Modules/BuildMacros.cmake index a1977f980..083380d8c 100644 --- a/cmake/Modules/BuildMacros.cmake +++ b/cmake/Modules/BuildMacros.cmake @@ -82,7 +82,11 @@ macro(build_library lib) endif() foreach(library ${TARGET_LIBS}) - target_compile_options(${library} PRIVATE -Wall) + if (NOT WIN32) + target_compile_options(${library} PRIVATE -Wall) + else () + target_compile_options(${library} PRIVATE) + endif () if(HICN_VERSION) set_target_properties(${library} 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, diff --git a/lib/src/protocol/tcp.c b/lib/src/protocol/tcp.c index 92ded5c29..bbe25fc6d 100644 --- a/lib/src/protocol/tcp.c +++ b/lib/src/protocol/tcp.c @@ -58,7 +58,7 @@ tcp_init_packet_header (hicn_type_t type, hicn_protocol_t * h) TCP_DEFAULT_SYN << 1 | TCP_DEFAULT_FIN << 0,.window = htons (TCP_DEFAULT_WINDOW_SIZE),.csum = 0,.urg_ptr = 65000,}; - uint8_t ah_flag = type.l2 == IPPROTO_AH ? AH_FLAG : ~AH_FLAG; + uint8_t ah_flag = type.l2 == IPPROTO_AH ? AH_FLAG : 0; h->tcp.flags |= ah_flag; 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 ×tamp); 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 2d4943f1a..dbf1c1bd1 100644 --- a/libtransport/src/hicn/transport/protocols/rtc.cc +++ b/libtransport/src/hicn/transport/protocols/rtc.cc @@ -119,9 +119,6 @@ void RTCTransportProtocol::reset() { nackedByProducerMaxSize_ = 512; if (content_buffer_) content_buffer_->clear(); - holes_.clear(); - lastReceived_ = 0; - // stats receivedBytes_ = 0; sentInterest_ = 0; @@ -145,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) { @@ -167,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 @@ -217,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); } @@ -262,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 @@ -307,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 @@ -322,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_); } @@ -332,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); } } @@ -343,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_--; @@ -360,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 } } @@ -379,14 +378,6 @@ void RTCTransportProtocol::sendInterest() { uint32_t rtxSeg = interestRetransmissions_.front(); interestRetransmissions_.pop(); - std::unordered_map<uint32_t, uint64_t>::const_iterator res = - holes_.find(rtxSeg); - if (res != holes_.end()) { - // this packet is already managed by as an hole - // we don't need to send it again - return; - } - // a packet recovery means that there was a loss packetLost_++; @@ -454,73 +445,6 @@ void RTCTransportProtocol::scheduleNextInterest() { checkRound(); if (!is_running_) return; - uint32_t MAX_RECOVER = - 40; // if the packet is more than MAX_RECOVER seq in the past we drop it - uint64_t TIME_BEFORE_RECOVERY = 10; // this should be proporsional to the RTT - - // holes are important only in NORMAL state - if (currentState_ == HICN_RTC_NORMAL_STATE) { - for (std::unordered_map<uint32_t, uint64_t>::iterator it = holes_.begin(); - it != holes_.end();) { - if (it->first < lastReceived_ - MAX_RECOVER) { - // the packet is to hold, remove it - it = holes_.erase(it); - } else { - uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>( - std::chrono::steady_clock::now().time_since_epoch()) - .count(); - uint64_t sinceLastTry = now - it->second; - - if (sinceLastTry > TIME_BEFORE_RECOVERY || it->second == 0) { - // a recovery means a packet lost - packetLost_++; - // update last sent time - it->second = now; - - Name interest_name; - socket_->getSocketOption(GeneralTransportOptions::NETWORK_NAME, - interest_name); - - uint32_t pkt = it->first & modMask_; - interest_name.setSuffix(it->first); - - if (!portal_->interestIsPending(interest_name)) { - inflightInterests_[pkt].retransmissions++; - } - - inflightInterests_[pkt].transmissionTime = 0; - // XXX - // code refactoring: - // from here on this is a copy and paste of the code inside - // sendInterest this should go inside an other method - auto interest = getInterest(); - uint32_t interestLifetime = default_values::interest_lifetime; - socket_->getSocketOption(GeneralTransportOptions::INTEREST_LIFETIME, - interestLifetime); - interest->setLifetime(uint32_t(interestLifetime)); - - ConsumerInterestCallback on_interest_output = VOID_HANDLER; - - socket_->getSocketOption(ConsumerCallbacksOptions::INTEREST_OUTPUT, - on_interest_output); - if (on_interest_output != VOID_HANDLER) - on_interest_output(*dynamic_cast<ConsumerSocket *>(socket_), - *interest); - - if (TRANSPORT_EXPECT_FALSE(!is_running_)) return; - - using namespace std::placeholders; - portal_->sendInterest(std::move(interest)); - - sentInterest_++; - } - ++it; - } - // as usual check the round at each packet - checkRound(); - } - } - while (interestRetransmissions_.size() > 0) { sendInterest(); checkRound(); @@ -584,11 +508,6 @@ void RTCTransportProtocol::onNack(const ContentObject &content_object) { actualSegment_ = max(productionSeg + 1, actualSegment_); if (currentState_ == HICN_RTC_NORMAL_STATE) { currentState_ = HICN_RTC_SYNC_STATE; - // if we switch in SYNC mode we do not care about holes - // se we reset the data structure. going back to NORMAL - // mode will anable again the holes_ check. - holes_.clear(); - lastReceived_ = 0; } computeMaxWindow(productionRate, 0); @@ -625,20 +544,10 @@ 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_; - // try to recover holes - // we can recover haoles with valid data, nacks or retransmitted packets - bool recoveredHole = false; - std::unordered_map<uint32_t, uint64_t>::const_iterator res = - holes_.find(segmentNumber); - if (res != holes_.end()) { - holes_.erase(res); - recoveredHole = true; - } - if (payload_size == HICN_NACK_HEADER_SIZE) { // Nacks always come form the producer, so we set the producerePathLabel_; producerPathLabel_ = content_object->getPathLabel(); @@ -651,43 +560,17 @@ 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); - - // handle holes - // the packet sequence make sense only in case of valid data (no nacks, no - // rtx) in RTC_NORMAL_STATE we should get all the packets in order, so if - // segmentNumber != lastReceived + 1 something happened - // if recoveredHole == true this is a packet recovered so we should do - // nothing - if (currentState_ == HICN_RTC_NORMAL_STATE && recoveredHole == false) { - if ((segmentNumber != lastReceived_ + 1) && - segmentNumber > lastReceived_) { - // we have holes in the sequence - for (uint32_t seq = lastReceived_ + 1; seq < segmentNumber; seq++) { - // the hole exists we do not insert it again - std::unordered_map<uint32_t, uint64_t>::const_iterator res = - holes_.find(seq); - if (res == holes_.end()) - holes_.insert(std::make_pair(seq, 0)); // 0 means never sent - } - } - } - - // this if should be always true - if (segmentNumber > lastReceived_) { - lastReceived_ = segmentNumber; - } } returnContentToUser(*content_object); @@ -703,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 b235a6726..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 @@ -182,9 +182,6 @@ class RTCTransportProtocol : public TransportProtocol { // std::vector<uint64_t> minRTTwin_; uint64_t minRtt_; - std::unordered_map<uint32_t, uint64_t> holes_; - uint32_t lastReceived_; - // CC var double estimatedBw_; double lossRate_; 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 |