Face: In expressInterest, add optional wireFormat argument.
diff --git a/include/ndn-cpp/face.hpp b/include/ndn-cpp/face.hpp
index 7859000..de317c6 100644
--- a/include/ndn-cpp/face.hpp
+++ b/include/ndn-cpp/face.hpp
@@ -46,12 +46,15 @@
* use func_lib::ref() as appropriate.
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
+ * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
* @return The pending interest ID which can be used with removePendingInterest.
*/
uint64_t
- expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
+ expressInterest
+ (const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
+ WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
- return node_.expressInterest(interest, onData, onTimeout);
+ return node_.expressInterest(interest, onData, onTimeout, wireFormat);
}
/**
@@ -63,10 +66,13 @@
* use func_lib::ref() as appropriate.
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
+ * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
* @return The pending interest ID which can be used with removePendingInterest.
*/
uint64_t
- expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
+ expressInterest
+ (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
+ WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
* Encode name as an Interest, using a default interest lifetime.
@@ -76,12 +82,15 @@
* use func_lib::ref() as appropriate.
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
+ * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
* @return The pending interest ID which can be used with removePendingInterest.
*/
uint64_t
- expressInterest(const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
+ expressInterest
+ (const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout(),
+ WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
- return expressInterest(name, 0, onData, onTimeout);
+ return expressInterest(name, 0, onData, onTimeout, wireFormat);
}
/**
@@ -105,7 +114,7 @@
* This calls onRegisterFailed(prefix) where prefix is the prefix given to registerPrefix.
* @param flags The flags for finer control of which interests are forward to the application. If omitted, use
* the default flags defined by the default ForwardingFlags constructor.
- * @param wireFormat A WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
+ * @param wireFormat A WireFormat object used to encode the message. If omitted, use WireFormat getDefaultWireFormat().
* @return The registered prefix ID which can be used with removeRegisteredPrefix.
*/
uint64_t
diff --git a/include/ndn-cpp/node.hpp b/include/ndn-cpp/node.hpp
index d428378..5767be8 100644
--- a/include/ndn-cpp/node.hpp
+++ b/include/ndn-cpp/node.hpp
@@ -59,10 +59,11 @@
* use func_lib::ref() as appropriate.
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
+ * @param wireFormat A WireFormat object used to encode the message.
* @return The pending interest ID which can be used with removePendingInterest.
*/
uint64_t
- expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
+ expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout, WireFormat& wireFormat);
/**
* Remove the pending interest entry with the pendingInterestId from the pending interest table.
@@ -81,7 +82,7 @@
* @param onRegisterFailed A function object to call if failed to retrieve the connected hub’s ID or failed to register the prefix.
* This calls onRegisterFailed(prefix) where prefix is the prefix given to registerPrefix.
* @param flags The flags for finer control of which interests are forward to the application.
- * @param wireFormat A WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
+ * @param wireFormat A WireFormat object used to encode the message.
* @return The registered prefix ID which can be used with removeRegisteredPrefix.
*/
uint64_t
diff --git a/src/face.cpp b/src/face.cpp
index b137765..f5ce755 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -12,16 +12,18 @@
namespace ndn {
uint64_t
-Face::expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
+Face::expressInterest
+ (const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout,
+ WireFormat& wireFormat)
{
if (interestTemplate)
return node_.expressInterest(Interest
(name, interestTemplate->getMinSuffixComponents(), interestTemplate->getMaxSuffixComponents(),
interestTemplate->getPublisherPublicKeyDigest(), interestTemplate->getExclude(),
interestTemplate->getChildSelector(), interestTemplate->getAnswerOriginKind(),
- interestTemplate->getScope(), interestTemplate->getInterestLifetimeMilliseconds()), onData, onTimeout);
+ interestTemplate->getScope(), interestTemplate->getInterestLifetimeMilliseconds()), onData, onTimeout, wireFormat);
else
- return node_.expressInterest(Interest(name, 4000.0), onData, onTimeout);
+ return node_.expressInterest(Interest(name, 4000.0), onData, onTimeout, wireFormat);
}
void
diff --git a/src/node.cpp b/src/node.cpp
index ade4a6e..a31144c 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -118,7 +118,7 @@
}
uint64_t
-Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
+Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout, WireFormat& wireFormat)
{
// TODO: Properly check if we are already connected to the expected host.
if (!transport_->getIsConnected())
@@ -128,7 +128,7 @@
pendingInterestTable_.push_back(shared_ptr<PendingInterest>(new PendingInterest
(pendingInterestId, shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout)));
- Blob encoding = interest.wireEncode();
+ Blob encoding = interest.wireEncode(wireFormat);
transport_->send(*encoding);
return pendingInterestId;
@@ -158,7 +158,7 @@
(shared_ptr<NdndIdFetcher::Info>(new NdndIdFetcher::Info
(this, registeredPrefixId, prefix, onInterest, onRegisterFailed, flags, wireFormat)));
// It is OK for func_lib::function make a copy of the function object because the Info is in a shared_ptr.
- expressInterest(ndndIdFetcherInterest_, fetcher, fetcher);
+ expressInterest(ndndIdFetcherInterest_, fetcher, fetcher, wireFormat);
}
else
registerPrefixHelper(registeredPrefixId, make_shared<const Name>(prefix), onInterest, onRegisterFailed, flags, wireFormat);