aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2020-02-03 10:38:56 +0000
committerGerrit Code Review <gerrit@fd.io>2020-02-03 10:38:56 +0000
commite90a3ec9cbc98d73dfeb2175ee12edfb56af11ee (patch)
tree77b833e5189847e84933ce3269aaa05ffda24138 /ctrl
parentb289a24a07d9fe67e8cd9ea0247987e009df6d50 (diff)
parent55f2219ab98b039f256671c5e584a61ab52bfed0 (diff)
Merge "[HICN-489] Add iOS support to hicn stack"
Diffstat (limited to 'ctrl')
-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
8 files changed, 55 insertions, 55 deletions
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 63e27ba42..15425b513 100644
--- a/ctrl/libhicnctrl/CMakeLists.txt
+++ b/ctrl/libhicnctrl/CMakeLists.txt
@@ -63,7 +63,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
${SAFE_VAPI_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;