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