blob: 5c2f10957e357188db911691b720c73386c89a40 [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 NDNS_NAME_SERVER_HPP
20#define NDNS_NAME_SERVER_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
36#include "ndn-app.hpp"
37
38using namespace std;
39using namespace ndn;
40
shockjiang99ad3892014-08-03 14:56:13 -070041namespace ndn {
42namespace ndns {
43class NameServer: public NDNApp
shockjianga5ae48c2014-07-27 23:21:41 -070044{
45
46public:
shockjiang99ad3892014-08-03 14:56:13 -070047 explicit
48 NameServer(const char *programName, const char *prefix, const char *nameZone,
49 const string dbfile = "src/db/ndns-local.db");
shockjianga5ae48c2014-07-27 23:21:41 -070050
shockjiang99ad3892014-08-03 14:56:13 -070051 void
52 onInterest(const Name &name, const Interest &interest);
shockjianga5ae48c2014-07-27 23:21:41 -070053
shockjiang99ad3892014-08-03 14:56:13 -070054 void
55 run();
shockjianga5ae48c2014-07-27 23:21:41 -070056
57public:
58 /*
59 * the name used by the server to provide routeable accessory.
60
shockjiang99ad3892014-08-03 14:56:13 -070061 Name m_name;
62 */
shockjianga5ae48c2014-07-27 23:21:41 -070063 /*
64 * the zone the server is in charge of
65 */
66 Zone m_zone;
67
68 /*
69 * to manage the m_zone; m_zoneMgr.getZone() returns the referrence of m_zone
70 */
71 ZoneMgr m_zoneMgr;
72
shockjiang99ad3892014-08-03 14:56:13 -070073};
74//clcass NameServer
shockjianga5ae48c2014-07-27 23:21:41 -070075}//namespace ndns
shockjiang99ad3892014-08-03 14:56:13 -070076} //namespace ndn
shockjianga5ae48c2014-07-27 23:21:41 -070077#endif /* NAME_SERVER_HPP_ */