summaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authorAngelo Mantellini <angelo.mantellini@cisco.com>2020-01-30 10:44:19 +0100
committerAngelo Mantellini <angelo.mantellini@cisco.com>2020-02-03 10:18:52 +0000
commit55f2219ab98b039f256671c5e584a61ab52bfed0 (patch)
treed97fbf6a57dfdb4335bba979f27bd18f4999c492 /hicn-light
parentbe54ac541c9700eaa9085bc8b4ee21b7a5f7e30a (diff)
[HICN-489] Add iOS support to hicn stack
Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com> Change-Id: I8fa8c4eaa3218eb4be46f713b15ab789c6930aa0
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/CMakeLists.txt2
-rw-r--r--hicn-light/src/hicn/CMakeLists.txt4
-rw-r--r--hicn-light/src/hicn/command_line/controller/CMakeLists.txt17
-rw-r--r--hicn-light/src/hicn/command_line/daemon/CMakeLists.txt17
-rw-r--r--hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c7
-rw-r--r--hicn-light/src/hicn/core/nameBitvector.c2
-rw-r--r--hicn-light/src/hicn/io/udpConnection.c2
-rw-r--r--hicn-light/src/hicn/strategies/lowLatency.c4
8 files changed, 30 insertions, 25 deletions
diff --git a/hicn-light/CMakeLists.txt b/hicn-light/CMakeLists.txt
index 41eeb5d84..1923e7aee 100644
--- a/hicn-light/CMakeLists.txt
+++ b/hicn-light/CMakeLists.txt
@@ -59,7 +59,7 @@ set(HICN_LIGHT_DAEMON ${HICN_LIGHT}-daemon CACHE INTERNAL "" FORCE)
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
find_package_wrapper(Libhicn REQUIRED)
else()
- if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+ if (DISABLE_SHARED_LIBRARIES)
set(HICN_LIBRARIES ${LIBHICN_STATIC} log)
list(APPEND DEPENDENCIES
${LIBHICN_STATIC}
diff --git a/hicn-light/src/hicn/CMakeLists.txt b/hicn-light/src/hicn/CMakeLists.txt
index 3b4ead33f..82de74ac7 100644
--- a/hicn-light/src/hicn/CMakeLists.txt
+++ b/hicn-light/src/hicn/CMakeLists.txt
@@ -14,10 +14,8 @@ list(APPEND COMPILER_DEFINITIONS
"-DWITH_POLICY"
)
-if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android" AND NOT COMPILE_FOR_IOS)
+if (NOT DISABLE_EXECUTABLES)
add_subdirectory(command_line)
-else ()
- add_subdirectory(command_line/controller)
endif()
add_subdirectory(config)
diff --git a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
index 405654052..949cace28 100644
--- a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
@@ -14,11 +14,12 @@
list(APPEND CONTROLLER_SRC
hicnLightControl_main.c
)
-
-build_executable(${HICN_LIGHT_CONTROL}
- SOURCES ${CONTROLLER_SRC}
- LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
- DEPENDS ${LIBHICN_LIGHT_STATIC}
- COMPONENT ${HICN_LIGHT}
- DEFINITIONS ${COMPILER_DEFINITIONS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HICN_LIGHT_CONTROL}
+ SOURCES ${CONTROLLER_SRC}
+ LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
+ DEPENDS ${LIBHICN_LIGHT_STATIC}
+ COMPONENT ${HICN_LIGHT}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ )
+endif ()
diff --git a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
index ff9d31ebc..1ab8a4e6f 100644
--- a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
@@ -14,11 +14,12 @@
list(APPEND DAEMON_SRC
hicnLightDaemon_main.c
)
-
-build_executable(${HICN_LIGHT_DAEMON}
- SOURCES ${DAEMON_SRC}
- LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
- DEPENDS ${LIBHICN_LIGHT_STATIC}
- COMPONENT ${HICN_LIGHT}
- DEFINITIONS ${COMPILER_DEFINITIONS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HICN_LIGHT_DAEMON}
+ SOURCES ${DAEMON_SRC}
+ LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
+ DEPENDS ${LIBHICN_LIGHT_STATIC}
+ COMPONENT ${HICN_LIGHT}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ )
+endif ()
diff --git a/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c b/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
index c0b332b91..89a80d0b1 100644
--- a/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
+++ b/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
@@ -218,10 +218,15 @@ static void _daemonize(void) {
setsid();
/* close all descriptors */
+#ifdef __ANDROID__
+ for (int i = sysconf(_SC_OPEN_MAX); i >= 0; --i) {
+ close(i);
+ }
+#else
for (int i = getdtablesize(); i >= 0; --i) {
close(i);
}
-
+#endif
// reset errno because it might be seg to EBADF from the close calls above
errno = 0;
diff --git a/hicn-light/src/hicn/core/nameBitvector.c b/hicn-light/src/hicn/core/nameBitvector.c
index ab459b126..6ad623b14 100644
--- a/hicn-light/src/hicn/core/nameBitvector.c
+++ b/hicn-light/src/hicn/core/nameBitvector.c
@@ -240,7 +240,7 @@ uint32_t nameBitvector_lpm(const NameBitvector *a,
uint64_t diff = a->bits[0] ^ b->bits[0];
if(diff){
- prefix_len = BV_SIZE - (_diff_bit_log2(diff) + 1);
+ 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;
diff --git a/hicn-light/src/hicn/io/udpConnection.c b/hicn-light/src/hicn/io/udpConnection.c
index b22b1227f..14ffe1e5b 100644
--- a/hicn-light/src/hicn/io/udpConnection.c
+++ b/hicn-light/src/hicn/io/udpConnection.c
@@ -315,7 +315,7 @@ static bool _sendIOVBuffer(IoOperations *ops, struct iovec *message,
udpConnState->peerAddress,
udpConnState->peerAddressLength);
- ssize_t writeLength = writev(udpConnState->udpListenerSocket, message, size);
+ ssize_t writeLength = writev(udpConnState->udpListenerSocket, message, (int)size);
struct sockaddr any_address = {0};
any_address.sa_family = AF_UNSPEC;
diff --git a/hicn-light/src/hicn/strategies/lowLatency.c b/hicn-light/src/hicn/strategies/lowLatency.c
index d525f3c5c..47de73538 100644
--- a/hicn-light/src/hicn/strategies/lowLatency.c
+++ b/hicn-light/src/hicn/strategies/lowLatency.c
@@ -171,7 +171,7 @@ static void strategyLowLatency_SendProbesCB(int fd, PARCEventType which_event,
PARCUnsigned *parc_seq = parcUnsigned_Create(seq);
Ticks now = forwarder_GetTicks(ll->forwarder);
- PARCUnsigned *parc_time = parcUnsigned_Create(now);
+ PARCUnsigned *parc_time = parcUnsigned_Create((unsigned int)now);
parcHashMap_Put(ll->pending_probes_ticks, parc_seq, parc_time);
parcHashMap_Put(ll->pending_probes_faces, parc_seq, cid);
strategyNexthopStateLL_SentProbe(state);
@@ -656,7 +656,7 @@ static void _strategyLowLatency_ReceiveObject(StrategyImpl *strategy,
if(RTT <= 0)
RTT = 1;
strategyNexthopStateLL_AddRttSample(
- (StrategyNexthopStateLL *) state, RTT);
+ (StrategyNexthopStateLL *) state, (unsigned int)RTT);
parcHashMap_Remove(ll->pending_probes_ticks, parc_seq);
} else {
// this may happen if we remove a face/route while downloading a file