summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2020-03-24 17:34:14 +0000
committerMauro Sardara <msardara@cisco.com>2020-09-14 17:31:15 +0000
commit88509fe353767cbde707c3e3b1f29392957819f3 (patch)
treecccd51bac7966cd3138c525e8075d90341184a66 /libtransport
parentd875ae92a7fa1eaab3bc2616aeeedfc64a81fea4 (diff)
[HICN-574] Host stack plugin for VPP.
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I8d8fdffef31a7013265d6529c5f52f3d5ec70d18 Signed-off-by: Mauro Sardara <msardara@cisco.com> Signed-off-by: Mauro <you@example.com> Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/includes/hicn/transport/protocols/CMakeLists.txt20
-rw-r--r--libtransport/includes/hicn/transport/protocols/transport_algorithm.h (renamed from libtransport/src/protocols/transport_algorithm.h)24
-rw-r--r--libtransport/src/CMakeLists.txt4
-rw-r--r--libtransport/src/protocols/CMakeLists.txt1
-rw-r--r--libtransport/src/protocols/raaqm_transport_algorithm.h2
-rw-r--r--libtransport/src/protocols/transport_algorithm.cc19
6 files changed, 46 insertions, 24 deletions
diff --git a/libtransport/includes/hicn/transport/protocols/CMakeLists.txt b/libtransport/includes/hicn/transport/protocols/CMakeLists.txt
new file mode 100644
index 000000000..5d8fc69b2
--- /dev/null
+++ b/libtransport/includes/hicn/transport/protocols/CMakeLists.txt
@@ -0,0 +1,20 @@
+# Copyright (c) 2017-2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
+
+list(APPEND HEADER_FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/transport_algorithm.h
+)
+
+set(HEADER_FILES ${HEADER_FILES} PARENT_SCOPE) \ No newline at end of file
diff --git a/libtransport/src/protocols/transport_algorithm.h b/libtransport/includes/hicn/transport/protocols/transport_algorithm.h
index 5dacdb3e0..f5c8cf415 100644
--- a/libtransport/src/protocols/transport_algorithm.h
+++ b/libtransport/includes/hicn/transport/protocols/transport_algorithm.h
@@ -17,7 +17,6 @@
#define transport_algorithm_h
#include <hicn/header.h>
-#include <hicn/transport/interfaces/socket_options_keys.h>
#include <stddef.h>
#include <stdint.h>
@@ -38,7 +37,7 @@ class TransportAlgorithm {
virtual void sessionEnd() = 0;
};
-using transport::interface::TransportProtocolAlgorithms;
+extern "C" {
#else
typedef void *TransportAlgorithm;
@@ -47,22 +46,27 @@ typedef void *TransportAlgorithm;
typedef void *(allocator_t)(size_t size);
typedef void *(deallocator_t)(void *ptr);
-extern "C" void transportAlgorithm_Init(allocator_t *allocator,
- deallocator_t *deallocator);
+void transportAlgorithm_Init(allocator_t *allocator,
+ deallocator_t *deallocator);
-extern "C" TransportAlgorithm *transportAlgorithm_CreateRaaqm(
+TransportAlgorithm *transportAlgorithm_CreateRaaqm(
double drop_factor, double minimum_drop_probability, double gamma,
double beta, uint32_t sample_number, uint32_t interest_lifetime,
double beta_wifi, double drop_wifi, double beta_lte, double drop_lte,
unsigned int wifi_delay, unsigned int lte_delay, double max_window,
double min_window);
-extern "C" void transportAlgorithm_Destroy(TransportAlgorithm *algorithm);
+void transportAlgorithm_Destroy(TransportAlgorithm *algorithm);
-extern "C" uint32_t transportAlgorithm_OnContentObject(
- TransportAlgorithm *algorithm, uint32_t suffix, uint32_t path_label);
+uint32_t transportAlgorithm_OnContentObject(TransportAlgorithm *algorithm,
+ uint32_t suffix,
+ uint32_t path_label);
-extern "C" uint32_t transportAlgorithm_OnInterestTimeout(
- TransportAlgorithm *algorithm, uint32_t suffix);
+uint32_t transportAlgorithm_OnInterestTimeout(TransportAlgorithm *algorithm,
+ uint32_t suffix);
+
+#ifdef __cplusplus
+} /* __cplusplus */
+#endif
#endif /* transport_algorithm_h */ \ No newline at end of file
diff --git a/libtransport/src/CMakeLists.txt b/libtransport/src/CMakeLists.txt
index c10f3da5a..f1544cf8d 100644
--- a/libtransport/src/CMakeLists.txt
+++ b/libtransport/src/CMakeLists.txt
@@ -68,7 +68,7 @@ if (DISABLE_SHARED_LIBRARIES)
DEPENDS ${DEPENDENCIES}
COMPONENT lib${LIBTRANSPORT}
INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBTRANSPORT_INTERNAL_INCLUDE_DIRS}
- INSTALL_ROOT_DIR hicn/transport
+ HEADER_ROOT_DIR hicn/transport
DEFINITIONS ${COMPILER_DEFINITIONS}
)
else ()
@@ -80,7 +80,7 @@ else ()
DEPENDS ${DEPENDENCIES}
COMPONENT lib${LIBTRANSPORT}
INCLUDE_DIRS ${LIBTRANSPORT_INCLUDE_DIRS} ${LIBTRANSPORT_INTERNAL_INCLUDE_DIRS}
- INSTALL_ROOT_DIR hicn/transport
+ HEADER_ROOT_DIR hicn/transport
DEFINITIONS ${COMPILER_DEFINITIONS}
)
endif ()
diff --git a/libtransport/src/protocols/CMakeLists.txt b/libtransport/src/protocols/CMakeLists.txt
index 02e626840..6dc1a0737 100644
--- a/libtransport/src/protocols/CMakeLists.txt
+++ b/libtransport/src/protocols/CMakeLists.txt
@@ -33,7 +33,6 @@ list(APPEND HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/verification_manager.h
${CMAKE_CURRENT_SOURCE_DIR}/data_processing_events.h
${CMAKE_CURRENT_SOURCE_DIR}/raaqm_transport_algorithm.h
- ${CMAKE_CURRENT_SOURCE_DIR}/transport_algorithm.h
)
list(APPEND SOURCE_FILES
diff --git a/libtransport/src/protocols/raaqm_transport_algorithm.h b/libtransport/src/protocols/raaqm_transport_algorithm.h
index 5b0b5c05c..eaa65d2a6 100644
--- a/libtransport/src/protocols/raaqm_transport_algorithm.h
+++ b/libtransport/src/protocols/raaqm_transport_algorithm.h
@@ -17,11 +17,11 @@
#include <hicn/transport/interfaces/socket_options_default_values.h>
#include <hicn/transport/interfaces/statistics.h>
+#include <hicn/transport/protocols/transport_algorithm.h>
#include <hicn/transport/utils/chrono_typedefs.h>
#include <protocols/congestion_window_protocol.h>
#include <protocols/raaqm_data_path.h>
#include <protocols/rate_estimation.h>
-#include <protocols/transport_algorithm.h>
#include <array>
#include <queue>
diff --git a/libtransport/src/protocols/transport_algorithm.cc b/libtransport/src/protocols/transport_algorithm.cc
index 2b8d60934..37dbf5453 100644
--- a/libtransport/src/protocols/transport_algorithm.cc
+++ b/libtransport/src/protocols/transport_algorithm.cc
@@ -13,9 +13,9 @@
* limitations under the License.
*/
+#include <hicn/transport/protocols/transport_algorithm.h>
#include <hicn/transport/utils/log.h>
#include <protocols/raaqm_transport_algorithm.h>
-#include <protocols/transport_algorithm.h>
#include <stdexcept>
@@ -44,17 +44,17 @@ void custom_deallocate(void *p) {
} // namespace
-void transportAlgorithm_Init(allocator_t *allocator,
- deallocator_t *deallocator) {
+extern "C" void transportAlgorithm_Init(allocator_t *allocator,
+ deallocator_t *deallocator) {
algorithm_allocator = allocator;
algorithm_deallocator = deallocator;
}
-void transportAlgorithm_Destroy(TransportAlgorithm *algorithm) {
+extern "C" void transportAlgorithm_Destroy(TransportAlgorithm *algorithm) {
custom_deallocate(algorithm);
}
-TransportAlgorithm *transportAlgorithm_CreateRaaqm(
+extern "C" TransportAlgorithm *transportAlgorithm_CreateRaaqm(
double drop_factor, double minimum_drop_probability, double gamma,
double beta, uint32_t sample_number, uint32_t interest_lifetime,
double beta_wifi, double drop_wifi, double beta_lte, double drop_lte,
@@ -71,13 +71,12 @@ TransportAlgorithm *transportAlgorithm_CreateRaaqm(
return ret;
}
-uint32_t transportAlgorithm_OnContentObject(TransportAlgorithm *algorithm,
- uint32_t suffix,
- uint32_t path_label) {
+extern "C" uint32_t transportAlgorithm_OnContentObject(
+ TransportAlgorithm *algorithm, uint32_t suffix, uint32_t path_label) {
return algorithm->onContentObject(suffix, path_label);
}
-uint32_t transportAlgorithm_OnInterestTimeout(TransportAlgorithm *algorithm,
- uint32_t suffix) {
+extern "C" uint32_t transportAlgorithm_OnInterestTimeout(
+ TransportAlgorithm *algorithm, uint32_t suffix) {
return algorithm->onInterestTimeout(suffix);
} \ No newline at end of file