blob: f5a59eafafeb940904dd7f9a63bfe9e8c197c715 [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
Jeff Thompson22552902013-07-07 21:26:20 -070045 int getInterestLifetime() { return interestLifetime_; }
46
Jeff Thompsonb7f95562013-07-03 18:36:42 -070047 /**
48 * Clear this interest, and set the values by copying from the interest struct.
49 * @param interestStruct a C ndn_Interest struct
50 */
51 void set(struct ndn_Interest &interestStruct);
52
53private:
54
55 Name name_;
56 int maxSuffixComponents_;
57 int minSuffixComponents_;
58
59 std::vector<unsigned char> publisherPublicKeyDigest_;
60 // TODO: implement exclude
61 int childSelector_;
62 int answerOriginKind_;
63 int scope_;
64 int interestLifetime_;
65 std::vector<unsigned char> nonce_;
66};
67
68}
69
70#endif