summaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/.clang-format14
-rw-r--r--libtransport/cmake/Modules/Packaging.cmake8
-rw-r--r--libtransport/format_all.sh8
-rw-r--r--libtransport/src/hicn/transport/core/portal.h4
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc24
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h4
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_options_default_values.h4
-rw-r--r--libtransport/src/hicn/transport/interfaces/socket_producer.h8
-rw-r--r--libtransport/src/hicn/transport/utils/fd_deadline_timer.h3
9 files changed, 54 insertions, 23 deletions
diff --git a/libtransport/.clang-format b/libtransport/.clang-format
new file mode 100644
index 000000000..513da4d69
--- /dev/null
+++ b/libtransport/.clang-format
@@ -0,0 +1,14 @@
+# 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.
+
+BasedOnStyle: Google \ No newline at end of file
diff --git a/libtransport/cmake/Modules/Packaging.cmake b/libtransport/cmake/Modules/Packaging.cmake
index 4112d3844..99dccbec4 100644
--- a/libtransport/cmake/Modules/Packaging.cmake
+++ b/libtransport/cmake/Modules/Packaging.cmake
@@ -32,22 +32,22 @@ set(lib${LIBTRANSPORT}-devel_DESCRIPTION ${lib${LIBTRANSPORT}_DESCRIPTION}
if ((BUILD_MEMIF_CONNECTOR OR BUILD_HICNPLUGIN) AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(lib${LIBTRANSPORT}_DEB_DEPENDENCIES
- "lib${LIBHICN} (>= stable_version), libparc (>= 1.0), vpp-lib (= stable_version-release)"
+ "lib${LIBHICN} (>= stable_version), libparc (>= 1.0), vpp-lib (>= stable_version-release), vpp-lib (< next_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}_RPM_DEPENDENCIES
- "lib${LIBHICN} >= stable_version, libparc >= 1.0, vpp-lib = stable_version-release"
+ "lib${LIBHICN} >= stable_version, libparc >= 1.0, vpp-lib >= stable_version-release, vpp-lib < next_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_DEB_DEPENDENCIES
- "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (= stable_version-release)"
+ "lib${LIBTRANSPORT} (>= stable_version), libasio-dev (>= 1.10), libhicn-dev (>= stable_version), libparc-dev (>= 1.0), vpp-dev (>= stable_version-release), vpp-dev (< next_version-release)"
CACHE STRING "Dependencies for deb/rpm package."
)
set(lib${LIBTRANSPORT}-dev_RPM_DEPENDENCIES
- "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, lib${LIBHICN}-devel >= stable_version, libparc-devel >= 1.0, vpp-devel = stable_version-release"
+ "lib${LIBTRANSPORT} >= stable_version, asio-devel >= 1.10, lib${LIBHICN}-devel >= stable_version, libparc-devel >= 1.0, vpp-devel >= stable_version-release, vpp-devel < next_version-release"
CACHE STRING "Dependencies for deb/rpm package."
)
diff --git a/libtransport/format_all.sh b/libtransport/format_all.sh
new file mode 100644
index 000000000..0591413e0
--- /dev/null
+++ b/libtransport/format_all.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -xue
+
+SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P )
+
+pushd ${SCRIPT_PATH}
+find src/ -type f '(' -name '*.c' -o -name '*.cc' -o -name '*.h' ')' -exec clang-format -style=file -i {} \;
+popd \ No newline at end of file
diff --git a/libtransport/src/hicn/transport/core/portal.h b/libtransport/src/hicn/transport/core/portal.h
index d9051c23c..07f84075e 100644
--- a/libtransport/src/hicn/transport/core/portal.h
+++ b/libtransport/src/hicn/transport/core/portal.h
@@ -407,7 +407,9 @@ class Portal {
}
}
- TRANSPORT_ALWAYS_INLINE void killConnection() { connector_.close(); }
+ TRANSPORT_ALWAYS_INLINE void killConnection() {
+ forwarder_interface_.closeConnection();
+ }
TRANSPORT_ALWAYS_INLINE void clear() {
for (auto &pend_interest : pending_interest_hash_table_) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
index c07ca7989..87cf27b75 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
@@ -74,22 +74,22 @@ RTCProducerSocket::RTCProducerSocket()
RTCProducerSocket::~RTCProducerSocket() {}
-void RTCProducerSocket::registerName(Prefix &producer_namespace) {
+void RTCProducerSocket::registerPrefix(const Prefix &producer_namespace) {
ProducerSocket::registerPrefix(producer_namespace);
flowName_ = producer_namespace.getName();
-
- if (flowName_.getType() == HNT_CONTIGUOUS_V4 ||
- flowName_.getType() == HNT_IOV_V4) {
- headerSize_ = sizeof(hicn_v6_hdr_t::ip);
- } else if (flowName_.getType() == HNT_CONTIGUOUS_V6 ||
- flowName_.getType() == HNT_IOV_V6) {
- headerSize_ = sizeof(hicn_v4_hdr_t::ip);
- } else {
- throw errors::RuntimeException("Unknown name format.");
+ auto family = flowName_.getAddressFamily();
+
+ switch (family) {
+ case AF_INET6:
+ headerSize_ = (uint32_t)Packet::getHeaderSizeFromFormat(HF_INET6_TCP);
+ break;
+ case AF_INET:
+ headerSize_ = (uint32_t)Packet::getHeaderSizeFromFormat(HF_INET_TCP);
+ break;
+ default:
+ throw errors::RuntimeException("Unknown name format.");
}
-
- headerSize_ += TCP_HEADER_SIZE;
}
void RTCProducerSocket::updateStats(uint32_t packet_size) {
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
index f1bcaa9e8..bc54be4bb 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.h
@@ -33,9 +33,9 @@ class RTCProducerSocket : public ProducerSocket {
~RTCProducerSocket();
- void registerName(Prefix &producer_namespace);
+ void registerPrefix(const Prefix &producer_namespace) override;
- void produce(const uint8_t *buffer, size_t buffer_size);
+ void produce(const uint8_t *buffer, size_t buffer_size) override;
void onInterest(Interest::Ptr &&interest) override;
diff --git a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
index 046fea892..13029e83a 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h
@@ -61,8 +61,8 @@ static constexpr uint32_t rate_choice = 0;
static constexpr uint32_t transport_protocol_min_retransmissions = 0;
static constexpr uint32_t transport_protocol_max_retransmissions = 128;
static constexpr uint32_t max_content_object_size = 8096;
-static constexpr uint32_t min_window_size = 1; // Interests
-static constexpr uint32_t max_window_size = 256 * 2; // Interests
+static constexpr uint32_t min_window_size = 1; // Interests
+static constexpr uint32_t max_window_size = 256 * 2; // Interests
} // namespace default_values
diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.h b/libtransport/src/hicn/transport/interfaces/socket_producer.h
index d3738dc59..6ba5671cc 100644
--- a/libtransport/src/hicn/transport/interfaces/socket_producer.h
+++ b/libtransport/src/hicn/transport/interfaces/socket_producer.h
@@ -51,13 +51,19 @@ class ProducerSocket : public Socket<BasePortal>,
void produce(ContentObject &content_object);
+ virtual void produce(const uint8_t *buffer, size_t buffer_size) {
+ // This API is meant to be used just with the RTC producer.
+ // Here it cannot be used since no name for the content is specified.
+ throw errors::NotImplementedException();
+ }
+
void asyncProduce(const Name &suffix, const uint8_t *buf, size_t buffer_size);
void asyncProduce(const Name &suffix, ContentBuffer &&output_buffer);
void asyncProduce(ContentObject &content_object);
- void registerPrefix(const Prefix &producer_namespace);
+ virtual void registerPrefix(const Prefix &producer_namespace);
void serveForever();
diff --git a/libtransport/src/hicn/transport/utils/fd_deadline_timer.h b/libtransport/src/hicn/transport/utils/fd_deadline_timer.h
index 6fb823a05..1c14513c9 100644
--- a/libtransport/src/hicn/transport/utils/fd_deadline_timer.h
+++ b/libtransport/src/hicn/transport/utils/fd_deadline_timer.h
@@ -53,7 +53,8 @@ class FdDeadlineTimer : public DeadlineTimer<FdDeadlineTimer> {
reactor_.addFileDescriptor(
timer_fd_, events,
- [callback = std::forward<WaitHandler &&>(callback)](const Event &event) -> int {
+ [callback = std::forward<WaitHandler &&>(callback)](
+ const Event &event) -> int {
uint64_t s = 0;
std::error_code ec;