Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: test-no-boost.cpp |
| 3 | * Author: jefft0 |
| 4 | * |
| 5 | * Created on June 10, 2013, 4:21 PM |
| 6 | */ |
| 7 | |
| 8 | #include <cstdlib> |
| 9 | #include <sstream> |
| 10 | #include <iostream> |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 11 | #include <ndn-cpp/Interest.hpp> |
Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 12 | |
| 13 | using namespace std; |
| 14 | using namespace ndn; |
| 15 | |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 16 | unsigned char Interest1[] = { |
Jeff Thompson | 7afc98e | 2013-06-27 14:33:53 -0700 | [diff] [blame] | 17 | 0x01, 0xd2, |
| 18 | 0xf2, 0xfa, 0x9d, 0x6e, 0x64, 0x6e, 0x00, 0xfa, 0x9d, 0x61, 0x62, 0x63, 0x00, 0x00, |
| 19 | 0x05, 0x9a, 0x8e, 0x32, 0x00, |
| 20 | 0x05, 0xa2, 0x8e, 0x34, 0x00, |
| 21 | 0x03, 0xe2, |
| 22 | 0x02, 0x85, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 23 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, |
| 24 | 0x00, |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 25 | #if 0 |
| 26 | 0x02, 0xda, 0xfa, 0x9d, 0x61, 0x62, 0x63, 0x00, 0xea, 0x00, 0x00, |
Jeff Thompson | 539e79f | 2013-06-28 12:51:05 -0700 | [diff] [blame] | 27 | #endif |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 28 | 0x05, 0xaa, 0x8e, 0x31, 0x00, |
| 29 | 0x02, 0xfa, 0x8e, 0x34, 0x00, |
| 30 | 0x02, 0xd2, 0x8e, 0x32, 0x00, |
| 31 | 0x03, 0x82, 0x9d, 0x01, 0xe0, 0x00, 0x00, |
| 32 | 0x02, 0xca, 0xb5, 0x61, 0x62, 0x61, 0x62, 0x61, 0x62, 0x00, |
| 33 | 0x00, |
Jeff Thompson | 7afc98e | 2013-06-27 14:33:53 -0700 | [diff] [blame] | 34 | 1 |
| 35 | }; |
| 36 | |
Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 37 | /* |
| 38 | * |
| 39 | */ |
Jeff Thompson | 7afc98e | 2013-06-27 14:33:53 -0700 | [diff] [blame] | 40 | int main(int argc, char** argv) |
| 41 | { |
| 42 | try { |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 43 | Interest interest; |
| 44 | interest.decode(Interest1, sizeof(Interest1)); |
| 45 | cout << "Interest name " << interest.getName().to_uri() << endl; |
| 46 | cout << "InterestLifetime " << interest.getInterestLifetime() << endl; |
Jeff Thompson | 2fb4b1b | 2013-07-01 15:10:43 -0700 | [diff] [blame] | 47 | |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 48 | #if 0 |
Jeff Thompson | 1f3f517 | 2013-07-01 19:02:36 -0700 | [diff] [blame] | 49 | vector<unsigned char> encoding; |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 50 | interest.encode(encoding); |
Jeff Thompson | 1f3f517 | 2013-07-01 19:02:36 -0700 | [diff] [blame] | 51 | unsigned char *encodingBuffer = &encoding[0]; |
| 52 | unsigned int encodingLength = encoding.size(); |
Jeff Thompson | 2255290 | 2013-07-07 21:26:20 -0700 | [diff] [blame] | 53 | cout << "Interest encoding length " << encodingLength << " vs. sizeof(Interest1) " << sizeof(Interest1) << endl; |
| 54 | #endif |
Jeff Thompson | 7afc98e | 2013-06-27 14:33:53 -0700 | [diff] [blame] | 55 | } catch (exception &e) { |
| 56 | cout << "exception " << e.what() << endl; |
| 57 | } |
Jeff Thompson | 3b3aabf | 2013-06-21 16:50:20 -0700 | [diff] [blame] | 58 | return 0; |
| 59 | } |