blob: 3f07a1ef50adec8f9bc4d7ae9b1851f7bf55fb23 [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_DIG_HPP_
20#define NAME_DIG_HPP_
21
22#include "ndn-app.hpp"
23#include "rr.hpp"
24#include "response.hpp"
25#include "query.hpp"
26
27namespace ndn {
28namespace ndns {
29
shockjiang99ad3892014-08-03 14:56:13 -070030class NameDig: public NDNApp
31{
shockjianga5ae48c2014-07-27 23:21:41 -070032public:
33 NameDig(const char *programName, const char *prefix);
34 virtual ~NameDig();
35
36 void
37 onData(const ndn::Interest& interest, Data& data);
38
shockjianga5ae48c2014-07-27 23:21:41 -070039 void
40 onTimeout(const ndn::Interest& interest);
41
42 void
43 sendQuery();
44
45 void
46 run();
47
shockjiang99ad3892014-08-03 14:56:13 -070048 const vector<RR>& getRrs() const
49 {
shockjianga5ae48c2014-07-27 23:21:41 -070050 return m_rrs;
51 }
52
shockjiang99ad3892014-08-03 14:56:13 -070053 void setRrs(const vector<RR>& rrs)
54 {
shockjianga5ae48c2014-07-27 23:21:41 -070055 m_rrs = rrs;
56 }
57
shockjiang99ad3892014-08-03 14:56:13 -070058 const Name& getResolverName() const
59 {
shockjianga5ae48c2014-07-27 23:21:41 -070060 return m_resolverName;
61 }
62
shockjiang99ad3892014-08-03 14:56:13 -070063 void setResolverName(const Name& resolverName)
64 {
shockjianga5ae48c2014-07-27 23:21:41 -070065 m_resolverName = resolverName;
66 }
67
shockjiang99ad3892014-08-03 14:56:13 -070068 const Name& getDstLabel() const
69 {
shockjianga5ae48c2014-07-27 23:21:41 -070070 return m_dstLabel;
71 }
72
shockjiang99ad3892014-08-03 14:56:13 -070073 void setDstLabel(const Name& dstLabel)
74 {
shockjianga5ae48c2014-07-27 23:21:41 -070075 m_dstLabel = dstLabel;
76 }
77
shockjiang99ad3892014-08-03 14:56:13 -070078 RR::RRType getRrType() const
79 {
shockjianga5ae48c2014-07-27 23:21:41 -070080 return m_rrType;
81 }
82
shockjiang99ad3892014-08-03 14:56:13 -070083 void setRrType(RR::RRType rrType)
84 {
shockjianga5ae48c2014-07-27 23:21:41 -070085 m_rrType = rrType;
86 }
87
shockjiang99ad3892014-08-03 14:56:13 -070088 const Response& getResponse() const
89 {
90 return response;
91 }
92
93 void setResponse(const Response& response)
94 {
95 this->response = response;
96 }
97
shockjianga5ae48c2014-07-27 23:21:41 -070098private:
99 Name m_resolverName;
100 Name m_dstLabel;
101 RR::RRType m_rrType;
102 vector<RR> m_rrs;
shockjiang99ad3892014-08-03 14:56:13 -0700103
104 Response response;
shockjianga5ae48c2014-07-27 23:21:41 -0700105};
106
107} /* namespace ndns */
108} /* namespace ndn */
109
110#endif /* NAME_DIG_HPP_ */