Jeff Thompson | 47eecfc | 2013-07-07 22:56:46 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <stdexcept> |
Jeff Thompson | 5341219 | 2013-08-06 13:35:50 -0700 | [diff] [blame] | 7 | #include "wire-format.hpp" |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 8 | |
| 9 | using namespace std; |
| 10 | |
| 11 | namespace ndn { |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 12 | |
Jeff Thompson | 1a1312d | 2013-08-05 19:08:35 -0700 | [diff] [blame] | 13 | static bool gotInitialDefaultWireFormat = false; |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 14 | |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 15 | WireFormat *WireFormat::defaultWireFormat_ = 0; |
| 16 | |
| 17 | WireFormat *WireFormat::getDefaultWireFormat() |
| 18 | { |
Jeff Thompson | 1a1312d | 2013-08-05 19:08:35 -0700 | [diff] [blame] | 19 | if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) { |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 20 | // 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] | 21 | gotInitialDefaultWireFormat = true; |
| 22 | // NOTE: This allocates one object which we never free for the life of the application. |
| 23 | defaultWireFormat_ = newInitialDefaultWireFormat(); |
Jeff Thompson | 535f21a | 2013-08-05 18:25:46 -0700 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | return defaultWireFormat_; |
| 27 | } |
Jeff Thompson | fa181ac | 2013-08-02 19:00:51 -0700 | [diff] [blame] | 28 | |
Jeff Thompson | c2b7b14 | 2013-09-12 15:29:04 -0700 | [diff] [blame] | 29 | Blob WireFormat::encodeInterest(const Interest& interest) |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 30 | { |
| 31 | throw logic_error("unimplemented"); |
| 32 | } |
Jeff Thompson | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame] | 33 | void WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 34 | { |
| 35 | throw logic_error("unimplemented"); |
| 36 | } |
| 37 | |
Jeff Thompson | c2b7b14 | 2013-09-12 15:29:04 -0700 | [diff] [blame] | 38 | Blob WireFormat::encodeData(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 39 | { |
| 40 | throw logic_error("unimplemented"); |
| 41 | } |
Jeff Thompson | c87f39a | 2013-08-12 11:55:11 -0700 | [diff] [blame] | 42 | void WireFormat::decodeData |
Jeff Thompson | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame] | 43 | (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset) |
Jeff Thompson | 5cae5e5 | 2013-07-10 19:41:20 -0700 | [diff] [blame] | 44 | { |
| 45 | throw logic_error("unimplemented"); |
| 46 | } |
| 47 | |
Jeff Thompson | c2b7b14 | 2013-09-12 15:29:04 -0700 | [diff] [blame] | 48 | Blob WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry) |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 49 | { |
| 50 | throw logic_error("unimplemented"); |
| 51 | } |
Jeff Thompson | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame] | 52 | void WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength) |
Jeff Thompson | 990599b | 2013-08-27 15:14:25 -0700 | [diff] [blame] | 53 | { |
| 54 | throw logic_error("unimplemented"); |
| 55 | } |
| 56 | |
Jeff Thompson | 9c41dfe | 2013-06-27 12:10:25 -0700 | [diff] [blame] | 57 | } |