tools: include the key name in keylocator as the NFD id in nfd-status
refs #1807
Change-Id: I28f17c459efb720f957f33a6fc27a55edde719ea
diff --git a/docs/_static/nfd-status.xsd b/docs/_static/nfd-status.xsd
index 6a080a7..844b4f9 100644
--- a/docs/_static/nfd-status.xsd
+++ b/docs/_static/nfd-status.xsd
@@ -27,6 +27,7 @@
<xs:complexType name="generalStatusType">
<xs:sequence>
+ <xs:element type="xs:anyURI" name="nfdId"/>
<xs:element type="xs:string" name="version"/>
<xs:element type="xs:dateTime" name="startTime"/>
<xs:element type="xs:dateTime" name="currentTime"/>
diff --git a/docs/manpages/nfd-status.rst b/docs/manpages/nfd-status.rst
index a4d7c04..22892b7 100644
--- a/docs/manpages/nfd-status.rst
+++ b/docs/manpages/nfd-status.rst
@@ -55,6 +55,7 @@
$ nfd-status
General NFD status:
+ nfdId=/chengyu/KEY/ksk-1405136377018/ID-CERT
version=2000
startTime=20140725T232341.374000
currentTime=20140725T233240
diff --git a/tools/nfd-status-http-server-files/nfd-status.xsl b/tools/nfd-status-http-server-files/nfd-status.xsl
index e7cc55a..031f273 100644
--- a/tools/nfd-status-http-server-files/nfd-status.xsl
+++ b/tools/nfd-status-http-server-files/nfd-status.xsl
@@ -72,6 +72,7 @@
<table class="item-list">
<thead>
<tr>
+ <th>NFD ID</th>
<th>Version</th>
<th>Start time</th>
<th>Current time</th>
@@ -89,6 +90,7 @@
</thead>
<tbody>
<tr class="center">
+ <td><xsl:apply-templates select="nfd:nfdId"/></td>
<td><xsl:apply-templates select="nfd:version"/></td>
<td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:startTime" /></xsl:call-template></td>
<td><xsl:call-template name="formatDate"><xsl:with-param name="date" select="nfd:currentTime" /></xsl:call-template></td>
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index 3262a28..219e53d 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -184,9 +184,20 @@
afterFetchedVersionInformation(const Data& data)
{
nfd::ForwarderStatus status(data.getContent());
+ std::string nfdId;
+ if (data.getSignature().hasKeyLocator())
+ {
+ const ndn::KeyLocator& locator = data.getSignature().getKeyLocator();
+ if (locator.getType() == KeyLocator::KeyLocator_Name)
+ nfdId = locator.getName().toUri();
+ //todo: KeyDigest supporting
+ }
+
if (m_isOutputXml)
{
std::cout << "<generalStatus>";
+ std::cout << "<nfdId>"
+ << nfdId << "</nfdId>";
std::cout << "<version>"
<< status.getNfdVersion() << "</version>";
std::cout << "<startTime>"
@@ -228,6 +239,8 @@
else
{
std::cout << "General NFD status:" << std::endl;
+ std::cout << " nfdId="
+ << nfdId << std::endl;
std::cout << " version="
<< status.getNfdVersion() << std::endl;
std::cout << " startTime="