Browse Source

Change Interest.nonce to a Blob.

pull/1/head
Jeff Thompson 12 years ago
parent
commit
412226d574
  1. 4
      ndn-cpp/interest.cpp
  2. 4
      ndn-cpp/interest.hpp
  3. 2
      tests/test-encode-decode-interest.cpp

4
ndn-cpp/interest.cpp

@ -68,7 +68,7 @@ void Interest::set(const struct ndn_Interest& interestStruct)
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 @@ void Interest::get(struct ndn_Interest& interestStruct) const
interestStruct.nonceLength = nonce_.size();
if (nonce_.size() > 0)
interestStruct.nonce = (unsigned char *)&nonce_[0];
interestStruct.nonce = (unsigned char *)nonce_.buf();
else
interestStruct.nonce = 0;
}

4
ndn-cpp/interest.hpp

@ -200,7 +200,7 @@ public:
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 @@ private:
int answerOriginKind_;
int scope_;
double interestLifetimeMilliseconds_;
std::vector<unsigned char> nonce_;
Blob nonce_;
};
}

2
tests/test-encode-decode-interest.cpp

@ -68,7 +68,7 @@ static void dumpInterest(const Interest& interest)
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)

Loading…
Cancel
Save