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 | { |
Ilya Moiseenko | 42b4924 | 2011-08-05 20:23:30 -0700 | [diff] [blame^] | 14 | ContentPacket::ContentPacket(const struct ccn_charbuf *Name,const void *data,size_t size) |
| 15 | : Packet() |
Ilya Moiseenko | 7e254b7 | 2011-08-04 19:06:10 -0700 | [diff] [blame] | 16 | { |
| 17 | ccn_charbuf *output = ccn_charbuf_create(); |
| 18 | int result = ccn_encode_ContentObject(output,Name,data,size); |
| 19 | |
| 20 | if(result>=0) |
| 21 | { |
| 22 | Ptr<Packet> p = Create<Packet> (output->buf, (uint32_t)output->length); |
| 23 | this->AddAtEnd (p); |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |