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