blob: 5f4fe53882d9bb59b2dc74fff8fd1fa6e97ce404 [file] [log] [blame]
shockjianga5ae48c2014-07-27 23:21:41 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2014, Regents of the University of California.
4 *
5 * This file is part of NDNS (Named Data Networking Domain Name Service).
6 * See AUTHORS.md for complete list of NDNS authors and contributors.
7 *
8 * NDNS is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
11 *
12 * NDNS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * NDNS, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef NAME_RESOLVER_HPP
20#define NAME_RESOLVER_HPP
21
22#include <boost/asio.hpp>
23#include <boost/noncopyable.hpp>
24
25#include <ndn-cxx/face.hpp>
26#include <ndn-cxx/name.hpp>
27#include <ndn-cxx/security/key-chain.hpp>
28
29#include "zone.hpp"
30#include "db/zone-mgr.hpp"
31#include "db/rr-mgr.hpp"
32#include "query.hpp"
33#include "response.hpp"
34#include "rr.hpp"
35#include "iterative-query.hpp"
36#include "ndn-app.hpp"
37
38using namespace std;
39
40namespace ndn {
41namespace ndns {
42
43
44class NameCachingResolver : public NDNApp{
45enum ResolverType
46{
47 StubResolver,
48 CachingResolver
49};
50
51public:
52
53NameCachingResolver(const char *programName, const char *prefix);
54
55
56void
57resolve(IterativeQuery& iq);
58
59void
60answerRespNack(IterativeQuery& iq);
61
62using NDNApp::onData;
63void
64onData(const Interest& interest, Data &data, IterativeQuery& iq);
65
66void
67onInterest(const Name &name, const Interest &interest);
68
69using NDNApp::onTimeout;
70
71void
72onTimeout(const Interest& interest, IterativeQuery& iq);
73
74void
75run();
76
77private:
78 //ResolverType m_resolverType;
79
80};
81
82} /* namespace ndns */
83} /* namespace ndn */
84
85#endif /* NAME_RESOLVER_HPP_ */