auth_srv.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 __AUTH_SRV_H
  16. #define __AUTH_SRV_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. class Message;
  25. class MessageRenderer;
  26. }
  27. namespace xfr {
  28. class AbstractXfroutClient;
  29. };
  30. }
  31. namespace asiolink {
  32. class IOMessage;
  33. }
  34. class AuthSrvImpl;
  35. class AuthSrv {
  36. ///
  37. /// \name Constructors, Assignment Operator and Destructor.
  38. ///
  39. /// Note: The copy constructor and the assignment operator are
  40. /// intentionally defined as private.
  41. //@{
  42. private:
  43. AuthSrv(const AuthSrv& source);
  44. AuthSrv& operator=(const AuthSrv& source);
  45. public:
  46. /// The constructor.
  47. ///
  48. /// \param use_cache Whether to enable hot spot cache for lookup results.
  49. /// \param xfrout_client Communication interface with a separate xfrout
  50. /// process. It's normally a reference to an xfr::XfroutClient object,
  51. /// but can refer to a local mock object for testing (or other
  52. /// experimental) purposes.
  53. AuthSrv(const bool use_cache,
  54. isc::xfr::AbstractXfroutClient& xfrout_client);
  55. ~AuthSrv();
  56. //@}
  57. /// \return \c true if the \message contains a response to be returned;
  58. /// otherwise \c false.
  59. bool processMessage(const asiolink::IOMessage& io_message,
  60. isc::dns::Message& message,
  61. isc::dns::MessageRenderer& response_renderer);
  62. void setVerbose(bool on);
  63. bool getVerbose() const;
  64. isc::data::ConstElementPtr updateConfig(isc::data::ConstElementPtr config);
  65. isc::config::ModuleCCSession* configSession() const;
  66. void setConfigSession(isc::config::ModuleCCSession* config_session);
  67. asiolink::DNSProvider* getDNSProvider() {
  68. return (dns_provider_);
  69. }
  70. asiolink::CheckinProvider* getCheckinProvider() {
  71. return (checkin_provider_);
  72. }
  73. ///
  74. /// Note: this interface is tentative. We'll revisit the ASIO and session
  75. /// frameworks, at which point the session will probably be passed on
  76. /// construction of the server.
  77. ///
  78. /// \param xfrin_session A Session object over which NOTIFY message
  79. /// information is exchanged with a XFRIN handler.
  80. /// The session must be established before setting in the server
  81. /// object.
  82. /// Ownership isn't transferred: the caller is responsible for keeping
  83. /// this object to be valid while the server object is working and for
  84. /// disconnecting the session and destroying the object when the server
  85. ///
  86. void setXfrinSession(isc::cc::AbstractSession* xfrin_session);
  87. private:
  88. AuthSrvImpl* impl_;
  89. asiolink::CheckinProvider* checkin_provider_;
  90. asiolink::DNSProvider* dns_provider_;
  91. };
  92. #endif // __AUTH_SRV_H
  93. // Local Variables:
  94. // mode: c++
  95. // End: