blob: 2d71733c1dde2b488af7ec7538ebe8182f1c2e4a [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{
Ilya Moiseenko42b49242011-08-05 20:23:30 -070014 ContentPacket::ContentPacket(const struct ccn_charbuf *Name,const void *data,size_t size)
15 : Packet()
Ilya Moiseenko7e254b72011-08-04 19:06:10 -070016 {
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}