blob: a1f045f08a655c8e7c59491ecdd6421b1c4fdbe5 [file] [log] [blame]
Jeff Thompsonb7f95562013-07-03 18:36:42 -07001/*
2 * Author: Jeff Thompson
3 *
4 * BSD license, See the LICENSE file for more information.
5 */
6
7#ifndef NDN_INTEREST_HPP
8#define NDN_INTEREST_HPP
9
10#include <vector>
11#include "Name.hpp"
12#include "c/Interest.h"
13
14namespace ndn {
15
16class Interest {
17public:
18 void encode(std::vector<unsigned char> &output, WireFormat &wireFormat)
19 {
20 wireFormat.encodeInterest(*this, output);
21 }
22 void encode(std::vector<unsigned char> &output)
23 {
24 encode(output, BinaryXMLWireFormat::instance());
25 }
26 void decode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
27 {
28 wireFormat.decodeInterest(*this, input, inputLength);
29 }
30 void decode(const unsigned char *input, unsigned int inputLength)
31 {
32 decode(input, inputLength, BinaryXMLWireFormat::instance());
33 }
34 void decode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
35 {
36 decode(&input[0], input.size(), wireFormat);
37 }
38 void decode(const std::vector<unsigned char> &input)
39 {
40 decode(&input[0], input.size());
41 }
42
43 Name &getName() { return name_; }
44
45 /**
46 * Clear this interest, and set the values by copying from the interest struct.
47 * @param interestStruct a C ndn_Interest struct
48 */
49 void set(struct ndn_Interest &interestStruct);
50
51private:
52
53 Name name_;
54 int maxSuffixComponents_;
55 int minSuffixComponents_;
56
57 std::vector<unsigned char> publisherPublicKeyDigest_;
58 // TODO: implement exclude
59 int childSelector_;
60 int answerOriginKind_;
61 int scope_;
62 int interestLifetime_;
63 std::vector<unsigned char> nonce_;
64};
65
66}
67
68#endif