database.h 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef __DATABASE_DATASRC_H
  15. #define __DATABASE_DATASRC_H
  16. #include <string>
  17. #include <boost/scoped_ptr.hpp>
  18. #include <boost/tuple/tuple.hpp>
  19. #include <dns/rrclass.h>
  20. #include <dns/rrset.h>
  21. #include <dns/rrtype.h>
  22. #include <datasrc/client.h>
  23. #include <dns/name.h>
  24. #include <exceptions/exceptions.h>
  25. #include <map>
  26. #include <set>
  27. namespace isc {
  28. namespace datasrc {
  29. /**
  30. * \brief Abstraction of lowlevel database with DNS data
  31. *
  32. * This class is defines interface to databases. Each supported database
  33. * will provide methods for accessing the data stored there in a generic
  34. * manner. The methods are meant to be low-level, without much or any knowledge
  35. * about DNS and should be possible to translate directly to queries.
  36. *
  37. * On the other hand, how the communication with database is done and in what
  38. * schema (in case of relational/SQL database) is up to the concrete classes.
  39. *
  40. * This class is non-copyable, as copying connections to database makes little
  41. * sense and will not be needed.
  42. *
  43. * \todo Is it true this does not need to be copied? For example the zone
  44. * iterator might need it's own copy. But a virtual clone() method might
  45. * be better for that than copy constructor.
  46. *
  47. * \note The same application may create multiple connections to the same
  48. * database, having multiple instances of this class. If the database
  49. * allows having multiple open queries at one connection, the connection
  50. * class may share it.
  51. */
  52. class DatabaseAccessor : boost::noncopyable {
  53. public:
  54. /**
  55. * Definitions of the fields as they are required to be filled in
  56. * by IteratorContext::getNext()
  57. *
  58. * When implementing getNext(), the columns array should
  59. * be filled with the values as described in this enumeration,
  60. * in this order, i.e. TYPE_COLUMN should be the first element
  61. * (index 0) of the array, TTL_COLUMN should be the second element
  62. * (index 1), etc.
  63. */
  64. enum RecordColumns {
  65. TYPE_COLUMN = 0, ///< The RRType of the record (A/NS/TXT etc.)
  66. TTL_COLUMN = 1, ///< The TTL of the record (a
  67. SIGTYPE_COLUMN = 2, ///< For RRSIG records, this contains the RRTYPE
  68. ///< the RRSIG covers. In the current implementation,
  69. ///< this field is ignored.
  70. RDATA_COLUMN = 3, ///< Full text representation of the record's RDATA
  71. NAME_COLUMN = 4, ///< The domain name of this RR
  72. COLUMN_COUNT = 5 ///< The total number of columns, MUST be value of
  73. ///< the largest other element in this enum plus 1.
  74. };
  75. /**
  76. * Definitions of the fields to be passed to addRecordToZone().
  77. *
  78. * Each derived implementation of addRecordToZone() should expect
  79. * the "columns" array to be filled with the values as described in this
  80. * enumeration, in this order.
  81. */
  82. enum AddRecordColumns {
  83. ADD_NAME = 0, ///< The owner name of the record (a domain name)
  84. ADD_REV_NAME = 1, ///< Reversed name of NAME (used for DNSSEC)
  85. ADD_TTL = 2, ///< The TTL of the record (in numeric form)
  86. ADD_TYPE = 3, ///< The RRType of the record (A/NS/TXT etc.)
  87. ADD_SIGTYPE = 4, ///< For RRSIG records, this contains the RRTYPE
  88. ///< the RRSIG covers.
  89. ADD_RDATA = 5, ///< Full text representation of the record's RDATA
  90. ADD_COLUMN_COUNT = 6 ///< Number of columns
  91. };
  92. /**
  93. * Definitions of the fields to be passed to deleteRecordInZone().
  94. *
  95. * Each derived implementation of deleteRecordInZone() should expect
  96. * the "params" array to be filled with the values as described in this
  97. * enumeration, in this order.
  98. */
  99. enum DeleteRecordParams {
  100. DEL_NAME = 0, ///< The owner name of the record (a domain name)
  101. DEL_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
  102. DEL_RDATA = 2, ///< Full text representation of the record's RDATA
  103. DEL_PARAM_COUNT = 3 ///< Number of parameters
  104. };
  105. /**
  106. * Operation mode when adding a record diff.
  107. *
  108. * This is used as the "operation" parameter value of addRecordDiff().
  109. */
  110. enum DiffOperation {
  111. DIFF_ADD = 0, ///< This diff is for adding an RR
  112. DIFF_DELETE = 1 ///< This diff is for deleting an RR
  113. };
  114. /**
  115. * Definitions of the fields to be passed to addRecordDiff().
  116. *
  117. * Each derived implementation of addRecordDiff() should expect
  118. * the "params" array to be filled with the values as described in this
  119. * enumeration, in this order.
  120. */
  121. enum DiffRecordParams {
  122. DIFF_NAME = 0, ///< The owner name of the record (a domain name)
  123. DIFF_TYPE = 1, ///< The RRType of the record (A/NS/TXT etc.)
  124. DIFF_TTL = 2, ///< The TTL of the record (in numeric form)
  125. DIFF_RDATA = 3, ///< Full text representation of the record's RDATA
  126. DIFF_PARAM_COUNT = 4 ///< Number of parameters
  127. };
  128. /**
  129. * \brief Destructor
  130. *
  131. * It is empty, but needs a virtual one, since we will use the derived
  132. * classes in polymorphic way.
  133. */
  134. virtual ~DatabaseAccessor() { }
  135. /**
  136. * \brief Retrieve a zone identifier
  137. *
  138. * This method looks up a zone for the given name in the database. It
  139. * should match only exact zone name (eg. name is equal to the zone's
  140. * apex), as the DatabaseClient will loop trough the labels itself and
  141. * find the most suitable zone.
  142. *
  143. * It is not specified if and what implementation of this method may throw,
  144. * so code should expect anything.
  145. *
  146. * \param name The (fully qualified) domain name of the zone's apex to be
  147. * looked up.
  148. * \return The first part of the result indicates if a matching zone
  149. * was found. In case it was, the second part is internal zone ID.
  150. * This one will be passed to methods finding data in the zone.
  151. * It is not required to keep them, in which case whatever might
  152. * be returned - the ID is only passed back to the database as
  153. * an opaque handle.
  154. */
  155. virtual std::pair<bool, int> getZone(const std::string& name) const = 0;
  156. /**
  157. * \brief This holds the internal context of ZoneIterator for databases
  158. *
  159. * While the ZoneIterator implementation from DatabaseClient does all the
  160. * translation from strings to DNS classes and validation, this class
  161. * holds the pointer to where the database is at reading the data.
  162. *
  163. * It can either hold shared pointer to the connection which created it
  164. * and have some kind of statement inside (in case single database
  165. * connection can handle multiple concurrent SQL statements) or it can
  166. * create a new connection (or, if it is more convenient, the connection
  167. * itself can inherit both from DatabaseConnection and IteratorContext
  168. * and just clone itself).
  169. */
  170. class IteratorContext : public boost::noncopyable {
  171. public:
  172. /**
  173. * \brief Destructor
  174. *
  175. * Virtual destructor, so any descendand class is destroyed correctly.
  176. */
  177. virtual ~IteratorContext() { }
  178. /**
  179. * \brief Function to provide next resource record
  180. *
  181. * This function should provide data about the next resource record
  182. * from the data that is searched. The data is not converted yet.
  183. *
  184. * Depending on how the iterator was constructed, there is a difference
  185. * in behaviour; for a 'full zone iterator', created with
  186. * getAllRecords(), all COLUMN_COUNT elements of the array are
  187. * overwritten.
  188. * For a 'name iterator', created with getRecords(), the column
  189. * NAME_COLUMN is untouched, since what would be added here is by
  190. * definition already known to the caller (it already passes it as
  191. * an argument to getRecords()).
  192. *
  193. * Once this function returns false, any subsequent call to it should
  194. * result in false. The implementation of a derived class must ensure
  195. * it doesn't cause any disruption due to that such as a crash or
  196. * exception.
  197. *
  198. * \note The order of RRs is not strictly set, but the RRs for single
  199. * RRset must not be interleaved with any other RRs (eg. RRsets must be
  200. * "together").
  201. *
  202. * \param columns The data will be returned through here. The order
  203. * is specified by the RecordColumns enum, and the size must be
  204. * COLUMN_COUNT
  205. * \todo Do we consider databases where it is stored in binary blob
  206. * format?
  207. * \throw DataSourceError if there's database-related error. If the
  208. * exception (or any other in case of derived class) is thrown,
  209. * the iterator can't be safely used any more.
  210. * \return true if a record was found, and the columns array was
  211. * updated. false if there was no more data, in which case
  212. * the columns array is untouched.
  213. */
  214. virtual bool getNext(std::string (&columns)[COLUMN_COUNT]) = 0;
  215. };
  216. typedef boost::shared_ptr<IteratorContext> IteratorContextPtr;
  217. /**
  218. * \brief Creates an iterator context for a specific name.
  219. *
  220. * Returns an IteratorContextPtr that contains all records of the
  221. * given name from the given zone.
  222. *
  223. * The implementation of the iterator that is returned may leave the
  224. * NAME_COLUMN column of the array passed to getNext() untouched, as that
  225. * data is already known (it is the same as the name argument here)
  226. *
  227. * \exception any Since any implementation can be used, the caller should
  228. * expect any exception to be thrown.
  229. *
  230. * \param name The name to search for. This should be a FQDN.
  231. * \param id The ID of the zone, returned from getZone().
  232. * \param subdomains If set to true, match subdomains of name instead
  233. * of name itself. It is used to find empty domains and match
  234. * wildcards.
  235. * \return Newly created iterator context. Must not be NULL.
  236. */
  237. virtual IteratorContextPtr getRecords(const std::string& name,
  238. int id,
  239. bool subdomains = false) const = 0;
  240. /**
  241. * \brief Creates an iterator context for the whole zone.
  242. *
  243. * Returns an IteratorContextPtr that contains all records of the
  244. * zone with the given zone id.
  245. *
  246. * Each call to getNext() on the returned iterator should copy all
  247. * column fields of the array that is passed, as defined in the
  248. * RecordColumns enum.
  249. *
  250. * \exception any Since any implementation can be used, the caller should
  251. * expect any exception to be thrown.
  252. *
  253. * \param id The ID of the zone, returned from getZone().
  254. * \return Newly created iterator context. Must not be NULL.
  255. */
  256. virtual IteratorContextPtr getAllRecords(int id) const = 0;
  257. /**
  258. * \brief Creates an iterator context for a set of differences.
  259. *
  260. * Returns an IteratorContextPtr that contains all difference records for
  261. * the given zone between two versions of a zone.
  262. *
  263. * The difference records are the set of records that would appear in an
  264. * IXFR serving a request for the difference between two versions of a zone.
  265. * The records are returned in the same order as they would be in the IXFR.
  266. * This means that if the the difference between versions of a zone with SOA
  267. * serial numbers of "start" and "end" is required, and the zone contains
  268. * the differences between serial number "start" to serial number
  269. * "intermediate" and from serial number "intermediate" to serial number
  270. * "end", the returned records will be (in order):
  271. *
  272. * \li SOA for serial "start"
  273. * \li Records removed from the zone between versions "start" and
  274. * "intermediate" of the zone. The order of these is not guaranteed.
  275. * \li SOA for serial "intermediate"
  276. * \li Records added to the zone between versions "start" and
  277. * "intermediate" of the zone. The order of these is not guaranteed.
  278. * \li SOA for serial "intermediate"
  279. * \li Records removed from the zone between versions "intermediate" and
  280. * "end" of the zone. The order of these is not guaranteed.
  281. * \li SOA for serial "end"
  282. * \li Records added to the zone between versions "intermediate" and "end"
  283. * of the zone. The order of these is not guaranteed.
  284. *
  285. * Note that there is no requirement that "start" be less than "end". Owing
  286. * to serial number arithmetic, it is entirely possible that a later version
  287. * of a zone will have a smaller SOA serial number than an earlier version.
  288. *
  289. * Each call to getNext() on the returned iterator should copy all
  290. * column fields of the array that is passed, as defined in the
  291. * RecordColumns enum.
  292. *
  293. * \exception any Since any implementation can be used, the caller should
  294. * expect any exception to be thrown.
  295. *
  296. * \param id The ID of the zone, returned from getZone().
  297. * \param start The SOA serial number of the version of the zone from
  298. * which the difference sequence should start.
  299. * \param end The SOA serial number of the version of the zone at which
  300. * the difference sequence should end.
  301. *
  302. * \return Newly created iterator context. Must not be NULL.
  303. */
  304. virtual IteratorContextPtr
  305. getDiffs(int id, uint32_t start, uint32_t end) const = 0;
  306. /// Start a transaction for updating a zone.
  307. ///
  308. /// Each derived class version of this method starts a database
  309. /// transaction to make updates to the given name of zone (whose class was
  310. /// specified at the construction of the class).
  311. ///
  312. /// If \c replace is true, any existing records of the zone will be
  313. /// deleted on successful completion of updates (after
  314. /// \c commitUpdateZone()); if it's false, the existing records will be
  315. /// intact unless explicitly deleted by \c deleteRecordInZone().
  316. ///
  317. /// A single \c DatabaseAccessor instance can perform at most one
  318. /// transaction; a duplicate call to this method before
  319. /// \c commitUpdateZone() or \c rollbackUpdateZone(), or a call to this
  320. /// method within another transaction started by \c startTransaction()
  321. /// will result in a \c DataSourceError exception.
  322. /// If multiple update attempts need to be performed concurrently (and
  323. /// if the underlying database allows such operation), separate
  324. /// \c DatabaseAccessor instance must be created.
  325. ///
  326. /// \note The underlying database may not allow concurrent updates to
  327. /// the same database instance even if different "connections" (or
  328. /// something similar specific to the database implementation) are used
  329. /// for different sets of updates. For example, it doesn't seem to be
  330. /// possible for SQLite3 unless different databases are used. MySQL
  331. /// allows concurrent updates to different tables of the same database,
  332. /// but a specific operation may block others. As such, this interface
  333. /// doesn't require derived classes to allow concurrent updates with
  334. /// multiple \c DatabaseAccessor instances; however, the implementation
  335. /// is encouraged to do the best for making it more likely to succeed
  336. /// as long as the underlying database system allows concurrent updates.
  337. ///
  338. /// This method returns a pair of \c bool and \c int. Its first element
  339. /// indicates whether the given name of zone is found. If it's false,
  340. /// the transaction isn't considered to be started; a subsequent call to
  341. /// this method with an existing zone name should succeed. Likewise,
  342. /// if a call to this method results in an exception, the transaction
  343. /// isn't considered to be started. Note also that if the zone is not
  344. /// found this method doesn't try to create a new one in the database.
  345. /// It must have been created by some other means beforehand.
  346. ///
  347. /// The second element is the internal zone ID used for subsequent
  348. /// updates. Depending on implementation details of the actual derived
  349. /// class method, it may be different from the one returned by
  350. /// \c getZone(); for example, a specific implementation may use a
  351. /// completely new zone ID when \c replace is true.
  352. ///
  353. /// \exception DataSourceError Duplicate call to this method, call to
  354. /// this method within another transaction, or some internal database
  355. /// related error.
  356. ///
  357. /// \param zone_name A string representation of the zone name to be updated
  358. /// \param replace Whether to replace the entire zone (see above)
  359. ///
  360. /// \return A pair of bool and int, indicating whether the specified zone
  361. /// exists and (if so) the zone ID to be used for the update, respectively.
  362. virtual std::pair<bool, int> startUpdateZone(const std::string& zone_name,
  363. bool replace) = 0;
  364. /// Add a single record to the zone to be updated.
  365. ///
  366. /// This method provides a simple interface to insert a new record
  367. /// (a database "row") to the zone in the update context started by
  368. /// \c startUpdateZone(). The zone to which the record to be added
  369. /// is the one specified at the time of the \c startUpdateZone() call.
  370. ///
  371. /// A successful call to \c startUpdateZone() must have preceded to
  372. /// this call; otherwise a \c DataSourceError exception will be thrown.
  373. ///
  374. /// The row is defined as a vector of strings that has exactly
  375. /// ADD_COLUMN_COUNT number of elements. See AddRecordColumns for
  376. /// the semantics of each element.
  377. ///
  378. /// Derived class methods are not required to check whether the given
  379. /// values in \c columns are valid in terms of the expected semantics;
  380. /// in general, it's the caller's responsibility.
  381. /// For example, TTLs would normally be expected to be a textual
  382. /// representation of decimal numbers, but this interface doesn't require
  383. /// the implementation to perform this level of validation. It may check
  384. /// the values, however, and in that case if it detects an error it
  385. /// should throw a \c DataSourceError exception.
  386. ///
  387. /// Likewise, derived class methods are not required to detect any
  388. /// duplicate record that is already in the zone.
  389. ///
  390. /// \note The underlying database schema may not have a trivial mapping
  391. /// from this style of definition of rows to actual database records.
  392. /// It's the implementation's responsibility to implement the mapping
  393. /// in the actual derived method.
  394. ///
  395. /// \exception DataSourceError Invalid call without starting a transaction,
  396. /// or other internal database error.
  397. ///
  398. /// \param columns An array of strings that defines a record to be added
  399. /// to the zone.
  400. virtual void addRecordToZone(
  401. const std::string (&columns)[ADD_COLUMN_COUNT]) = 0;
  402. /// Delete a single record from the zone to be updated.
  403. ///
  404. /// This method provides a simple interface to delete a record
  405. /// (a database "row") from the zone in the update context started by
  406. /// \c startUpdateZone(). The zone from which the record to be deleted
  407. /// is the one specified at the time of the \c startUpdateZone() call.
  408. ///
  409. /// A successful call to \c startUpdateZone() must have preceded to
  410. /// this call; otherwise a \c DataSourceError exception will be thrown.
  411. ///
  412. /// The record to be deleted is specified by a vector of strings that has
  413. /// exactly DEL_PARAM_COUNT number of elements. See DeleteRecordParams
  414. /// for the semantics of each element.
  415. ///
  416. /// \note In IXFR, TTL may also be specified, but we intentionally
  417. /// ignore that in this interface, because it's not guaranteed
  418. /// that all records have the same TTL (unlike the RRset
  419. /// assumption) and there can even be multiple records for the
  420. /// same name, type and rdata with different TTLs. If we only
  421. /// delete one of them, subsequent lookup will still return a
  422. /// positive answer, which would be confusing. It's a higher
  423. /// layer's responsibility to check if there is at least one
  424. /// record in the database that has the given TTL.
  425. ///
  426. /// Like \c addRecordToZone, derived class methods are not required to
  427. /// validate the semantics of the given parameters or to check if there
  428. /// is a record that matches the specified parameter; if there isn't
  429. /// it simply ignores the result.
  430. ///
  431. /// \exception DataSourceError Invalid call without starting a transaction,
  432. /// or other internal database error.
  433. ///
  434. /// \param params An array of strings that defines a record to be deleted
  435. /// from the zone.
  436. virtual void deleteRecordInZone(
  437. const std::string (&params)[DEL_PARAM_COUNT]) = 0;
  438. /// Start a general transaction.
  439. ///
  440. /// Each derived class version of this method starts a database
  441. /// transaction in a way specific to the database details. Any subsequent
  442. /// operations on the accessor are guaranteed to be not susceptible to
  443. /// any update attempts made during the transaction. The transaction
  444. /// must be terminated by either \c commit() or \c rollback().
  445. ///
  446. /// In practice, this transaction is intended to be used to perform
  447. /// a set of atomic reads and work as a read-only lock. So, in many
  448. /// cases \c commit() and \c rollback() will have the same effect.
  449. ///
  450. /// This transaction cannot coexist with an update transaction started
  451. /// by \c startUpdateZone(). Such an attempt will result in
  452. /// \c DataSourceError.
  453. ///
  454. /// \exception DataSourceError An attempt of nested transaction, or some
  455. /// internal database related error.
  456. virtual void startTransaction() = 0;
  457. /// Commit a transaction.
  458. ///
  459. /// This method completes a transaction started by \c startTransaction
  460. /// or \c startUpdateZone.
  461. ///
  462. /// A successful call to one of the "start" methods must have preceded to
  463. /// this call; otherwise a \c DataSourceError exception will be thrown.
  464. /// Once this method successfully completes, the transaction isn't
  465. /// considered to exist any more. So a new transaction can now be
  466. /// started. On the other hand, a duplicate call to this method after
  467. /// a successful completion of it is invalid and should result in
  468. /// a \c DataSourceError exception.
  469. ///
  470. /// If some internal database error happens, a \c DataSourceError
  471. /// exception must be thrown. In that case the transaction is still
  472. /// considered to be valid; the caller must explicitly rollback it
  473. /// or (if it's confident that the error is temporary) try to commit it
  474. /// again.
  475. ///
  476. /// \exception DataSourceError Call without a transaction, duplicate call
  477. /// to the method or internal database error.
  478. virtual void commit() = 0;
  479. /// Rollback any changes in a transaction made so far.
  480. ///
  481. /// This method rollbacks a transaction started by \c startTransaction or
  482. /// \c startUpdateZone. When it succeeds (it normally should, but see
  483. /// below), the underlying database should be reverted to the point
  484. /// before performing the corresponding "start" method.
  485. ///
  486. /// A successful call to one of the "start" method must have preceded to
  487. /// this call; otherwise a \c DataSourceError exception will be thrown.
  488. /// Once this method successfully completes, the transaction isn't
  489. /// considered to exist any more. So a new transaction can now be
  490. /// started. On the other hand, a duplicate call to this method after
  491. /// a successful completion of it is invalid and should result in
  492. /// a \c DataSourceError exception.
  493. ///
  494. /// Normally this method should not fail. But it may not always be
  495. /// possible to guarantee it depending on the characteristics of the
  496. /// underlying database system. So this interface doesn't require the
  497. /// actual implementation for the error free property. But if a specific
  498. /// implementation of this method can fail, it is encouraged to document
  499. /// when that can happen with its implication.
  500. ///
  501. /// \exception DataSourceError Call without a transaction, duplicate call
  502. /// to the method or internal database error.
  503. virtual void rollback() = 0;
  504. /// Install a single RR diff in difference sequences for zone update.
  505. ///
  506. /// This method inserts parameters of an update operation for a single RR
  507. /// (either adding or deleting one) in the underlying database.
  508. /// (These parameters would normally be a separate database table, but
  509. /// actual realization can differ in specific implementations).
  510. /// The information given via this method generally corresponds to either
  511. /// a single call to \c addRecordToZone() or \c deleteRecordInZone(),
  512. /// and this method is expected to be called immediately after (or before)
  513. /// a call to either of those methods.
  514. ///
  515. /// Note, however, that this method passes more detailed information
  516. /// than those update methods: it passes "serial", even if the diff
  517. /// is not for the SOA RR; it passes TTL for a diff that deletes an RR
  518. /// while in \c deleteRecordInZone() it's omitted. This is because
  519. /// the stored diffs are expected to be retrieved in the form that
  520. /// \c getRecordDiffs() is expected to meet. This means if the caller
  521. /// wants to use this method with other update operations, it must
  522. /// ensure the additional information is ready when this method is called.
  523. ///
  524. /// \note \c getRecordDiffs() is not yet implemented.
  525. ///
  526. /// The caller of this method must ensure that the added diffs via
  527. /// this method in a single transaction form an IXFR-style difference
  528. /// sequences: Each difference sequence is a sequence of RRs:
  529. /// an older version of SOA (to be deleted), zero or more other deleted
  530. /// RRs, the post-transaction SOA (to be added), and zero or more other
  531. /// added RRs. So, for example, the first call to this method in a
  532. /// transaction must always be deleting an SOA. Also, the \c serial
  533. /// parameter must be equal to the value of the serial field of the
  534. /// SOA that was last added or deleted (if the call is to add or delete
  535. /// an SOA RR, \c serial must be identical to the serial of that SOA).
  536. /// The underlying derived class implementation may or may not check
  537. /// this condition, but if the caller doesn't meet the condition
  538. /// a subsequent call to \c getRecordDiffs() will not work as expected.
  539. ///
  540. /// Any call to this method must be in a transaction, and, for now,
  541. /// it must be a transaction triggered by \c startUpdateZone() (that is,
  542. /// it cannot be a transaction started by \c startTransaction()).
  543. /// All calls to this method are considered to be part of an atomic
  544. /// transaction: Until \c commit() is performed, the added diffs are
  545. /// not visible outside the transaction; if \c rollback() is performed,
  546. /// all added diffs are canceled; and the added sequences are not
  547. /// affected by any concurrent attempt of adding diffs (conflict resolution
  548. /// is up to the database implementation).
  549. ///
  550. /// Also for now, all diffs are assumed to be for the zone that is
  551. /// being updated in the context of \c startUpdateZone(). So the
  552. /// \c zone_id parameter must be identical to the zone ID returned by
  553. /// \c startUpdateZone().
  554. ///
  555. /// In a future version we may loosen this condition so that diffs can be
  556. /// added in a generic transaction and may not even have to belong to
  557. /// a single zone. For this possible extension \c zone_id parameter is
  558. /// included even if it's redundant under the current restriction.
  559. ///
  560. /// The support for adding (or retrieving) diffs is optional; if it's
  561. /// not supported in a specific data source, this method for the
  562. /// corresponding derived class will throw an \c NotImplemented exception.
  563. ///
  564. /// \exception DataSourceError Invalid call without starting a transaction,
  565. /// zone ID doesn't match the zone being updated, or other internal
  566. /// database error.
  567. /// \exception NotImplemented Adding diffs is not supported in the
  568. /// data source.
  569. /// \exception Other The concrete derived method may throw other
  570. /// data source specific exceptions.
  571. ///
  572. /// \param zone_id The zone for the diff to be added.
  573. /// \param serial The SOA serial to which the diff belongs.
  574. /// \param operation Either \c DIFF_ADD or \c DIFF_DELETE.
  575. /// \param params An array of strings that defines a record for the diff.
  576. virtual void addRecordDiff(
  577. int zone_id, uint32_t serial, DiffOperation operation,
  578. const std::string (&params)[DIFF_PARAM_COUNT]) = 0;
  579. /// Clone the accessor with the same configuration.
  580. ///
  581. /// Each derived class implementation of this method will create a new
  582. /// accessor of the same derived class with the same configuration
  583. /// (such as the database server address) as that of the caller object
  584. /// and return it.
  585. ///
  586. /// Note that other internal states won't be copied to the new accessor
  587. /// even though the name of "clone" may indicate so. For example, even
  588. /// if the calling accessor is in the middle of a update transaction,
  589. /// the new accessor will not start a transaction to trace the same
  590. /// updates.
  591. ///
  592. /// The intended use case of cloning is to create a separate context
  593. /// where a specific set of database operations can be performed
  594. /// independently from the original accessor. The updater will use it
  595. /// so that multiple updaters can be created concurrently even if the
  596. /// underlying database system doesn't allow running multiple transactions
  597. /// in a single database connection.
  598. ///
  599. /// The underlying database system may not support the functionality
  600. /// that would be needed to implement this method. For example, it
  601. /// may not allow a single thread (or process) to have more than one
  602. /// database connections. In such a case the derived class implementation
  603. /// should throw a \c DataSourceError exception.
  604. ///
  605. /// \return A shared pointer to the cloned accessor.
  606. virtual boost::shared_ptr<DatabaseAccessor> clone() = 0;
  607. /**
  608. * \brief Returns a string identifying this dabase backend
  609. *
  610. * The returned string is mainly intended to be used for
  611. * debugging/logging purposes.
  612. *
  613. * Any implementation is free to choose the exact string content,
  614. * but it is advisable to make it a name that is distinguishable
  615. * from the others.
  616. *
  617. * \return the name of the database
  618. */
  619. virtual const std::string& getDBName() const = 0;
  620. /**
  621. * \brief It returns the previous name in DNSSEC order.
  622. *
  623. * This is used in DatabaseClient::findPreviousName and does more
  624. * or less the real work, except for working on strings.
  625. *
  626. * \param rname The name to ask for previous of, in reversed form.
  627. * We use the reversed form (see isc::dns::Name::reverse),
  628. * because then the case insensitive order of string representation
  629. * and the DNSSEC order correspond (eg. org.example.a is followed
  630. * by org.example.a.b which is followed by org.example.b, etc).
  631. * \param zone_id The zone to look through.
  632. * \return The previous name.
  633. * \note This function must return previous name even in case
  634. * the queried rname does not exist in the zone.
  635. * \note This method must skip under-the-zone-cut data (glue data).
  636. * This might be implemented by looking for NSEC records (as glue
  637. * data don't have them) in the zone or in some other way.
  638. *
  639. * \throw DataSourceError if there's a problem with the database.
  640. * \throw NotImplemented if this database doesn't support DNSSEC
  641. * or there's no previous name for the queried one (the NSECs
  642. * might be missing or the queried name is less or equal the
  643. * apex of the zone).
  644. */
  645. virtual std::string findPreviousName(int zone_id,
  646. const std::string& rname) const = 0;
  647. };
  648. /**
  649. * \brief Concrete data source client oriented at database backends.
  650. *
  651. * This class (together with corresponding versions of ZoneFinder,
  652. * ZoneIterator, etc.) translates high-level data source queries to
  653. * low-level calls on DatabaseAccessor. It calls multiple queries
  654. * if necessary and validates data from the database, allowing the
  655. * DatabaseAccessor to be just simple translation to SQL/other
  656. * queries to database.
  657. *
  658. * While it is possible to subclass it for specific database in case
  659. * of special needs, it is not expected to be needed. This should just
  660. * work as it is with whatever DatabaseAccessor.
  661. */
  662. class DatabaseClient : public DataSourceClient {
  663. public:
  664. /**
  665. * \brief Constructor
  666. *
  667. * It initializes the client with a database via the given accessor.
  668. *
  669. * \exception isc::InvalidParameter if accessor is NULL. It might throw
  670. * standard allocation exception as well, but doesn't throw anything else.
  671. *
  672. * \param rrclass The RR class of the zones that this client will handle.
  673. * \param accessor The accessor to the database to use to get data.
  674. * As the parameter suggests, the client takes ownership of the accessor
  675. * and will delete it when itself deleted.
  676. */
  677. DatabaseClient(isc::dns::RRClass rrclass,
  678. boost::shared_ptr<DatabaseAccessor> accessor);
  679. /**
  680. * \brief Corresponding ZoneFinder implementation
  681. *
  682. * The zone finder implementation for database data sources. Similarly
  683. * to the DatabaseClient, it translates the queries to methods of the
  684. * database.
  685. *
  686. * Application should not come directly in contact with this class
  687. * (it should handle it trough generic ZoneFinder pointer), therefore
  688. * it could be completely hidden in the .cc file. But it is provided
  689. * to allow testing and for rare cases when a database needs slightly
  690. * different handling, so it can be subclassed.
  691. *
  692. * Methods directly corresponds to the ones in ZoneFinder.
  693. */
  694. class Finder : public ZoneFinder {
  695. public:
  696. /**
  697. * \brief Constructor
  698. *
  699. * \param database The database (shared with DatabaseClient) to
  700. * be used for queries (the one asked for ID before).
  701. * \param zone_id The zone ID which was returned from
  702. * DatabaseAccessor::getZone and which will be passed to further
  703. * calls to the database.
  704. * \param origin The name of the origin of this zone. It could query
  705. * it from database, but as the DatabaseClient just searched for
  706. * the zone using the name, it should have it.
  707. */
  708. Finder(boost::shared_ptr<DatabaseAccessor> database, int zone_id,
  709. const isc::dns::Name& origin);
  710. // The following three methods are just implementations of inherited
  711. // ZoneFinder's pure virtual methods.
  712. virtual isc::dns::Name getOrigin() const;
  713. virtual isc::dns::RRClass getClass() const;
  714. /**
  715. * \brief Find an RRset in the datasource
  716. *
  717. * Searches the datasource for an RRset of the given name and
  718. * type. If there is a CNAME at the given name, the CNAME rrset
  719. * is returned.
  720. * (this implementation is not complete, and currently only
  721. * does full matches, CNAMES, and the signatures for matches and
  722. * CNAMEs)
  723. * \note target was used in the original design to handle ANY
  724. * queries. This is not implemented yet, and may use
  725. * target again for that, but it might also use something
  726. * different. It is left in for compatibility at the moment.
  727. * \note options are ignored at this moment
  728. *
  729. * \note Maybe counter intuitively, this method is not a const member
  730. * function. This is intentional; some of the underlying implementations
  731. * are expected to use a database backend, and would internally contain
  732. * some abstraction of "database connection". In the most strict sense
  733. * any (even read only) operation might change the internal state of
  734. * such a connection, and in that sense the operation cannot be considered
  735. * "const". In order to avoid giving a false sense of safety to the
  736. * caller, we indicate a call to this method may have a surprising
  737. * side effect. That said, this view may be too strict and it may
  738. * make sense to say the internal database connection doesn't affect
  739. * external behavior in terms of the interface of this method. As
  740. * we gain more experiences with various kinds of backends we may
  741. * revisit the constness.
  742. *
  743. * \exception DataSourceError when there is a problem reading
  744. * the data from the dabase backend.
  745. * This can be a connection, code, or
  746. * data (parse) error.
  747. *
  748. * \param name The name to find
  749. * \param type The RRType to find
  750. * \param target Unused at this moment
  751. * \param options Options about how to search.
  752. * See ZoneFinder::FindOptions.
  753. */
  754. virtual FindResult find(const isc::dns::Name& name,
  755. const isc::dns::RRType& type,
  756. isc::dns::RRsetList* target = NULL,
  757. const FindOptions options = FIND_DEFAULT);
  758. /**
  759. * \brief Implementation of ZoneFinder::findPreviousName method.
  760. */
  761. virtual isc::dns::Name findPreviousName(const isc::dns::Name& query)
  762. const;
  763. /**
  764. * \brief The zone ID
  765. *
  766. * This function provides the stored zone ID as passed to the
  767. * constructor. This is meant for testing purposes and normal
  768. * applications shouldn't need it.
  769. */
  770. int zone_id() const { return (zone_id_); }
  771. /**
  772. * \brief The database accessor.
  773. *
  774. * This function provides the database accessor stored inside as
  775. * passed to the constructor. This is meant for testing purposes and
  776. * normal applications shouldn't need it.
  777. */
  778. const DatabaseAccessor& getAccessor() const {
  779. return (*accessor_);
  780. }
  781. /// \brief Search result of \c findDelegationPoint().
  782. ///
  783. /// This is a tuple combining the result of the search - a status code
  784. /// and a pointer to the RRset found - together with additional
  785. /// information needed for subsequent processing, an indication of
  786. /// the first NS RRset found in the search and the number of labels
  787. /// in the last non-empty domain encountered in the search. It is
  788. /// used by \c findDelegationPoint().
  789. ///
  790. /// The last two items are located naturally in the search and although
  791. /// not strictly part of the result, they are passed back to avoid
  792. /// another (duplicate) search later in the processing.
  793. ///
  794. /// Note that the code and rrset elements are the same as that in
  795. /// the \c ZoneFinder::FindResult struct: this structure could be
  796. /// derived from that one, but as it is used just once in the code and
  797. /// will never be treated as a \c FindResult, the obscurity involved in
  798. /// deriving it from a parent class was deemed not worthwhile.
  799. struct DelegationSearchResult {
  800. DelegationSearchResult(const ZoneFinder::Result param_code,
  801. const isc::dns::RRsetPtr param_rrset,
  802. const isc::dns::RRsetPtr param_ns,
  803. size_t param_last_known) :
  804. code(param_code), rrset(param_rrset),
  805. first_ns(param_ns),
  806. last_known(param_last_known)
  807. {}
  808. const ZoneFinder::Result code; ///< Result code
  809. const isc::dns::RRsetPtr rrset; ///< Pointer to RRset found
  810. const isc::dns::RRsetPtr first_ns; ///< Pointer to first NS found
  811. const size_t last_known; ///< No. labels in last non-empty domain
  812. };
  813. /// \brief Search result of \c findWildcard().
  814. ///
  815. /// This is a tuple combining the result of the search - a status code
  816. /// and a pointer to the RRset found - together with additional
  817. /// information needed for subsequent processing: if there is not a
  818. /// match for the data sought, then whether there is no match for the
  819. /// wildcard or where there is a match, but no RRs of the type
  820. /// requested.
  821. ///
  822. /// Note that the code and rrset elements are the same as that in
  823. /// the \c ZoneFinder::FindResult struct: this structure could be
  824. /// derived from that one, but as it is used just once in the code and
  825. /// will never be treated as a \c FindResult, the obscurity involved in
  826. /// deriving it from a parent class was deemed not worthwhile.
  827. struct WildcardSearchResult {
  828. WildcardSearchResult(const ZoneFinder::Result param_code,
  829. const isc::dns::RRsetPtr param_rrset,
  830. const bool param_found) :
  831. code(param_code), rrset(param_rrset),
  832. records_found(param_found)
  833. {}
  834. const ZoneFinder::Result code; ///< Result code
  835. const isc::dns::RRsetPtr rrset; ///< Pointer to RRset found
  836. const bool records_found; ///< true => NXRRSET
  837. };
  838. private:
  839. boost::shared_ptr<DatabaseAccessor> accessor_;
  840. const int zone_id_;
  841. const isc::dns::Name origin_;
  842. //
  843. /// \brief Shortcut name for the result of getRRsets
  844. typedef std::pair<bool, std::map<dns::RRType, dns::RRsetPtr> >
  845. FoundRRsets;
  846. /// \brief Just shortcut for set of types
  847. typedef std::set<dns::RRType> WantedTypes;
  848. /**
  849. * \brief Searches database for RRsets of one domain.
  850. *
  851. * This method scans RRs of single domain specified by name and
  852. * extracts any RRsets found and requested by parameters.
  853. *
  854. * It is used internally by find(), because it is called multiple
  855. * times (usually with different domains).
  856. *
  857. * \param name Which domain name should be scanned.
  858. * \param types List of types the caller is interested in.
  859. * \param check_ns If this is set to true, it checks nothing lives
  860. * together with NS record (with few little exceptions, like RRSIG
  861. * or NSEC). This check is meant for non-apex NS records.
  862. * \param construct_name If this is NULL, the resulting RRsets have
  863. * their name set to name. If it is not NULL, it overrides the name
  864. * and uses this one (this can be used for wildcard synthesized
  865. * records).
  866. * \return A pair, where the first element indicates if the domain
  867. * contains any RRs at all (not only the requested, it may happen
  868. * this is set to true, but the second part is empty). The second
  869. * part is map from RRtypes to RRsets of the corresponding types.
  870. * If the RRset is not present in DB, the RRtype is not there at
  871. * all (so you'll not find NULL pointer in the result).
  872. * \throw DataSourceError If there's a low-level error with the
  873. * database or the database contains bad data.
  874. */
  875. FoundRRsets getRRsets(const std::string& name,
  876. const WantedTypes& types, bool check_ns,
  877. const std::string* construct_name = NULL);
  878. /**
  879. * \brief Find delegation point
  880. *
  881. * Given a name, searches through the superdomains from the origin
  882. * down, searching for a point that indicates a delegation (i.e. an
  883. * NS record or a DNAME).
  884. *
  885. * The method operates in two modes, non-glue-ok and glue-ok modes:
  886. *
  887. * In non-glue-ok mode, the search is made purely for the NS or DNAME
  888. * RR. The zone is searched from the origin down looking for one
  889. * of these RRTypes (and ignoring the NS records at the zone origin).
  890. * A status is returned indicating what is found: DNAME, DELEGATION
  891. * of SUCCESS, the last indicating that nothing was found, together
  892. * with a pointer to the relevant RR.
  893. *
  894. * In glue-ok mode, the first NS encountered in the search (apart from
  895. * the NS at the zone apex) is remembered but otherwise NS records are
  896. * ignored and the search attempts to find a DNAME. The result is
  897. * returned in the same format, along with a pointer to the first non-
  898. * apex NS (if found).
  899. *
  900. * \param name The name to find
  901. * \param options Options about how to search. See the documentation for
  902. * ZoneFinder::FindOptions.
  903. *
  904. * \return Tuple holding the result of the search - the RRset of the
  905. * delegation point and the type of the point (DELEGATION or
  906. * DNAME) - and associated information. This latter item
  907. * comprises two pieces of data: a pointer to the highest
  908. * encountered NS, and the number of labels in the last known
  909. * non-empty domain. The associated information is found as
  910. * a natural part of the search for the delegation point and
  911. * is used later in the find() processing; it is passed back
  912. * to avoid the need to perform a second search to obtain it.
  913. */
  914. DelegationSearchResult
  915. findDelegationPoint(const isc::dns::Name& name,
  916. const FindOptions options);
  917. /**
  918. * \brief Find wildcard match
  919. *
  920. * Having found that the name is not an empty non-terminal, this
  921. * searches the zone for for wildcards that match the name.
  922. *
  923. * It searches superdomains of the name from the zone origin down
  924. * looking for a wildcard in the zone that matches the name. There
  925. * are several cases to consider:
  926. *
  927. * - If the previous search for a delegation point has found that
  928. * there is an NS at the superdomain of the point at which the
  929. * wildcard is found, the delegation is returned.
  930. * - If there is a match to the name, an appropriate status is
  931. * returned (match on requested type, delegation, cname, or just
  932. * the indication of a match but no RRs relevant to the query).
  933. * - If the match is to an non-empty non-terminal wildcard, a
  934. * wildcard NXRRSET is returned.
  935. *
  936. * Note that if DNSSEC is enabled for the search and the zone uses
  937. * NSEC for authenticated denial of existence, the search may
  938. * return NSEC records.
  939. *
  940. * \param name The name to find
  941. * \param type The RRType to find
  942. * \param options Options about how to search. See the documentation
  943. * for ZoneFinder::FindOptions.
  944. * \param first_ns A pointer to the first NS found in a search for
  945. * the name (will only be non-null in glue-ok mode).
  946. * \param last_known the number of labels in the last known non-empty
  947. * domain in the name.
  948. *
  949. * \return Tuple holding the result of the search - the RRset of the
  950. * wildcard records matching the name, together with a status
  951. * indicating the match type (e.g. CNAME at the wildcard
  952. * match, no RRs of the requested type at the wildcard,
  953. * success due to an exact match). Also returned if there
  954. * is no match is an indication as to whether there was an
  955. * NXDOMAIN or an NXRRSET.
  956. */
  957. WildcardSearchResult
  958. findWildcardMatch(const isc::dns::Name& name,
  959. const isc::dns::RRType& type, const FindOptions options,
  960. isc::dns::RRsetPtr& first_ns, size_t last_known);
  961. /**
  962. * \brief Checks if something lives below this domain.
  963. *
  964. * This looks if there's any subdomain of the given name. It can be
  965. * used to test if domain is empty non-terminal.
  966. *
  967. * \param name The domain to check.
  968. */
  969. bool hasSubdomains(const std::string& name);
  970. /**
  971. * \brief Get the NSEC covering a name.
  972. *
  973. * This one calls findPreviousName on the given name and extracts an NSEC
  974. * record on the result. It handles various error cases. The method exists
  975. * to share code present at more than one location.
  976. */
  977. dns::RRsetPtr findNSECCover(const dns::Name& name);
  978. /**
  979. * \brief Convenience type shortcut.
  980. *
  981. * To find stuff in the result of getRRsets.
  982. */
  983. typedef std::map<dns::RRType, dns::RRsetPtr>::const_iterator
  984. FoundIterator;
  985. };
  986. /**
  987. * \brief Find a zone in the database
  988. *
  989. * This queries database's getZone to find the best matching zone.
  990. * It will propagate whatever exceptions are thrown from that method
  991. * (which is not restricted in any way).
  992. *
  993. * \param name Name of the zone or data contained there.
  994. * \return FindResult containing the code and an instance of Finder, if
  995. * anything is found. However, application should not rely on the
  996. * ZoneFinder being instance of Finder (possible subclass of this class
  997. * may return something else and it may change in future versions), it
  998. * should use it as a ZoneFinder only.
  999. */
  1000. virtual FindResult findZone(const isc::dns::Name& name) const;
  1001. /**
  1002. * \brief Get the zone iterator
  1003. *
  1004. * The iterator allows going through the whole zone content. If the
  1005. * underlying DatabaseConnection is implemented correctly, it should
  1006. * be possible to have multiple ZoneIterators at once and query data
  1007. * at the same time.
  1008. *
  1009. * \exception DataSourceError if the zone doesn't exist.
  1010. * \exception isc::NotImplemented if the underlying DatabaseConnection
  1011. * doesn't implement iteration. But in case it is not implemented
  1012. * and the zone doesn't exist, DataSourceError is thrown.
  1013. * \exception Anything else the underlying DatabaseConnection might
  1014. * want to throw.
  1015. * \param name The origin of the zone to iterate.
  1016. * \param separate_rrs If true, the iterator will return each RR as a
  1017. * new RRset object. If false, the iterator will
  1018. * combine consecutive RRs with the name and type
  1019. * into 1 RRset. The capitalization of the RRset will
  1020. * be that of the first RR read, and TTLs will be
  1021. * adjusted to the lowest one found.
  1022. * \return Shared pointer to the iterator (it will never be NULL)
  1023. */
  1024. virtual ZoneIteratorPtr getIterator(const isc::dns::Name& name,
  1025. bool separate_rrs = false) const;
  1026. /// This implementation internally clones the accessor from the one
  1027. /// used in the client and starts a separate transaction using the cloned
  1028. /// accessor. The returned updater will be able to work separately from
  1029. /// the original client.
  1030. virtual ZoneUpdaterPtr getUpdater(const isc::dns::Name& name,
  1031. bool replace,
  1032. bool journaling = false) const;
  1033. private:
  1034. /// \brief The RR class that this client handles.
  1035. const isc::dns::RRClass rrclass_;
  1036. /// \brief The accessor to our database.
  1037. const boost::shared_ptr<DatabaseAccessor> accessor_;
  1038. };
  1039. }
  1040. }
  1041. #endif // __DATABASE_DATASRC_H
  1042. // Local Variables:
  1043. // mode: c++
  1044. // End: