shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame^] | 1 | /* -*- 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 | |
| 28 | |
| 29 | namespace ndn { |
| 30 | namespace ndns{ |
| 31 | class RRMgr : public DBMgr { |
| 32 | public: |
| 33 | RRMgr( Zone& zone, Query& query, Response& response); |
| 34 | virtual ~RRMgr(); |
| 35 | |
| 36 | public: |
| 37 | int lookup(); |
| 38 | |
| 39 | int callback_getRr(int argc, char **argv, char **azColName); |
| 40 | |
| 41 | static int |
| 42 | static_callback_getRr(void *param, int argc, char **argv, char **azColName) |
| 43 | { |
| 44 | RRMgr *mgr = reinterpret_cast<RRMgr*>(param); |
| 45 | return mgr->callback_getRr(argc, argv, azColName); |
| 46 | } |
| 47 | |
| 48 | int count(); |
| 49 | int callback_countRr(int argc, char **argv, char **azColName); |
| 50 | |
| 51 | static int |
| 52 | static_callback_countRr(void *param, int argc, char **argv, char **azColName) |
| 53 | { |
| 54 | RRMgr *mgr = reinterpret_cast<RRMgr*>(param); |
| 55 | return mgr->callback_countRr(argc, argv, azColName); |
| 56 | } |
| 57 | |
| 58 | const Query& getQuery() const { |
| 59 | return m_query; |
| 60 | } |
| 61 | |
| 62 | void setQuery(const Query& query) { |
| 63 | m_query = query; |
| 64 | } |
| 65 | |
| 66 | const Response& getResponse() const { |
| 67 | return m_response; |
| 68 | } |
| 69 | |
| 70 | void setResponse(const Response& response) { |
| 71 | m_response = response; |
| 72 | } |
| 73 | |
| 74 | const Zone& getZone() const { |
| 75 | return m_zone; |
| 76 | } |
| 77 | |
| 78 | void setZone(const Zone& zone) { |
| 79 | m_zone = zone; |
| 80 | } |
| 81 | |
| 82 | private: |
| 83 | unsigned int m_count; |
| 84 | Zone& m_zone; |
| 85 | Query& m_query; |
| 86 | Response& m_response; |
| 87 | }; |
| 88 | |
| 89 | |
| 90 | |
| 91 | } //namespace ndns |
| 92 | } /* namespace ndn */ |
| 93 | |
| 94 | #endif /* RR_MGR_HPP_ */ |