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 | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame^] | 29 | ptr_lib::shared_ptr<vector<unsigned char> > 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 | c87f39a | 2013-08-12 11:55:11 -0700 | [diff] [blame] | 38 | ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData |
Jeff Thompson | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame^] | 39 | (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 | 1656e6a | 2013-08-29 18:01:48 -0700 | [diff] [blame^] | 49 | ptr_lib::shared_ptr<vector<unsigned char> > 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 | } |