Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 1 | /** |
Jeff Thompson | 7687dc0 | 2013-09-13 11:54:07 -0700 | [diff] [blame] | 2 | * Copyright (C) 2013 Regents of the University of California. |
| 3 | * @author: Jeff Thompson <jefft0@remap.ucla.edu> |
Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 4 | * See COPYING for copyright and distribution information. |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <stdexcept> |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 8 | #include "wire-format.hpp" |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 9 | |
| 10 | using namespace std; |
| 11 | |
| 12 | namespace ndn { |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 13 | |
Jeff Thompson | 1a1312d | 2013-08-05 19:08:35 -0700 | [diff] [blame] | 14 | static bool gotInitialDefaultWireFormat = false; |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 15 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 16 | WireFormat* WireFormat::defaultWireFormat_ = 0; |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 17 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 18 | WireFormat* |
| 19 | WireFormat::getDefaultWireFormat() |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 20 | { |
Jeff Thompson | 1a1312d | 2013-08-05 19:08:35 -0700 | [diff] [blame] | 21 | if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) { |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 22 | // There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it. |
Jeff Thompson | 1a1312d | 2013-08-05 19:08:35 -0700 | [diff] [blame] | 23 | gotInitialDefaultWireFormat = true; |
| 24 | // NOTE: This allocates one object which we never free for the life of the application. |
| 25 | defaultWireFormat_ = newInitialDefaultWireFormat(); |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | return defaultWireFormat_; |
| 29 | } |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 30 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 31 | Blob |
| 32 | WireFormat::encodeInterest(const Interest& interest) |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 33 | { |
| 34 | throw logic_error("unimplemented"); |
| 35 | } |
| 36 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 37 | void |
| 38 | WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 39 | { |
| 40 | throw logic_error("unimplemented"); |
| 41 | } |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 42 | |
| 43 | Blob |
| 44 | WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) |
| 45 | { |
| 46 | throw logic_error("unimplemented"); |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | WireFormat::decodeData |
Jeff Thompson | 9c66170 | 2013-09-13 14:35:44 -0700 | [diff] [blame] | 51 | (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 52 | { |
| 53 | throw logic_error("unimplemented"); |
| 54 | } |
| 55 | |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 56 | Blob |
| 57 | WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry) |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 58 | { |
| 59 | throw logic_error("unimplemented"); |
| 60 | } |
Jeff Thompson | 0050abe | 2013-09-17 12:50:25 -0700 | [diff] [blame] | 61 | |
| 62 | void |
| 63 | WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 64 | { |
| 65 | throw logic_error("unimplemented"); |
| 66 | } |
| 67 | |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 68 | } |