address_request_callback.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright (C) 2010 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 ADDRESS_REQUEST_CALLBACK_H
  15. #define ADDRESS_REQUEST_CALLBACK_H
  16. #include "asiolink.h"
  17. #include "nameserver_address.h"
  18. namespace isc {
  19. namespace nsas {
  20. /// \brief Callback When Address Obtained
  21. ///
  22. /// This is the callback object used to return an address of a nameserver to a
  23. /// caller. It (or a subclass of it) is passed to the NSAS when a request is
  24. /// made for the address of a nameserver. When an address is available,
  25. /// methods on the passed objects are called.
  26. ///
  27. /// Note that there is no guarantee as to when the methods are called; they
  28. /// could be called after the function call that made the address request has
  29. /// returned the caller. Equally, the call could complete before that function
  30. /// call returns. It is up to the caller to handle all cases.
  31. ///
  32. /// In terms of use, a shared pointer to this object is passed to the NSAS.
  33. /// The NSAS will store the object via a shared pointer and after the callback
  34. /// will delete the pointer. Whether this results in the deletion of the
  35. /// callback object is up to the caller - if the caller wants to retain it
  36. /// they should keep the shared pointer.
  37. class AddressRequestCallback {
  38. public:
  39. /// Default constructor, copy constructor and assignment operator
  40. /// are implicitly present and are OK.
  41. /// \brief Virtual Destructor
  42. virtual ~AddressRequestCallback()
  43. {}
  44. /// \brief Success Callback
  45. ///
  46. /// This method is used when an address has been retrieved for the request.
  47. ///
  48. /// \param address Address to be used to access the nameserver.
  49. virtual void success(const NameserverAddress& address) = 0;
  50. /// \brief Unreachable
  51. ///
  52. /// This method is called when a request is made for an address, but all
  53. /// the addresses for the zone are marked as unreachable. This may be
  54. /// due to the NS records being unobtainable, or the A records for known
  55. /// nameservers being unobtainable.
  56. virtual void unreachable() = 0;
  57. };
  58. } // namespace nsas
  59. } // namespace isc
  60. #endif // ADDRESS_REQUEST_CALLBACK_H