blob: 41c1f399f2c38c20db320cc14d18a545da53fcf3 [file] [log] [blame]
Jeff Thompson47eecfc2013-07-07 22:56:46 -07001/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07002 * Copyright (C) 2013 Regents of the University of California.
3 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompson47eecfc2013-07-07 22:56:46 -07004 * See COPYING for copyright and distribution information.
Jeff Thompson9c41dfe2013-06-27 12:10:25 -07005 */
6
7#include <stdexcept>
Jeff Thompson53412192013-08-06 13:35:50 -07008#include "wire-format.hpp"
Jeff Thompson9c41dfe2013-06-27 12:10:25 -07009
10using namespace std;
11
12namespace ndn {
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070013
Jeff Thompson1a1312d2013-08-05 19:08:35 -070014static bool gotInitialDefaultWireFormat = false;
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070015
Jeff Thompson0050abe2013-09-17 12:50:25 -070016WireFormat* WireFormat::defaultWireFormat_ = 0;
Jeff Thompson535f21a2013-08-05 18:25:46 -070017
Jeff Thompson0050abe2013-09-17 12:50:25 -070018WireFormat*
19WireFormat::getDefaultWireFormat()
Jeff Thompson535f21a2013-08-05 18:25:46 -070020{
Jeff Thompson1a1312d2013-08-05 19:08:35 -070021 if (!defaultWireFormat_ && !gotInitialDefaultWireFormat) {
Jeff Thompson535f21a2013-08-05 18:25:46 -070022 // There is no defaultWireFormat_ and we have not yet initialized initialDefaultWireFormat_, so initialize and use it.
Jeff Thompson1a1312d2013-08-05 19:08:35 -070023 gotInitialDefaultWireFormat = true;
24 // NOTE: This allocates one object which we never free for the life of the application.
25 defaultWireFormat_ = newInitialDefaultWireFormat();
Jeff Thompson535f21a2013-08-05 18:25:46 -070026 }
27
28 return defaultWireFormat_;
29}
Jeff Thompsonfa181ac2013-08-02 19:00:51 -070030
Jeff Thompson0050abe2013-09-17 12:50:25 -070031Blob
32WireFormat::encodeInterest(const Interest& interest)
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070033{
34 throw logic_error("unimplemented");
35}
36
Jeff Thompson0050abe2013-09-17 12:50:25 -070037void
38WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070039{
40 throw logic_error("unimplemented");
41}
Jeff Thompson0050abe2013-09-17 12:50:25 -070042
43Blob
44WireFormat::encodeData(const Data& data, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
45{
46 throw logic_error("unimplemented");
47}
48
49void
50WireFormat::decodeData
Jeff Thompson9c661702013-09-13 14:35:44 -070051 (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedPortionBeginOffset, unsigned int *signedPortionEndOffset)
Jeff Thompson5cae5e52013-07-10 19:41:20 -070052{
53 throw logic_error("unimplemented");
54}
55
Jeff Thompson0050abe2013-09-17 12:50:25 -070056Blob
57WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
Jeff Thompson990599b2013-08-27 15:14:25 -070058{
59 throw logic_error("unimplemented");
60}
Jeff Thompson0050abe2013-09-17 12:50:25 -070061
62void
63WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
Jeff Thompson990599b2013-08-27 15:14:25 -070064{
65 throw logic_error("unimplemented");
66}
67
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070068}