face-management-protocol: port is actually a string (can be either number or service name)
Change-Id: I9f3a174d7bac720b1b2765e9d931cd968cfcd3b0
diff --git a/include/ndn-cpp/face-instance.hpp b/include/ndn-cpp/face-instance.hpp
index 19a65e7..74feee1 100644
--- a/include/ndn-cpp/face-instance.hpp
+++ b/include/ndn-cpp/face-instance.hpp
@@ -23,7 +23,7 @@
int64_t faceId,
uint32_t ipProto,
const std::string &host,
- uint32_t port,
+ const std::string &port,
const std::string &multicastInterface,
uint32_t multicastTtl,
Milliseconds freshnessPeriod)
@@ -41,7 +41,6 @@
FaceInstance()
: faceId_(-1)
, ipProto_(-1)
- , port_(-1)
, multicastTtl_(-1)
, freshnessPeriod_(-1)
{
@@ -76,11 +75,11 @@
setHost(const std::string& host) { host_ = host; wire_.reset(); }
// Port
- int32_t
+ const std::string&
getPort() const { return port_; }
void
- setPort(int port) { port_ = port; wire_.reset(); }
+ setPort(const std::string &port) { port_ = port; wire_.reset(); }
// MulticastInterface
const std::string&
@@ -115,7 +114,7 @@
int64_t faceId_;
int32_t ipProto_;
std::string host_;
- int32_t port_;
+ std::string port_;
std::string multicastInterface_;
int32_t multicastTtl_;
Milliseconds freshnessPeriod_;
@@ -170,10 +169,10 @@
}
// Port
- if (port_ >= 0)
+ if (!port_.empty())
{
wire_.push_back
- (nonNegativeIntegerBlock(Tlv::FaceManagement::Port, port_));
+ (dataBlock(Tlv::FaceManagement::Port, port_.c_str(), port_.size()));
}
// MulticastInterface
@@ -208,7 +207,7 @@
faceId_ = -1;
ipProto_ = -1;
host_.clear();
- port_ = -1;
+ port_.clear();
multicastInterface_.clear();
multicastTtl_ = -1;
freshnessPeriod_ = -1;
@@ -258,7 +257,7 @@
val = wire_.find(Tlv::FaceManagement::Port);
if (val != wire_.getAll().end())
{
- port_ = readNonNegativeInteger(*val);
+ port_ = std::string(reinterpret_cast<const char*>(val->value()), val->value_size());
}
// MulticastInterface
@@ -313,7 +312,7 @@
}
// Port
- if (entry.getPort() >= 0)
+ if (!entry.getPort().empty())
{
os << "Port:" << entry.getPort() << ", ";
}