7 #ifndef NDN_MANAGEMENT_NDND_FACE_INSTANCE_HPP
8 #define NDN_MANAGEMENT_NDND_FACE_INSTANCE_HPP
10 #include "../encoding/tlv-ndnd.hpp"
11 #include "../encoding/block.hpp"
12 #include "../name.hpp"
26 const std::string& host,
27 const std::string& port,
28 const std::string& multicastInterface,
29 uint32_t multicastTtl,
30 const time::milliseconds& freshnessPeriod)
36 , multicastInterface_(multicastInterface)
37 , multicastTtl_(multicastTtl)
38 , freshnessPeriod_(freshnessPeriod)
46 , freshnessPeriod_(time::milliseconds::min())
101 multicastInterface_ = multicastInterface; wire_.
reset();
112 const time::milliseconds&
118 freshnessPeriod_ = freshnessPeriod; wire_.
reset();
134 std::string multicastInterface_;
135 int32_t multicastTtl_;
136 time::milliseconds freshnessPeriod_;
160 if (!action_.empty())
195 if (!multicastInterface_.empty())
202 if (multicastTtl_ >= 0)
209 if (freshnessPeriod_ >= time::milliseconds::zero())
227 multicastInterface_.clear();
229 freshnessPeriod_ = time::milliseconds::min();
248 action_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
269 host_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
276 port_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
283 multicastInterface_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
304 os <<
"FaceInstance(";
309 os <<
"Action:" << entry.
getAction() <<
", ";
315 os <<
"FaceID:" << entry.
getFaceId() <<
", ";
321 os <<
"IPProto:" << entry.
getIpProto() <<
", ";
327 os <<
"Host:" << entry.
getHost() <<
", ";
333 os <<
"Port:" << entry.
getPort() <<
", ";
361 #endif // NDN_MANAGEMENT_NDND_FACE_INSTANCE_HPP
FaceInstance(const Block &wire)
Create from wire encoding.
FaceInstance(const std::string &action, int64_t faceId, uint32_t ipProto, const std::string &host, const std::string &port, const std::string &multicastInterface, uint32_t multicastTtl, const time::milliseconds &freshnessPeriod)
const std::string & getAction() const
Block nonNegativeIntegerBlock(uint32_t type, uint64_t value)
const time::milliseconds & getFreshnessPeriod() const
element_const_iterator find(uint32_t type) const
const std::string & getMulticastInterface() const
void wireDecode(const Block &wire)
void setPort(const std::string &port)
int64_t getFaceId() const
void setHost(const std::string &host)
int32_t getMulticastTtl() const
Class representing wire element of the NDN packet.
void setMulticastInterface(const std::string &multicastInterface)
void setAction(const std::string &action)
uint64_t readNonNegativeInteger(const Block &block)
element_const_iterator elements_end() const
const std::string & getPort() const
void setFaceId(int64_t faceId)
An FaceInstance holds an action and Name prefix and other fields for an forwarding entry...
element_container::const_iterator element_const_iterator
int32_t getIpProto() const
void reset()
Reset wire buffer of the element.
void push_back(const Block &element)
const Block & wireEncode() const
const std::string & getHost() const
void parse() const
Parse wire buffer into subblocks.
void encode()
Encode subblocks into wire buffer.
void setFreshnessPeriod(const time::milliseconds &freshnessPeriod)
Block dataBlock(uint32_t type, const char *data, size_t dataSize)
std::ostream & operator<<(std::ostream &os, const FaceInstance &entry)
bool hasWire() const
Check if the Block has fully encoded wire.
void setIpProto(int32_t ipProto)
void setMulticastTtl(int32_t multicastTtl)