| /** |
| * @author: Jeff Thompson |
| * See COPYING for copyright and distribution information. |
| */ |
| |
| #include "Interest.hpp" |
| |
| using namespace std; |
| |
| namespace ndn { |
| |
| void Interest::set(struct ndn_Interest &interestStruct) |
| { |
| name_.set(interestStruct.name); |
| minSuffixComponents_ = interestStruct.minSuffixComponents; |
| maxSuffixComponents_ = interestStruct.maxSuffixComponents; |
| |
| publisherPublicKeyDigest_.clear(); |
| if (interestStruct.publisherPublicKeyDigest) |
| publisherPublicKeyDigest_.insert |
| (publisherPublicKeyDigest_.begin(), interestStruct.publisherPublicKeyDigest, interestStruct.publisherPublicKeyDigest + interestStruct.publisherPublicKeyDigestLength); |
| // TODO: implement exclude |
| childSelector_ = interestStruct.childSelector; |
| answerOriginKind_ = interestStruct.answerOriginKind; |
| scope_ = interestStruct.scope; |
| interestLifetime_ = interestStruct.interestLifetime; |
| nonce_.clear(); |
| if (interestStruct.nonce) |
| nonce_.insert |
| (nonce_.begin(), interestStruct.nonce, interestStruct.nonce + interestStruct.nonceLength); |
| } |
| |
| void Interest::get(struct ndn_Interest &interestStruct) |
| { |
| name_.get(interestStruct.name); |
| interestStruct.minSuffixComponents = minSuffixComponents_; |
| interestStruct.maxSuffixComponents = maxSuffixComponents_; |
| |
| interestStruct.publisherPublicKeyDigestLength = publisherPublicKeyDigest_.size(); |
| if (publisherPublicKeyDigest_.size() > 0) |
| interestStruct.publisherPublicKeyDigest = &publisherPublicKeyDigest_[0]; |
| else |
| interestStruct.publisherPublicKeyDigest = 0; |
| |
| // TODO: implement exclude. |
| |
| interestStruct.childSelector = childSelector_; |
| interestStruct.answerOriginKind = answerOriginKind_; |
| interestStruct.scope = scope_; |
| interestStruct.interestLifetime = interestLifetime_; |
| |
| interestStruct.nonceLength = nonce_.size(); |
| if (nonce_.size() > 0) |
| interestStruct.nonce = &nonce_[0]; |
| else |
| interestStruct.nonce = 0; |
| } |
| |
| } |
| |