data_source_plot.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright (C) 2009 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. // $Id$
  15. #ifndef __DATA_SOURCE_SIMPLE_H
  16. #define __DATA_SOURCE_SIMPLE_H
  17. #include <dns/buffer.h>
  18. #include <dns/name.h>
  19. #include <dns/rdata.h>
  20. #include <dns/rrclass.h>
  21. #include <dns/rrtype.h>
  22. #include <dns/rrset.h>
  23. #include <dns/message.h>
  24. #include <cc/data.h>
  25. #include "common.h"
  26. #include "data_source.h"
  27. #include "zoneset.h"
  28. namespace isc {
  29. namespace dns {
  30. class DataSourceParkingLot : public DataSource {
  31. public:
  32. DataSourceParkingLot();
  33. void init() {};
  34. void close() {};
  35. bool hasZoneFor(const Name& name, Name &zone_name);
  36. SearchResult findRRsets(const isc::dns::Name& zone_name,
  37. const isc::dns::Name& name,
  38. const isc::dns::RRClass& clas,
  39. const isc::dns::RRType& type) const;
  40. /* move these to private (or to zoneset) and the calling functions
  41. * from parkinglot to here? */
  42. void serve(std::string zone_name);
  43. void clear_zones() { zones.clear_zones(); };
  44. void clearARecords() { a_records.clear(); };
  45. void clearAAAARecords() { aaaa_records.clear(); };
  46. void clearNSRecords() { ns_records.clear(); };
  47. void addARecord(std::string data);
  48. void addAAAARecord(std::string data);
  49. void addNSRecord(std::string data);
  50. void setSOARecord(isc::dns::rdata::RdataPtr soa_record);
  51. /// Do direct 'search' in database, no extra processing,
  52. /// and add the resulting rrsets to the specified section
  53. /// in the given message
  54. /// Once the dns logic is moved from parkinglot to this class,
  55. /// we should probably make this private
  56. SearchResult::status_type addToMessage(Message& msg,
  57. const isc::dns::Section& section,
  58. const isc::dns::Name& zone_name,
  59. const isc::dns::Name& name,
  60. const isc::dns::RRClass& clas,
  61. const isc::dns::RRType& type) const;
  62. private:
  63. //
  64. void setDefaultZoneData();
  65. std::vector<isc::dns::rdata::RdataPtr> a_records, aaaa_records, ns_records;
  66. isc::dns::rdata::RdataPtr soa;
  67. ZoneSet zones;
  68. };
  69. }
  70. }
  71. #endif
  72. // Local Variables:
  73. // mode: c++
  74. // End: