Face: Make pendingInterestId and registeredPrefixId uint64_t.
diff --git a/ndn-cpp/face.cpp b/ndn-cpp/face.cpp
index febdc7b..d70023b 100644
--- a/ndn-cpp/face.cpp
+++ b/ndn-cpp/face.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-unsigned int
+uint64_t
Face::expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
{
if (interestTemplate)
diff --git a/ndn-cpp/face.hpp b/ndn-cpp/face.hpp
index 69f662d..8eab12a 100644
--- a/ndn-cpp/face.hpp
+++ b/ndn-cpp/face.hpp
@@ -47,7 +47,7 @@
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
* @return The pending interest ID which can be used with removePendingInterest.
*/
- unsigned int
+ uint64_t
expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
return node_.expressInterest(interest, onData, onTimeout);
@@ -64,7 +64,7 @@
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
* @return The pending interest ID which can be used with removePendingInterest.
*/
- unsigned int
+ uint64_t
expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
/**
@@ -77,7 +77,7 @@
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
* @return The pending interest ID which can be used with removePendingInterest.
*/
- unsigned int
+ uint64_t
expressInterest(const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
return expressInterest(name, 0, onData, onTimeout);
@@ -90,7 +90,7 @@
* @param pendingInterestId The ID returned from expressInterest.
*/
void
- removePendingInterest(unsigned int pendingInterestId)
+ removePendingInterest(uint64_t pendingInterestId)
{
node_.removePendingInterest(pendingInterestId);
}
@@ -107,7 +107,7 @@
* @param wireFormat A WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
* @return The registered prefix ID which can be used with removeRegisteredPrefix.
*/
- unsigned int
+ uint64_t
registerPrefix
(const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags = ForwardingFlags(),
WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
@@ -122,7 +122,7 @@
* @param registeredPrefixId The ID returned from registerPrefix.
*/
void
- removeRegisteredPrefix(unsigned int registeredPrefixId)
+ removeRegisteredPrefix(uint64_t registeredPrefixId)
{
node_.removeRegisteredPrefix(registeredPrefixId);
}
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index a86bdff..b0df607 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -65,8 +65,8 @@
0x30, 0x18, 0xeb, 0x90, 0xfb, 0x17, 0xd3, 0xce, 0xb5
};
-unsigned int Node::PendingInterest::lastPendingInterestId_ = 0;
-unsigned int Node::RegisteredPrefix::lastRegisteredPrefixId_ = 0;
+uint64_t Node::PendingInterest::lastPendingInterestId_ = 0;
+uint64_t Node::RegisteredPrefix::lastRegisteredPrefixId_ = 0;
/**
* Set the KeyLocator using the full SELFREG_PUBLIC_KEY_DER, sign the data packet using SELFREG_PRIVATE_KEY_DER
@@ -123,14 +123,14 @@
{
}
-unsigned int
+uint64_t
Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
{
// TODO: Properly check if we are already connected to the expected host.
if (!transport_->getIsConnected())
transport_->connect(*connectionInfo_, *this);
- unsigned int pendingInterestId = PendingInterest::getNextPendingInterestId();
+ uint64_t pendingInterestId = PendingInterest::getNextPendingInterestId();
pendingInterestTable_.push_back(shared_ptr<PendingInterest>(new PendingInterest
(pendingInterestId, shared_ptr<const Interest>(new Interest(interest)), onData, onTimeout)));
@@ -141,7 +141,7 @@
}
void
-Node::removePendingInterest(unsigned int pendingInterestId)
+Node::removePendingInterest(uint64_t pendingInterestId)
{
// Go backwards through the list so we can erase entries.
// Remove all entries even though pendingInterestId should be unique.
@@ -151,12 +151,12 @@
}
}
-unsigned int
+uint64_t
Node::registerPrefix
(const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat)
{
// Get the registeredPrefixId now so we can return it to the caller.
- unsigned int registeredPrefixId = RegisteredPrefix::getNextRegisteredPrefixId();
+ uint64_t registeredPrefixId = RegisteredPrefix::getNextRegisteredPrefixId();
if (ndndId_.size() == 0) {
// First fetch the ndndId of the connected hub.
@@ -173,7 +173,7 @@
}
void
-Node::removeRegisteredPrefix(unsigned int registeredPrefixId)
+Node::removeRegisteredPrefix(uint64_t registeredPrefixId)
{
// Go backwards through the list so we can erase entries.
// Remove all entries even though pendingInterestId should be unique.
@@ -206,7 +206,7 @@
void
Node::registerPrefixHelper
- (unsigned int registeredPrefixId, const shared_ptr<const Name>& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed,
+ (uint64_t registeredPrefixId, const shared_ptr<const Name>& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed,
const ForwardingFlags& flags, WireFormat& wireFormat)
{
// Create a ForwardingEntry.
@@ -337,7 +337,7 @@
}
Node::PendingInterest::PendingInterest
- (unsigned int pendingInterestId, const shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
+ (uint64_t pendingInterestId, const shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
: pendingInterestId_(pendingInterestId), interest_(interest), onData_(onData), onTimeout_(onTimeout)
{
// Set up timeoutTime_.
diff --git a/ndn-cpp/node.hpp b/ndn-cpp/node.hpp
index 794120c..9130815 100644
--- a/ndn-cpp/node.hpp
+++ b/ndn-cpp/node.hpp
@@ -58,7 +58,7 @@
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
* @return The pending interest ID which can be used with removePendingInterest.
*/
- unsigned int
+ uint64_t
expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
/**
@@ -68,7 +68,7 @@
* @param pendingInterestId The ID returned from expressInterest.
*/
void
- removePendingInterest(unsigned int pendingInterestId);
+ removePendingInterest(uint64_t pendingInterestId);
/**
* Register prefix with the connected NDN hub and call onInterest when a matching interest is received.
@@ -81,7 +81,7 @@
* @param wireFormat A WireFormat object used to encode the input. If omitted, use WireFormat getDefaultWireFormat().
* @return The registered prefix ID which can be used with removeRegisteredPrefix.
*/
- unsigned int
+ uint64_t
registerPrefix
(const Name& prefix, const OnInterest& onInterest, const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags,
WireFormat& wireFormat);
@@ -93,7 +93,7 @@
* @param registeredPrefixId The ID returned from registerPrefix.
*/
void
- removeRegisteredPrefix(unsigned int registeredPrefixId);
+ removeRegisteredPrefix(uint64_t registeredPrefixId);
/**
* Process any data to receive. For each element received, call onReceivedElement.
@@ -128,13 +128,13 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
*/
PendingInterest
- (unsigned int pendingInterestId, const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData,
+ (uint64_t pendingInterestId, const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData,
const OnTimeout& onTimeout);
/**
* Return the next unique pending interest ID.
*/
- static unsigned int
+ static uint64_t
getNextPendingInterestId()
{
return ++lastPendingInterestId_;
@@ -143,7 +143,7 @@
/**
* Return the pendingInterestId given to the constructor.
*/
- unsigned int
+ uint64_t
getPendingInterestId() { return pendingInterestId_; }
const ptr_lib::shared_ptr<const Interest>&
@@ -181,8 +181,8 @@
std::vector<struct ndn_ExcludeEntry> excludeEntries_;
struct ndn_Interest interestStruct_;
- static unsigned int lastPendingInterestId_; /**< A class variable used to get the next unique ID. */
- unsigned int pendingInterestId_; /**< A unique identifier for this entry so it can be deleted */
+ static uint64_t lastPendingInterestId_; /**< A class variable used to get the next unique ID. */
+ uint64_t pendingInterestId_; /**< A unique identifier for this entry so it can be deleted */
const OnData onData_;
const OnTimeout onTimeout_;
double timeoutTimeMilliseconds_; /**< The time when the interest times out in milliseconds according to gettimeofday, or -1 for no timeout. */
@@ -196,7 +196,7 @@
* @param prefix A shared_ptr for the prefix.
* @param onInterest A function object to call when a matching data packet is received.
*/
- RegisteredPrefix(unsigned int registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest)
+ RegisteredPrefix(uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest)
: registeredPrefixId_(registeredPrefixId), prefix_(prefix), onInterest_(onInterest)
{
}
@@ -204,7 +204,7 @@
/**
* Return the next unique entry ID.
*/
- static unsigned int
+ static uint64_t
getNextRegisteredPrefixId()
{
return ++lastRegisteredPrefixId_;
@@ -213,7 +213,7 @@
/**
* Return the registeredPrefixId given to the constructor.
*/
- unsigned int
+ uint64_t
getRegisteredPrefixId() { return registeredPrefixId_; }
const ptr_lib::shared_ptr<const Name>&
@@ -223,8 +223,8 @@
getOnInterest() { return onInterest_; }
private:
- static unsigned int lastRegisteredPrefixId_; /**< A class variable used to get the next unique ID. */
- unsigned int registeredPrefixId_; /**< A unique identifier for this entry so it can be deleted */
+ static uint64_t lastRegisteredPrefixId_; /**< A class variable used to get the next unique ID. */
+ uint64_t registeredPrefixId_; /**< A unique identifier for this entry so it can be deleted */
ptr_lib::shared_ptr<const Name> prefix_;
const OnInterest onInterest_;
};
@@ -268,7 +268,7 @@
* @param flags
* @param wireFormat
*/
- Info(Node *node, unsigned int registeredPrefixId, const Name& prefix, const OnInterest& onInterest,
+ Info(Node *node, uint64_t registeredPrefixId, const Name& prefix, const OnInterest& onInterest,
const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat)
: node_(*node), registeredPrefixId_(registeredPrefixId), prefix_(new Name(prefix)), onInterest_(onInterest), onRegisterFailed_(onRegisterFailed),
flags_(flags), wireFormat_(wireFormat)
@@ -276,7 +276,7 @@
}
Node& node_;
- unsigned int registeredPrefixId_;
+ uint64_t registeredPrefixId_;
ptr_lib::shared_ptr<const Name> prefix_;
const OnInterest onInterest_;
const OnRegisterFailed onRegisterFailed_;
@@ -316,7 +316,7 @@
*/
void
registerPrefixHelper
- (unsigned int registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest,
+ (uint64_t registeredPrefixId, const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest,
const OnRegisterFailed& onRegisterFailed, const ForwardingFlags& flags, WireFormat& wireFormat);
ptr_lib::shared_ptr<Transport> transport_;