datasrc_util.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // Copyright (C) 2012 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 AUTH_DATA_SOURCE_UTIL_H
  15. #define AUTH_DATA_SOURCE_UTIL_H 1
  16. #include <dns/name.h>
  17. #include <dns/rrclass.h>
  18. #include <istream>
  19. namespace isc {
  20. namespace auth {
  21. namespace unittest {
  22. /// \brief Create an SQLite3 database file for a given zone from a stream.
  23. ///
  24. /// This function creates an SQLite3 DB file for the specified zone
  25. /// with specified content. The zone will be created in the given
  26. /// SQLite3 database file. The database file does not have to exist;
  27. /// this function will automatically create a new file for the test
  28. /// based on a template that only contains the necessary schema. If
  29. /// the given file already exists this function overrides the content
  30. /// (so basically the file must be an ephemeral one only for that test
  31. /// case).
  32. ///
  33. /// The input stream must produce strings as the corresponding
  34. /// \c dns::masterLoad() function expects.
  35. ///
  36. /// \param zclass The RR class of the zone
  37. /// \param zname The origin name of the zone
  38. /// \param db_file The SQLite3 data base file in which the zone data should be
  39. /// installed.
  40. /// \param rr_stream An input stream that produces zone data.
  41. void
  42. createSQLite3DB(dns::RRClass zclass, const dns::Name& zname,
  43. const char* const db_file, std::istream& rr_stream);
  44. } // end of unittest
  45. } // end of auth
  46. } // end of isc
  47. #endif // AUTH_DATA_SOURCE_UTIL_H
  48. // Local Variables:
  49. // mode: c++
  50. // End: