summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-05 16:55:27 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-05 17:10:42 +0100
commita30d495f6e91f3bed0420bf76c19315fe0de8801 (patch)
treeafecede81fc0c1ed271d43c8e6280653af8a7c26
parent8adda70cd102a3ea5d91a72aecfde7107dd0c807 (diff)
[HICN-382] Misc compilation issues on MacOS (incl. Catalina specific code)
Change-Id: I4cb2378b2e44afbaedb984409a221b2e3f0e99b4 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
-rw-r--r--ctrl/facemgr/src/CMakeLists.txt8
-rw-r--r--ctrl/facemgr/src/interfaces/network_framework/network_framework.c21
-rw-r--r--ctrl/facemgr/src/loop_dispatcher.c9
-rw-r--r--ctrl/facemgr/src/main.c2
4 files changed, 20 insertions, 20 deletions
diff --git a/ctrl/facemgr/src/CMakeLists.txt b/ctrl/facemgr/src/CMakeLists.txt
index a473d6f72..47390cb60 100644
--- a/ctrl/facemgr/src/CMakeLists.txt
+++ b/ctrl/facemgr/src/CMakeLists.txt
@@ -56,17 +56,17 @@ endif()
set(INCLUDE_DIRS
./
../includes/
- ${CONFIG_INCLUDE_DIR}
- ${LIBEVENT_INCLUDE_DIR}
${HICN_INCLUDE_DIRS}
${LIBHICNCTRL_INCLUDE_DIRS}
+ ${CONFIG_INCLUDE_DIR}
+ ${LIBEVENT_INCLUDE_DIR}
)
set(LIBRARIES
- ${CONFIG_LIBRARY}
- ${LIBEVENT_LIBRARY}
${HICN_LIBRARIES}
${LIBHICNCTRL_LIBRARIES}
+ ${CONFIG_LIBRARY}
+ ${LIBEVENT_LIBRARY}
)
diff --git a/ctrl/facemgr/src/interfaces/network_framework/network_framework.c b/ctrl/facemgr/src/interfaces/network_framework/network_framework.c
index 19fe7bbe2..01c40c0b7 100644
--- a/ctrl/facemgr/src/interfaces/network_framework/network_framework.c
+++ b/ctrl/facemgr/src/interfaces/network_framework/network_framework.c
@@ -224,17 +224,17 @@ dump_browse_result(nw_browse_result_t result, int indent)
{
/* Endpoint */
nw_endpoint_t browse_endpoint = nw_browse_result_copy_endpoint(result);
- if (!bendpoint) {
+ if (!browse_endpoint) {
ERROR("[network_framework.dump_result] Failed to retrieve endpoint from Bonjour browse result");
return;
}
- printfi(indent + 1, "Endpoint:")
+ printfi(indent + 1, "Endpoint:");
dump_endpoint(browse_endpoint, indent + 2);
/* Interfaces */
- printfi(indent + 1, "Interfaces:")
- nw_browse_result_enumerate_interfaces(result, ^(nw_interface_t interface) {
- dump_interface(interface, index + 2);
+ printfi(indent + 1, "Interfaces:");
+ nw_browse_result_enumerate_interfaces(result, (nw_browse_result_enumerate_interface_t) ^(nw_interface_t interface) {
+ dump_interface(interface, indent + 2);
return true;
});
}
@@ -482,13 +482,13 @@ void on_interface_event(interface_t * interface, nw_interface_t iface)
dump_browse_result(result, 2);
printfi(1, "Result2:");
dump_browse_result(result2, 2);
- printfi("Flag: %s\n", flag?"ON":"OFF");
+ printfi(1, "Flag: %s\n", (flag?"ON":"OFF"));
/* Changes */
nw_browse_result_change_t change = nw_browse_result_get_changes(result, result2);
switch(change) {
case nw_browse_result_change_identical:
- printfi("The compared services are identical.");
+ printfi(2, "The compared services are identical.");
break;
case nw_browse_result_change_result_added:
printfi(2, "A new service was discovered.");
@@ -506,17 +506,12 @@ void on_interface_event(interface_t * interface, nw_interface_t iface)
printfi(2, "The service was discovered over a new interface.");
break;
-nw_browse_result_change_interface_removed
+ case nw_browse_result_change_interface_removed:
printfi(2, "The service was no longer discovered over a certain interface.");
break;
}
});
- browser.browseResultsChangedHandler = { browseResults, _ in
- for browseResult in browseResults {
- print("Discovered \(browseResult.endpoint) over \(browseResult.interfaces)")
- }
- }
nw_browser_start(browser);
//#else
//#warning "Bonjour discovery only available in MacOS 10.15+"
diff --git a/ctrl/facemgr/src/loop_dispatcher.c b/ctrl/facemgr/src/loop_dispatcher.c
index d2177ba21..499a1ccac 100644
--- a/ctrl/facemgr/src/loop_dispatcher.c
+++ b/ctrl/facemgr/src/loop_dispatcher.c
@@ -39,7 +39,14 @@ struct loop_s {
loop_t *
loop_create()
{
- /* Nothing to do */
+ loop_t * loop = malloc(sizeof(loop_t));
+ if (!loop) {
+ ERROR("[loop_create] Failed to allocate memory");
+ goto ERR_MALLOC;
+ }
+ return loop;
+
+ERR_MALLOC:
return NULL;
}
diff --git a/ctrl/facemgr/src/main.c b/ctrl/facemgr/src/main.c
index b7bd6c6cd..eeb0a0259 100644
--- a/ctrl/facemgr/src/main.c
+++ b/ctrl/facemgr/src/main.c
@@ -185,9 +185,7 @@ MAIN_LOOP:
/* Main loop */
loop = loop_create();
-#ifdef __linux__
facemgr_set_callback(facemgr, loop, (void*)loop_callback);
-#endif /* __linux__ */
#ifdef __ANDROID__
facemgr_set_jvm(facemgr, NULL, NULL); // FIXME