interest: Allow in-wire refreshing of Interest's nonce

Change-Id: I47500fce16a1d37af865d3f9dab59355d6108c95
Refs: #1758
diff --git a/src/interest.cpp b/src/interest.cpp
index a6bd107..db3744c 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -58,6 +58,20 @@
   return *this;
 }
 
+void
+Interest::refreshNonce()
+{
+  if (!hasNonce())
+    return;
+
+  uint32_t oldNonce = getNonce();
+  uint32_t newNonce = oldNonce;
+  while (newNonce == oldNonce)
+    newNonce = random::generateWord32();
+
+  setNonce(newNonce);
+}
+
 bool
 Interest::matchesName(const Name& name) const
 {