14 #include "ns3/buffer.h"
16 #include "ns3/ndn-common.h"
17 #include "ns3/ndn-name.h"
18 #include "ns3/ndn-interest.h"
19 #include "ns3/ndn-data.h"
27 WIRE_FORMAT_DEFAULT = -2,
28 WIRE_FORMAT_AUTODETECT = -1,
30 WIRE_FORMAT_NDNSIM = 0,
35 FromInterest (Ptr<const Interest> interest, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
38 ToInterest (Ptr<Packet> packet, int8_t type = WIRE_FORMAT_AUTODETECT);
41 FromData (Ptr<const Data> data, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
44 ToData (Ptr<Packet> packet, int8_t type = WIRE_FORMAT_AUTODETECT);
49 FromInterestStr (Ptr<const Interest> interest, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
52 ToInterestStr (
const std::string &wire, int8_t type = WIRE_FORMAT_AUTODETECT);
55 FromDataStr (Ptr<const Data> data, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
58 ToDataStr (
const std::string &wire, int8_t type = WIRE_FORMAT_AUTODETECT);
70 FromName (Ptr<const Name> name, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
76 ToName (
const std::string &wire, int8_t wireFormat = WIRE_FORMAT_DEFAULT);
80 PacketToBuffer (Ptr<const Packet> pkt)
83 buffer.resize (pkt->GetSize ());
84 pkt->CopyData (reinterpret_cast<uint8_t*> (&buffer[0]), buffer.size ());
90 BufferToPacket (
const std::string &buffer)
92 return Create<Packet> (
reinterpret_cast<const uint8_t*
> (&buffer[0]), buffer.size ());