tools: display face flags in nfdc and nfd-status-http-server
refs #3733
Change-Id: Idd66ffb7594079d2738253d035792300fe3febef
diff --git a/tests/tools/nfdc/face-module.t.cpp b/tests/tools/nfdc/face-module.t.cpp
index 6d316e6..faf8ead 100644
--- a/tests/tools/nfdc/face-module.t.cpp
+++ b/tests/tools/nfdc/face-module.t.cpp
@@ -44,6 +44,7 @@
<faceScope>non-local</faceScope>
<facePersistency>permanent</facePersistency>
<linkType>multi-access</linkType>
+ <flags/>
<packetCounters>
<incomingPackets>
<nInterests>22562</nInterests>
@@ -68,6 +69,9 @@
<faceScope>local</faceScope>
<facePersistency>on-demand</facePersistency>
<linkType>point-to-point</linkType>
+ <flags>
+ <localFieldsEnabled/>
+ </flags>
<packetCounters>
<incomingPackets>
<nInterests>18998</nInterests>
@@ -92,10 +96,10 @@
"Faces:\n"
" faceid=134 remote=udp4://233.252.0.4:6363 local=udp4://192.0.2.1:6363"
" counters={in={22562i 22031d 63n 2522915B} out={30121i 20940d 1218n 1353592B}}"
- " non-local permanent multi-access\n"
+ " non-local permanent multi-access flags={}\n"
" faceid=745 remote=fd://75 local=unix:///var/run/nfd.sock"
" counters={in={18998i 26701d 147n 4672308B} out={34779i 17028d 1176n 8957187B}}"
- " local on-demand point-to-point\n";
+ " local on-demand point-to-point flags={local-fields}\n";
BOOST_AUTO_TEST_CASE(Status)
{
@@ -122,6 +126,7 @@
.setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL)
.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND)
.setLinkType(ndn::nfd::LINK_TYPE_POINT_TO_POINT)
+ .setFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED, true)
.setNInInterests(18998)
.setNInDatas(26701)
.setNInNacks(147)
diff --git a/tools/nfd-status-http-server-files/nfd-status.xsl b/tools/nfd-status-http-server-files/nfd-status.xsl
index f8ba4c8..ff92dae 100644
--- a/tools/nfd-status-http-server-files/nfd-status.xsl
+++ b/tools/nfd-status-http-server-files/nfd-status.xsl
@@ -151,6 +151,7 @@
<th>Scope</th>
<th>Persistency</th>
<th>LinkType</th>
+ <th>Flags</th>
<th>Expires in</th>
<th>In Interests</th>
<th>In Data</th>
@@ -181,6 +182,13 @@
<td><xsl:value-of select="nfd:linkType"/></td>
<td>
<xsl:choose>
+ <xsl:when test="nfd:flags/nfd:localFieldsEnabled">
+ local-fields
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ <td>
+ <xsl:choose>
<xsl:when test="nfd:expirationPeriod">
<xsl:call-template name="formatDuration"><xsl:with-param name="duration" select="nfd:expirationPeriod" /></xsl:call-template>
</xsl:when>
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 97e836c..076b7af 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.cpp
@@ -91,6 +91,17 @@
os << "<facePersistency>" << item.getFacePersistency() << "</facePersistency>";
os << "<linkType>" << item.getLinkType() << "</linkType>";
+ if (item.getFlags() == 0) {
+ os << "<flags/>";
+ }
+ else {
+ os << "<flags>";
+ if (item.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)) {
+ os << "<localFieldsEnabled/>";
+ }
+ os << "</flags>";
+ }
+
os << "<packetCounters>";
os << "<incomingPackets>"
<< "<nInterests>" << item.getNInInterests() << "</nInterests>"
@@ -146,6 +157,13 @@
os << " " << item.getFaceScope();
os << " " << item.getFacePersistency();
os << " " << item.getLinkType();
+
+ os << " flags={";
+ if (item.getFlagBit(ndn::nfd::BIT_LOCAL_FIELDS_ENABLED)) {
+ os << "local-fields";
+ }
+ os << "}";
+
os << "\n";
}