Ilya Moiseenko | 08a98a4 | 2011-08-02 16:06:51 -0700 | [diff] [blame] | 1 | // |
| 2 | // ndn_contentpacket.cpp |
| 3 | // Abstraction |
| 4 | // |
| 5 | // Copyright 2011 UCLA. All rights reserved. |
| 6 | // |
| 7 | |
| 8 | #include "ndn_contentpacket.h" |
Ilya Moiseenko | 7e254b7 | 2011-08-04 19:06:10 -0700 | [diff] [blame^] | 9 | |
| 10 | namespace ns3 |
| 11 | { |
| 12 | namespace NDNabstraction |
| 13 | { |
| 14 | ContentPacket::ContentPacket(const struct ccn_charbuf *Name,const void *data,size_t size):Packet() |
| 15 | { |
| 16 | ccn_charbuf *output = ccn_charbuf_create(); |
| 17 | int result = ccn_encode_ContentObject(output,Name,data,size); |
| 18 | |
| 19 | if(result>=0) |
| 20 | { |
| 21 | Ptr<Packet> p = Create<Packet> (output->buf, (uint32_t)output->length); |
| 22 | this->AddAtEnd (p); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |