diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2020-02-21 17:30:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2020-02-21 17:30:49 +0000 |
commit | e1135db42f05a94c6790c8650a3ac20396e0d78c (patch) | |
tree | 65b48490ced07f11597aedc2b752381b0d9e4b30 /libtransport/src/hicn/transport/core/name.cc | |
parent | 1b9512282a5324b2bd2b28b8e5555e15676cb54c (diff) | |
parent | 35058cdfe0134c88f1aa8d23342d1d7b9d39e296 (diff) |
Merge "[HICN-2] Added P2P confidential communication on hICN"
Diffstat (limited to 'libtransport/src/hicn/transport/core/name.cc')
-rw-r--r-- | libtransport/src/hicn/transport/core/name.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libtransport/src/hicn/transport/core/name.cc b/libtransport/src/hicn/transport/core/name.cc index 46ef98948..85e2b8565 100644 --- a/libtransport/src/hicn/transport/core/name.cc +++ b/libtransport/src/hicn/transport/core/name.cc @@ -116,9 +116,9 @@ std::string Name::toString() const { return name_string; } -uint32_t Name::getHash32() const { +uint32_t Name::getHash32(bool consider_suffix) const { uint32_t hash; - if (hicn_name_hash((hicn_name_t *)&name_, &hash) < 0) { + if (hicn_name_hash(&name_, &hash, consider_suffix) < 0) { throw errors::RuntimeException("Error computing the hash of the name!"); } return hash; @@ -206,6 +206,17 @@ std::ostream &operator<<(std::ostream &os, const Name &name) { return os; } +size_t hash<transport::core::Name>::operator()( + const transport::core::Name &name) const { + return name.getHash32(false); +} + +size_t compare2<transport::core::Name>::operator()( + const transport::core::Name &name1, + const transport::core::Name &name2) const { + return name1.equals(name2, false); +} + } // end namespace core } // end namespace transport |