aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/includes/hicn/transport/core/prefix.h
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/includes/hicn/transport/core/prefix.h')
-rw-r--r--libtransport/includes/hicn/transport/core/prefix.h38
1 files changed, 19 insertions, 19 deletions
diff --git a/libtransport/includes/hicn/transport/core/prefix.h b/libtransport/includes/hicn/transport/core/prefix.h
index 7ef667bc8..791fbc770 100644
--- a/libtransport/includes/hicn/transport/core/prefix.h
+++ b/libtransport/includes/hicn/transport/core/prefix.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 Cisco and/or its affiliates.
+ * 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:
@@ -25,16 +25,18 @@ class Prefix {
public:
Prefix();
- Prefix(const char *prefix);
-
Prefix(const std::string &prefix);
- Prefix(std::string &&prefix);
-
- Prefix(std::string &prefix, uint16_t prefix_length);
+ Prefix(const std::string &prefix, uint16_t prefix_length);
Prefix(const core::Name &content_name, uint16_t prefix_length);
+ bool operator<(const Prefix &prefix) const;
+
+ bool operator==(const Prefix &prefix) const;
+
+ bool operator!=(const Prefix &prefix) const { return !operator==(prefix); }
+
std::unique_ptr<Sockaddr> toSockaddr() const;
uint16_t getPrefixLength() const;
@@ -43,36 +45,34 @@ class Prefix {
std::string getNetwork() const;
- int contains(const ip_address_t &content_name) const;
+ Prefix &setNetwork(const std::string &network);
- int contains(const core::Name &content_name) const;
+ int getAddressFamily() const;
- Name getName() const;
+ bool contains(const hicn_ip_address_t &content_name) const;
- Name getRandomName() const;
+ bool contains(const core::Name &content_name) const;
Name getName(const core::Name &mask, const core::Name &components,
const core::Name &content_name) const;
Name mapName(const core::Name &content_name) const;
- Prefix &setNetwork(std::string &network);
-
- int getAddressFamily() const;
-
- Prefix &setAddressFamily(int address_family);
-
+ Name makeName() const;
Name makeRandomName() const;
+ Name makeNameWithIndex(std::uint64_t index) const;
- const ip_prefix_t &toIpPrefixStruct() const;
+ const hicn_ip_prefix_t &toIpPrefixStruct() const;
private:
static bool checkPrefixLengthAndAddressFamily(uint16_t prefix_length,
int family);
- void buildPrefix(std::string &prefix, uint16_t prefix_length, int family);
+ void buildPrefix(const std::string &prefix, uint16_t prefix_length,
+ int family);
- ip_prefix_t ip_prefix_;
+ private:
+ hicn_ip_prefix_t hicn_ip_prefix_;
};
} // end namespace core