Rename interestLifetime to interestLifetimeMilliseconds and make it a double
diff --git a/ndn-cpp/Interest.cpp b/ndn-cpp/Interest.cpp
index 2b39b49..634559e 100644
--- a/ndn-cpp/Interest.cpp
+++ b/ndn-cpp/Interest.cpp
@@ -48,7 +48,7 @@
childSelector_ = interestStruct.childSelector;
answerOriginKind_ = interestStruct.answerOriginKind;
scope_ = interestStruct.scope;
- interestLifetime_ = interestStruct.interestLifetime;
+ interestLifetimeMilliseconds_ = interestStruct.interestLifetimeMilliseconds;
setVector(nonce_, interestStruct.nonce, interestStruct.nonceLength);
}
@@ -62,7 +62,7 @@
interestStruct.childSelector = childSelector_;
interestStruct.answerOriginKind = answerOriginKind_;
interestStruct.scope = scope_;
- interestStruct.interestLifetime = interestLifetime_;
+ interestStruct.interestLifetimeMilliseconds = interestLifetimeMilliseconds_;
interestStruct.nonceLength = nonce_.size();
if (nonce_.size() > 0)
diff --git a/ndn-cpp/Interest.hpp b/ndn-cpp/Interest.hpp
index cf5647b..b279bf0 100644
--- a/ndn-cpp/Interest.hpp
+++ b/ndn-cpp/Interest.hpp
@@ -125,7 +125,7 @@
childSelector_ = -1;
answerOriginKind_ = -1;
scope_ = -1;
- interestLifetime_ = -1;
+ interestLifetimeMilliseconds_ = -1.0;
}
void encode(std::vector<unsigned char> &output, WireFormat &wireFormat) const
@@ -179,7 +179,7 @@
int getScope() const { return scope_; }
- int getInterestLifetime() const { return interestLifetime_; }
+ double getInterestLifetimeMilliseconds() const { return interestLifetimeMilliseconds_; }
const std::vector<unsigned char> getNonce() const { return nonce_; }
@@ -199,7 +199,7 @@
void setScope(int value) { scope_ = value; }
- void setInterestLifetime(int value) { interestLifetime_ = value; }
+ void setInterestLifetimeMilliseconds(double value) { interestLifetimeMilliseconds_ = value; }
void setNonce(const std::vector<unsigned char> &value) { nonce_ = value; }
@@ -213,7 +213,7 @@
int childSelector_;
int answerOriginKind_;
int scope_;
- int interestLifetime_;
+ double interestLifetimeMilliseconds_;
std::vector<unsigned char> nonce_;
};
diff --git a/ndn-cpp/c/Interest.h b/ndn-cpp/c/Interest.h
index 832fb96..ada7a7e 100644
--- a/ndn-cpp/c/Interest.h
+++ b/ndn-cpp/c/Interest.h
@@ -85,7 +85,7 @@
int childSelector; /**< -1 for none */
int answerOriginKind; /**< -1 for none */
int scope; /**< -1 for none */
- int interestLifetime; /**< milliseconds. -1 for none */
+ double interestLifetimeMilliseconds; /**< milliseconds. -1.0 for none */
unsigned char *nonce; /**< pointer to pre-allocated buffer. 0 for none */
unsigned int nonceLength; /**< length of nonce. 0 for none */
};
@@ -111,7 +111,7 @@
self->childSelector = -1;
self->answerOriginKind = -1;
self->scope = -1;
- self->interestLifetime = -1;
+ self->interestLifetimeMilliseconds = -1.0;
self->nonce = 0;
self->nonceLength = 0;
}
diff --git a/ndn-cpp/c/encoding/BinaryXMLInterest.c b/ndn-cpp/c/encoding/BinaryXMLInterest.c
index 5708761..1dda876 100644
--- a/ndn-cpp/c/encoding/BinaryXMLInterest.c
+++ b/ndn-cpp/c/encoding/BinaryXMLInterest.c
@@ -155,11 +155,11 @@
(encoder, ndn_BinaryXML_DTag_Scope, interest->scope))
return error;
- if (interest->interestLifetime >= 0) {
+ if (interest->interestLifetimeMilliseconds >= 0) {
if (error = ndn_BinaryXMLEncoder_writeElementStartDTag(encoder, ndn_BinaryXML_DTag_InterestLifetime))
return error;
- unsigned int ticks = (unsigned int)(((double)interest->interestLifetime / 1000.0) * 4096.0);
+ unsigned int ticks = (unsigned int)((interest->interestLifetimeMilliseconds / 1000.0) * 4096.0);
if (error = ndn_BinaryXMLEncoder_writeUnsignedIntBigEndianBlob(encoder, ticks))
return error;
@@ -225,11 +225,11 @@
(decoder, ndn_BinaryXML_DTag_InterestLifetime, 0, &interestLifetime, &interestLifetimeLength))
return error;
- interest->interestLifetime = (int)(1000.0 *
- (double)ndn_BinaryXMLDecoder_bigEndianToUnsignedInt(interestLifetime, interestLifetimeLength) / 4096.0);
+ interest->interestLifetimeMilliseconds = 1000.0 *
+ (double)ndn_BinaryXMLDecoder_bigEndianToUnsignedInt(interestLifetime, interestLifetimeLength) / 4096.0;
}
else
- interest->interestLifetime = -1;
+ interest->interestLifetimeMilliseconds = -1.0;
if (error = ndn_BinaryXMLDecoder_readOptionalBinaryDTagElement
(decoder, ndn_BinaryXML_DTag_Nonce, 0, &interest->nonce, &interest->nonceLength))