recursor.h 2.9 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 __RECURSOR_H
  16. #define __RECURSOR_H 1
  17. #include <string>
  18. #include <cc/data.h>
  19. #include <config/ccsession.h>
  20. #include <asiolink/asiolink.h>
  21. namespace isc {
  22. namespace dns {
  23. class InputBuffer;
  24. }
  25. }
  26. namespace asiolink {
  27. class IOMessage;
  28. }
  29. class RecursorImpl;
  30. class Recursor {
  31. ///
  32. /// \name Constructors, Assignment Operator and Destructor.
  33. ///
  34. /// Note: The copy constructor and the assignment operator are
  35. /// intentionally defined as private.
  36. //@{
  37. private:
  38. Recursor(const Recursor& source);
  39. Recursor& operator=(const Recursor& source);
  40. public:
  41. /// The constructor.
  42. ///
  43. /// \param forward The address of the name server to which requests
  44. /// should be forwarded. (In the future, when the server is running
  45. /// in forwarding mode, the forward nameserver addresses will be set
  46. /// via the config channel instaed.)
  47. Recursor(const char& forward);
  48. ~Recursor();
  49. //@}
  50. /// \return \c true if the \message contains a response to be returned;
  51. /// otherwise \c false.
  52. void processMessage(const asiolink::IOMessage& io_message,
  53. isc::dns::MessagePtr message,
  54. isc::dns::OutputBufferPtr buffer,
  55. asiolink::IOServer* server);
  56. void setVerbose(bool on);
  57. bool getVerbose() const;
  58. isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
  59. isc::config::ModuleCCSession* configSession() const;
  60. void setConfigSession(isc::config::ModuleCCSession* config_session);
  61. void setIOService(asiolink::IOService& ios);
  62. asiolink::IOService& getIOService() const { return (*io_); }
  63. asiolink::DNSLookup* getDNSLookupProvider() {
  64. return (dns_lookup_);
  65. }
  66. asiolink::DNSAnswer* getDNSAnswerProvider() {
  67. return (dns_answer_);
  68. }
  69. asiolink::IOCallback* getCheckinProvider() {
  70. return (checkin_);
  71. }
  72. private:
  73. RecursorImpl* impl_;
  74. asiolink::IOService* io_;
  75. asiolink::IOCallback* checkin_;
  76. asiolink::DNSLookup* dns_lookup_;
  77. asiolink::DNSAnswer* dns_answer_;
  78. };
  79. #endif // __RECURSOR_H
  80. // Local Variables:
  81. // mode: c++
  82. // End: