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 __GLUE_HINTS_H
16 : : #define __GLUE_HINTS_H
17 : :
18 : : #include <vector>
19 : :
20 : : #include <dns/message.h>
21 : :
22 : : #include "nsas_types.h"
23 : : #include "nameserver_address.h"
24 : :
25 : : namespace isc {
26 : : namespace nsas {
27 : :
28 [ + - ]: 402045 : class GlueHints {
29 : : public:
30 : : /// \brief Empty constructor
31 : 804086 : GlueHints() {};
32 : :
33 : : /// \brief Constructor
34 : : ///
35 : : /// Creates a glue hint object, with the glue data found in the
36 : : /// given packet.
37 : : ///
38 : : /// \param zone_name The name of the zone to find glue for
39 : : /// \param delegation_message The Message that may contain glue
40 : : GlueHints(const std::string& zone_name,
41 : : const isc::dns::Message& delegation_message);
42 : :
43 : : /// \brief Check if there is glue for the given AddressFamily
44 : : ///
45 : : /// \param family the AddressFamily to check for glue for
46 : : /// \return true if there is glue for that family. false if not
47 : : bool hasGlue(AddressFamily family) const;
48 : :
49 : : /// \brief Get a random glue address for the given family
50 : : ///
51 : : /// ONLY call this if hasGlue() returned true.
52 : : ///
53 : : /// \param family the AddressFamily to get glue for
54 : : /// \return a NameserverAddress specified by the glue
55 : : NameserverAddress getGlue(AddressFamily family) const;
56 : :
57 : : private:
58 : : void addGlueForName(const isc::dns::Name& name,
59 : : const isc::dns::Message& message);
60 : : void addGlueForRRset(const isc::dns::RRsetPtr rrset,
61 : : const isc::dns::Message& message);
62 : :
63 : : std::vector<NameserverAddress> addresses_v4;
64 : : std::vector<NameserverAddress> addresses_v6;
65 : : };
66 : :
67 : : }
68 : : }
69 : :
70 : :
71 : : #endif // __GLUE_HINTS_H
|