Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 1 | /** |
| 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 Thompson | b982b6d | 2013-07-15 18:15:45 -0700 | [diff] [blame] | 11 | using namespace std; |
| 12 | |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 13 | namespace ndn { |
| 14 | |
| 15 | void NDN::onReceivedElement(unsigned char *element, unsigned int elementLength) |
| 16 | { |
| 17 | BinaryXMLDecoder decoder(element, elementLength); |
| 18 | |
| 19 | if (decoder.peekDTag(ndn_BinaryXML_DTag_ContentObject)) { |
Jeff Thompson | b982b6d | 2013-07-15 18:15:45 -0700 | [diff] [blame] | 20 | ptr_lib::shared_ptr<ContentObject> contentObject(new ContentObject()); |
| 21 | contentObject->decode(element, elementLength); |
| 22 | |
Jeff Thompson | 85ff99f | 2013-07-15 18:23:58 -0700 | [diff] [blame] | 23 | ptr_lib::shared_ptr<Interest> dummyInterest; |
| 24 | UpcallInfo upcallInfo(this, dummyInterest, 0, contentObject); |
Jeff Thompson | b982b6d | 2013-07-15 18:15:45 -0700 | [diff] [blame] | 25 | closure_->upcall(UPCALL_CONTENT, upcallInfo); |
Jeff Thompson | aa4e6db | 2013-07-15 17:25:23 -0700 | [diff] [blame] | 26 | } |
| 27 | } |
| 28 | |
| 29 | } |