aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/http-proxy/main.cc5
-rw-r--r--apps/http-proxy/src/ATSConnector.cc2
-rw-r--r--apps/http-proxy/src/IcnReceiver.cc2
-rw-r--r--apps/http-server/http-client/http_client.h6
-rw-r--r--hicn-plugin/src/hicn.api41
-rw-r--r--hicn-plugin/src/hicn_api.c63
-rw-r--r--hicn-plugin/src/hicn_api_test.c82
-rw-r--r--libtransport/src/hicn/transport/core/packet.cc8
-rw-r--r--libtransport/src/hicn/transport/core/packet.h2
-rw-r--r--libtransport/src/hicn/transport/protocols/packet_manager.h1
-rw-r--r--libtransport/src/hicn/transport/protocols/raaqm.cc5
11 files changed, 206 insertions, 11 deletions
diff --git a/apps/http-proxy/main.cc b/apps/http-proxy/main.cc
index 179da452b..0dedbd8a7 100644
--- a/apps/http-proxy/main.cc
+++ b/apps/http-proxy/main.cc
@@ -46,7 +46,7 @@ int main(int argc, char** argv) {
break;
case 'h':
default:
- usage(argv[0]);
+ return usage(argv[0]);
break;
}
}
@@ -57,6 +57,9 @@ int main(int argc, char** argv) {
prefix = argv[optind];
}
+ std::cout << "Connecting to " << ip_address << " port " << port
+ << " Cache size " << cache_size << " Prefix " << prefix
+ << std::endl;
transport::AsyncConsumerProducer proxy(prefix, ip_address, port, cache_size);
proxy.run();
diff --git a/apps/http-proxy/src/ATSConnector.cc b/apps/http-proxy/src/ATSConnector.cc
index 81f7a776a..2a2f73c3e 100644
--- a/apps/http-proxy/src/ATSConnector.cc
+++ b/apps/http-proxy/src/ATSConnector.cc
@@ -161,7 +161,7 @@ void ATSConnector::tryReconnection() {
is_reconnection_ = true;
io_service_.post([this]() {
if (socket_.is_open()) {
- socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both);
+ // socket_.shutdown(asio::ip::tcp::socket::shutdown_type::shutdown_both);
socket_.close();
}
startConnectionTimer();
diff --git a/apps/http-proxy/src/IcnReceiver.cc b/apps/http-proxy/src/IcnReceiver.cc
index ee8ef0823..76e2bd10b 100644
--- a/apps/http-proxy/src/IcnReceiver.cc
+++ b/apps/http-proxy/src/IcnReceiver.cc
@@ -130,7 +130,7 @@ void AsyncConsumerProducer::manageIncomingInterest(
HTTPMessageFastParser::isMpdRequest(payload->data(), payload->length());
chunk_number_map_.emplace(name, 0);
- response_name_queue_.emplace(std::move(name), is_mpd ? 500 : 10000);
+ response_name_queue_.emplace(std::move(name), is_mpd ? 1000 : 10000);
connector_.send(payload, [packet = std::move(packet)]() {});
}
diff --git a/apps/http-server/http-client/http_client.h b/apps/http-server/http-client/http_client.h
index 087a061ab..f36c2fa35 100644
--- a/apps/http-server/http-client/http_client.h
+++ b/apps/http-server/http-client/http_client.h
@@ -17,13 +17,7 @@
#include <string>
-#if defined(HICNET)
#include <hicn/transport/http/facade.h>
-#elif defined(ICNET)
-#include <icnet/icnet_http_facade.h>
-#else
-#error "No ICN tranport library to which link against."
-#endif
class HTTPClient {
public:
diff --git a/hicn-plugin/src/hicn.api b/hicn-plugin/src/hicn.api
index 46ce177ea..48e2eace5 100644
--- a/hicn-plugin/src/hicn.api
+++ b/hicn-plugin/src/hicn.api
@@ -223,6 +223,47 @@ define hicn_api_face_ip_params_get
u16 faceid;
};
+define hicn_api_face_stats_details
+{
+/* From the request */
+ u32 context;
+
+ /* Return value, zero means all OK */
+ i32 retval;
+
+ /* Id of the face */
+ u32 faceid;
+
+ /* Interest rx */
+ u64 irx_packets;
+
+ u64 irx_bytes;
+
+ /* Interest tx */
+ u64 itx_packets;
+
+ u64 itx_bytes;
+
+ /* data rx */
+ u64 drx_packets;
+
+ u64 drx_bytes;
+
+ /* data tx */
+ u64 dtx_packets;
+
+ u64 dtx_bytes;
+};
+
+define hicn_api_face_stats_dump
+{
+/* Client identifier, set from api_main.my_client_index */
+ u32 client_index;
+
+ /* Arbitrary context, so client can match reply to request */
+ u32 context;
+};
+
define hicn_api_face_ip_params_get_reply
{
/* From the request */
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index c532118b3..6249d6e5e 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -68,6 +68,7 @@
_(HICN_API_FACE_IP_ADD, hicn_api_face_ip_add) \
_(HICN_API_FACE_IP_DEL, hicn_api_face_ip_del) \
_(HICN_API_FACE_IP_PARAMS_GET, hicn_api_face_ip_params_get) \
+ _(HICN_API_FACE_STATS_DUMP, hicn_api_face_stats_dump) \
_(HICN_API_ROUTE_GET, hicn_api_route_get) \
_(HICN_API_ROUTE_NHOPS_ADD, hicn_api_route_nhops_add) \
_(HICN_API_ROUTE_DEL, hicn_api_route_del) \
@@ -255,6 +256,68 @@ static void
/* *INDENT-ON* */
}
+static void
+send_face_stats_details (vl_api_registration_t * reg,
+ hicn_face_t * face, u32 context)
+{
+ vl_api_hicn_api_face_stats_details_t *mp;
+ hicn_main_t *hm = &hicn_main;
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+
+ mp->_vl_msg_id =
+ htons (VL_API_HICN_API_FACE_STATS_DETAILS + hm->msg_id_base);
+ mp->context = context;
+
+ mp->faceid = htonl (hicn_dpoi_get_index (face));
+ vlib_counter_t v;
+ vlib_get_combined_counter (&counters
+ [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_INTEREST_RX, &v);
+ mp->irx_packets = clib_net_to_host_u64 (v.packets);
+ mp->irx_bytes = clib_net_to_host_u64 (v.bytes);
+
+ vlib_get_combined_counter (&counters
+ [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_INTEREST_TX, &v);
+ mp->itx_packets = clib_net_to_host_u64 (v.packets);
+ mp->itx_bytes = clib_net_to_host_u64 (v.bytes);
+
+ vlib_get_combined_counter (&counters
+ [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_DATA_RX, &v);
+ mp->drx_packets = clib_net_to_host_u64 (v.packets);
+ mp->drx_bytes = clib_net_to_host_u64 (v.bytes);
+
+ vlib_get_combined_counter (&counters
+ [hicn_dpoi_get_index (face) * HICN_N_COUNTER],
+ HICN_FACE_COUNTERS_DATA_TX, &v);
+ mp->dtx_packets = clib_net_to_host_u64 (v.packets);
+ mp->dtx_bytes = clib_net_to_host_u64 (v.bytes);
+
+ vl_api_send_msg (reg, (u8 *) mp);
+}
+
+static void
+ vl_api_hicn_api_face_stats_dump_t_handler
+ (vl_api_hicn_api_face_stats_dump_t * mp)
+{
+ hicn_face_t *face;
+ vl_api_registration_t *reg;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ /* *INDENT-OFF* */
+ pool_foreach (face, hicn_dpoi_face_pool,
+ ({
+ send_face_stats_details (reg, face, mp->context);
+ }));
+ /* *INDENT-ON* */
+}
+
+
/****** ROUTE *******/
static void
diff --git a/hicn-plugin/src/hicn_api_test.c b/hicn-plugin/src/hicn_api_test.c
index 2619803b7..909bc540f 100644
--- a/hicn-plugin/src/hicn_api_test.c
+++ b/hicn-plugin/src/hicn_api_test.c
@@ -27,7 +27,6 @@
#define __plugin_msg_base hicn_test_main.msg_id_base
#include <vlibapi/vat_helper_macros.h>
-
#include <hicn/hicn_api.h>
#include "error.h"
@@ -36,6 +35,17 @@
/* Declare message IDs */
#include "hicn_msg_enum.h"
+/* define message structures */
+#define vl_typedefs
+#include <vpp/api/vpe_all_api_h.h>
+#include <hicn/hicn_all_api_h.h>
+#undef vl_typedefs
+
+/* Get CRC codes of the messages defined outside of this plugin */
+#define vl_msg_name_crc_list
+#include <vpp/api/vpe_all_api_h.h>
+#undef vl_msg_name_crc_list
+
/* declare message handlers for each api */
#define vl_endianfun /* define message structures */
@@ -82,6 +92,7 @@ typedef struct
/* API message ID base */
u16 msg_id_base;
vat_main_t *vat_main;
+ u32 ping_id;
} hicn_test_main_t;
hicn_test_main_t hicn_test_main;
@@ -120,6 +131,7 @@ _(HICN_API_NODE_PARAMS_GET_REPLY, hicn_api_node_params_get_reply) \
_(HICN_API_NODE_STATS_GET_REPLY, hicn_api_node_stats_get_reply) \
_(HICN_API_FACE_IP_DEL_REPLY, hicn_api_face_ip_del_reply) \
_(HICN_API_FACE_IP_ADD_REPLY, hicn_api_face_ip_add_reply) \
+_(HICN_API_FACE_STATS_DETAILS, hicn_api_face_stats_details) \
_(HICN_API_ROUTE_NHOPS_ADD_REPLY, hicn_api_route_nhops_add_reply) \
_(HICN_API_FACE_IP_PARAMS_GET_REPLY, hicn_api_face_ip_params_get_reply) \
_(HICN_API_ROUTE_GET_REPLY, hicn_api_route_get_reply) \
@@ -512,6 +524,66 @@ static void
clib_net_to_host_i32 (rmp->flags));
}
+/* memif-dump API */
+static int
+api_hicn_api_face_stats_dump (vat_main_t * vam)
+{
+ hicn_test_main_t *hm = &hicn_test_main;
+ vl_api_hicn_api_face_stats_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (vam->json_output)
+ {
+ clib_warning ("JSON output not supported for memif_dump");
+ return -99;
+ }
+
+ M (HICN_API_FACE_STATS_DUMP, mp);
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping));
+ mp_ping->_vl_msg_id = htons (hm->ping_id);
+ mp_ping->client_index = vam->my_client_index;
+
+ fformat (vam->ofp, "Sending ping id=%d\n", hm->ping_id);
+
+ vam->result_ready = 0;
+ S (mp_ping);
+
+ W (ret);
+ return ret;
+}
+
+/* memif-details message handler */
+static void
+vl_api_hicn_api_face_stats_details_t_handler
+ (vl_api_hicn_api_face_stats_details_t * mp)
+{
+ vat_main_t *vam = hicn_test_main.vat_main;
+
+ fformat (vam->ofp, "face id %d\n"
+ " interest rx packets %16Ld\n"
+ " bytes %16Ld\n"
+ " interest tx packets %16Ld\n"
+ " bytes %16Ld\n"
+ " data rx packets %16Ld\n"
+ " bytes %16Ld\n"
+ " data tx packets %16Ld\n"
+ " bytes %16Ld\n",
+ clib_host_to_net_u32 (mp->faceid),
+ clib_host_to_net_u64 (mp->irx_packets),
+ clib_host_to_net_u64 (mp->irx_bytes),
+ clib_host_to_net_u64 (mp->itx_packets),
+ clib_host_to_net_u64 (mp->itx_bytes),
+ clib_host_to_net_u64 (mp->drx_packets),
+ clib_host_to_net_u64 (mp->drx_bytes),
+ clib_host_to_net_u64 (mp->dtx_packets),
+ clib_host_to_net_u64 (mp->dtx_bytes));
+}
+
+
static int
api_hicn_api_route_get (vat_main_t * vam)
{
@@ -1000,6 +1072,7 @@ _(hicn_api_node_params_get, "") \
_(hicn_api_node_stats_get, "") \
_(hicn_api_face_ip_del, "face <faceID>") \
_(hicn_api_face_ip_add, "add <swif> <address>") \
+_(hicn_api_face_stats_dump, "") \
_(hicn_api_route_nhops_add, "add prefix <IP4/IP6>/<subnet> face <faceID> weight <weight>") \
_(hicn_api_face_ip_params_get, "face <faceID>") \
_(hicn_api_route_get, "prefix <IP4/IP6>/<subnet>") \
@@ -1049,6 +1122,13 @@ vat_plugin_register (vat_main_t * vam)
name = format (0, "hicn_%08x%c", api_version, 0);
sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
+ /* Get the control ping ID */
+#define _(id,n,crc) \
+ const char *id ## _CRC __attribute__ ((unused)) = #n "_" #crc;
+ foreach_vl_msg_name_crc_vpe;
+#undef _
+ sm->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC));
+
if (sm->msg_id_base != (u16) ~ 0)
hicn_vat_api_hookup (vam);
diff --git a/libtransport/src/hicn/transport/core/packet.cc b/libtransport/src/hicn/transport/core/packet.cc
index de8ede421..954266664 100644
--- a/libtransport/src/hicn/transport/core/packet.cc
+++ b/libtransport/src/hicn/transport/core/packet.cc
@@ -594,6 +594,14 @@ void Packet::separateHeaderPayload() {
packet_->append(header_size);
}
+void Packet::resetPayload() {
+ if (packet_->isChained()) {
+ packet_->separateChain(packet_->next(), packet_->prev());
+ payload_head_ = nullptr;
+ updateLength();
+ }
+}
+
} // end namespace core
} // end namespace transport
diff --git a/libtransport/src/hicn/transport/core/packet.h b/libtransport/src/hicn/transport/core/packet.h
index 6d8bc7e0f..4ec93205a 100644
--- a/libtransport/src/hicn/transport/core/packet.h
+++ b/libtransport/src/hicn/transport/core/packet.h
@@ -178,6 +178,8 @@ class Packet : public std::enable_shared_from_this<Packet> {
Packet &setTTL(uint8_t hops);
uint8_t getTTL() const;
+ void resetPayload();
+
private:
virtual void resetForHash() = 0;
void setSignatureSize(std::size_t size_bytes);
diff --git a/libtransport/src/hicn/transport/protocols/packet_manager.h b/libtransport/src/hicn/transport/protocols/packet_manager.h
index 53486edde..4d4011ecf 100644
--- a/libtransport/src/hicn/transport/protocols/packet_manager.h
+++ b/libtransport/src/hicn/transport/protocols/packet_manager.h
@@ -53,6 +53,7 @@ class PacketManager {
result = interest_pool_.get();
}
+ result.second->resetPayload();
return std::move(result.second);
}
diff --git a/libtransport/src/hicn/transport/protocols/raaqm.cc b/libtransport/src/hicn/transport/protocols/raaqm.cc
index be76f7c23..b10457f40 100644
--- a/libtransport/src/hicn/transport/protocols/raaqm.cc
+++ b/libtransport/src/hicn/transport/protocols/raaqm.cc
@@ -102,6 +102,9 @@ void RaaqmTransportProtocol::reset() {
core::Name *name;
socket_->getSocketOption(GeneralTransportOptions::NETWORK_NAME, &name);
index_manager_->setFirstSuffix(name->getSuffix());
+ std::queue<Interest::Ptr> empty;
+ std::swap(interest_to_retransmit_, empty);
+ current_window_size_ = 1;
// Reset reassembly component
BaseReassembly::reset();
@@ -484,7 +487,7 @@ void RaaqmTransportProtocol::sendInterest(std::uint64_t next_suffix) {
return;
}
- interest_retransmissions_[next_suffix & mask] = ~0;
+ interest_retransmissions_[next_suffix & mask] = 0;
interest_timepoints_[next_suffix & mask] = utils::SteadyClock::now();
sendInterest(std::move(interest));
}