blob: 2fda5388fcd85985a13155cf5f7155aacc4427a6 [file] [log] [blame]
/**
* @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);
maxSuffixComponents_ = interestStruct.maxSuffixComponents;
minSuffixComponents_ = interestStruct.minSuffixComponents;
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.maxSuffixComponents = maxSuffixComponents_;
interestStruct.minSuffixComponents = minSuffixComponents_;
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;
}
}