management: Implementing encoding/decoding Strategy in nfd::FibManagementOptions
Change-Id: I865d8d6fc44f7a8232a0260719f697ec6cb6857f
Refs: #1292
diff --git a/src/management/nfd-fib-management-options.hpp b/src/management/nfd-fib-management-options.hpp
index 16d688e..b2f8485 100644
--- a/src/management/nfd-fib-management-options.hpp
+++ b/src/management/nfd-fib-management-options.hpp
@@ -32,13 +32,13 @@
{
wireDecode(block);
}
-
- const Name&
+
+ const Name&
getName () const
{
return m_name;
}
-
+
FibManagementOptions&
setName (const Name &name)
{
@@ -46,8 +46,8 @@
m_wire.reset ();
return *this;
}
-
- uint64_t
+
+ uint64_t
getFaceId () const
{
return m_faceId;
@@ -61,7 +61,7 @@
return *this;
}
- uint64_t
+ uint64_t
getCost () const
{
return m_cost;
@@ -75,7 +75,7 @@
return *this;
}
- const Name&
+ const Name&
getStrategy () const
{
return m_strategy;
@@ -88,17 +88,17 @@
m_wire.reset ();
return *this;
}
-
+
template<bool T>
size_t
wireEncode(EncodingImpl<T> &block) const;
-
+
const Block&
wireEncode () const;
-
- void
+
+ void
wireDecode (const Block &wire);
-
+
private:
Name m_name;
uint64_t m_faceId;
@@ -114,11 +114,11 @@
{
size_t total_len = 0;
- // if (!m_strategy.empty())
- // {
- // total_len += prependNestedBlock(blk, tlv::nfd::Strategy, m_strategy);
- // }
-
+ if (!m_strategy.empty())
+ {
+ total_len += prependNestedBlock(blk, tlv::nfd::Strategy, m_strategy);
+ }
+
if (m_cost != 0)
{
total_len += prependNonNegativeIntegerBlock(blk, tlv::nfd::Cost, m_cost);
@@ -144,15 +144,15 @@
EncodingEstimator estimator;
size_t estimatedSize = wireEncode(estimator);
-
+
EncodingBuffer buffer(estimatedSize, 0);
wireEncode(buffer);
m_wire = buffer.block();
return m_wire;
}
-
-inline void
+
+inline void
FibManagementOptions::wireDecode (const Block &wire)
{
m_name.clear();
@@ -164,7 +164,7 @@
if (m_wire.type() != tlv::nfd::FibManagementOptions)
throw Error("Requested decoding of FibManagementOptions, but Block is of different type");
-
+
m_wire.parse ();
// Name
@@ -202,7 +202,7 @@
operator << (std::ostream &os, const FibManagementOptions &option)
{
os << "ForwardingEntry(";
-
+
// Name
os << "Prefix: " << option.getName() << ", ";
@@ -214,7 +214,7 @@
// Strategy
os << "Strategy: " << option.getStrategy() << ", ";
-
+
os << ")";
return os;
}