aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-10-07 09:52:33 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-10-07 15:55:42 +0200
commit6b84ec54083da9911f5ad4816d0eb4f4745afad4 (patch)
treee4296ebb218fff02dc0bbea73ce1c8d12aba7bcc /libtransport
parent85a791ac2cdd35d79c00141e748b4c68fbdafb0d (diff)
[HICN-298] Release new hICN app for Android
Change-Id: I43adc62fadf00690b687078d739788dffdc5e566 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'libtransport')
-rw-r--r--libtransport/CMakeLists.txt4
-rw-r--r--libtransport/src/hicn/transport/CMakeLists.txt4
-rw-r--r--libtransport/src/hicn/transport/core/content_object.cc7
-rw-r--r--libtransport/src/hicn/transport/core/content_object.h4
-rw-r--r--libtransport/src/hicn/transport/core/facade.h2
-rw-r--r--libtransport/src/hicn/transport/core/forwarder_interface.h4
-rw-r--r--libtransport/src/hicn/transport/core/hicn_binary_api.c22
-rw-r--r--libtransport/src/hicn/transport/core/hicn_binary_api.h15
-rw-r--r--libtransport/src/hicn/transport/core/interest.cc8
-rw-r--r--libtransport/src/hicn/transport/core/interest.h4
-rw-r--r--libtransport/src/hicn/transport/core/name.cc6
-rw-r--r--libtransport/src/hicn/transport/core/name.h2
-rw-r--r--libtransport/src/hicn/transport/core/packet.h4
-rw-r--r--libtransport/src/hicn/transport/core/prefix.cc30
-rw-r--r--libtransport/src/hicn/transport/core/prefix.h6
-rw-r--r--libtransport/src/hicn/transport/core/raw_socket_interface.cc2
-rw-r--r--libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc40
17 files changed, 82 insertions, 82 deletions
diff --git a/libtransport/CMakeLists.txt b/libtransport/CMakeLists.txt
index e68e45c40..dc3409c6f 100644
--- a/libtransport/CMakeLists.txt
+++ b/libtransport/CMakeLists.txt
@@ -85,7 +85,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(LIBTRANSPORT_SHARED ${LIBTRANSPORT}.shared)
set(LIBTRANSPORT_STATIC ${LIBTRANSPORT}.static)
else()
- if(ANDROID_API)
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(HICN_LIBRARIES ${LIBHICN_STATIC})
list(APPEND DEPENDENCIES
${LIBHICN_STATIC}
@@ -130,7 +130,7 @@ if (${COMPILE_TESTS})
)
endif()
-if(ANDROID_API)
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
find_package(OpenSSL REQUIRED)
endif ()
diff --git a/libtransport/src/hicn/transport/CMakeLists.txt b/libtransport/src/hicn/transport/CMakeLists.txt
index 5fe101c18..6e0ae5b88 100644
--- a/libtransport/src/hicn/transport/CMakeLists.txt
+++ b/libtransport/src/hicn/transport/CMakeLists.txt
@@ -54,11 +54,11 @@ else ()
set(CMAKE_SHARED_LINKER_FLAGS "/NODEFAULTLIB:\"MSVCRTD\"" )
endif ()
endif ()
-if (ANDROID_API)
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -isystem -lm")
endif()
-if (ANDROID_API)
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
build_library(${LIBTRANSPORT}
STATIC
SOURCES ${SOURCE_FILES} ${HEADER_FILES}
diff --git a/libtransport/src/hicn/transport/core/content_object.cc b/libtransport/src/hicn/transport/core/content_object.cc
index 83b545c05..d05239372 100644
--- a/libtransport/src/hicn/transport/core/content_object.cc
+++ b/libtransport/src/hicn/transport/core/content_object.cc
@@ -22,6 +22,7 @@ extern "C" {
TRANSPORT_CLANG_DISABLE_WARNING("-Wextern-c-compat")
#endif
#include <hicn/hicn.h>
+#include <hicn/util/ip_address.h>
}
#include <cstring>
@@ -153,7 +154,7 @@ ContentObject &ContentObject::setPathLabel(uint32_t path_label) {
return *this;
}
-void ContentObject::setLocator(const ip_address_t &ip_address) {
+void ContentObject::setLocator(const ip_prefix_t &ip_address) {
if (hicn_data_set_locator(format_, packet_start_, &ip_address) < 0) {
throw errors::RuntimeException("Error setting content object locator");
}
@@ -161,8 +162,8 @@ void ContentObject::setLocator(const ip_address_t &ip_address) {
return;
}
-ip_address_t ContentObject::getLocator() const {
- ip_address_t ip;
+ip_prefix_t ContentObject::getLocator() const {
+ ip_prefix_t ip;
if (hicn_data_get_locator(format_, packet_start_, &ip) < 0) {
throw errors::RuntimeException("Error getting content object locator.");
diff --git a/libtransport/src/hicn/transport/core/content_object.h b/libtransport/src/hicn/transport/core/content_object.h
index 5af548fe4..ef5144c23 100644
--- a/libtransport/src/hicn/transport/core/content_object.h
+++ b/libtransport/src/hicn/transport/core/content_object.h
@@ -60,9 +60,9 @@ class ContentObject : public Packet {
ContentObject &setPathLabel(uint32_t path_label);
- void setLocator(const ip_address_t &ip_address) override;
+ void setLocator(const ip_prefix_t &ip_address) override;
- ip_address_t getLocator() const override;
+ ip_prefix_t getLocator() const override;
void setLifetime(uint32_t lifetime) override;
diff --git a/libtransport/src/hicn/transport/core/facade.h b/libtransport/src/hicn/transport/core/facade.h
index c28c84671..27e738e62 100644
--- a/libtransport/src/hicn/transport/core/facade.h
+++ b/libtransport/src/hicn/transport/core/facade.h
@@ -37,7 +37,7 @@ namespace core {
using HicnForwarderPortal = Portal<HicnForwarderInterface>;
#ifdef __linux__
-#ifndef __ANDROID_API__
+#ifndef __ANDROID__
using RawSocketPortal = Portal<RawSocketInterface>;
#endif
#ifdef __vpp__
diff --git a/libtransport/src/hicn/transport/core/forwarder_interface.h b/libtransport/src/hicn/transport/core/forwarder_interface.h
index 8fefba8ad..6bcdaafc1 100644
--- a/libtransport/src/hicn/transport/core/forwarder_interface.h
+++ b/libtransport/src/hicn/transport/core/forwarder_interface.h
@@ -133,8 +133,8 @@ class ForwarderInterface {
protected:
ConnectorType &connector_;
- ip_address_t inet_address_;
- ip_address_t inet6_address_;
+ ip_prefix_t inet_address_;
+ ip_prefix_t inet6_address_;
uint16_t mtu_;
std::string output_interface_;
uint32_t content_store_reserved_;
diff --git a/libtransport/src/hicn/transport/core/hicn_binary_api.c b/libtransport/src/hicn/transport/core/hicn_binary_api.c
index 3868c0a14..8fde516fd 100644
--- a/libtransport/src/hicn/transport/core/hicn_binary_api.c
+++ b/libtransport/src/hicn/transport/core/hicn_binary_api.c
@@ -92,12 +92,12 @@ int hicn_binary_api_register_prod_app(
CONTEXT_SAVE(context_store, api, mp)
- mp->len = (u8)input_params->prefix->prefix_len;
+ mp->len = (u8)input_params->prefix->len;
mp->swif = clib_host_to_net_u32(input_params->swif);
mp->cs_reserved = clib_host_to_net_u32(input_params->cs_reserved);
- mp->prefix[0] = clib_host_to_net_u64(input_params->prefix->as_u64[0]);
- mp->prefix[1] = clib_host_to_net_u64(input_params->prefix->as_u64[1]);
+ mp->prefix[0] = clib_host_to_net_u64(input_params->prefix->address.as_u64[0]);
+ mp->prefix[1] = clib_host_to_net_u64(input_params->prefix->address.as_u64[1]);
return vpp_binary_api_send_request_wait_reply(api->vpp_api, mp);
}
@@ -112,8 +112,8 @@ static void vl_api_hicn_api_register_prod_app_reply_t_handler(
vpp_binary_api_set_ret_value(binary_api->vpp_api,
clib_net_to_host_u32(mp->retval));
params->cs_reserved = mp->cs_reserved;
- params->prod_addr->as_u64[0] = mp->prod_addr[0];
- params->prod_addr->as_u64[1] = mp->prod_addr[1];
+ params->prod_addr->address.as_u64[0] = mp->prod_addr[0];
+ params->prod_addr->address.as_u64[1] = mp->prod_addr[1];
params->face_id = clib_net_to_host_u32(mp->faceid);
vpp_binary_api_unlock_waiting_thread(binary_api->vpp_api);
@@ -147,9 +147,9 @@ static void vl_api_hicn_api_register_cons_app_reply_t_handler(
vpp_binary_api_set_ret_value(binary_api->vpp_api,
clib_net_to_host_u32(mp->retval));
- params->src4->as_ip46.ip4.as_u32 = clib_net_to_host_u32(mp->src_addr4);
- params->src6->as_u64[0] = clib_net_to_host_u64(mp->src_addr6[0]);
- params->src6->as_u64[1] = clib_net_to_host_u64(mp->src_addr6[1]);
+ params->src4->address.v4.as_u32 = clib_net_to_host_u32(mp->src_addr4);
+ params->src6->address.as_u64[0] = clib_net_to_host_u64(mp->src_addr6[0]);
+ params->src6->address.as_u64[1] = clib_net_to_host_u64(mp->src_addr6[1]);
params->face_id = clib_host_to_net_u32(mp->faceid);
vpp_binary_api_unlock_waiting_thread(binary_api->vpp_api);
@@ -166,9 +166,9 @@ int hicn_binary_api_register_route(
CONTEXT_SAVE(context_store, api, mp)
- mp->prefix[0] = input_params->prefix->as_u64[0];
- mp->prefix[1] = input_params->prefix->as_u64[1];
- mp->len = input_params->prefix->prefix_len;
+ mp->prefix[0] = input_params->prefix->address.as_u64[0];
+ mp->prefix[1] = input_params->prefix->address.as_u64[1];
+ mp->len = input_params->prefix->len;
mp->face_ids[0] = input_params->face_id;
mp->n_faces = 1;
diff --git a/libtransport/src/hicn/transport/core/hicn_binary_api.h b/libtransport/src/hicn/transport/core/hicn_binary_api.h
index 410ffb96c..b09b5f4a7 100644
--- a/libtransport/src/hicn/transport/core/hicn_binary_api.h
+++ b/libtransport/src/hicn/transport/core/hicn_binary_api.h
@@ -16,6 +16,7 @@
#pragma once
#include <hicn/transport/config.h>
+#include <hicn/util/ip_address.h>
#ifdef __vpp__
@@ -27,10 +28,8 @@ extern "C" {
#include "stdint.h"
-typedef struct ip_address ip_address_t;
-
typedef struct {
- ip_address_t* prefix;
+ ip_prefix_t* prefix;
uint32_t swif;
uint32_t cs_reserved;
} hicn_producer_input_params;
@@ -41,18 +40,18 @@ typedef struct {
typedef struct {
uint32_t cs_reserved;
- ip_address_t* prod_addr;
+ ip_prefix_t* prod_addr;
uint32_t face_id;
} hicn_producer_output_params;
typedef struct {
- ip_address_t* src4;
- ip_address_t* src6;
+ ip_prefix_t* src4;
+ ip_prefix_t* src6;
uint32_t face_id;
} hicn_consumer_output_params;
typedef struct {
- ip_address_t* prefix;
+ ip_prefix_t* prefix;
uint32_t face_id;
} hicn_producer_set_route_params;
@@ -75,4 +74,4 @@ char* hicn_binary_api_get_error_string(int ret_val);
}
#endif
-#endif // __vpp__ \ No newline at end of file
+#endif // __vpp__
diff --git a/libtransport/src/hicn/transport/core/interest.cc b/libtransport/src/hicn/transport/core/interest.cc
index 60ab10967..6465053de 100644
--- a/libtransport/src/hicn/transport/core/interest.cc
+++ b/libtransport/src/hicn/transport/core/interest.cc
@@ -119,7 +119,7 @@ void Interest::setName(Name &&name) {
}
}
-void Interest::setLocator(const ip_address_t &ip_address) {
+void Interest::setLocator(const ip_prefix_t &ip_address) {
if (hicn_interest_set_locator(format_, packet_start_, &ip_address) < 0) {
throw errors::RuntimeException("Error setting interest locator.");
}
@@ -127,8 +127,8 @@ void Interest::setLocator(const ip_address_t &ip_address) {
return;
}
-ip_address_t Interest::getLocator() const {
- ip_address_t ip;
+ip_prefix_t Interest::getLocator() const {
+ ip_prefix_t ip;
if (hicn_interest_get_locator(format_, packet_start_, &ip) < 0) {
throw errors::RuntimeException("Error getting interest locator.");
@@ -163,4 +163,4 @@ void Interest::resetForHash() {
} // end namespace core
-} // end namespace transport \ No newline at end of file
+} // end namespace transport
diff --git a/libtransport/src/hicn/transport/core/interest.h b/libtransport/src/hicn/transport/core/interest.h
index 48c833a73..12fd597e5 100644
--- a/libtransport/src/hicn/transport/core/interest.h
+++ b/libtransport/src/hicn/transport/core/interest.h
@@ -55,9 +55,9 @@ class Interest
void setName(Name &&name) override;
- void setLocator(const ip_address_t &ip_address) override;
+ void setLocator(const ip_prefix_t &ip_address) override;
- ip_address_t getLocator() const override;
+ ip_prefix_t getLocator() const override;
void setLifetime(uint32_t lifetime) override;
diff --git a/libtransport/src/hicn/transport/core/name.cc b/libtransport/src/hicn/transport/core/name.cc
index 0621eeeb5..46ef98948 100644
--- a/libtransport/src/hicn/transport/core/name.cc
+++ b/libtransport/src/hicn/transport/core/name.cc
@@ -169,11 +169,11 @@ std::shared_ptr<Sockaddr> Name::getAddress() const {
return std::shared_ptr<Sockaddr>(ret);
}
-ip_address_t Name::toIpAddress() const {
- ip_address_t ret;
+ip_prefix_t Name::toIpAddress() const {
+ ip_prefix_t ret;
std::memset(&ret, 0, sizeof(ret));
- if (hicn_name_to_ip_address(&name_, &ret) < 0) {
+ if (hicn_name_to_ip_prefix(&name_, &ret) < 0) {
throw errors::InvalidIpAddressException();
}
diff --git a/libtransport/src/hicn/transport/core/name.h b/libtransport/src/hicn/transport/core/name.h
index 061371be5..35625ddd1 100644
--- a/libtransport/src/hicn/transport/core/name.h
+++ b/libtransport/src/hicn/transport/core/name.h
@@ -93,7 +93,7 @@ class Name {
Name &setSuffix(uint32_t seq_number);
- ip_address_t toIpAddress() const;
+ ip_prefix_t toIpAddress() const;
void copyToDestination(uint8_t *destination,
bool include_suffix = false) const;
diff --git a/libtransport/src/hicn/transport/core/packet.h b/libtransport/src/hicn/transport/core/packet.h
index 4ec93205a..825c4c9dd 100644
--- a/libtransport/src/hicn/transport/core/packet.h
+++ b/libtransport/src/hicn/transport/core/packet.h
@@ -133,9 +133,9 @@ class Packet : public std::enable_shared_from_this<Packet> {
void dump() const;
- virtual void setLocator(const ip_address_t &locator) = 0;
+ virtual void setLocator(const ip_prefix_t &locator) = 0;
- virtual ip_address_t getLocator() const = 0;
+ virtual ip_prefix_t getLocator() const = 0;
void setSignatureTimestamp(const uint64_t &timestamp);
diff --git a/libtransport/src/hicn/transport/core/prefix.cc b/libtransport/src/hicn/transport/core/prefix.cc
index 74d1466ac..badbf3b3b 100644
--- a/libtransport/src/hicn/transport/core/prefix.cc
+++ b/libtransport/src/hicn/transport/core/prefix.cc
@@ -33,7 +33,7 @@ namespace transport {
namespace core {
-Prefix::Prefix() { std::memset(&ip_address_, 0, sizeof(ip_address_t)); }
+Prefix::Prefix() { std::memset(&ip_address_, 0, sizeof(ip_prefix_t)); }
Prefix::Prefix(const char *prefix) : Prefix(std::string(prefix)) {}
@@ -67,7 +67,7 @@ Prefix::Prefix(const core::Name &content_name, uint16_t prefix_length) {
}
ip_address_ = content_name.toIpAddress();
- ip_address_.prefix_len = prefix_length;
+ ip_address_.len = prefix_length;
ip_address_.family = family;
}
@@ -77,13 +77,13 @@ void Prefix::buildPrefix(std::string &prefix, uint16_t prefix_length,
throw errors::InvalidIpAddressException();
}
- int ret = inet_pton(family, prefix.c_str(), ip_address_.buffer);
+ int ret = inet_pton(family, prefix.c_str(), ip_address_.address.buffer);
if (ret != 1) {
throw errors::InvalidIpAddressException();
}
- ip_address_.prefix_len = prefix_length;
+ ip_address_.len = prefix_length;
ip_address_.family = family;
}
@@ -101,17 +101,17 @@ std::unique_ptr<Sockaddr> Prefix::toSockaddr() {
throw errors::InvalidIpAddressException();
}
- if (hicn_ip_to_sockaddr_address(&ip_address_, ret) < 0) {
+ if (ip_prefix_to_sockaddr(&ip_address_, ret) < 0) {
throw errors::InvalidIpAddressException();
}
return std::unique_ptr<Sockaddr>(ret);
}
-uint16_t Prefix::getPrefixLength() { return ip_address_.prefix_len; }
+uint16_t Prefix::getPrefixLength() { return ip_address_.len; }
Prefix &Prefix::setPrefixLength(uint16_t prefix_length) {
- ip_address_.prefix_len = prefix_length;
+ ip_address_.len = prefix_length;
return *this;
}
@@ -123,17 +123,17 @@ Prefix &Prefix::setAddressFamily(int address_family) {
}
std::string Prefix::getNetwork() const {
- if (!checkPrefixLengthAndAddressFamily(ip_address_.prefix_len,
+ if (!checkPrefixLengthAndAddressFamily(ip_address_.len,
ip_address_.family)) {
throw errors::InvalidIpAddressException();
}
std::size_t size =
- ip_address_.family == AF_INET ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
+ ip_address_.family == 4 + AF_INET ? INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
std::string network(size, 0);
- if (hicn_ip_ntop(&ip_address_, (char *)network.c_str(), size) < 0) {
+ if (ip_prefix_ntop(&ip_address_, (char *)network.c_str(), size) < 0) {
throw errors::RuntimeException(
"Impossible to retrieve network from ip address.");
}
@@ -147,7 +147,7 @@ Name Prefix::getName() const {
}
Prefix &Prefix::setNetwork(std::string &network) {
- if (!inet_pton(AF_INET6, network.c_str(), ip_address_.buffer)) {
+ if (!inet_pton(AF_INET6, network.c_str(), ip_address_.address.buffer)) {
throw errors::RuntimeException("The network name is not valid.");
}
@@ -163,10 +163,10 @@ Name Prefix::makeRandomName() const {
0, std::numeric_limits<uint32_t>::max());
uint64_t random_number = idis(eng);
- uint32_t hash_size_bits = IPV6_ADDR_LEN_BITS - ip_address_.prefix_len;
+ uint32_t hash_size_bits = IPV6_ADDR_LEN_BITS - ip_address_.len;
uint64_t ip_address[2];
- memcpy(ip_address, ip_address_.buffer, sizeof(uint64_t));
- memcpy(ip_address + 1, ip_address_.buffer + 8, sizeof(uint64_t));
+ memcpy(ip_address, ip_address_.address.buffer, sizeof(uint64_t));
+ memcpy(ip_address + 1, ip_address_.address.buffer + 8, sizeof(uint64_t));
std::string network(IPV6_ADDR_LEN * 3, 0);
// Let's do the magic ;)
@@ -208,7 +208,7 @@ bool Prefix::checkPrefixLengthAndAddressFamily(uint16_t prefix_length,
return true;
}
-ip_address_t &Prefix::toIpAddressStruct() { return ip_address_; }
+ip_prefix_t &Prefix::toIpAddressStruct() { return ip_address_; }
} // namespace core
diff --git a/libtransport/src/hicn/transport/core/prefix.h b/libtransport/src/hicn/transport/core/prefix.h
index b68c6bdf6..022e2bec2 100644
--- a/libtransport/src/hicn/transport/core/prefix.h
+++ b/libtransport/src/hicn/transport/core/prefix.h
@@ -52,7 +52,7 @@ class Prefix {
Name makeRandomName() const;
- ip_address_t &toIpAddressStruct();
+ ip_prefix_t &toIpAddressStruct();
private:
static bool checkPrefixLengthAndAddressFamily(uint16_t prefix_length,
@@ -60,9 +60,9 @@ class Prefix {
void buildPrefix(std::string &prefix, uint16_t prefix_length, int family);
- ip_address_t ip_address_;
+ ip_prefix_t ip_address_;
};
} // end namespace core
-} // end namespace transport \ No newline at end of file
+} // end namespace transport
diff --git a/libtransport/src/hicn/transport/core/raw_socket_interface.cc b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
index 4cf7b2ca6..ef365fce7 100644
--- a/libtransport/src/hicn/transport/core/raw_socket_interface.cc
+++ b/libtransport/src/hicn/transport/core/raw_socket_interface.cc
@@ -45,7 +45,7 @@ void RawSocketInterface::connect(bool is_consumer) {
utils::retrieveInterfaceAddress(output_interface_, &address);
inet6_address_.family = address.sin6_family;
- std::memcpy(inet6_address_.buffer, &address.sin6_addr,
+ std::memcpy(inet6_address_.address.buffer, &address.sin6_addr,
sizeof(address.sin6_addr));
connector_.connect(output_interface_, remote_mac_address_);
}
diff --git a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
index 61c5dfc7f..c8a4f9c88 100644
--- a/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
+++ b/libtransport/src/hicn/transport/core/vpp_forwarder_interface.cc
@@ -87,8 +87,8 @@ uint32_t VPPForwarderInterface::getMemifConfiguration() {
void VPPForwarderInterface::consumerConnection() {
hicn_consumer_input_params input = {0};
hicn_consumer_output_params output = {0};
- ip_address_t ip4_address;
- ip_address_t ip6_address;
+ ip_prefix_t ip4_address;
+ ip_prefix_t ip6_address;
output.src4 = &ip4_address;
output.src6 = &ip6_address;
@@ -103,12 +103,12 @@ void VPPForwarderInterface::consumerConnection() {
}
inet_address_.family = AF_INET;
- inet_address_.prefix_len = output.src4->prefix_len;
- std::memcpy(inet_address_.buffer, output.src4->buffer, IPV6_ADDR_LEN);
+ inet_address_.len = output.src4->len;
+ std::memcpy(inet_address_.address.buffer, output.src4->address.buffer, IPV6_ADDR_LEN);
inet6_address_.family = AF_INET6;
- inet6_address_.prefix_len = output.src6->prefix_len;
- std::memcpy(inet6_address_.buffer, output.src6->buffer, IPV6_ADDR_LEN);
+ inet6_address_.len = output.src6->len;
+ std::memcpy(inet6_address_.address.buffer, output.src6->address.buffer, IPV6_ADDR_LEN);
}
void VPPForwarderInterface::producerConnection() {
@@ -144,7 +144,7 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
auto &addr = prefix.toIpAddressStruct();
// Same ip address for input and outurt params
- ip_address_t ip_address;
+ ip_prefix_t ip_address;
if (face_id_ == uint32_t(~0)) {
hicn_producer_input_params input;
@@ -160,10 +160,10 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
// memif_id, since this function should be called after the
// memif creation.
input.swif = sw_if_index_;
- input.prefix->as_u64[0] = addr.as_u64[0];
- input.prefix->as_u64[1] = addr.as_u64[1];
+ input.prefix->address.as_u64[0] = addr.address.as_u64[0];
+ input.prefix->address.as_u64[1] = addr.address.as_u64[1];
input.prefix->family = addr.family == AF_INET6 ? AF_INET6 : AF_INET;
- input.prefix->prefix_len = addr.prefix_len;
+ input.prefix->len = addr.len;
input.cs_reserved = content_store_reserved_;
int ret = hicn_binary_api_register_prod_app(
@@ -174,25 +174,25 @@ void VPPForwarderInterface::registerRoute(Prefix &prefix) {
}
if (addr.family == AF_INET6) {
- inet6_address_.prefix_len = output.prod_addr->prefix_len;
- inet6_address_.as_u64[0] = output.prod_addr->as_u64[0];
- inet6_address_.as_u64[1] = output.prod_addr->as_u64[1];
+ inet6_address_.len = output.prod_addr->len;
+ inet6_address_.address.as_u64[0] = output.prod_addr->address.as_u64[0];
+ inet6_address_.address.as_u64[1] = output.prod_addr->address.as_u64[1];
} else {
- inet_address_.prefix_len = output.prod_addr->prefix_len;
+ inet_address_.len = output.prod_addr->len;
// The ipv4 is written in the last 4 bytes of the ipv6 address, so we need
// to copy from the byte 12
- inet_address_.as_u64[0] = output.prod_addr->as_u64[0];
- inet_address_.as_u64[1] = output.prod_addr->as_u64[1];
+ inet_address_.address.as_u64[0] = output.prod_addr->address.as_u64[0];
+ inet_address_.address.as_u64[1] = output.prod_addr->address.as_u64[1];
}
face_id_ = output.face_id;
} else {
hicn_producer_set_route_params params;
params.prefix = &ip_address;
- params.prefix->as_u64[0] = addr.as_u64[0];
- params.prefix->as_u64[1] = addr.as_u64[1];
+ params.prefix->address.as_u64[0] = addr.address.as_u64[0];
+ params.prefix->address.as_u64[1] = addr.address.as_u64[1];
params.prefix->family = addr.family == AF_INET6 ? AF_INET6 : AF_INET;
- params.prefix->prefix_len = addr.prefix_len;
+ params.prefix->len = addr.len;
params.face_id = face_id_;
int ret = hicn_binary_api_register_route(VPPForwarderInterface::hicn_api_,
@@ -225,4 +225,4 @@ void VPPForwarderInterface::closeConnection() {
} // namespace transport
-#endif \ No newline at end of file
+#endif