Change Interest.nonce to a Blob.
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index 35ed7ad..453dba3 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -68,7 +68,7 @@
answerOriginKind_ = interestStruct.answerOriginKind;
scope_ = interestStruct.scope;
interestLifetimeMilliseconds_ = interestStruct.interestLifetimeMilliseconds;
- setVector(nonce_, interestStruct.nonce, interestStruct.nonceLength);
+ nonce_ = Blob(interestStruct.nonce, interestStruct.nonceLength);
}
void Interest::get(struct ndn_Interest& interestStruct) const
@@ -85,7 +85,7 @@
interestStruct.nonceLength = nonce_.size();
if (nonce_.size() > 0)
- interestStruct.nonce = (unsigned char *)&nonce_[0];
+ interestStruct.nonce = (unsigned char *)nonce_.buf();
else
interestStruct.nonce = 0;
}
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index bd7991f..8f47f1a 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -200,7 +200,7 @@
double getInterestLifetimeMilliseconds() const { return interestLifetimeMilliseconds_; }
- const std::vector<unsigned char>& getNonce() const { return nonce_; }
+ const Blob& getNonce() const { return nonce_; }
/**
* Clear this interest, and set the values by copying from the interest struct.
@@ -242,7 +242,7 @@
int answerOriginKind_;
int scope_;
double interestLifetimeMilliseconds_;
- std::vector<unsigned char> nonce_;
+ Blob nonce_;
};
}
diff --git a/tests/test-encode-decode-interest.cpp b/tests/test-encode-decode-interest.cpp
index 9326893..ff4a920 100644
--- a/tests/test-encode-decode-interest.cpp
+++ b/tests/test-encode-decode-interest.cpp
@@ -68,7 +68,7 @@
else
cout << "<none>" << endl;
cout << "nonce: "
- << (interest.getNonce().size() > 0 ? toHex(interest.getNonce()) : "<none>") << endl;
+ << (interest.getNonce().size() > 0 ? toHex(*interest.getNonce()) : "<none>") << endl;
}
int main(int argc, char** argv)