blob: 2fda5388fcd85985a13155cf5f7155aacc4427a6 [file] [log] [blame]
Jeff Thompson47eecfc2013-07-07 22:56:46 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
Jeff Thompsonb7f95562013-07-03 18:36:42 -07004 */
5
6#include "Interest.hpp"
7
8using namespace std;
9
10namespace ndn {
11
12void Interest::set(struct ndn_Interest &interestStruct)
13{
14 name_.set(interestStruct.name);
15 maxSuffixComponents_ = interestStruct.maxSuffixComponents;
16 minSuffixComponents_ = interestStruct.minSuffixComponents;
17
18 publisherPublicKeyDigest_.clear();
19 if (interestStruct.publisherPublicKeyDigest)
20 publisherPublicKeyDigest_.insert
21 (publisherPublicKeyDigest_.begin(), interestStruct.publisherPublicKeyDigest, interestStruct.publisherPublicKeyDigest + interestStruct.publisherPublicKeyDigestLength);
22 // TODO: implement exclude
23 childSelector_ = interestStruct.childSelector;
24 answerOriginKind_ = interestStruct.answerOriginKind;
25 scope_ = interestStruct.scope;
26 interestLifetime_ = interestStruct.interestLifetime;
27 nonce_.clear();
28 if (interestStruct.nonce)
29 nonce_.insert
30 (nonce_.begin(), interestStruct.nonce, interestStruct.nonce + interestStruct.nonceLength);
31}
Jeff Thompsond9e278c2013-07-08 15:20:13 -070032
33void Interest::get(struct ndn_Interest &interestStruct)
34{
35 name_.get(interestStruct.name);
36 interestStruct.maxSuffixComponents = maxSuffixComponents_;
37 interestStruct.minSuffixComponents = minSuffixComponents_;
38
39 interestStruct.publisherPublicKeyDigestLength = publisherPublicKeyDigest_.size();
40 if (publisherPublicKeyDigest_.size() > 0)
41 interestStruct.publisherPublicKeyDigest = &publisherPublicKeyDigest_[0];
42 else
43 interestStruct.publisherPublicKeyDigest = 0;
44
45 // TODO: implement exclude.
46
47 interestStruct.childSelector = childSelector_;
48 interestStruct.answerOriginKind = answerOriginKind_;
49 interestStruct.scope = scope_;
50 interestStruct.interestLifetime = interestLifetime_;
51
52 interestStruct.nonceLength = nonce_.size();
53 if (nonce_.size() > 0)
54 interestStruct.nonce = &nonce_[0];
55 else
56 interestStruct.nonce = 0;
57}
Jeff Thompsonb7f95562013-07-03 18:36:42 -070058
59}
60