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 NDNS_ZONE_MGR_CPP |
| 21 | #define NDNS_ZONE_MGR_CPP |
| 22 | |
| 23 | #include <sqlite3.h> |
| 24 | |
| 25 | #include "db-mgr.hpp" |
| 26 | #include "zone.hpp" |
| 27 | #include <ndn-cxx/name.hpp> |
| 28 | |
| 29 | namespace ndn { |
| 30 | namespace ndns { |
| 31 | |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 32 | class ZoneMgr: public DBMgr |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 33 | { |
| 34 | |
| 35 | public: |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 36 | ZoneMgr(Zone& zone); |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 37 | |
| 38 | public: |
| 39 | void |
| 40 | lookupId(const Name& name); |
| 41 | |
| 42 | void |
| 43 | lookupId(); |
| 44 | |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 45 | const Zone& getZone() const |
| 46 | { |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 47 | return m_zone; |
| 48 | } |
| 49 | |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 50 | void setZone(const Zone& zone) |
| 51 | { |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 52 | this->m_zone = zone; |
| 53 | } |
| 54 | |
| 55 | int |
| 56 | callback_setId(int argc, char **argv, char **azColName); |
| 57 | |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 58 | static int static_callback_setId(void *param, int argc, char **argv, |
| 59 | char **azColName) |
| 60 | { |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 61 | |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 62 | ZoneMgr *mgr = reinterpret_cast<ZoneMgr*>(param); |
| 63 | return mgr->callback_setId(argc, argv, azColName); |
| 64 | } |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 65 | |
| 66 | private: |
| 67 | Zone& m_zone; |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 68 | }; |
| 69 | //class ZoneMgr |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 70 | |
| 71 | }//namespace ndns |
shockjiang | 99ad389 | 2014-08-03 14:56:13 -0700 | [diff] [blame] | 72 | } //namespace ndn |
shockjiang | a5ae48c | 2014-07-27 23:21:41 -0700 | [diff] [blame] | 73 | #endif |