summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-03 15:49:22 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-03 15:49:22 +0000
commitc5b44768744d758e8f66679bada353039a206b16 (patch)
tree3970147d4ca6e85a4171d8ab7c8a4a3aadc167df /include
parent0c1916945a52232d46b4661339e7eed2ce3e665d (diff)
Support CNAME, AAAA
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4673 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/dns.h44
1 files changed, 32 insertions, 12 deletions
diff --git a/include/dns.h b/include/dns.h
index 9d6f161df..7b96f792d 100644
--- a/include/dns.h
+++ b/include/dns.h
@@ -88,6 +88,25 @@ typedef std::map<int,DNSRequest*> requestlist;
typedef requestlist::iterator requestlist_iter;
/**
+ * Query and resource record types
+ */
+enum QueryType
+{
+ DNS_QUERY_A = 1, /* 'A' record: an ipv4 address */
+ DNS_QUERY_CNAME = 5, /* 'CNAME' record: An alias */
+ DNS_QUERY_PTR = 12, /* 'PTR' record: a hostname */
+ DNS_QUERY_AAAA = 28, /* 'AAAA' record: an ipv6 address */
+};
+
+#ifdef IPV6
+const QueryType DNS_QUERY_FORWARD = DNS_QUERY_AAAA;
+const QueryType DNS_QUERY_REVERSE = DNS_QUERY_PTR;
+#else
+const QueryType DNS_QUERY_FORWARD = DNS_QUERY_A;
+const QueryType DNS_QUERY_REVERSE = DNS_QUERY_PTR;
+#endif
+
+/**
* The Resolver class is a high-level abstraction for resolving DNS entries.
* It can do forward and reverse IPv4 lookups, and where IPv6 is supported, will
* also be able to do those, transparent of protocols. Module developers must
@@ -107,7 +126,7 @@ class Resolver : public Extensible
/**
* True if a forward lookup is being performed, false if otherwise
*/
- bool fwd;
+ QueryType querytype;
/**
* The DNS erver being used for lookups. If this is an empty string,
* the value of ServerConfig::DNSServer is used instead.
@@ -137,7 +156,7 @@ class Resolver : public Extensible
* event a lookup could not be allocated, or a similar hard error occurs such as
* the network being down.
*/
- Resolver(const std::string &source, bool forward);
+ Resolver(const std::string &source, QueryType qt);
/**
* The default destructor does nothing.
*/
@@ -165,15 +184,6 @@ class Resolver : public Extensible
int GetId();
};
-/**
- * Query and resource record types
- */
-enum QueryType
-{
- DNS_QUERY_A = 1, /* 'A' record: an IP address */
- DNS_QUERY_PTR = 12 /* 'PTR' record: a hostname */
-};
-
/** DNS is a singleton class used by the core to dispatch dns
* requests to the dns server, and route incoming dns replies
* back to Resolver objects, based upon the request ID. You
@@ -244,7 +254,7 @@ class DNS : public Extensible
static int GetMasterSocket();
/**
- * Start the lookup of an ip from a hostname
+ * Start the lookup of an ipv4 from a hostname
*/
int GetIP(const char* name);
@@ -254,6 +264,16 @@ class DNS : public Extensible
int GetName(const insp_inaddr* ip);
/**
+ * Start lookup of an ipv6 from a hostname
+ */
+ int GetIP6(const char *name);
+
+ /**
+ * Start lookup of a CNAME from another hostname
+ */
+ int GetCName(const char* alias);
+
+ /**
* Fetch the result string (an ip or host)
* and/or an error message to go with it.
*/