auth_srv.h 3.7 KB

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