aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/includes/hicn/transport/core/name.h
diff options
context:
space:
mode:
Diffstat (limited to 'libtransport/includes/hicn/transport/core/name.h')
-rw-r--r--libtransport/includes/hicn/transport/core/name.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/libtransport/includes/hicn/transport/core/name.h b/libtransport/includes/hicn/transport/core/name.h
index 033582289..14ea10898 100644
--- a/libtransport/includes/hicn/transport/core/name.h
+++ b/libtransport/includes/hicn/transport/core/name.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:
@@ -46,12 +46,13 @@ class Name {
friend class Packet;
friend class ContentObject;
friend class Interest;
+ friend class Prefix;
static const uint32_t standard_name_string_length = 100;
public:
using NameStruct = hicn_name_t;
- using Type = hicn_name_type_t;
+ enum class Type { UNDEFINED, V4, V6 };
Name();
@@ -69,6 +70,8 @@ class Name {
Name(const Name &name);
+ ~Name();
+
Name &operator=(const Name &name);
bool operator==(const Name &name) const;
@@ -91,23 +94,22 @@ class Name {
uint32_t getSuffix() const;
- std::shared_ptr<Sockaddr> getAddress() const;
-
Name &setSuffix(uint32_t seq_number);
- ip_prefix_t toIpAddress() const;
+ hicn_ip_prefix_t toIpAddress() const;
+
+ std::string getPrefix() const;
- void copyToDestination(uint8_t *destination,
- bool include_suffix = false) const;
+ void copyPrefixToDestination(uint8_t *destination) const;
int getAddressFamily() const;
private:
- TRANSPORT_ALWAYS_INLINE const NameStruct *getConstStructReference() const {
- return &name_;
+ TRANSPORT_ALWAYS_INLINE const NameStruct &getConstStructReference() const {
+ return name_;
}
- TRANSPORT_ALWAYS_INLINE NameStruct *getStructReference() { return &name_; }
+ TRANSPORT_ALWAYS_INLINE NameStruct &getStructReference() { return name_; }
NameStruct name_;
};