summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xCMakeLists.txt16
-rwxr-xr-xcmake/Modules/Packager.cmake58
-rw-r--r--hicn-light/cmake/Modules/Packaging.cmake4
-rwxr-xr-xhicn-light/src/command_line/daemon/hicnLightDaemon_main.c2
-rwxr-xr-xhicn-light/src/config/configuration.c10
-rwxr-xr-xhicn-light/src/config/configurationListeners.c14
-rwxr-xr-xhicn-light/src/config/controlAddConnection.c32
-rwxr-xr-xhicn-light/src/core/forwarder.c2
-rwxr-xr-xhicn-light/src/core/forwarder.h2
-rwxr-xr-xhicn-light/src/core/messageHandler.h2
-rwxr-xr-xhicn-light/src/io/hicnConnection.c8
-rwxr-xr-xhicn-light/src/io/hicnConnection.h4
-rwxr-xr-xhicn-light/src/io/hicnListener.c64
-rwxr-xr-xhicn-light/src/io/hicnListener.h4
-rwxr-xr-xhicn-light/src/io/streamConnection.c8
-rw-r--r--hicn-plugin/cmake/Modules/Packaging.cmake4
-rw-r--r--lib/cmake/Modules/Packaging.cmake11
-rwxr-xr-xlibtransport/cmake/Modules/Packaging.cmake24
-rw-r--r--libtransport/src/hicn/transport/core/memif_connector.cc5
-rw-r--r--libtransport/src/hicn/transport/core/pending_interest.cc40
-rw-r--r--libtransport/src/hicn/transport/core/pending_interest.h21
-rw-r--r--libtransport/src/hicn/transport/core/portal.h60
-rw-r--r--libtransport/src/hicn/transport/core/raw_socket_interface.cc2
-rw-r--r--libtransport/src/hicn/transport/core/socket_connector.cc19
-rw-r--r--libtransport/src/hicn/transport/core/socket_connector.h2
-rw-r--r--libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc2
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc3
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h2
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc18
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/rtc_socket_producer.h3
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_consumer.cc4
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/socket_consumer.h3
-rwxr-xr-xlibtransport/src/hicn/transport/interfaces/socket_producer.cc6
-rw-r--r--scripts/build-packages.sh129
-rw-r--r--utils/cmake/Modules/Packaging.cmake4
-rwxr-xr-xutils/src/ping_client.cc15
36 files changed, 440 insertions, 167 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a362a4005..29fa1700b 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,13 +39,17 @@ set(LIBTRANSPORT_HEADER_FILES)
set(SUBDIRS lib hicn-light libtransport utils)
+add_compile_options(-Wall -Werror)
+
if (BUILD_VPP_PLUGIN AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" )
-list(APPEND SUBDIRS
- hicn-plugin
-)
-list(APPEND HICN_BINARY_API_INCLUDE_DIRS
- ${PROJECT_BINARY_DIR}/hicn-plugin
- ${PROJECT_BINARY_DIR}/hicn-plugin/vpp_plugins)
+ list(APPEND SUBDIRS
+ hicn-plugin
+ )
+
+ list(APPEND HICN_BINARY_API_INCLUDE_DIRS
+ ${PROJECT_BINARY_DIR}/hicn-plugin
+ ${PROJECT_BINARY_DIR}/hicn-plugin/vpp_plugins
+ )
endif()
foreach(dir ${SUBDIRS})
diff --git a/cmake/Modules/Packager.cmake b/cmake/Modules/Packager.cmake
index f060bfa4b..c04e5c0b0 100755
--- a/cmake/Modules/Packager.cmake
+++ b/cmake/Modules/Packager.cmake
@@ -42,7 +42,7 @@ macro(make_packages)
)
if (NOT VER)
- set(VER 1.0)
+ set(VER "v1.0-1-gcafe")
endif()
string(REGEX REPLACE "v(.*)-([0-9]+)-(g[0-9a-f]+)" "\\1;\\2;\\3" VER ${VER})
@@ -51,13 +51,21 @@ macro(make_packages)
list(GET VER 1 commit_num)
list(GET VER 2 commit_name)
+ if (NOT DEFINED ENV{BUILD_NUMBER})
+ set(bld "b1")
+ else()
+ set(bld "b$ENV{BUILD_NUMBER}")
+ endif()
+
+ message("Build number is: ${bld}")
+
#define DEB and RPM version numbers
if(${commit_num} EQUAL 0)
set(deb_ver "${tag}")
set(rpm_ver "${tag}")
else()
- set(deb_ver "${tag}~${commit_num}~${commit_name}")
- set(rpm_ver "${tag}~${commit_num}_${commit_name}")
+ set(deb_ver "${tag}-${commit_num}-release")
+ set(rpm_ver "${tag}-${commit_num}-release")
endif()
get_cmake_property(components COMPONENTS)
@@ -65,29 +73,57 @@ macro(make_packages)
if(OS_ID_LIKE MATCHES "debian")
set(CPACK_GENERATOR "DEB")
set(type "DEBIAN")
+
+ execute_process(
+ COMMAND dpkg --print-architecture
+ OUTPUT_VARIABLE arch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
set(CPACK_PACKAGE_VERSION "${deb_ver}")
- set(CPACK_${type}_FILE_NAME DEB-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
- set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${${lc}_DEB_DEPENDENCIES}")
+ set(CPACK_${type}_${uc}_FILE_NAME "${lc}_${deb_ver}_${arch}.deb")
+
+ set(DEB_DEPS)
+ if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
+ string(REPLACE "stable_version" ${tag} DEB_DEPS ${${lc}_DEB_DEPENDENCIES})
+ endif()
+
+ set(CPACK_${type}_${uc}_PACKAGE_DEPENDS "${DEB_DEPS}")
set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
set(CPACK_COMPONENT_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
endforeach()
elseif(OS_ID_LIKE MATCHES "rhel")
set(CPACK_GENERATOR "RPM")
set(type "RPM")
+
+ execute_process(
+ COMMAND uname -m
+ OUTPUT_VARIABLE arch
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
set(CPACK_PACKAGE_VERSION "${rpm_ver}")
- set(CPACK_${type}_FILE_NAME RPM-DEFAULT)
foreach(lc ${components})
string(TOUPPER ${lc} uc)
+ set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
+
+ set(RPM_DEPS)
+ if (NOT ${${lc}_DEB_DEPENDENCIES} STREQUAL "")
+ string(REPLACE "stable_version" ${tag} RPM_DEPS ${${lc}_RPM_DEPENDENCIES})
+ endif()
+
+ set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${RPM_DEPS}")
+
if(${lc} MATCHES ".*-dev")
- set(CPACK_${type}_${uc}_DEBUGINFO_PACKAGE ON)
- set(lc ${lc}el)
+ set(package_name ${lc}el)
+ else()
+ set(package_name ${lc})
endif()
- set(CPACK_${type}_${uc}_PACKAGE_NAME "${lc}")
- set(CPACK_${type}_${uc}_DESCRIPTION "${${lc}_DESCRIPTION}")
- set(CPACK_${type}_${uc}_PACKAGE_REQUIRES "${${lc}_RPM_DEPENDENCIES}")
+ set(CPACK_RPM_${uc}_PACKAGE_NAME "${package_name}")
+ set(CPACK_${type}_${uc}_FILE_NAME "${package_name}-${rpm_ver}.${arch}.rpm")
endforeach()
endif()
diff --git a/hicn-light/cmake/Modules/Packaging.cmake b/hicn-light/cmake/Modules/Packaging.cmake
index 386c9e985..7e8399626 100644
--- a/hicn-light/cmake/Modules/Packaging.cmake
+++ b/hicn-light/cmake/Modules/Packaging.cmake
@@ -21,11 +21,11 @@ set(${LIBHICN_LIGHT}_DESCRIPTION
)
set(${LIBHICN_LIGHT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0)"
+ "libhicn (>= stable_version), libparc (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${LIBHICN_LIGHT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0"
+ "libhicn >= stable_version, libparc >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
index f6d521711..415e98d65 100755
--- a/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
+++ b/hicn-light/src/command_line/daemon/hicnLightDaemon_main.c
@@ -158,7 +158,7 @@ static void _daemonize(void) {
}
int forkReturn = fork();
- parcTrapUnexpectedStateIf(forkReturn < 0, "Fork error");
+ parcTrapUnexpectedStateIf(forkReturn < 0, "Fork error")
if (forkReturn > 0) {
// parent exits
diff --git a/hicn-light/src/config/configuration.c b/hicn-light/src/config/configuration.c
index cccd60620..737605932 100755
--- a/hicn-light/src/config/configuration.c
+++ b/hicn-light/src/config/configuration.c
@@ -102,7 +102,7 @@ void configuration_Destroy(Configuration **configPtr) {
*configPtr = NULL;
}
-struct iovec *configuration_ProcessRegisterHIcnPrefix(Configuration *config,
+struct iovec *configuration_ProcessRegisterHicnPrefix(Configuration *config,
struct iovec *request,
unsigned ingressId) {
header_control_message *header = request[0].iov_base;
@@ -168,7 +168,7 @@ struct iovec *configuration_ProcessRegisterHIcnPrefix(Configuration *config,
return response;
}
-struct iovec *configuration_ProcessUnregisterHIcnPrefix(Configuration *config,
+struct iovec *configuration_ProcessUnregisterHicnPrefix(Configuration *config,
struct iovec *request) {
header_control_message *header = request[0].iov_base;
remove_route_command *control = request[1].iov_base;
@@ -292,6 +292,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
response[1].iov_base = payloadResponse;
response[1].iov_len = sizeof(list_routes_command) * payloadSize;
+ fibEntryList_Destroy(&fibList);
return response;
}
@@ -578,6 +579,7 @@ struct iovec *configuration_ProcessConnectionList(Configuration *config,
response[1].iov_len =
sizeof(list_connections_command) * connectionList_Length(connList);
+ connectionList_Destroy(&connList);
return response;
}
@@ -984,7 +986,7 @@ struct iovec *configuration_DispatchCommand(Configuration *config,
case ADD_ROUTE:
response =
- configuration_ProcessRegisterHIcnPrefix(config, control, ingressId);
+ configuration_ProcessRegisterHicnPrefix(config, control, ingressId);
break;
case LIST_ROUTES:
@@ -996,7 +998,7 @@ struct iovec *configuration_DispatchCommand(Configuration *config,
break;
case REMOVE_ROUTE:
- response = configuration_ProcessUnregisterHIcnPrefix(config, control);
+ response = configuration_ProcessUnregisterHicnPrefix(config, control);
break;
case CACHE_STORE:
diff --git a/hicn-light/src/config/configurationListeners.c b/hicn-light/src/config/configurationListeners.c
index be30e2a49..0982a2b13 100755
--- a/hicn-light/src/config/configurationListeners.c
+++ b/hicn-light/src/config/configurationListeners.c
@@ -37,7 +37,7 @@
#include <src/utils/commands.h>
#include <src/utils/utils.h>
-static bool _setupHIcnListenerOnInet4(Forwarder *forwarder,
+static bool _setupHicnListenerOnInet4(Forwarder *forwarder,
const char *symbolic, Address *address) {
bool success = false;
#ifndef __APPLE__
@@ -45,14 +45,14 @@ static bool _setupHIcnListenerOnInet4(Forwarder *forwarder,
hicnListener_CreateInet(forwarder, (char *)symbolic, address);
if (ops != NULL) {
success = listenerSet_Add(forwarder_GetListenerSet(forwarder), ops);
- parcAssertTrue(success, "Failed to add HIcn listener %s to ListenerSet",
+ parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet",
symbolic);
}
#endif /* __APPLE__ */
return success;
}
-static bool _setupHIcnListenerOnInet6(Forwarder *forwarder,
+static bool _setupHicnListenerOnInet6(Forwarder *forwarder,
const char *symbolic, Address *address) {
bool success = false;
#ifndef __APPLE__
@@ -60,7 +60,7 @@ static bool _setupHIcnListenerOnInet6(Forwarder *forwarder,
hicnListener_CreateInet6(forwarder, (char *)symbolic, address);
if (ops != NULL) {
success = listenerSet_Add(forwarder_GetListenerSet(forwarder), ops);
- parcAssertTrue(success, "Failed to add HIcn listener %s to ListenerSet",
+ parcAssertTrue(success, "Failed to add Hicn listener %s to ListenerSet",
symbolic);
}
#endif /* __APPLE__ */
@@ -149,7 +149,7 @@ bool _AddPuntingInet6(const Configuration *config, Punting *punting,
Address *fakeAddr = addressCreateFromInet6((struct sockaddr_in6 *)addr);
// comments:
- // EncapType: I use the HIcn encap since the puting is available only for HIcn
+ // EncapType: I use the Hicn encap since the punting is available only for Hicn
// listeners LocalAddress: The only listern for which we need punting rules is
// the main one, which has no address
// so I create a fake empty address. This need to be consistent
@@ -297,7 +297,7 @@ bool _addHicn(Configuration *config, add_listener_command *control,
case ADDR_INET: {
localAddress =
utils_AddressFromInet(&control->address.ipv4, &control->port);
- success = _setupHIcnListenerOnInet4(configuration_GetForwarder(config),
+ success = _setupHicnListenerOnInet4(configuration_GetForwarder(config),
symbolic, localAddress);
break;
}
@@ -305,7 +305,7 @@ bool _addHicn(Configuration *config, add_listener_command *control,
case ADDR_INET6: {
localAddress =
utils_AddressFromInet6(&control->address.ipv6, &control->port);
- success = _setupHIcnListenerOnInet6(configuration_GetForwarder(config),
+ success = _setupHicnListenerOnInet6(configuration_GetForwarder(config),
symbolic, localAddress);
break;
}
diff --git a/hicn-light/src/config/controlAddConnection.c b/hicn-light/src/config/controlAddConnection.c
index a0a966ddf..0603e37a5 100755
--- a/hicn-light/src/config/controlAddConnection.c
+++ b/hicn-light/src/config/controlAddConnection.c
@@ -43,9 +43,9 @@ static CommandReturn _controlAddConnection_Execute(CommandParser *parser,
// ===================================================
-static CommandReturn _controlAddConnection_HIcnHelpExecute(
+static CommandReturn _controlAddConnection_HicnHelpExecute(
CommandParser *parser, CommandOps *ops, PARCList *args);
-static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser,
+static CommandReturn _controlAddConnection_HicnExecute(CommandParser *parser,
CommandOps *ops,
PARCList *args);
@@ -66,11 +66,11 @@ static CommandReturn _controlAddConnection_TcpExecute(CommandParser *parser,
// ===================================================
static const char *_commandAddConnection = "add connection";
-static const char *_commandAddConnectionHIcn = "add connection hicn";
+static const char *_commandAddConnectionHicn = "add connection hicn";
static const char *_commandAddConnectionUdp = "add connection udp";
static const char *_commandAddConnectionTcp = "add connection tcp";
static const char *_commandAddConnectionHelp = "help add connection";
-static const char *_commandAddConnectionHIcnHelp = "help add connection hicn";
+static const char *_commandAddConnectionHicnHelp = "help add connection hicn";
static const char *_commandAddConnectionUdpHelp = "help add connection udp";
static const char *_commandAddConnectionTcpHelp = "help add connection tcp";
@@ -90,9 +90,9 @@ CommandOps *controlAddConnection_HelpCreate(ControlState *state) {
// ===================================================
-static CommandOps *_controlAddConnection_HIcnCreate(ControlState *state) {
- return commandOps_Create(state, _commandAddConnectionHIcn, NULL,
- _controlAddConnection_HIcnExecute,
+static CommandOps *_controlAddConnection_HicnCreate(ControlState *state) {
+ return commandOps_Create(state, _commandAddConnectionHicn, NULL,
+ _controlAddConnection_HicnExecute,
commandOps_Destroy);
}
@@ -110,9 +110,9 @@ static CommandOps *_controlAddConnection_TcpCreate(ControlState *state) {
// ===================================================
-static CommandOps *_controlAddConnection_HIcnHelpCreate(ControlState *state) {
- return commandOps_Create(state, _commandAddConnectionHIcnHelp, NULL,
- _controlAddConnection_HIcnHelpExecute,
+static CommandOps *_controlAddConnection_HicnHelpCreate(ControlState *state) {
+ return commandOps_Create(state, _commandAddConnectionHicnHelp, NULL,
+ _controlAddConnection_HicnHelpExecute,
commandOps_Destroy);
}
@@ -134,7 +134,7 @@ static CommandReturn _controlAddConnection_HelpExecute(CommandParser *parser,
CommandOps *ops,
PARCList *args) {
printf("Available commands:\n");
- printf(" %s\n", _commandAddConnectionHIcn);
+ printf(" %s\n", _commandAddConnectionHicn);
printf(" %s\n", _commandAddConnectionUdp);
printf(" %s\n", _commandAddConnectionTcp);
printf("\n");
@@ -144,13 +144,13 @@ static CommandReturn _controlAddConnection_HelpExecute(CommandParser *parser,
static void _controlAddConnection_Init(CommandParser *parser, CommandOps *ops) {
ControlState *state = ops->closure;
controlState_RegisterCommand(state,
- _controlAddConnection_HIcnHelpCreate(state));
+ _controlAddConnection_HicnHelpCreate(state));
controlState_RegisterCommand(state,
_controlAddConnection_UdpHelpCreate(state));
controlState_RegisterCommand(state,
_controlAddConnection_TcpHelpCreate(state));
- controlState_RegisterCommand(state, _controlAddConnection_HIcnCreate(state));
+ controlState_RegisterCommand(state, _controlAddConnection_HicnCreate(state));
controlState_RegisterCommand(state, _controlAddConnection_UdpCreate(state));
controlState_RegisterCommand(state, _controlAddConnection_TcpCreate(state));
}
@@ -269,14 +269,14 @@ static CommandReturn _controlAddConnection_IpHelp(CommandParser *parser,
return CommandReturn_Success;
}
-static CommandReturn _controlAddConnection_HIcnHelpExecute(
+static CommandReturn _controlAddConnection_HicnHelpExecute(
CommandParser *parser, CommandOps *ops, PARCList *args) {
_controlAddConnection_IpHelp(parser, ops, args, "hicn");
return CommandReturn_Success;
}
-static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser,
+static CommandReturn _controlAddConnection_HicnExecute(CommandParser *parser,
CommandOps *ops,
PARCList *args) {
static const int _indexSymbolic = 3;
@@ -284,7 +284,7 @@ static CommandReturn _controlAddConnection_HIcnExecute(CommandParser *parser,
static const int _indexLocAddr = 5;
if (parcList_Size(args) != 6) {
- _controlAddConnection_HIcnHelpExecute(parser, ops, args);
+ _controlAddConnection_HicnHelpExecute(parser, ops, args);
return CommandReturn_Failure;
}
diff --git a/hicn-light/src/core/forwarder.c b/hicn-light/src/core/forwarder.c
index cb94af3b5..e84351365 100755
--- a/hicn-light/src/core/forwarder.c
+++ b/hicn-light/src/core/forwarder.c
@@ -439,7 +439,7 @@ PARCClock *forwarder_GetClock(const Forwarder *forwarder) {
return forwarder->clock;
}
-hicn_socket_helper_t *forwarder_GetHIcnSocketHelper(Forwarder *forwarder) {
+hicn_socket_helper_t *forwarder_GetHicnSocketHelper(Forwarder *forwarder) {
return forwarder->hicnSocketHelper;
}
diff --git a/hicn-light/src/core/forwarder.h b/hicn-light/src/core/forwarder.h
index ad3f9756b..e044add3b 100755
--- a/hicn-light/src/core/forwarder.h
+++ b/hicn-light/src/core/forwarder.h
@@ -240,7 +240,7 @@ void forwarder_ClearCache(Forwarder *forwarder);
void forwarder_SetStrategy(Forwarder *forwarder, Name *prefix,
strategy_type strategy);
-hicn_socket_helper_t *forwarder_GetHIcnSocketHelper(Forwarder *forwarder);
+hicn_socket_helper_t *forwarder_GetHicnSocketHelper(Forwarder *forwarder);
#ifdef WITH_MAPME
diff --git a/hicn-light/src/core/messageHandler.h b/hicn-light/src/core/messageHandler.h
index d63656461..cf8ab3672 100755
--- a/hicn-light/src/core/messageHandler.h
+++ b/hicn-light/src/core/messageHandler.h
@@ -145,7 +145,7 @@ static inline size_t messageHandler_GetIPHeaderLength(unsigned ipVersion) {
return 0;
}
-static inline bool messageHandler_IsValidHIcnPacket(const uint8_t *message) {
+static inline bool messageHandler_IsValidHicnPacket(const uint8_t *message) {
uint8_t version = messageHandler_GetIPPacketType(message);
if (version == IPv6_TYPE || version == IPv4_TYPE) {
return true;
diff --git a/hicn-light/src/io/hicnConnection.c b/hicn-light/src/io/hicnConnection.c
index 85cf50921..6def8ed43 100755
--- a/hicn-light/src/io/hicnConnection.c
+++ b/hicn-light/src/io/hicnConnection.c
@@ -14,7 +14,7 @@
*/
/**
- * Embodies the reader/writer for a HIcn connection
+ * Embodies the reader/writer for a Hicn connection
*
* NB The Send() function may overflow the output buffer
*
@@ -112,7 +112,7 @@ static IoOperations _template = {.closure = NULL,
// =================================================================
-static void _setConnectionState(_HicnState *HIcn, bool isUp);
+static void _setConnectionState(_HicnState *Hicn, bool isUp);
static bool _saveSockaddr(_HicnState *hicnConnState, const AddressPair *pair);
static void _refreshProbeDestAddress(_HicnState *hicnConnState,
const uint8_t *message);
@@ -150,7 +150,7 @@ IoOperations *hicnConnection_Create(Forwarder *forwarder, int fd,
char *str = addressPair_ToString(hicnConnState->addressPair);
logger_Log(hicnConnState->logger, LoggerFacility_IO, PARCLogLevel_Info,
__func__,
- "HIcnConnection %p created for address %s (isLocal %d)",
+ "HicnConnection %p created for address %s (isLocal %d)",
(void *)hicnConnState, str, hicnConnState->isLocal);
free(str);
}
@@ -196,7 +196,7 @@ static void _destroy(IoOperations **opsPtr) {
if (logger_IsLoggable(hicnConnState->logger, LoggerFacility_IO,
PARCLogLevel_Info)) {
logger_Log(hicnConnState->logger, LoggerFacility_IO, PARCLogLevel_Info,
- __func__, "HIcnConnection %p destroyed", (void *)hicnConnState);
+ __func__, "HicnConnection %p destroyed", (void *)hicnConnState);
}
// XXX
diff --git a/hicn-light/src/io/hicnConnection.h b/hicn-light/src/io/hicnConnection.h
index 757e534ba..930e2d470 100755
--- a/hicn-light/src/io/hicnConnection.h
+++ b/hicn-light/src/io/hicnConnection.h
@@ -15,7 +15,7 @@
/**
* @file hicnConnection.h
- * @brief Represents a HIcn connection for the connection table
+ * @brief Represents a Hicn connection for the connection table
*
* <#Detailed Description#>
*
@@ -30,7 +30,7 @@
#include <src/utils/address.h>
/**
- * Creates a HIcn connection that can send to the remote address
+ * Creates a Hicn connection that can send to the remote address
*
* The address pair must both be same type (i.e. INET or INET6).
*
diff --git a/hicn-light/src/io/hicnListener.c b/hicn-light/src/io/hicnListener.c
index 161f5b317..789face90 100755
--- a/hicn-light/src/io/hicnListener.c
+++ b/hicn-light/src/io/hicnListener.c
@@ -119,9 +119,9 @@ static bool _isEmptyAddressIPv4(Address *address) {
ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
Address *address) {
- HIcnListener *hicn = parcMemory_AllocateAndClear(sizeof(HIcnListener));
+ HicnListener *hicn = parcMemory_AllocateAndClear(sizeof(HicnListener));
parcAssertNotNull(hicn, "parcMemory_AllocateAndClear(%zu) returned NULL",
- sizeof(HIcnListener));
+ sizeof(HicnListener));
hicn->forwarder = forwarder;
hicn->logger = logger_Acquire(forwarder_GetLogger(forwarder));
@@ -134,7 +134,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
hicn->connection_id = -1;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(forwarder);
+ forwarder_GetHicnSocketHelper(forwarder);
if (_isEmptyAddressIPv4(address)) {
hicn->hicn_fd = hicn_socket(hicnSocketHelper, symbolic, NULL);
@@ -158,7 +158,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
PARCLogLevel_Debug)) {
logger_Log(
hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s: error while creating an hicn listener in lib_hicn",
+ "HicnListener %s: error while creating an hicn listener in lib_hicn",
symbolic);
}
logger_Release(&hicn->logger);
@@ -190,7 +190,7 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
if (logger_IsLoggable(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug)) {
logger_Log(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s created", symbolic);
+ "HicnListener %s created", symbolic);
}
return ops;
@@ -199,9 +199,9 @@ ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
Address *address) {
- HIcnListener *hicn = parcMemory_AllocateAndClear(sizeof(HIcnListener));
+ HicnListener *hicn = parcMemory_AllocateAndClear(sizeof(HicnListener));
parcAssertNotNull(hicn, "parcMemory_AllocateAndClear(%zu) returned NULL",
- sizeof(HIcnListener));
+ sizeof(HicnListener));
hicn->forwarder = forwarder;
hicn->logger = logger_Acquire(forwarder_GetLogger(forwarder));
@@ -219,7 +219,7 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
//address we just need to set the right type of packet
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(forwarder);
+ forwarder_GetHicnSocketHelper(forwarder);
if (_isEmptyAddressIPv6(address)) {
// create main listener
@@ -248,7 +248,7 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
PARCLogLevel_Debug)) {
logger_Log(
hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s: error while creating an hicn listener in lib_hicn",
+ "HicnListener %s: error while creating an hicn listener in lib_hicn",
symbolic);
}
logger_Release(&hicn->logger);
@@ -280,16 +280,16 @@ ListenerOps *hicnListener_CreateInet6(Forwarder *forwarder, char *symbolic,
if (logger_IsLoggable(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug)) {
logger_Log(hicn->logger, LoggerFacility_IO, PARCLogLevel_Debug, __func__,
- "HIcnListener %s created", symbolic);
+ "HicnListener %s created", symbolic);
}
return ops;
}
bool _hicnListener_BindInet6(ListenerOps *ops, const Address *remoteAddress) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
struct sockaddr_in6 *tmpAddr =
parcMemory_AllocateAndClear(sizeof(struct sockaddr_in6));
@@ -319,9 +319,9 @@ bool _hicnListener_BindInet6(ListenerOps *ops, const Address *remoteAddress) {
}
bool _hicnListener_BindInet(ListenerOps *ops, const Address *remoteAddress) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
struct sockaddr_in *tmpAddr =
parcMemory_AllocateAndClear(sizeof(struct sockaddr_in));
@@ -362,9 +362,9 @@ bool hicnListener_Bind(ListenerOps *ops, const Address *remoteAddress) {
}
bool hicnListener_Punting(ListenerOps *ops, const char *prefix) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
hicn_socket_helper_t *hicnSocketHelper =
- forwarder_GetHIcnSocketHelper(hicn->forwarder);
+ forwarder_GetHicnSocketHelper(hicn->forwarder);
int res = hicn_listen(hicnSocketHelper, hicn->hicn_fd, prefix);
int retry = 0;
@@ -388,7 +388,7 @@ bool hicnListener_Punting(ListenerOps *ops, const char *prefix) {
}
bool hicnListener_SetConnectionId(ListenerOps *ops, unsigned connId) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
if (hicn) {
hicn->connection_id = connId;
return true;
@@ -396,12 +396,12 @@ bool hicnListener_SetConnectionId(ListenerOps *ops, unsigned connId) {
return false;
}
-static void _hicnListener_Destroy(HIcnListener **listenerPtr) {
+static void _hicnListener_Destroy(HicnListener **listenerPtr) {
parcAssertNotNull(listenerPtr, "Parameter must be non-null double pointer");
parcAssertNotNull(*listenerPtr,
"Parameter must derefernce to non-null pointer");
- HIcnListener *hicn = *listenerPtr;
+ HicnListener *hicn = *listenerPtr;
// close(hicn->hicn_fd); //XXX close the fd in the hicnlib (detroy listener?)
dispatcher_DestroyNetworkEvent(forwarder_GetDispatcher(hicn->forwarder),
@@ -414,32 +414,32 @@ static void _hicnListener_Destroy(HIcnListener **listenerPtr) {
static void _destroy(ListenerOps **listenerOpsPtr) {
ListenerOps *ops = *listenerOpsPtr;
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
_hicnListener_Destroy(&hicn);
parcMemory_Deallocate((void **)&ops);
*listenerOpsPtr = NULL;
}
static unsigned _getInterfaceIndex(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->conn_id;
}
static const Address *_getListenAddress(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->localAddress;
}
static EncapType _getEncapType(const ListenerOps *ops) { return ENCAP_HICN; }
static int _getSocket(const ListenerOps *ops) {
- HIcnListener *hicn = (HIcnListener *)ops->context;
+ HicnListener *hicn = (HicnListener *)ops->context;
return hicn->hicn_fd;
}
// ===============================
-static void _readFrameToDiscard(HIcnListener *hicn, int fd) {
+static void _readFrameToDiscard(HicnListener *hicn, int fd) {
// we need to discard the frame. Read 1 byte. This will clear it off the
// stack.
uint8_t buffer;
@@ -463,7 +463,7 @@ static void _readFrameToDiscard(HIcnListener *hicn, int fd) {
}
}
-static unsigned _createNewConnection(HIcnListener *hicn, int fd,
+static unsigned _createNewConnection(HicnListener *hicn, int fd,
const AddressPair *pair) {
bool isLocal = false;
@@ -477,7 +477,7 @@ static unsigned _createNewConnection(HIcnListener *hicn, int fd,
return connid;
}
-const Connection *_findConnectionFromPacket(HIcnListener *hicn,
+const Connection *_findConnectionFromPacket(HicnListener *hicn,
Address *packetSourceAddress) {
const Connection *conn = NULL;
if (hicn->connection_id != -1) {
@@ -520,7 +520,7 @@ static Address *_createAddressFromPacket(uint8_t *msgBuffer) {
return packetAddr;
}
-static void _handleProbeMessage(HIcnListener *hicn, uint8_t *msgBuffer) {
+static void _handleProbeMessage(HicnListener *hicn, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr != NULL) {
@@ -536,7 +536,7 @@ static void _handleProbeMessage(HIcnListener *hicn, uint8_t *msgBuffer) {
parcMemory_Deallocate((void **)&msgBuffer);
}
-static void _handleWldrNotification(HIcnListener *hicn, uint8_t *msgBuffer) {
+static void _handleWldrNotification(HicnListener *hicn, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr == NULL) {
@@ -563,7 +563,7 @@ static void _handleWldrNotification(HIcnListener *hicn, uint8_t *msgBuffer) {
}
#ifdef WITH_MAPME
-static void _handleMapMe(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
+static void _handleMapMe(HicnListener *hicn, int fd, uint8_t *msgBuffer) {
Address *packetAddr = _createAddressFromPacket(msgBuffer);
if (packetAddr == NULL) {
@@ -630,7 +630,7 @@ static void _handleMapMe(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
}
#endif /* WITH_MAPME */
-static Message *_readMessage(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
+static Message *_readMessage(HicnListener *hicn, int fd, uint8_t *msgBuffer) {
Message *message = NULL;
ssize_t readLength = read(fd, msgBuffer, MTU_SIZE);
@@ -702,7 +702,7 @@ static Message *_readMessage(HIcnListener *hicn, int fd, uint8_t *msgBuffer) {
return message;
}
-static void _receivePacket(HIcnListener *hicn, int fd) {
+static void _receivePacket(HicnListener *hicn, int fd) {
Message *msg = NULL;
uint8_t *msgBuffer = parcMemory_AllocateAndClear(MTU_SIZE);
msg = _readMessage(hicn, fd, msgBuffer);
@@ -713,7 +713,7 @@ static void _receivePacket(HIcnListener *hicn, int fd) {
}
static void _hicnListener_readcb(int fd, PARCEventType what, void *hicnVoid) {
- HIcnListener *hicn = (HIcnListener *)hicnVoid;
+ HicnListener *hicn = (HicnListener *)hicnVoid;
if (hicn->inetFamily == IPv4 || hicn->inetFamily == IPv6) {
if (what & PARCEventType_Read) {
diff --git a/hicn-light/src/io/hicnListener.h b/hicn-light/src/io/hicnListener.h
index 98c5387c9..5897d33ad 100755
--- a/hicn-light/src/io/hicnListener.h
+++ b/hicn-light/src/io/hicnListener.h
@@ -15,7 +15,7 @@
/**
* @file hicnListener.h
- * @brief Listens for in coming HIcn connections
+ * @brief Listens for in coming Hicn connections
*
*
*/
@@ -29,7 +29,7 @@
#include <stdlib.h>
struct hicn_listener;
-typedef struct hicn_listener HIcnListener;
+typedef struct hicn_listener HicnListener;
ListenerOps *hicnListener_CreateInet(Forwarder *forwarder, char *symbolic,
Address *address);
diff --git a/hicn-light/src/io/streamConnection.c b/hicn-light/src/io/streamConnection.c
index fedbb157a..948b6c01b 100755
--- a/hicn-light/src/io/streamConnection.c
+++ b/hicn-light/src/io/streamConnection.c
@@ -504,13 +504,13 @@ PARCEventBuffer *_tryReadControlMessage(_StreamState *stream,
return NULL;
}
-static bool _isAnHIcnPacket(PARCEventBuffer *input) {
+static bool _isAnHicnPacket(PARCEventBuffer *input) {
size_t bytesAvailable = parcEventBuffer_GetLength(input);
parcAssertTrue(bytesAvailable >= sizeof(header_control_message),
"Called with too short an input: %zu", bytesAvailable);
uint8_t *fh = parcEventBuffer_Pullup(input, sizeof(header_control_message));
- return messageHandler_IsValidHIcnPacket(fh);
+ return messageHandler_IsValidHicnPacket(fh);
}
static Message *_readMessage(_StreamState *stream, Ticks time,
@@ -607,8 +607,8 @@ static void _conn_readcb(PARCEventQueue *event, PARCEventType type,
parcEventBuffer_Destroy(&message);
}
- } else if (_isAnHIcnPacket(input)) {
- // this is an HIcn packet (here we should distinguish between IPv4 and
+ } else if (_isAnHicnPacket(input)) {
+ // this is an Hicn packet (here we should distinguish between IPv4 and
// IPv6 tryReadMessage may set nextMessageLength
Message *message = _tryReadMessage(input, stream);
diff --git a/hicn-plugin/cmake/Modules/Packaging.cmake b/hicn-plugin/cmake/Modules/Packaging.cmake
index 21ba4138d..ce3b69f8f 100644
--- a/hicn-plugin/cmake/Modules/Packaging.cmake
+++ b/hicn-plugin/cmake/Modules/Packaging.cmake
@@ -21,11 +21,11 @@ set(${HICN_PLUGIN}_DESCRIPTION
)
set(${HICN_PLUGIN}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), vpp (== 19.01-release), vpp-plugins (== 19.01-release)"
+ "libhicn (>= stable_version), vpp (== stable_version-release), vpp-plugins (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${HICN_PLUGIN}_RPM_DEPENDENCIES
- "libhicn >= 1.0, vpp = 19.01-release, vpp-plugins = 19.01-release"
+ "libhicn >= stable_version, vpp = stable_version-release, vpp-plugins = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/lib/cmake/Modules/Packaging.cmake b/lib/cmake/Modules/Packaging.cmake
index 5f946f95d..2ceda1426 100644
--- a/lib/cmake/Modules/Packaging.cmake
+++ b/lib/cmake/Modules/Packaging.cmake
@@ -23,19 +23,20 @@ socket API, etc"
CACHE STRING "Description for deb/rpm package."
)
-set(lib${LIBHICN}-dev_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+set(lib${LIBHICN}_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
CACHE STRING "Description for deb/rpm package."
)
-set(lib${LIBHICN}-devel_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
+
+set(lib${LIBHICN}-dev_DESCRIPTION ${${LIBHICN}_DESCRIPTION}
CACHE STRING "Description for deb/rpm package."
)
set(lib${LIBHICN}-dev_DEB_DEPENDENCIES
- "libhicn (>= 1.0)"
+ "libhicn (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
-set(lib${LIBHICN}-devel_DEB_DEPENDENCIES
- "libhicn >= 1.0"
+set(lib${LIBHICN}-dev_RPM_DEPENDENCIES
+ "libhicn >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/libtransport/cmake/Modules/Packaging.cmake b/libtransport/cmake/Modules/Packaging.cmake
index 6dc0eb457..64d1dd325 100755
--- a/libtransport/cmake/Modules/Packaging.cmake
+++ b/libtransport/cmake/Modules/Packaging.cmake
@@ -32,48 +32,44 @@ set(lib${LIBTRANSPORT}-devel_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
if ((BUILD_MEMIF_CONNECTOR OR BUILD_VPP_PLUGIN) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0), vpp-lib (== 19.01-release)"
+ "libhicn (>= stable_version), libparc (>= 1.0), vpp-lib (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0, vpp-lib = 19.01-release"
+ "libhicn >= stable_version, libparc >= 1.0, vpp-lib = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0), vpp-dev (== 19.01-release)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (== stable_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
- set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
- "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0, vpp-devel = 19.01-release"
+ set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, libhicn-devel >= stable_version, libparc-devel >= 1.0, vpp-devel = stable_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
else()
-<<<<<<< HEAD
-
-=======
->>>>>>> 691dfde... [HICN-3] First version of packaging system based on cmake.
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "libhicn (>= 1.0), libparc (>= 1.0)"
+ "libhicn (>= stable_version), libparc (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "libhicn >= 1.0, libparc >= 1.0"
+ "libhicn >= stable_version, libparc >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "libtransport (>= 1.0), libasio-dev (>= 1.10), libhicn-dev (>= 1.0), libparc-dev (>= 1.0)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0)"
CACHE STRING "Dependencies for deb/rpm package."
)
- set(lib${LIBTRANSPORT}-devel_RPM_DEPENDENCIES
- "libtransport >= 1.0, asio-devel >= 1.10, libhicn-devel >= 1.0, libparc-devel >= 1.0"
+ set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, libhicn-devel >= stable_version, libparc-devel >= 1.0"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/libtransport/src/hicn/transport/core/memif_connector.cc b/libtransport/src/hicn/transport/core/memif_connector.cc
index b3785e5c3..6c5f2ff5f 100644
--- a/libtransport/src/hicn/transport/core/memif_connector.cc
+++ b/libtransport/src/hicn/transport/core/memif_connector.cc
@@ -38,7 +38,6 @@ MemifConnector::MemifConnector(PacketReceivedCallback &&receive_callback,
timer_set_(false),
send_timer_(std::make_unique<utils::FdDeadlineTimer>(event_reactor_)),
io_service_(io_service),
- work_(std::make_unique<asio::io_service::work>(io_service_)),
packet_counter_(0),
memif_connection_({}),
tx_buf_counter_(0),
@@ -74,6 +73,8 @@ void MemifConnector::connect(uint32_t memif_id, long memif_mode) {
createMemif(memif_id, memif_mode, nullptr);
+ work_ = std::make_unique<asio::io_service::work>(io_service_);
+
while (is_connecting_) {
MemifConnector::main_event_reactor_.runOneEvent();
}
@@ -402,7 +403,7 @@ void MemifConnector::close() {
if (!closed_) {
closed_ = true;
event_reactor_.stop();
- io_service_.stop();
+ work_.reset();
if (memif_worker_ && memif_worker_->joinable()) {
memif_worker_->join();
diff --git a/libtransport/src/hicn/transport/core/pending_interest.cc b/libtransport/src/hicn/transport/core/pending_interest.cc
index 8f6de1839..a2df9ba44 100644
--- a/libtransport/src/hicn/transport/core/pending_interest.cc
+++ b/libtransport/src/hicn/transport/core/pending_interest.cc
@@ -20,12 +20,28 @@ namespace transport {
namespace core {
PendingInterest::PendingInterest()
- : interest_(nullptr, nullptr), timer_(), received_(false) {}
+ : interest_(nullptr, nullptr),
+ timer_(),
+ on_content_object_callback_(),
+ on_interest_timeout_callback_(),
+ received_(false) {}
PendingInterest::PendingInterest(Interest::Ptr &&interest,
std::unique_ptr<asio::steady_timer> &&timer)
: interest_(std::move(interest)),
timer_(std::move(timer)),
+ on_content_object_callback_(),
+ on_interest_timeout_callback_(),
+ received_(false) {}
+
+PendingInterest::PendingInterest(Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object,
+ const OnInterestTimeoutCallback &&on_interest_timeout,
+ std::unique_ptr<asio::steady_timer> &&timer)
+ : interest_(std::move(interest)),
+ timer_(std::move(timer)),
+ on_content_object_callback_(std::move(on_content_object)),
+ on_interest_timeout_callback_(std::move(on_interest_timeout)),
received_(false) {}
PendingInterest::~PendingInterest() {
@@ -34,16 +50,28 @@ PendingInterest::~PendingInterest() {
void PendingInterest::cancelTimer() { timer_->cancel(); }
-bool PendingInterest::isReceived() const { return received_; }
-
void PendingInterest::setReceived() { received_ = true; }
+bool PendingInterest::isReceived() const { return received_; }
+
Interest::Ptr &&PendingInterest::getInterest() { return std::move(interest_); }
-void PendingInterest::setReceived(bool received) {
- PendingInterest::received_ = received;
+const OnContentObjectCallback &PendingInterest::getOnDataCallback() const {
+ return on_content_object_callback_;
+}
+
+void PendingInterest::setOnDataCallback(const OnContentObjectCallback &on_content_object) {
+ PendingInterest::on_content_object_callback_ = on_content_object;
+}
+
+const OnInterestTimeoutCallback &PendingInterest::getOnTimeoutCallback() const {
+ return on_interest_timeout_callback_;
+}
+
+void PendingInterest::setOnTimeoutCallback(const OnInterestTimeoutCallback &on_interest_timeout) {
+ PendingInterest::on_interest_timeout_callback_ = on_interest_timeout;
}
} // end namespace core
-} // end namespace transport \ No newline at end of file
+} // end namespace transport
diff --git a/libtransport/src/hicn/transport/core/pending_interest.h b/libtransport/src/hicn/transport/core/pending_interest.h
index cbcafb5d9..58b51db79 100644
--- a/libtransport/src/hicn/transport/core/pending_interest.h
+++ b/libtransport/src/hicn/transport/core/pending_interest.h
@@ -34,6 +34,8 @@ class RawSocketInterface;
template <typename ForwarderInt>
class Portal;
+typedef std::function<void(Interest::Ptr&&, ContentObject::Ptr&&)> OnContentObjectCallback;
+typedef std::function<void(Interest::Ptr&&)> OnInterestTimeoutCallback;
typedef std::function<void(const std::error_code &)> TimerCallback;
class PendingInterest {
@@ -47,9 +49,12 @@ class PendingInterest {
PendingInterest(Interest::Ptr &&interest,
std::unique_ptr<asio::steady_timer> &&timer);
- ~PendingInterest();
+ PendingInterest(Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object,
+ const OnInterestTimeoutCallback &&on_interest_timeout,
+ std::unique_ptr<asio::steady_timer> &&timer);
- bool isReceived() const;
+ ~PendingInterest();
template <typename Handler>
TRANSPORT_ALWAYS_INLINE void startCountdown(Handler &&cb) {
@@ -62,17 +67,23 @@ class PendingInterest {
void setReceived();
+ bool isReceived() const;
+
Interest::Ptr &&getInterest();
- void setReceived(bool received);
+ const OnContentObjectCallback &getOnDataCallback() const;
+
+ void setOnDataCallback(const OnContentObjectCallback &on_content_object);
- bool isValid() const;
+ const OnInterestTimeoutCallback &getOnTimeoutCallback() const;
- void setValid(bool valid);
+ void setOnTimeoutCallback(const OnInterestTimeoutCallback &on_interest_timeout);
private:
Interest::Ptr interest_;
std::unique_ptr<asio::steady_timer> timer_;
+ OnContentObjectCallback on_content_object_callback_;
+ OnInterestTimeoutCallback on_interest_timeout_callback_;
bool received_;
};
diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h
index a79717037..58406bbde 100644
--- a/libtransport/src/hicn/transport/core/portal.h
+++ b/libtransport/src/hicn/transport/core/portal.h
@@ -97,13 +97,10 @@ class Portal {
virtual void onInterest(Interest::Ptr &&i) = 0;
};
- Portal() : Portal(internal_io_service_) {
- internal_work_ = std::make_unique<asio::io_service::work>(io_service_);
- }
+ Portal() : Portal(internal_io_service_) {}
Portal(asio::io_service &io_service)
: io_service_(io_service),
- is_running_(false),
app_name_("libtransport_application"),
consumer_callback_(nullptr),
producer_callback_(nullptr),
@@ -131,8 +128,7 @@ class Portal {
}
~Portal() {
- connector_.close();
- stopEventsLoop();
+ stopEventsLoop(true);
}
TRANSPORT_ALWAYS_INLINE bool interestIsPending(const Name &name) {
@@ -157,9 +153,30 @@ class Portal {
std::placeholders::_1, name));
}
+ TRANSPORT_ALWAYS_INLINE void sendInterest(Interest::Ptr &&interest,
+ const OnContentObjectCallback &&on_content_object_callback,
+ const OnInterestTimeoutCallback &&on_interest_timeout_callback) {
+
+ const Name name(interest->getName(), true);
+
+ // Send it
+ forwarder_interface_.send(*interest);
+
+ pending_interest_hash_table_[name] = std::make_unique<PendingInterest>(
+ std::move(interest), std::move(on_content_object_callback),
+ std::move(on_interest_timeout_callback),
+ std::make_unique<asio::steady_timer>(io_service_));
+
+ pending_interest_hash_table_[name]->startCountdown(
+ std::bind(&Portal<ForwarderInt>::timerHandler,
+ this, std::placeholders::_1, name));
+
+ }
+
TRANSPORT_ALWAYS_INLINE void timerHandler(const std::error_code &ec,
const Name &name) {
- if (TRANSPORT_EXPECT_FALSE(!is_running_)) {
+ bool is_stopped = io_service_.stopped();
+ if (TRANSPORT_EXPECT_FALSE(is_stopped)) {
return;
}
@@ -170,7 +187,9 @@ class Portal {
std::unique_ptr<PendingInterest> ptr = std::move(it->second);
pending_interest_hash_table_.erase(it);
- if (consumer_callback_) {
+ if(ptr->getOnTimeoutCallback() != UNSET_CALLBACK){
+ ptr->on_interest_timeout_callback_(std::move(ptr->getInterest()));
+ }else if (consumer_callback_) {
consumer_callback_->onTimeout(std::move(ptr->getInterest()));
}
}
@@ -189,9 +208,7 @@ class Portal {
io_service_.reset(); // ensure that run()/poll() will do some work
}
- is_running_ = true;
this->io_service_.run();
- is_running_ = false;
}
TRANSPORT_ALWAYS_INLINE void runOneEvent() {
@@ -199,9 +216,7 @@ class Portal {
io_service_.reset(); // ensure that run()/poll() will do some work
}
- is_running_ = true;
this->io_service_.run_one();
- is_running_ = false;
}
TRANSPORT_ALWAYS_INLINE void sendContentObject(
@@ -209,16 +224,17 @@ class Portal {
forwarder_interface_.send(content_object);
}
- TRANSPORT_ALWAYS_INLINE void stopEventsLoop() {
- is_running_ = false;
- internal_work_.reset();
-
+ TRANSPORT_ALWAYS_INLINE void stopEventsLoop(bool kill_connection = false) {
for (auto &pend_interest : pending_interest_hash_table_) {
pend_interest.second->cancelTimer();
}
clear();
+ if(kill_connection) {
+ connector_.close();
+ }
+
io_service_.post([this]() { io_service_.stop(); });
}
@@ -242,7 +258,8 @@ class Portal {
private:
TRANSPORT_ALWAYS_INLINE void processIncomingMessages(
Packet::MemBufPtr &&packet_buffer) {
- if (TRANSPORT_EXPECT_FALSE(!is_running_)) {
+ bool is_stopped = io_service_.stopped();
+ if (TRANSPORT_EXPECT_FALSE(is_stopped)) {
return;
}
@@ -293,7 +310,11 @@ class Portal {
interest_ptr->setReceived();
pending_interest_hash_table_.erase(content_object->getName());
- if (consumer_callback_) {
+ if(interest_ptr->getOnDataCallback() != UNSET_CALLBACK){
+ interest_ptr->on_content_object_callback_(
+ std::move(interest_ptr->getInterest()),
+ std::move(content_object));
+ }else if (consumer_callback_) {
consumer_callback_->onContentObject(
std::move(interest_ptr->getInterest()),
std::move(content_object));
@@ -318,9 +339,6 @@ class Portal {
private:
asio::io_service &io_service_;
asio::io_service internal_io_service_;
- std::unique_ptr<asio::io_service::work> internal_work_;
-
- volatile bool is_running_;
std::string app_name_;
diff --git a/libtransport/src/hicn/transport/core/raw_socket_interface.cc b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
index 37aaff7e0..4cf7b2ca6 100644
--- a/libtransport/src/hicn/transport/core/raw_socket_interface.cc
+++ b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
@@ -41,7 +41,7 @@ void RawSocketInterface::connect(bool is_consumer) {
}
// Get interface ip address
- struct sockaddr_in6 address;
+ struct sockaddr_in6 address = {0};
utils::retrieveInterfaceAddress(output_interface_, &address);
inet6_address_.family = address.sin6_family;
diff --git a/libtransport/src/hicn/transport/core/socket_connector.cc b/libtransport/src/hicn/transport/core/socket_connector.cc
index 332b87ec7..704d3badb 100644
--- a/libtransport/src/hicn/transport/core/socket_connector.cc
+++ b/libtransport/src/hicn/transport/core/socket_connector.cc
@@ -62,6 +62,7 @@ SocketConnector::SocketConnector(PacketReceivedCallback &&receive_callback,
is_connecting_(false),
is_reconnection_(false),
data_available_(false),
+ is_closed_(false),
receive_callback_(receive_callback),
on_reconnect_callback_(on_reconnect_callback),
app_name_(app_name) {}
@@ -102,7 +103,11 @@ void SocketConnector::send(const Packet::MemBufPtr &packet) {
}
void SocketConnector::close() {
- io_service_.post([this]() { socket_.close(); });
+ io_service_.dispatch([this]() {
+ is_closed_ = true;
+ socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both);
+ socket_.close();
+ });
}
void SocketConnector::doWrite() {
@@ -125,6 +130,9 @@ void SocketConnector::doWrite() {
if (!output_buffer_.empty()) {
doWrite();
}
+ } else if (ec.value() == static_cast<int>(std::errc::operation_canceled)) {
+ // The connection has been closed by the application.
+ return;
} else {
TRANSPORT_LOGE("%d %s", ec.value(), ec.message().c_str());
tryReconnect();
@@ -141,6 +149,9 @@ void SocketConnector::doReadBody(std::size_t body_length) {
if (TRANSPORT_EXPECT_TRUE(!ec)) {
receive_callback_(std::move(read_msg_));
doReadHeader();
+ } else if (ec.value() == static_cast<int>(std::errc::operation_canceled)) {
+ // The connection has been closed by the application.
+ return;
} else {
TRANSPORT_LOGE("%d %s", ec.value(), ec.message().c_str());
tryReconnect();
@@ -165,6 +176,9 @@ void SocketConnector::doReadHeader() {
} else {
TRANSPORT_LOGE("Decoding error. Ignoring packet.");
}
+ } else if (ec.value() == static_cast<int>(std::errc::operation_canceled)) {
+ // The connection has been closed by the application.
+ return;
} else {
TRANSPORT_LOGE("%d %s", ec.value(), ec.message().c_str());
tryReconnect();
@@ -173,11 +187,12 @@ void SocketConnector::doReadHeader() {
}
void SocketConnector::tryReconnect() {
- if (!is_connecting_) {
+ if (!is_connecting_ && !is_closed_) {
TRANSPORT_LOGE("Connection lost. Trying to reconnect...\n");
is_connecting_ = true;
is_reconnection_ = true;
io_service_.post([this]() {
+ socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both);
socket_.close();
startConnectionTimer();
doConnect();
diff --git a/libtransport/src/hicn/transport/core/socket_connector.h b/libtransport/src/hicn/transport/core/socket_connector.h
index d7a05aab4..e014111e2 100644
--- a/libtransport/src/hicn/transport/core/socket_connector.h
+++ b/libtransport/src/hicn/transport/core/socket_connector.h
@@ -19,6 +19,7 @@
#include <hicn/transport/core/name.h>
#include <hicn/transport/utils/branch_prediction.h>
+#include <asio/steady_timer.hpp>
#include <asio.hpp>
#include <deque>
@@ -78,6 +79,7 @@ class SocketConnector : public Connector {
bool is_connecting_;
bool is_reconnection_;
bool data_available_;
+ bool is_closed_;
PacketReceivedCallback receive_callback_;
OnReconnect on_reconnect_callback_;
diff --git a/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc b/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
index 37e1d7b3e..e06858cc3 100644
--- a/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
+++ b/libtransport/src/hicn/transport/interfaces/full_duplex_socket.cc
@@ -397,7 +397,7 @@ void AsyncFullDuplexSocket::onContentRetrieved(ConsumerSocket &s,
return;
}
- TRANSPORT_LOGI("Received content with size %lu", size);
+ TRANSPORT_LOGI("Received content with size %zu", size);
if (!ec) {
read_callback_->readBufferAvailable(std::move(*receive_buffer_));
} else {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
index de3e84417..cc4f478af 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
@@ -22,6 +22,9 @@ namespace interface {
RTCConsumerSocket::RTCConsumerSocket(int protocol, asio::io_service &io_service)
: ConsumerSocket(protocol, io_service) {}
+RTCConsumerSocket::RTCConsumerSocket(int protocol)
+ : ConsumerSocket(protocol) {}
+
RTCConsumerSocket::~RTCConsumerSocket() {}
void RTCConsumerSocket::handleRTCPPacket(uint8_t *packet, size_t len) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
index 86ccf6e22..cfde3128d 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
@@ -25,6 +25,8 @@ class RTCConsumerSocket : public ConsumerSocket {
public:
explicit RTCConsumerSocket(int protocol, asio::io_service &io_service);
+ explicit RTCConsumerSocket(int protocol);
+
~RTCConsumerSocket();
void handleRTCPPacket(uint8_t *packet, size_t len);
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
index 7b39e7ac9..f19502dee 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
@@ -55,6 +55,24 @@ RTCProducerSocket::RTCProducerSocket(asio::io_service &io_service)
prodLabel_ = ((rand() % 255) << 24UL);
}
+RTCProducerSocket::RTCProducerSocket()
+ : ProducerSocket(),
+ currentSeg_(1),
+ nack_(std::make_shared<ContentObject>()),
+ producedBytes_(0),
+ producedPackets_(0),
+ bytesProductionRate_(0),
+ packetsProductionRate_(INIT_PACKET_PRODUCTION_RATE),
+ perSecondFactor_(1000 / STATS_INTERVAL_DURATION) {
+ auto nack_payload = utils::MemBuf::create(NACK_HEADER_SIZE);
+ nack_payload->append(NACK_HEADER_SIZE);
+ nack_->appendPayload(std::move(nack_payload));
+ lastStats_ = std::chrono::steady_clock::now();
+ srand(time(NULL));
+ prodLabel_ = ((rand() % 255) << 24UL);
+}
+
+
RTCProducerSocket::~RTCProducerSocket() {}
void RTCProducerSocket::registerName(Prefix &producer_namespace) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
index 1a42bdc56..f1bcaa9e8 100755
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
@@ -28,6 +28,9 @@ namespace interface {
class RTCProducerSocket : public ProducerSocket {
public:
RTCProducerSocket(asio::io_service &io_service);
+
+ RTCProducerSocket();
+
~RTCProducerSocket();
void registerName(Prefix &producer_namespace);
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
index 27ed4e65f..89411e92c 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc
@@ -99,7 +99,7 @@ int ConsumerSocket::consume(const Name &name,
transport_protocol_->start(receive_buffer);
- return CONSUMER_READY;
+ return CONSUMER_FINISHED;
}
int ConsumerSocket::asyncConsume(
@@ -115,7 +115,7 @@ int ConsumerSocket::asyncConsume(
});
}
- return CONSUMER_READY;
+ return CONSUMER_RUNNING;
}
void ConsumerSocket::asyncSendInterest(Interest::Ptr &&interest,
diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.h b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
index 9e309aae8..536d2fde3 100755
--- a/libtransport/src/hicn/transport/interfaces/socket_consumer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.h
@@ -26,8 +26,9 @@
#include <hicn/transport/utils/event_thread.h>
#include <hicn/transport/utils/sharable_vector.h>
-#define CONSUMER_READY 0
+#define CONSUMER_FINISHED 0
#define CONSUMER_BUSY 1
+#define CONSUMER_RUNNING 2
namespace transport {
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.cc b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
index 69adc2b3f..d9204f111 100755
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.cc
@@ -54,9 +54,9 @@ ProducerSocket::ProducerSocket(asio::io_service &io_service)
}
ProducerSocket::~ProducerSocket() {
- TRANSPORT_LOGI("Destroying the ProducerSocket");
+
processing_thread_stop_ = true;
- portal_->stopEventsLoop();
+ portal_->stopEventsLoop(true);
if (processing_thread_.joinable()) {
processing_thread_.join();
@@ -79,8 +79,6 @@ void ProducerSocket::serveForever() {
}
void ProducerSocket::stop() {
- TRANSPORT_LOGI("Calling stop for ProducerSocket");
- portal_->killConnection();
portal_->stopEventsLoop();
}
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh
index ae775aca9..b199f99e8 100644
--- a/scripts/build-packages.sh
+++ b/scripts/build-packages.sh
@@ -11,4 +11,133 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+#!/bin/bash
+set -euxo pipefail
+
+SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+APT_PATH=`which apt-get` || true
+apt_get=${APT_PATH:-"/usr/local/bin/apt-get"}
+
+PACKAGECLOUD_RELEASE_REPO_DEB="https://packagecloud.io/install/repositories/fdio/release/script.deb.sh"
+PACKAGECLOUD_RELEASE_REPO_RPM="https://packagecloud.io/install/repositories/fdio/release/script.rpm.sh"
+
+BUILD_TOOLS_UBUNTU="build-essential doxygen"
+LIBSSL_LIBEVENT_UBUNTU="libevent-dev libssl-dev"
+DEPS_UBUNTU="libparc-dev libasio-dev"
+
+# BUILD_TOOLS_GROUP_CENTOS="'Development Tools'"
+DEPS_CENTOS="libparc-devel asio-devel centos-release-scl devtoolset-7"
+LATEST_EPEL_REPO="http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
+
+install_cmake() {
+ cat /etc/resolv.conf
+ echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
+ cat /etc/resolv.conf
+
+ CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh"
+ CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh"
+ curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT}
+
+ sudo mkdir -p /opt/cmake
+ sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=/opt/cmake
+ export PATH=/opt/cmake/bin:${PATH}
+}
+
+# Parameters:
+# $1 = Distribution id
+# $2 = Distribution codename
+#
+setup_fdio_repo() {
+ DISTRIB_ID=${1}
+
+ if [ "${DISTRIB_ID}" == "ubuntu" ]; then
+ curl -s ${PACKAGECLOUD_RELEASE_REPO_DEB} | sudo bash
+ elif [ "${DISTRIB_ID}" == "centos" ]; then
+ curl -s ${PACKAGECLOUD_RELEASE_REPO_RPM} | sudo bash
+ curl ${LATEST_EPEL_REPO} > epel-release-latest-7.noarch.rpm
+ rpm -ivh epel-release-latest-7.noarch.rpm || true
+ rm epel-release-latest-7.noarch.rpm
+ else
+ echo "Distribution ${DISTRIB_ID} is not supported"
+ exit -1
+ fi
+}
+
+setup() {
+ # Figure out what system we are running on
+ if [ -f /etc/os-release ]; then
+ . /etc/os-release
+ else
+ echo "ERROR: System configuration not recognized. Build failed"
+ exit -1
+ fi
+
+ DISTRIB_ID=${ID}
+
+ echo DISTRIBUTION: ${PRETTY_NAME}
+ echo ARCHITECTURE: $(uname -m)
+
+ install_cmake
+ setup_fdio_repo ${DISTRIB_ID}
+
+ if [ "${DISTRIB_ID}" == "ubuntu" ]; then
+ sudo ${apt_get} update || true
+ fi
+
+ # Install dependencies
+ if [ ${DISTRIB_ID} == "ubuntu" ]; then
+ echo ${BUILD_TOOLS_UBUNTU} ${DEPS_UBUNTU} | xargs sudo ${apt_get} install -y --allow-unauthenticated --no-install-recommends
+ elif [ ${DISTRIB_ID} == "centos" ]; then
+ # echo ${BUILD_TOOLS_GROUP_CENTOS} | xargs sudo yum groupinstall -y --nogpgcheck
+ echo ${DEPS_CENTOS} | xargs sudo yum install -y --nogpgcheck
+ sudo yum install devtoolset-7
+ scl enable devtoolset-7 bash
+
+ c++ --version
+
+ CXX_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/c++"
+ CC_COMPILER="/opt/rh/devtoolset-7/root/usr/bin/cc"
+
+ ${CXX_COMPILER} --version
+ ${CC_COMPILER} --version
+
+ export CC=${CC_COMPILER} CXX=${CXX_COMPILER}
+ fi
+
+ # do nothing but check compiler version
+ c++ --version
+}
+
+# Parameters:
+# $1 = Package name
+#
+build_package() {
+ setup
+
+ echo "*******************************************************************"
+ echo "********************* STARTING PACKAGE BUILD **********************"
+ echo "*******************************************************************"
+
+ # Make the package
+ mkdir -p ${SCRIPT_PATH}/../build && pushd ${SCRIPT_PATH}/../build
+
+ rm -rf *
+ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
+ make package
+
+ find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
+
+ popd
+
+ echo "*******************************************************************"
+ echo "***************** BUILD COMPLETED SUCCESSFULLY *******************"
+ echo "*******************************************************************"
+
+ exit 0
+}
+
+pushd ${SCRIPT_PATH}/..
+build_package
+popd
+
exit 0 \ No newline at end of file
diff --git a/utils/cmake/Modules/Packaging.cmake b/utils/cmake/Modules/Packaging.cmake
index cff3d3fb1..37c123cf2 100644
--- a/utils/cmake/Modules/Packaging.cmake
+++ b/utils/cmake/Modules/Packaging.cmake
@@ -18,11 +18,11 @@ useful for testing and debugging within a hicn network."
)
set(${HICN_UTILS}_DEB_DEPENDENCIES
- "libhicntransport (>= 1.0)"
+ "libhicntransport (>= stable_version)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(${HICN_UTILS}_RPM_DEPENDENCIES
- "libhicntransport >= 1.0"
+ "libhicntransport >= stable_version"
CACHE STRING "Dependencies for deb/rpm package."
) \ No newline at end of file
diff --git a/utils/src/ping_client.cc b/utils/src/ping_client.cc
index c3bfa4086..24f7bd7c9 100755
--- a/utils/src/ping_client.cc
+++ b/utils/src/ping_client.cc
@@ -76,13 +76,15 @@ class Configuration {
class Client : interface::BasePortal::ConsumerCallback {
public:
- Client(Configuration *c) : portal_() {
+ Client(Configuration *c)
+ : portal_(),
+ signals_(portal_.getIoService(), SIGINT, SIGQUIT) {
// Let the main thread to catch SIGINT and SIGQUIT
- // asio::signal_set signals(io_service, SIGINT, SIGQUIT);
- // signals.async_wait(std::bind(&Client::afterSignal, this));
-
portal_.connect();
portal_.setConsumerCallback(this);
+
+ signals_.async_wait(std::bind(&Client::afterSignal, this));
+
timer_.reset(new asio::steady_timer(portal_.getIoService()));
config_ = c;
sequence_number_ = config_->first_suffix_;
@@ -97,6 +99,8 @@ class Client : interface::BasePortal::ConsumerCallback {
}
}
+ virtual ~Client() {}
+
void ping() {
std::cout << "start ping" << std::endl;
doPing();
@@ -270,7 +274,7 @@ class Client : interface::BasePortal::ConsumerCallback {
std::cout << "Stop ping" << std::endl;
std::cout << "Sent: " << sent_ << " Received: " << received_
<< " Timeouts: " << timedout_ << std::endl;
- portal_.stopEventsLoop();
+ portal_.stopEventsLoop(true);
}
void reset() {
@@ -287,6 +291,7 @@ class Client : interface::BasePortal::ConsumerCallback {
private:
SendTimeMap send_timestamps_;
interface::BasePortal portal_;
+ asio::signal_set signals_;
uint64_t sequence_number_;
uint64_t last_jump_;
uint64_t processed_;