blob: b1f33d02ca3424392ee1026882b34ac9a08f41b7 [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
20#ifndef RR_MGR_HPP
21#define RR_MGR_HPP
22
23#include "db-mgr.hpp"
24#include "query.hpp"
25#include "response.hpp"
26#include "zone.hpp"
27
shockjianga5ae48c2014-07-27 23:21:41 -070028namespace ndn {
shockjiang99ad3892014-08-03 14:56:13 -070029namespace ndns {
30class RRMgr: public DBMgr
31{
shockjianga5ae48c2014-07-27 23:21:41 -070032public:
shockjiang99ad3892014-08-03 14:56:13 -070033 RRMgr(Zone& zone, Query& query, Response& response);
shockjianga5ae48c2014-07-27 23:21:41 -070034 virtual ~RRMgr();
35
36public:
37 int lookup();
38
39 int callback_getRr(int argc, char **argv, char **azColName);
40
shockjiang99ad3892014-08-03 14:56:13 -070041 static int static_callback_getRr(void *param, int argc, char **argv,
42 char **azColName)
shockjianga5ae48c2014-07-27 23:21:41 -070043 {
44 RRMgr *mgr = reinterpret_cast<RRMgr*>(param);
45 return mgr->callback_getRr(argc, argv, azColName);
shockjiang99ad3892014-08-03 14:56:13 -070046 }
shockjianga5ae48c2014-07-27 23:21:41 -070047
48 int count();
49 int callback_countRr(int argc, char **argv, char **azColName);
50
shockjiang99ad3892014-08-03 14:56:13 -070051 static int static_callback_countRr(void *param, int argc, char **argv,
52 char **azColName)
shockjianga5ae48c2014-07-27 23:21:41 -070053 {
54 RRMgr *mgr = reinterpret_cast<RRMgr*>(param);
55 return mgr->callback_countRr(argc, argv, azColName);
shockjiang99ad3892014-08-03 14:56:13 -070056 }
shockjianga5ae48c2014-07-27 23:21:41 -070057
shockjiang99ad3892014-08-03 14:56:13 -070058 const Query& getQuery() const
59 {
shockjianga5ae48c2014-07-27 23:21:41 -070060 return m_query;
61 }
62
shockjiang99ad3892014-08-03 14:56:13 -070063 void setQuery(const Query& query)
64 {
shockjianga5ae48c2014-07-27 23:21:41 -070065 m_query = query;
66 }
67
shockjiang99ad3892014-08-03 14:56:13 -070068 const Response& getResponse() const
69 {
shockjianga5ae48c2014-07-27 23:21:41 -070070 return m_response;
71 }
72
shockjiang99ad3892014-08-03 14:56:13 -070073 void setResponse(const Response& response)
74 {
shockjianga5ae48c2014-07-27 23:21:41 -070075 m_response = response;
76 }
77
shockjiang99ad3892014-08-03 14:56:13 -070078 const Zone& getZone() const
79 {
shockjianga5ae48c2014-07-27 23:21:41 -070080 return m_zone;
81 }
82
shockjiang99ad3892014-08-03 14:56:13 -070083 void setZone(const Zone& zone)
84 {
shockjianga5ae48c2014-07-27 23:21:41 -070085 m_zone = zone;
86 }
87
88private:
89 unsigned int m_count;
90 Zone& m_zone;
91 Query& m_query;
92 Response& m_response;
93};
94
shockjianga5ae48c2014-07-27 23:21:41 -070095} //namespace ndns
96} /* namespace ndn */
97
98#endif /* RR_MGR_HPP_ */