blob: 1a62f208bc7dacfb6a9387d47783841caae106b6 [file] [log] [blame]
Jeff Thompsonfa306642013-06-17 15:06:57 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Alexander Afanasyev
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
9 */
10
11#include <ndn.cxx.h>
12#include <iostream>
13
14using namespace std;
15
16ndn::Name InterestBaseName;
17
18// create a global handler
19ndn::Wrapper handler;
20
21void OnInterest (ndn::InterestPtr interest)
22{
23 cerr << interest->getName () << endl;
24
25 static int COUNTER = 0;
26
27 ostringstream os;
28 os << "C++ LINE #" << (COUNTER++) << endl;
29
30 handler.publishData (interest->getName (), os.str (), 5);
31}
32
33int
34main (int argc, char **argv)
35{
36 InterestBaseName = ndn::Name ("ccnx:/my-local-prefix/simple-fetch/file");
37
38 handler.setInterestFilter (InterestBaseName, OnInterest);
39
40 while (true)
41 {
42 sleep (1);
43 }
44 return 0;
45}