Merge branch 'import-dissect' into master
refs #2931
Change-Id: Iecf80a6672e5c89dc80bf15ed58ec170c886b724
diff --git a/core/common.hpp b/core/common.hpp
index c2f833f..2b031cc 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -49,6 +49,8 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
+#include <ndn-cxx/security/signing-info.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
diff --git a/manpages/conf.py b/manpages/conf.py
index 9e67aa5..3c0f6bb 100644
--- a/manpages/conf.py
+++ b/manpages/conf.py
@@ -10,5 +10,6 @@
('ndnpoke', 'ndnpoke', 'simple producer to publish one Data', None, 1),
('ndnping', 'ndnping', 'reachability testing client', None, 1),
('ndnpingserver', 'ndnpingserver', 'reachability testing server', None, 1),
+ ('ndndump', 'ndndump', 'traffic analysis tool', None, 8),
('ndn-dissect', 'ndn-dissect', 'NDN packet format inspector', None, 1),
]
diff --git a/manpages/ndndump.rst b/manpages/ndndump.rst
new file mode 100644
index 0000000..95c1904
--- /dev/null
+++ b/manpages/ndndump.rst
@@ -0,0 +1,59 @@
+ndndump
+=======
+
+Usage
+-----
+
+::
+
+ ndndump [-hV] [-i interface] [-r file] [-f filter] [expression]
+
+Description
+-----------
+
+:program:`ndndump` is a traffic analysis tool that captures Interest and Data packets on the wire,
+and displays brief information about captured packets.
+
+Currently, :program:`ndndump` is capable of extracting Interest and Data packets from:
+
+* Ethernet, when bare Interest/Data is transmitted without NDNLP header
+* PPP link (e.g., pcap trace from ndnSIM)
+* IPv4 UDP unicast tunnel
+* IPv4 UDP multicast group
+* IPv6 TCP tunnel, when Interest/Data is aligned to the front of a TCP segment
+
+Options
+-------
+
+``-h``
+ Print help and exit.
+
+``-V``
+ Print version and exit.
+
+``-i``
+ Listen on :option:`interface`.
+ If unspecified, ndndump searches the system interface list for the lowest numbered,
+ configured up interface (excluding loopback).
+
+``-r``
+ Read packets from :option:`file` (which was created with :manpage:`tcpdump(8)` using its -w option).
+
+``-v``
+ Produce verbose output.
+
+``-f``
+ Print a packet only if its Name matches the regular expression :option:`filter`.
+
+``expression``
+ Selects which packets will be analyzed, in :manpage:`pcap-filter(7)` format.
+ If no :option:`expression` is given, a default expression is implied which can be seen with ``-h`` option.
+
+Examples
+--------
+
+Capture on eth1 and print packets containing "ping":
+
+::
+
+ ndndump -i eth1 -f '.*ping.*'
diff --git a/tools/dump/README.md b/tools/dump/README.md
new file mode 100644
index 0000000..d99bfe1
--- /dev/null
+++ b/tools/dump/README.md
@@ -0,0 +1,13 @@
+# ndndump
+
+**ndndump** is a traffic analysis tool that captures Interest and Data packets on the wire,
+and displays brief information about captured packets.
+
+Usage example:
+
+1. start NFD on local machine
+2. create an IPv4 UDP tunnel to a remote machine
+3. cause some traffic going on the tunnel
+4. execute `sudo ndndump`
+
+For more information, consult the manpage.
diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp
index 9f285a0..9ef3c53 100644
--- a/tools/peek/ndn-poke.cpp
+++ b/tools/peek/ndn-poke.cpp
@@ -164,13 +164,16 @@
}
}
- if (m_isUseDigestSha256Set)
- m_keyChain.signWithSha256(*dataPacket);
+ if (m_isUseDigestSha256Set) {
+ m_keyChain.sign(*dataPacket, signingWithSha256());
+ }
else {
- if (m_identityName == nullptr)
+ if (m_identityName == nullptr) {
m_keyChain.sign(*dataPacket);
- else
- m_keyChain.signByIdentity(*dataPacket, *m_identityName);
+ }
+ else {
+ m_keyChain.sign(*dataPacket, signingByIdentity(*m_identityName));
+ }
}
return dataPacket;
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index 699da5b..f919113 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -66,7 +66,7 @@
shared_ptr<Data> data = make_shared<Data>(interestName);
data->setFreshnessPeriod(m_options.freshnessPeriod);
data->setContent(m_payload);
- m_keyChain.signWithSha256(*data);
+ m_keyChain.sign(*data, signingWithSha256());
m_face.put(*data);
++m_nPings;