| * See COPYING for copyright and distribution information. |
| #include "../ndn-cpp/face.hpp" |
| #include "../ndn-cpp/key-chain.hpp" |
| using namespace func_lib; |
| void operator()(const ptr_lib::shared_ptr<const Name> &prefix, const ptr_lib::shared_ptr<const Interest> &interest) { |
| // Make and sign a Data packet. |
| Data data(interest->getName()); |
| string content(string("Echo ") + interest->getName().toUri()); |
| data.setContent((const unsigned char*)&content[0], sizeof(content)); |
| data.getSignedInfo().setTimestampMilliseconds(time(NULL) * 1000.0); |
| KeyChain::defaultSign(data); |
| // TODO: Need to put the Data. |
| int main(int argc, char** argv) |
| Name prefix("/testecho"); |
| cout << "Register prefix " << prefix.toUri() << endl; |
| face.registerPrefix(prefix, ref(echo)); |
| while (echo.interestCount_ < 1) { |
| // We need to sleep for a few milliseconds so we don't use 100% of the CPU. |
| } catch (std::exception &e) { |
| cout << "exception: " << e.what() << endl; |