aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/interfaces
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar@cisco.com>2022-06-09 21:34:09 +0200
committerLuca Muscariello <muscariello@ieee.org>2022-06-30 10:47:50 +0200
commit6b94663b2455e212009a544ae23bb6a8c55407f8 (patch)
tree0af780ce5eeb1009fd24b8af8af08e8368eda3bd /libtransport/src/interfaces
parenta1ac96f497719b897793ac14b287cb8d840651c1 (diff)
refactor(lib, hicn-light, vpp, hiperf): HICN-723
- move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests Co-authored-by: Mauro Sardara <msardara@cisco.com> Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Enrico Loparco <eloparco@cisco.com> Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Diffstat (limited to 'libtransport/src/interfaces')
-rw-r--r--libtransport/src/interfaces/CMakeLists.txt16
-rw-r--r--libtransport/src/interfaces/global_configuration.cc22
-rw-r--r--libtransport/src/interfaces/p2psecure_socket_consumer.cc37
-rw-r--r--libtransport/src/interfaces/p2psecure_socket_producer.cc34
-rw-r--r--libtransport/src/interfaces/portal.cc8
-rw-r--r--libtransport/src/interfaces/socket_consumer.cc11
-rw-r--r--libtransport/src/interfaces/socket_producer.cc12
-rw-r--r--libtransport/src/interfaces/tls_rtc_socket_producer.cc31
-rw-r--r--libtransport/src/interfaces/tls_rtc_socket_producer.h36
-rw-r--r--libtransport/src/interfaces/tls_socket_consumer.cc30
-rw-r--r--libtransport/src/interfaces/tls_socket_consumer.h36
-rw-r--r--libtransport/src/interfaces/tls_socket_producer.cc30
-rw-r--r--libtransport/src/interfaces/tls_socket_producer.h36
13 files changed, 48 insertions, 291 deletions
diff --git a/libtransport/src/interfaces/CMakeLists.txt b/libtransport/src/interfaces/CMakeLists.txt
index 0a0603ac8..bf8f8dcf8 100644
--- a/libtransport/src/interfaces/CMakeLists.txt
+++ b/libtransport/src/interfaces/CMakeLists.txt
@@ -19,20 +19,4 @@ list(APPEND SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/global_configuration.cc
)
-if (${OPENSSL_VERSION} VERSION_EQUAL "1.1.1a" OR ${OPENSSL_VERSION} VERSION_GREATER "1.1.1a")
- list(APPEND SOURCE_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/p2psecure_socket_producer.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/p2psecure_socket_consumer.cc
- # ${CMAKE_CURRENT_SOURCE_DIR}/tls_rtc_socket_producer.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/tls_socket_producer.cc
- ${CMAKE_CURRENT_SOURCE_DIR}/tls_socket_consumer.cc
- )
-
- list(APPEND HEADER_FILES
- # ${CMAKE_CURRENT_SOURCE_DIR}/tls_rtc_socket_producer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/tls_socket_producer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/tls_socket_consumer.h
- )
-endif()
-
set(SOURCE_FILES ${SOURCE_FILES} PARENT_SCOPE)
diff --git a/libtransport/src/interfaces/global_configuration.cc b/libtransport/src/interfaces/global_configuration.cc
index cecdacc07..f8e7a90c3 100644
--- a/libtransport/src/interfaces/global_configuration.cc
+++ b/libtransport/src/interfaces/global_configuration.cc
@@ -14,6 +14,7 @@
*/
#include <core/global_configuration.h>
+#include <core/global_workers.h>
#include <glog/logging.h>
#include <hicn/transport/interfaces/global_conf_interface.h>
@@ -23,10 +24,29 @@ namespace transport {
namespace interface {
namespace global_config {
-void parseConfigurationFile(const std::string& path) {
+GlobalConfigInterface::GlobalConfigInterface() { libtransportConfigInit(); }
+
+GlobalConfigInterface::~GlobalConfigInterface() {
+ libtransportConfigTerminate();
+}
+
+void GlobalConfigInterface::parseConfigurationFile(
+ const std::string &path) const {
core::GlobalConfiguration::getInstance().parseConfiguration(path);
}
+void GlobalConfigInterface::libtransportConfigInit() const {
+ // nothing to do
+}
+
+void GlobalConfigInterface::libtransportConfigTerminate() const {
+ // cleanup workers
+ auto &workers = core::GlobalWorkers::getInstance().getWorkers();
+ for (auto &worker : workers) {
+ worker.stop();
+ }
+}
+
void ConfigurationObject::get() {
std::error_code ec;
core::GlobalConfiguration::getInstance().getConfiguration(*this, ec);
diff --git a/libtransport/src/interfaces/p2psecure_socket_consumer.cc b/libtransport/src/interfaces/p2psecure_socket_consumer.cc
deleted file mode 100644
index e329a50f1..000000000
--- a/libtransport/src/interfaces/p2psecure_socket_consumer.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#include <hicn/transport/interfaces/p2psecure_socket_consumer.h>
-#include <implementation/p2psecure_socket_consumer.h>
-
-namespace transport {
-namespace interface {
-
-P2PSecureConsumerSocket::P2PSecureConsumerSocket(int handshake_protocol,
- int transport_protocol)
- : ConsumerSocket() {
- socket_ = std::unique_ptr<implementation::ConsumerSocket>(
- new implementation::P2PSecureConsumerSocket(this, handshake_protocol,
- transport_protocol));
-}
-
-void P2PSecureConsumerSocket::registerPrefix(const Prefix &producer_namespace) {
- implementation::P2PSecureConsumerSocket &secure_consumer_socket =
- *(static_cast<implementation::P2PSecureConsumerSocket *>(socket_.get()));
- secure_consumer_socket.registerPrefix(producer_namespace);
-}
-
-} // namespace interface
-} // namespace transport
diff --git a/libtransport/src/interfaces/p2psecure_socket_producer.cc b/libtransport/src/interfaces/p2psecure_socket_producer.cc
deleted file mode 100644
index 5f98302d0..000000000
--- a/libtransport/src/interfaces/p2psecure_socket_producer.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#include <hicn/transport/interfaces/p2psecure_socket_producer.h>
-#include <implementation/p2psecure_socket_producer.h>
-
-namespace transport {
-namespace interface {
-
-P2PSecureProducerSocket::P2PSecureProducerSocket() {
- socket_ = std::make_unique<implementation::P2PSecureProducerSocket>(this);
-}
-
-P2PSecureProducerSocket::P2PSecureProducerSocket(bool rtc,
- std::string &keystore_path,
- std::string &keystore_pwd) {
- socket_ = std::make_unique<implementation::P2PSecureProducerSocket>(
- this, rtc, keystore_path, keystore_pwd);
-}
-
-} // namespace interface
-} // namespace transport
diff --git a/libtransport/src/interfaces/portal.cc b/libtransport/src/interfaces/portal.cc
index 84634a282..898766c50 100644
--- a/libtransport/src/interfaces/portal.cc
+++ b/libtransport/src/interfaces/portal.cc
@@ -35,10 +35,10 @@ class Portal::Impl {
return portal_->interestIsPending(name);
}
- void sendInterest(core::Interest::Ptr &&interest,
+ void sendInterest(core::Interest::Ptr &interest, uint32_t lifetime,
OnContentObjectCallback &&on_content_object_callback,
OnInterestTimeoutCallback &&on_interest_timeout_callback) {
- portal_->sendInterest(std::move(interest),
+ portal_->sendInterest(interest, lifetime,
std::move(on_content_object_callback),
std::move(on_interest_timeout_callback));
}
@@ -86,10 +86,10 @@ bool Portal::interestIsPending(const core::Name &name) {
}
void Portal::sendInterest(
- core::Interest::Ptr &&interest,
+ core::Interest::Ptr &interest, uint32_t lifetime,
OnContentObjectCallback &&on_content_object_callback,
OnInterestTimeoutCallback &&on_interest_timeout_callback) {
- implementation_->sendInterest(std::move(interest),
+ implementation_->sendInterest(interest, lifetime,
std::move(on_content_object_callback),
std::move(on_interest_timeout_callback));
}
diff --git a/libtransport/src/interfaces/socket_consumer.cc b/libtransport/src/interfaces/socket_consumer.cc
index 747dc0974..cc496c8a5 100644
--- a/libtransport/src/interfaces/socket_consumer.cc
+++ b/libtransport/src/interfaces/socket_consumer.cc
@@ -102,6 +102,12 @@ int ConsumerSocket::setSocketOption(int socket_option_key,
int ConsumerSocket::setSocketOption(
int socket_option_key,
+ const std::shared_ptr<auth::Signer> &socket_option_value) {
+ return socket_->setSocketOption(socket_option_key, socket_option_value);
+}
+
+int ConsumerSocket::setSocketOption(
+ int socket_option_key,
const std::shared_ptr<auth::Verifier> &socket_option_value) {
return socket_->setSocketOption(socket_option_key, socket_option_value);
}
@@ -163,6 +169,11 @@ int ConsumerSocket::getSocketOption(int socket_option_key,
}
int ConsumerSocket::getSocketOption(
+ int socket_option_key, std::shared_ptr<auth::Signer> &socket_option_value) {
+ return socket_->getSocketOption(socket_option_key, socket_option_value);
+}
+
+int ConsumerSocket::getSocketOption(
int socket_option_key,
std::shared_ptr<auth::Verifier> &socket_option_value) {
return socket_->getSocketOption(socket_option_key, socket_option_value);
diff --git a/libtransport/src/interfaces/socket_producer.cc b/libtransport/src/interfaces/socket_producer.cc
index 10613c0e1..2155ebd78 100644
--- a/libtransport/src/interfaces/socket_producer.cc
+++ b/libtransport/src/interfaces/socket_producer.cc
@@ -148,6 +148,12 @@ int ProducerSocket::setSocketOption(
return socket_->setSocketOption(socket_option_key, socket_option_value);
}
+int ProducerSocket::setSocketOption(
+ int socket_option_key,
+ const std::shared_ptr<auth::Verifier> &socket_option_value) {
+ return socket_->setSocketOption(socket_option_key, socket_option_value);
+}
+
int ProducerSocket::setSocketOption(int socket_option_key,
Packet::Format socket_option_value) {
return socket_->setSocketOption(socket_option_key, socket_option_value);
@@ -194,6 +200,12 @@ int ProducerSocket::getSocketOption(
return socket_->getSocketOption(socket_option_key, socket_option_value);
}
+int ProducerSocket::getSocketOption(
+ int socket_option_key,
+ std::shared_ptr<auth::Verifier> &socket_option_value) {
+ return socket_->getSocketOption(socket_option_key, socket_option_value);
+}
+
int ProducerSocket::getSocketOption(int socket_option_key,
Packet::Format &socket_option_value) {
return socket_->getSocketOption(socket_option_key, socket_option_value);
diff --git a/libtransport/src/interfaces/tls_rtc_socket_producer.cc b/libtransport/src/interfaces/tls_rtc_socket_producer.cc
deleted file mode 100644
index 6bf1b011c..000000000
--- a/libtransport/src/interfaces/tls_rtc_socket_producer.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#include <implementation/tls_rtc_socket_producer.h>
-#include <interfaces/tls_rtc_socket_producer.h>
-
-namespace transport {
-namespace interface {
-
-TLSRTCProducerSocket::TLSRTCProducerSocket(
- implementation::TLSRTCProducerSocket *implementation) {
- socket_ =
- std::unique_ptr<implementation::TLSRTCProducerSocket>(implementation);
-}
-
-TLSRTCProducerSocket::~TLSRTCProducerSocket() { socket_.release(); }
-
-} // namespace interface
-} // namespace transport
diff --git a/libtransport/src/interfaces/tls_rtc_socket_producer.h b/libtransport/src/interfaces/tls_rtc_socket_producer.h
deleted file mode 100644
index b8b6ec298..000000000
--- a/libtransport/src/interfaces/tls_rtc_socket_producer.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#pragma once
-
-#include <hicn/transport/interfaces/socket_producer.h>
-
-namespace transport {
-
-namespace implementation {
-class TLSRTCProducerSocket;
-}
-
-namespace interface {
-
-class TLSRTCProducerSocket : public ProducerSocket {
- public:
- TLSRTCProducerSocket(implementation::TLSRTCProducerSocket *implementation);
-
- ~TLSRTCProducerSocket();
-};
-
-} // namespace interface
-} // end namespace transport
diff --git a/libtransport/src/interfaces/tls_socket_consumer.cc b/libtransport/src/interfaces/tls_socket_consumer.cc
deleted file mode 100644
index 24060d1d8..000000000
--- a/libtransport/src/interfaces/tls_socket_consumer.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#include <implementation/tls_socket_consumer.h>
-#include <interfaces/tls_socket_consumer.h>
-
-namespace transport {
-namespace interface {
-
-TLSConsumerSocket::TLSConsumerSocket(
- implementation::TLSConsumerSocket *implementation) {
- socket_ = std::unique_ptr<implementation::TLSConsumerSocket>(implementation);
-}
-
-TLSConsumerSocket::~TLSConsumerSocket() { socket_.release(); }
-
-} // namespace interface
-} // namespace transport
diff --git a/libtransport/src/interfaces/tls_socket_consumer.h b/libtransport/src/interfaces/tls_socket_consumer.h
deleted file mode 100644
index 242dc91a5..000000000
--- a/libtransport/src/interfaces/tls_socket_consumer.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#pragma once
-
-#include <hicn/transport/interfaces/socket_consumer.h>
-
-namespace transport {
-
-namespace implementation {
-class TLSConsumerSocket;
-}
-
-namespace interface {
-
-class TLSConsumerSocket : public ConsumerSocket {
- public:
- TLSConsumerSocket(implementation::TLSConsumerSocket *implementation);
- ~TLSConsumerSocket();
-};
-
-} // namespace interface
-
-} // end namespace transport
diff --git a/libtransport/src/interfaces/tls_socket_producer.cc b/libtransport/src/interfaces/tls_socket_producer.cc
deleted file mode 100644
index b2b9e723a..000000000
--- a/libtransport/src/interfaces/tls_socket_producer.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#include <implementation/tls_socket_producer.h>
-#include <interfaces/tls_socket_producer.h>
-
-namespace transport {
-namespace interface {
-
-TLSProducerSocket::TLSProducerSocket(
- implementation::TLSProducerSocket *implementation) {
- socket_ = std::unique_ptr<implementation::TLSProducerSocket>(implementation);
-}
-
-TLSProducerSocket::~TLSProducerSocket() { socket_.release(); }
-
-} // namespace interface
-} // namespace transport
diff --git a/libtransport/src/interfaces/tls_socket_producer.h b/libtransport/src/interfaces/tls_socket_producer.h
deleted file mode 100644
index 9b31cb483..000000000
--- a/libtransport/src/interfaces/tls_socket_producer.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2021 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.
- */
-
-#pragma once
-
-#include <hicn/transport/interfaces/socket_producer.h>
-
-namespace transport {
-
-namespace implementation {
-class TLSProducerSocket;
-}
-
-namespace interface {
-
-class TLSProducerSocket : public ProducerSocket {
- public:
- TLSProducerSocket(implementation::TLSProducerSocket *implementation);
- ~TLSProducerSocket();
-};
-
-} // namespace interface
-
-} // end namespace transport