binary-xml-wire-format.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_BINARYXMLWIREFORMAT_HPP
23 #define NDN_BINARYXMLWIREFORMAT_HPP
24 
25 #include "wire-format.hpp"
26 
27 namespace ndn {
28 
34 public:
36 
43  static BinaryXmlWireFormat*
44  get()
45  {
46  if (!instance_)
47  instance_ = new BinaryXmlWireFormat();
48 
49  return instance_;
50  }
51 
57  virtual Blob
58  encodeName(const Name& name);
59 
66  virtual void
67  decodeName(Name& name, const uint8_t *input, size_t inputLength);
68 
82  virtual Blob
84  (const Interest& interest, size_t *signedPortionBeginOffset,
85  size_t *signedPortionEndOffset);
86 
107  virtual void
109  (Interest& interest, const uint8_t *input, size_t inputLength,
110  size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
111 
121  virtual Blob
122  encodeData
123  (const Data& data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
124 
137  virtual void
138  decodeData
139  (Data& data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset);
140 
146  virtual Blob
147  encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
148 
155  virtual void
156  decodeForwardingEntry(ForwardingEntry& forwardingEntry, const uint8_t *input, size_t inputLength);
157 
158 private:
159  static BinaryXmlWireFormat* instance_;
160 };
161 
162 }
163 
164 #endif
165 
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
virtual void decodeForwardingEntry(ForwardingEntry &forwardingEntry, const uint8_t *input, size_t inputLength)
Decode input as a forwarding entry in binary XML and set the fields of the forwardingEntry object...
Definition: binary-xml-wire-format.cpp:200
virtual Blob encodeForwardingEntry(const ForwardingEntry &forwardingEntry)
Encode forwardingEntry in binary XML and return the encoding.
Definition: binary-xml-wire-format.cpp:183
A ForwardingEntry holds an action and Name prefix and other fields for a forwarding entry...
Definition: forwarding-entry.hpp:41
Definition: data.hpp:36
virtual void decodeName(Name &name, const uint8_t *input, size_t inputLength)
Decode input as a name in binary XML and set the fields of the Name object.
Definition: binary-xml-wire-format.cpp:78
virtual Blob encodeName(const Name &name)
Encode name in binary XML and return the encoding.
Definition: binary-xml-wire-format.cpp:58
virtual Blob encodeInterest(const Interest &interest, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
Encode interest in binary XML and return the encoding.
Definition: binary-xml-wire-format.cpp:97
virtual Blob encodeData(const Data &data, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
Encode data with binary XML and return the encoding.
Definition: binary-xml-wire-format.cpp:145
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:42
A BinaryXmlWireFormat extends WireFormat to override its virtual methods to implement encoding and de...
Definition: binary-xml-wire-format.hpp:33
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
An Interest holds a Name and other fields for an interest.
Definition: interest.hpp:41
virtual void decodeInterest(Interest &interest, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
Decode input as an interest in binary XML and set the fields of the interest object.
Definition: binary-xml-wire-format.cpp:122
Definition: wire-format.hpp:37
virtual void decodeData(Data &data, const uint8_t *input, size_t inputLength, size_t *signedPortionBeginOffset, size_t *signedPortionEndOffset)
Decode input as a data packet in binary XML and set the fields in the data object.
Definition: binary-xml-wire-format.cpp:165