blob: bb9ff8d3f3ebc212b20ecdb5e9015328bfc55cfb [file] [log] [blame]
Ilya Moiseenko08a98a42011-08-02 16:06:51 -07001//
2// ndn_contentpacket.cpp
3// Abstraction
4//
5// Copyright 2011 UCLA. All rights reserved.
6//
7
8#include "ndn_contentpacket.h"
Ilya Moiseenko7e254b72011-08-04 19:06:10 -07009
10namespace ns3
11{
12namespace 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}