aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--apps/higet/CMakeLists.txt18
-rw-r--r--apps/http-proxy/CMakeLists.txt18
-rw-r--r--ctrl/facemgr/CMakeLists.txt2
-rw-r--r--ctrl/facemgr/src/CMakeLists.txt4
-rw-r--r--ctrl/facemgr/src/api.c2
-rw-r--r--ctrl/facemgr/src/cfg.c2
-rw-r--r--ctrl/facemgr/src/facelet.c86
-rw-r--r--ctrl/libhicnctrl/CMakeLists.txt2
-rw-r--r--ctrl/libhicnctrl/src/CMakeLists.txt4
-rw-r--r--ctrl/libhicnctrl/src/api.c8
-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
-rw-r--r--lib/includes/hicn/util/map.h2
-rw-r--r--lib/includes/hicn/util/set.h2
-rw-r--r--lib/src/CMakeLists.txt2
-rw-r--r--lib/src/name.c8
-rw-r--r--lib/src/policy.c8
-rw-r--r--lib/src/util/ip_address.c10
-rw-r--r--libtransport/CMakeLists.txt2
-rw-r--r--libtransport/src/hicn/transport/CMakeLists.txt2
-rw-r--r--utils/CMakeLists.txt54
28 files changed, 155 insertions, 142 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0001a0a45..2ea6de33d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,7 +28,9 @@ option(BUILD_APPS "Build the hicn apps" OFF)
option(BUILD_CTRL "Build the hicn control tools" ON)
option(BUILD_HICNPLUGIN "Build the hicn vpp plugin" OFF)
option(BUILD_SYSREPOPLUGIN "Build the sysrepo plugin" OFF)
-option(BUILD_EXTRAS "Build external projects." OFF)
+option(BUILD_EXTRAS "Build external projects" OFF)
+option(DISABLE_EXECUTABLES "Disable executables" OFF)
+option(DISABLE_SHARED_LIBRARIES "Disable shared libraries" OFF)
if ((BUILD_APPS OR BUILD_UTILS) AND NOT BUILD_LIBTRANSPORT)
message(STATUS "Libhicntransport required. Enabled by default.")
@@ -84,7 +86,7 @@ foreach (opt ${dir_options})
endforeach()
if (NOT WIN32)
- add_compile_options(-Wall -Werror)
+ add_compile_options(-Wall -Werror -Wno-shorten-64-to-32)
endif ()
message(STATUS "Building the following subprojects: ${subdirs}")
diff --git a/apps/higet/CMakeLists.txt b/apps/higet/CMakeLists.txt
index 76814384d..1cf14c287 100644
--- a/apps/higet/CMakeLists.txt
+++ b/apps/higet/CMakeLists.txt
@@ -31,11 +31,13 @@ list(APPEND APPS_SRC
higet.cc
)
-build_executable(${HIGET}
- SOURCES ${APPS_SRC}
- LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
- DEPENDS ${LIBTRANSPORT_LIBRARIES}
- COMPONENT ${HICN_APPS}
- DEFINITIONS ${COMPILER_DEFINITIONS}
- LINK_FLAGS ${LINK_FLAGS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HIGET}
+ SOURCES ${APPS_SRC}
+ LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
+ DEPENDS ${LIBTRANSPORT_LIBRARIES}
+ COMPONENT ${HICN_APPS}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+endif ()
diff --git a/apps/http-proxy/CMakeLists.txt b/apps/http-proxy/CMakeLists.txt
index cc47e4b6f..94bf895c1 100644
--- a/apps/http-proxy/CMakeLists.txt
+++ b/apps/http-proxy/CMakeLists.txt
@@ -58,11 +58,13 @@ build_library(${LIBHTTP_PROXY}
LINK_FLAGS ${LINK_FLAGS}
)
-build_executable(${HTTP_PROXY}
- SOURCES ${APP_SOURCE_FILES}
- LINK_LIBRARIES ${LIBHTTP_PROXY_STATIC}
- DEPENDS ${LIBHTTP_PROXY_STATIC}
- COMPONENT ${HICN_APPS}
- DEFINITIONS ${COMPILER_DEFINITIONS}
- LINK_FLAGS ${LINK_FLAGS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HTTP_PROXY}
+ SOURCES ${APP_SOURCE_FILES}
+ LINK_LIBRARIES ${LIBHTTP_PROXY_STATIC}
+ DEPENDS ${LIBHTTP_PROXY_STATIC}
+ COMPONENT ${HICN_APPS}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+endif ()
diff --git a/ctrl/facemgr/CMakeLists.txt b/ctrl/facemgr/CMakeLists.txt
index db40eade3..a1cd48bbd 100644
--- a/ctrl/facemgr/CMakeLists.txt
+++ b/ctrl/facemgr/CMakeLists.txt
@@ -69,7 +69,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
find_package_wrapper(Libhicn REQUIRED)
find_package_wrapper(Libhicnctrl REQUIRED)
else()
- if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+ if (DISABLE_SHARED_LIBRARIES)
set(HICN_LIBRARIES ${LIBHICN_STATIC} log)
set(LIBHICNCTRL_LIBRARIES ${LIBHICNCTRL_STATIC})
list(APPEND DEPENDENCIES
diff --git a/ctrl/facemgr/src/CMakeLists.txt b/ctrl/facemgr/src/CMakeLists.txt
index e675c7785..4bcad475d 100644
--- a/ctrl/facemgr/src/CMakeLists.txt
+++ b/ctrl/facemgr/src/CMakeLists.txt
@@ -97,7 +97,7 @@ if(WITH_EXAMPLE_UPDOWN)
)
endif()
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+if (DISABLE_SHARED_LIBRARIES)
build_library(${LIBFACEMGR}
STATIC
SOURCES ${SOURCE_FILES}
@@ -123,7 +123,7 @@ else ()
)
endif ()
-if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android" AND NOT COMPILE_FOR_IOS)
+if(NOT DISABLE_EXECUTABLES)
list(APPEND DAEMON_SRC
main.c
)
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index a6f8dbc84..24d629d28 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -2454,7 +2454,7 @@ facemgr_list_facelets_json(const facemgr_t * facemgr, char ** buffer)
END:
free(facelet_array);
- return cur - s;
+ return (int)(cur - s);
ERR:
free(facelet_array);
diff --git a/ctrl/facemgr/src/cfg.c b/ctrl/facemgr/src/cfg.c
index 398076d02..df73acd1b 100644
--- a/ctrl/facemgr/src/cfg.c
+++ b/ctrl/facemgr/src/cfg.c
@@ -1210,5 +1210,5 @@ int facemgr_cfg_get_static_facelet_array(const facemgr_cfg_t * cfg, facelet_t **
ERROR("[facemgr_cfg_get_static_facelet_array] Error getting array elements");
return -1;
}
- return facelet_array_len(cfg->static_facelets);
+ return (int)facelet_array_len(cfg->static_facelets);
}
diff --git a/ctrl/facemgr/src/facelet.c b/ctrl/facemgr/src/facelet.c
index d33455b4d..0cf44d4dc 100644
--- a/ctrl/facemgr/src/facelet.c
+++ b/ctrl/facemgr/src/facelet.c
@@ -1041,7 +1041,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* Netdevice */
if (facelet_has_netdevice(facelet)) {
@@ -1051,14 +1051,14 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = snprintf(cur, s + size - cur, "/%d", facelet->netdevice.index);
if (rc < 0)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
} else {
rc = snprintf(cur, s + size - cur, " netdevice=*/*");
@@ -1066,7 +1066,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Netdevice type */
@@ -1077,7 +1077,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Local ip address */
@@ -1087,7 +1087,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = ip_address_snprintf(cur, s + size - cur, &facelet->local_addr,
facelet->family);
@@ -1095,7 +1095,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Local port */
@@ -1106,7 +1106,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Remote ip address */
@@ -1116,7 +1116,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = ip_address_snprintf(cur, s + size - cur, &facelet->remote_addr,
facelet->family);
@@ -1124,7 +1124,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Remote port */
@@ -1135,7 +1135,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Admin state */
@@ -1146,7 +1146,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* State */
@@ -1157,7 +1157,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
#ifdef WITH_POLICY
@@ -1168,7 +1168,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
#endif /* WITH_POLICY */
@@ -1180,7 +1180,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Routes */
@@ -1189,7 +1189,7 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
hicn_route_t ** route_array;
int n = route_set_get_array(facelet->routes, &route_array);
@@ -1198,19 +1198,19 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
} else {
for (unsigned i = 0; i < n; i++) {
hicn_route_t * route = route_array[i];
- rc = hicn_route_snprintf(cur, s + size - cur, route);
+ rc = (int)hicn_route_snprintf(cur, s + size - cur, route);
if (rc < 0)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = snprintf(cur, s + size - cur, ", ");
if (rc < 0)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
}
free(route_array);
@@ -1220,9 +1220,9 @@ facelet_snprintf(char * s, size_t size, const facelet_t * facelet)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
- return cur - s;
+ return (int)(cur - s);
}
int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int indent)
@@ -1238,7 +1238,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* id */
rc = snprintf(cur, s + size - cur, "%*s%s: %d,\n", 4 * (indent+1), "", "\"id\"",
@@ -1247,7 +1247,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* Status */
rc = snprintf(cur, s + size - cur, "%*s%s: \"%s\",\n", 4 * (indent+1), "", "\"status\"",
@@ -1256,7 +1256,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* Family */
rc = snprintf(cur, s + size - cur, "%*s%s: \"%s\",\n", 4 * (indent+1), "", "\"family\"",
@@ -1268,7 +1268,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* Netdevice */
if (facelet_has_netdevice(facelet)) {
@@ -1279,7 +1279,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
} else {
rc = snprintf(cur, s + size - cur, "%*s%s: \"%s\",\n", 4 * (indent+1), "",
@@ -1288,7 +1288,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Netdevice type */
@@ -1300,7 +1300,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Local ip address */
@@ -1311,7 +1311,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = ip_address_snprintf(cur, s + size - cur, &facelet->local_addr,
facelet->family);
@@ -1319,14 +1319,14 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = snprintf(cur, s + size - cur, "\",\n");
if (rc < 0)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Local port */
@@ -1338,7 +1338,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Remote ip address */
@@ -1349,7 +1349,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = ip_address_snprintf(cur, s + size - cur, &facelet->remote_addr,
facelet->family);
@@ -1357,14 +1357,14 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
rc = snprintf(cur, s + size - cur, "\",\n");
if (rc < 0)
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Remote port */
@@ -1376,7 +1376,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Admin state */
@@ -1388,7 +1388,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* State */
@@ -1400,7 +1400,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
#ifdef WITH_POLICY
@@ -1412,7 +1412,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
#endif /* WITH_POLICY */
@@ -1424,7 +1424,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
}
/* Status error */
@@ -1435,7 +1435,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
/* Routes */
// TODO
@@ -1445,7 +1445,7 @@ int facelet_snprintf_json(char * s, size_t size, const facelet_t * facelet, int
return rc;
cur += rc;
if (cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
- return cur - s;
+ return (int)(cur - s);
}
diff --git a/ctrl/libhicnctrl/CMakeLists.txt b/ctrl/libhicnctrl/CMakeLists.txt
index ff586ff22..f96bf13a6 100644
--- a/ctrl/libhicnctrl/CMakeLists.txt
+++ b/ctrl/libhicnctrl/CMakeLists.txt
@@ -61,7 +61,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
${HICNPLUGIN_INCLUDE_DIRS})
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/ctrl/libhicnctrl/src/CMakeLists.txt b/ctrl/libhicnctrl/src/CMakeLists.txt
index 6f4066238..00661a2a0 100644
--- a/ctrl/libhicnctrl/src/CMakeLists.txt
+++ b/ctrl/libhicnctrl/src/CMakeLists.txt
@@ -54,7 +54,7 @@ set(INCLUDE_DIRS
)
# Android requires static libraries
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+if (DISABLE_SHARED_LIBRARIES)
set(LIBRARIES ${LIBRARIES} ${LIBHICN_STATIC})
set(LINK_TYPE STATIC)
else ()
@@ -73,7 +73,7 @@ build_library(${LIBHICNCTRL}
DEFINITIONS ${COMPILER_DEFINITIONS}
)
-if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Android" AND NOT COMPILE_FOR_IOS)
+if (NOT DISABLE_EXECUTABLES)
set(LIBRARIES ${LIBRARIES} ${LIBHICN_SHARED} ${LIBHICNCTRL_SHARED})
list(APPEND DAEMON_SRC
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index 7e6a80254..8dcb978e0 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -444,7 +444,7 @@ hc_sock_parse_url(const char * url, struct sockaddr * sa)
#ifdef __linux__
srand(time(NULL) ^ getpid() ^ gettid());
#else
- srand(time(NULL) ^ getpid());
+ srand((unsigned int )(time(NULL) ^ getpid()));
#endif /* __linux__ */
/*
@@ -574,7 +574,7 @@ hc_sock_connect(hc_sock_t * s)
size_t size = ss.ss_family == AF_INET
? sizeof(struct sockaddr_in)
: sizeof(struct sockaddr_in6);
- if (connect(s->fd, (struct sockaddr *)&ss, size) < 0) //sizeof(struct sockaddr)) < 0)
+ if (connect(s->fd, (struct sockaddr *)&ss, (socklen_t)size) < 0) //sizeof(struct sockaddr)) < 0)
goto ERR_CONNECT;
return 0;
@@ -589,7 +589,7 @@ hc_sock_send(hc_sock_t * s, hc_msg_t * msg, size_t msglen, int seq)
{
int rc;
msg->hdr.seqNum = seq;
- rc = send(s->fd, msg, msglen, 0);
+ rc = (int)send(s->fd, msg, msglen, 0);
if (rc < 0) {
perror("hc_sock_send");
return -1;
@@ -617,7 +617,7 @@ hc_sock_recv(hc_sock_t * s)
*/
assert(RECV_BUFLEN - s->woff > MIN_BUFLEN);
- rc = recv(s->fd, s->buf + s->woff, RECV_BUFLEN - s->woff, 0);
+ rc = (int)recv(s->fd, s->buf + s->woff, RECV_BUFLEN - s->woff, 0);
if (rc == 0) {
/* Connection has been closed */
return 0;
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
diff --git a/lib/includes/hicn/util/map.h b/lib/includes/hicn/util/map.h
index 1ac5812ef..01195865e 100644
--- a/lib/includes/hicn/util/map.h
+++ b/lib/includes/hicn/util/map.h
@@ -94,7 +94,7 @@ NAME ## _pair_snprintf(char * buf, size_t size, const NAME ## _pair_t * pair) {
if (rc < 0) \
return rc; \
rc = VALUE_SNPRINTF(buf+rc, BUFSIZE/2, (VAL_T)pair->value); \
- return rc; \
+ return (int)rc; \
} \
\
TYPEDEF_SET(NAME ## _pair_set, NAME ## _pair_t *, NAME ## _pair_cmp, NAME ## _pair_snprintf); \
diff --git a/lib/includes/hicn/util/set.h b/lib/includes/hicn/util/set.h
index b4673a673..bc2e3caac 100644
--- a/lib/includes/hicn/util/set.h
+++ b/lib/includes/hicn/util/set.h
@@ -232,7 +232,7 @@ NAME ## _get_array(const NAME ## _t * set, T ** element) \
twalk(set->root, NAME ## _add_node_to_array); \
NAME ## _array_pos = NULL; \
END: \
- return set->size; \
+ return (int)(set->size); \
}
#endif /* UTIL_SET_H */
diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt
index f68e7a551..7eecaf775 100644
--- a/lib/src/CMakeLists.txt
+++ b/lib/src/CMakeLists.txt
@@ -35,7 +35,7 @@ set (COMPILER_DEFINITIONS "-DWITH_MAPME")
include(BuildMacros)
include(WindowsMacros)
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+if (DISABLE_SHARED_LIBRARIES)
build_library(${LIBHICN}
STATIC
SOURCES ${LIBHICN_SOURCE_FILES} ${LIBHICN_HEADER_FILES} ${LIBHICN_HEADER_FILES_PROTOCOL} ${LIBHICN_HEADER_FILES_UTIL}
diff --git a/lib/src/name.c b/lib/src/name.c
index 6c7945a18..7c1f7582a 100644
--- a/lib/src/name.c
+++ b/lib/src/name.c
@@ -460,19 +460,19 @@ hicn_name_ntop (const hicn_name_t * src, char *dst, size_t len)
switch (src->type)
{
case HNT_CONTIGUOUS_V6:
- rc = inet_ntop (AF_INET6, src->buffer, dst, len);
+ rc = inet_ntop (AF_INET6, src->buffer, dst, (socklen_t)len);
seg_number = (u8 *) src->buffer + IPV6_ADDR_LEN;
break;
case HNT_CONTIGUOUS_V4:
- rc = inet_ntop (AF_INET, src->buffer, dst, len);
+ rc = inet_ntop (AF_INET, src->buffer, dst, (socklen_t)len);
seg_number = (u8 *) src->buffer + IPV4_ADDR_LEN;
break;
case HNT_IOV_V6:
- rc = inet_ntop (AF_INET6, src->iov.buffers[0].iov_base, dst, len);
+ rc = inet_ntop (AF_INET6, src->iov.buffers[0].iov_base, dst, (socklen_t)len);
seg_number = src->iov.buffers[1].iov_base;
break;
case HNT_IOV_V4:
- rc = inet_ntop (AF_INET, src->iov.buffers[0].iov_base, dst, len);
+ rc = inet_ntop (AF_INET, src->iov.buffers[0].iov_base, dst, (socklen_t)len);
seg_number = src->iov.buffers[1].iov_base;
break;
default:
diff --git a/lib/src/policy.c b/lib/src/policy.c
index edbb02bea..694f0ea5e 100644
--- a/lib/src/policy.c
+++ b/lib/src/policy.c
@@ -49,13 +49,13 @@ policy_tag_state_snprintf(char * s, size_t size, const policy_tag_state_t * tag_
return -1;
rc = snprintf(cur, s + size - cur, "%s%s", (tag_state->disabled == 1) ? "!" : "", policy_state_str[tag_state->state]);
- if (rc >= s + size - cur)
- return s + size - cur;
+ if (rc >= (int)(s + size - cur))
+ return (int)(s + size - cur);
if (rc < 0)
return rc;
cur += rc;
if (size != 0 && cur >= s + size)
- return cur - s;
+ return (int)(cur - s);
- return cur - s;
+ return (int)(cur - s);
}
diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c
index 49818de40..805b0b261 100644
--- a/lib/src/util/ip_address.c
+++ b/lib/src/util/ip_address.c
@@ -91,10 +91,10 @@ ip_address_ntop (const ip_address_t * ip_address, char *dst, const size_t len,
const char * s;
switch(family) {
case AF_INET:
- s = inet_ntop (AF_INET, ip_address->v4.buffer, dst, len);
+ s = inet_ntop (AF_INET, ip_address->v4.buffer, dst, (socklen_t)len);
break;
case AF_INET6:
- s = inet_ntop (AF_INET6, ip_address->v6.buffer, dst, len);
+ s = inet_ntop (AF_INET6, ip_address->v6.buffer, dst, (socklen_t)len);
break;
default:
return -1;
@@ -156,7 +156,7 @@ ip_address_snprintf(char * s, size_t size, const ip_address_t * ip_address, int
}
if (!rc)
return -1;
- return strlen(s);
+ return (int)strlen(s);
}
int
@@ -281,7 +281,7 @@ ip_prefix_ntop_short(const ip_prefix_t * ip_prefix, char *dst, size_t size)
return -1;
int rc = snprintf(dst, size, "%s", ip_s);
if (rc >= size)
- return size;
+ return (int)size;
return rc;
}
@@ -304,7 +304,7 @@ ip_prefix_ntop(const ip_prefix_t * ip_prefix, char *dst, size_t size)
return -1;
int rc = snprintf(dst, size, "%s/%d", ip_s, ip_prefix->len);
if (rc >= size)
- return size;
+ return (int)size;
return rc;
}
diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt
index cc302d09a..75d5827cc 100644
--- a/libtransport/CMakeLists.txt
+++ b/libtransport/CMakeLists.txt
@@ -93,7 +93,7 @@ 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/libtransport/src/hicn/transport/CMakeLists.txt b/libtransport/src/hicn/transport/CMakeLists.txt
index 22acdcb7f..4bdb3c1e7 100644
--- a/libtransport/src/hicn/transport/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/CMakeLists.txt
@@ -60,7 +60,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -isystem -lm")
endif()
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+if (DISABLE_SHARED_LIBRARIES)
build_library(${LIBTRANSPORT}
STATIC
SOURCES ${SOURCE_FILES} ${HEADER_FILES}
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index d4458dc55..f52fec6c0 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -61,29 +61,31 @@ endif ()
include(Packaging)
-build_executable(hiperf
- SOURCES src/hiperf.cc
- LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
- DEPENDS ${DEPENDENCIES}
- COMPONENT ${HICN_UTILS}
- DEFINITIONS ${COMPILER_DEFINITIONS}
- LINK_FLAGS ${LINK_FLAGS}
-)
-
-build_executable(hicn-ping-server
- SOURCES src/ping_server.cc
- LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
- DEPENDS ${DEPENDENCIES}
- COMPONENT ${HICN_UTILS}
- DEFINITIONS ${COMPILER_DEFINITIONS}
- LINK_FLAGS ${LINK_FLAGS}
-)
-
-build_executable(hicn-ping-client
- SOURCES src/ping_client.cc
- LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
- DEPENDS ${DEPENDENCIES}
- COMPONENT ${HICN_UTILS}
- DEFINITIONS ${COMPILER_DEFINITIONS}
- LINK_FLAGS ${LINK_FLAGS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(hiperf
+ SOURCES src/hiperf.cc
+ LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${HICN_UTILS}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+
+ build_executable(hicn-ping-server
+ SOURCES src/ping_server.cc
+ LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${HICN_UTILS}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+
+ build_executable(hicn-ping-client
+ SOURCES src/ping_client.cc
+ LINK_LIBRARIES ${LIBTRANSPORT_LIBRARIES} ${WSOCK32_LIBRARY} ${WS2_32_LIBRARY}
+ DEPENDS ${DEPENDENCIES}
+ COMPONENT ${HICN_UTILS}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ LINK_FLAGS ${LINK_FLAGS}
+ )
+endif ()