aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/src/hicn')
-rw-r--r--libtransport/src/hicn/transport/interfaces/CMakeLists.txt4
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc38
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h37
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.cc110
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.h34
5 files changed, 3 insertions, 220 deletions
diff --git a/libtransport/src/hicn/transport/interfaces/CMakeLists.txt b/libtransport/src/hicn/transport/interfaces/CMakeLists.txt
index 2ff4fda56..a5cca78a6 100644
--- a/libtransport/src/hicn/transport/interfaces/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/interfaces/CMakeLists.txt
@@ -17,7 +17,6 @@ list(APPEND HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/socket.h
${CMAKE_CURRENT_SOURCE_DIR}/socket_consumer.h
${CMAKE_CURRENT_SOURCE_DIR}/socket_producer.h
- ${CMAKE_CURRENT_SOURCE_DIR}/rtc_socket_consumer.h
${CMAKE_CURRENT_SOURCE_DIR}/rtc_socket_producer.h
${CMAKE_CURRENT_SOURCE_DIR}/publication_options.h
${CMAKE_CURRENT_SOURCE_DIR}/socket_options_default_values.h
@@ -26,11 +25,10 @@ list(APPEND HEADER_FILES
)
list(APPEND SOURCE_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/rtc_socket_consumer.cc
${CMAKE_CURRENT_SOURCE_DIR}/rtc_socket_producer.cc
${CMAKE_CURRENT_SOURCE_DIR}/socket_producer.cc
${CMAKE_CURRENT_SOURCE_DIR}/socket_consumer.cc
)
set(SOURCE_FILES ${SOURCE_FILES} PARENT_SCOPE)
-set(HEADER_FILES ${HEADER_FILES} PARENT_SCOPE) \ No newline at end of file
+set(HEADER_FILES ${HEADER_FILES} PARENT_SCOPE)
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
deleted file mode 100644
index a24e3883c..000000000
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-#include <hicn/transport/interfaces/rtc_socket_consumer.h>
-#include <hicn/transport/protocols/rtc.h>
-
-namespace transport {
-
-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) {
- RTCTransportProtocol *transport = dynamic_cast<RTCTransportProtocol *>(
- ConsumerSocket::transport_protocol_.get());
- if (transport) transport->onRTCPPacket(packet, len);
-}
-
-} // namespace interface
-
-} // end namespace transport
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h b/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
deleted file mode 100644
index cfde3128d..000000000
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_consumer.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#include <hicn/transport/interfaces/socket_consumer.h>
-
-namespace transport {
-
-namespace interface {
-
-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);
-};
-
-} // namespace interface
-
-} // end namespace transport
diff --git a/libtransport/src/hicn/transport/protocols/rtc.cc b/libtransport/src/hicn/transport/protocols/rtc.cc
index 4205ade4e..c9aa6a56a 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.cc
+++ b/libtransport/src/hicn/transport/protocols/rtc.cc
@@ -70,23 +70,6 @@ void RTCTransportProtocol::resume() {
is_running_ = false;
}
-void RTCTransportProtocol::onRTCPPacket(uint8_t *packet, size_t len) {
- //#define MASK_RTCP_VERSION 192
- //#define MASK_TYPE_CODE 31
- size_t read = 0;
- uint8_t *offset = packet;
- while (read < len) {
- if ((((*offset) & HICN_MASK_RTCP_VERSION) >> 6) != HICN_RTCP_VERSION) {
- TRANSPORT_LOGE("error while parsing RTCP packet, version unkwown");
- return;
- }
- processRtcpHeader(offset);
- uint16_t RTCPlen = (ntohs(*(((uint16_t *)offset) + 1)) + 1) * 4;
- offset += RTCPlen;
- read += RTCPlen;
- }
-}
-
// private
void RTCTransportProtocol::reset() {
portal_->setConsumerCallback(this);
@@ -715,10 +698,6 @@ void RTCTransportProtocol::returnContentToApplication(
read_buffer->trimStart(HICN_TIMESTAMP_SIZE);
- // set offset between hICN and RTP packets
- uint16_t rtp_seq = ntohs(*(((uint16_t *)read_buffer->writableData()) + 1));
- RTPhICN_offset_ = content_object.getName().getSuffix() - rtp_seq;
-
interface::ConsumerSocket::ReadCallback *read_callback = nullptr;
socket_->getSocketOption(READ_CALLBACK, &read_callback);
@@ -758,95 +737,6 @@ void RTCTransportProtocol::returnContentToApplication(
}
}
-uint32_t RTCTransportProtocol::hICN2RTP(uint32_t hicn_seq) {
- return RTPhICN_offset_ - hicn_seq;
-}
-
-uint32_t RTCTransportProtocol::RTP2hICN(uint32_t rtp_seq) {
- return RTPhICN_offset_ + rtp_seq;
-}
-
-void RTCTransportProtocol::processRtcpHeader(uint8_t *offset) {
- uint8_t pkt_type = (*(offset + 1));
- switch (pkt_type) {
- case HICN_RTCP_RR: // Receiver report
- TRANSPORT_LOGD("got RR packet\n");
- break;
- case HICN_RTCP_SR: // Sender report
- TRANSPORT_LOGD("got SR packet\n");
- break;
- case HICN_RTCP_SDES: // Description
- processSDES(offset);
- break;
- case HICN_RTCP_RTPFB: // Transport layer FB message
- processGenericNack(offset);
- break;
- case HICN_RTCP_PSFB:
- processPli(offset);
- break;
- default:
- errorParsingRtcpHeader(offset);
- }
-}
-
-void RTCTransportProtocol::errorParsingRtcpHeader(uint8_t *offset) {
- uint8_t pt = (*(offset + 1));
- uint8_t code = ((*offset) & HICN_MASK_TYPE_CODE);
- TRANSPORT_LOGE("Received unknwnon RTCP packet. Payload type = %u, code = %u",
- pt, code);
-}
-
-void RTCTransportProtocol::processSDES(uint8_t *offset) {
- uint8_t code = ((*offset) & HICN_MASK_TYPE_CODE);
- switch (code) {
- case HICN_RTCP_SDES_CNAME:
- TRANSPORT_LOGI("got SDES packet: CNAME\n");
- break;
- default:
- errorParsingRtcpHeader(offset);
- }
-}
-
-void RTCTransportProtocol::processPli(uint8_t *offset) {
- if (((*offset) & HICN_MASK_TYPE_CODE) != HICN_RTCP_PSFB_PLI) {
- errorParsingRtcpHeader(offset);
- return;
- }
-
- TRANSPORT_LOGI("got PLI packet\n");
-}
-
-void RTCTransportProtocol::processGenericNack(uint8_t *offset) {
- if (((*offset) & HICN_MASK_TYPE_CODE) != HICN_RTCP_RTPFB_GENERIC_NACK) {
- errorParsingRtcpHeader(offset);
- return;
- }
-
- std::vector<uint32_t> nacks;
-
- uint16_t header_lines =
- ntohs(*(((uint16_t *)offset) + 1)) -
- 2; // 2 is the number of header 32-bits words - 1 (RFC 4885)
- uint8_t *payload = offset + HICN_RTPC_NACK_HEADER; // 12 bytes
- for (uint16_t l = header_lines; l > 0; l--) {
- nacks.push_back(RTP2hICN(ntohs(*((uint16_t *)payload))));
-
- uint16_t BLP = ntohs(*(((uint16_t *)payload) + 1));
-
- for (int bit = 0; bit < 15; bit++) { // 16 bits word to scan
- if ((BLP >> bit) & 1) {
- nacks.push_back(RTP2hICN((ntohs(*((uint16_t *)payload)) + bit + 1) %
- HICN_MAX_RTCP_SEQ_NUMBER));
- }
- }
-
- payload += 4; // go to the next line
- }
-
- portal_->getIoService().post(std::bind(
- &RTCTransportProtocol::scheduleAppNackRtx, this, std::move(nacks)));
-}
-
} // end namespace protocol
} // end namespace transport
diff --git a/libtransport/src/hicn/transport/protocols/rtc.h b/libtransport/src/hicn/transport/protocols/rtc.h
index 55deead6e..3e0ffe6e5 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.h
+++ b/libtransport/src/hicn/transport/protocols/rtc.h
@@ -36,8 +36,8 @@
#define HICN_RTC_INTEREST_LIFETIME 1000 // ms
// controller constant
-#define HICN_ROUND_LEN \
- 200 // ms interval of time on which we take decisions / measurements
+#define HICN_ROUND_LEN 200 // ms interval of time on which
+ // we take decisions / measurements
#define HICN_MAX_RTX 10
#define HICN_MAX_RTX_SIZE 1024
#define HICN_MAX_RTX_MAX_AGE 10000
@@ -62,24 +62,6 @@
#define HICN_MICRO_IN_A_SEC 1000000
#define HICN_MILLI_IN_A_SEC 1000
-// RTCP
-#define HICN_MASK_RTCP_VERSION 192
-#define HICN_MASK_TYPE_CODE \
- 31 // this is RC in the RR/SR packet or FMT int the early feedback packets
-#define HICN_RTPC_NACK_HEADER 12 // bytes
-#define HICN_MAX_RTCP_SEQ_NUMBER 0xffff
-#define HICN_RTCP_VERSION 2
-// RTCP TYPES
-#define HICN_RTCP_SR 200
-#define HICN_RTCP_RR 201
-#define HICN_RTCP_SDES 202
-#define HICN_RTCP_RTPFB 205
-#define HICN_RTCP_PSFB 206
-// RTCP RC/FMT
-#define HICN_RTCP_SDES_CNAME 1
-#define HICN_RTCP_RTPFB_GENERIC_NACK 1
-#define HICN_RTCP_PSFB_PLI 1
-
namespace transport {
namespace protocol {
@@ -113,8 +95,6 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
void resume() override;
- void onRTCPPacket(uint8_t *packet, size_t len);
-
private:
// algo functions
void reset() override;
@@ -155,15 +135,6 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
returnContentToApplication(*content_object);
}
- // RTCP functions
- uint32_t hICN2RTP(uint32_t hicn_seq);
- uint32_t RTP2hICN(uint32_t rtp_seq);
- void processRtcpHeader(uint8_t *offset);
- void errorParsingRtcpHeader(uint8_t *offset);
- void processSDES(uint8_t *offset);
- void processGenericNack(uint8_t *offset);
- void processPli(uint8_t *offset);
-
// controller var
std::chrono::steady_clock::time_point lastRoundBegin_;
unsigned currentState_;
@@ -174,7 +145,6 @@ class RTCTransportProtocol : public TransportProtocol, public Reassembly {
// names/packets var
uint32_t actualSegment_;
- int32_t RTPhICN_offset_;
uint32_t inflightInterestsCount_;
//map seq to rtx
std::map<uint32_t, uint8_t> interestRetransmissions_;