address_request_callback.h 2.7 KB

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