blob: cd1dbe6ebe8ae1e9d59305a04d4f5a908a570cef [file] [log] [blame]
Jeff Thompsonaa4e6db2013-07-15 17:25:23 -07001/**
2 * @author: Jeff Thompson
3 * See COPYING for copyright and distribution information.
4 */
5
6#include "encoding/BinaryXMLDecoder.hpp"
7#include "c/encoding/BinaryXML.h"
8#include "ContentObject.hpp"
9#include "NDN.hpp"
10
Jeff Thompsonb982b6d2013-07-15 18:15:45 -070011using namespace std;
12
Jeff Thompsonaa4e6db2013-07-15 17:25:23 -070013namespace ndn {
14
15void NDN::onReceivedElement(unsigned char *element, unsigned int elementLength)
16{
17 BinaryXMLDecoder decoder(element, elementLength);
18
19 if (decoder.peekDTag(ndn_BinaryXML_DTag_ContentObject)) {
Jeff Thompsonb982b6d2013-07-15 18:15:45 -070020 ptr_lib::shared_ptr<ContentObject> contentObject(new ContentObject());
21 contentObject->decode(element, elementLength);
22
23 UpcallInfo upcallInfo(this, ptr_lib::shared_ptr<Interest>(), 0, contentObject);
24 closure_->upcall(UPCALL_CONTENT, upcallInfo);
Jeff Thompsonaa4e6db2013-07-15 17:25:23 -070025 }
26}
27
28}