InspIRCd
2.0
|
#include <dns.h>
Public Member Functions | |
int | GetIP (const char *name) |
int | GetNameForce (const char *ip, ForceProtocol fp) |
int | GetIP6 (const char *name) |
int | GetCName (const char *alias) |
DNSResult | GetResult () |
void | HandleEvent (EventType et, int errornum=0) |
bool | AddResolverClass (Resolver *r) |
DNSRequest * | AddQuery (DNSHeader *header, int &id, const char *original) |
DNS () | |
void | Rehash () |
~DNS () | |
void | CleanResolvers (Module *module) |
CachedQuery * | GetCache (const std::string &source) |
void | DelCache (const std::string &source) |
int | ClearCache () |
int | PruneCache () |
![]() | |
int | GetFd () const |
int | GetEventMask () const |
void | SetFd (int FD) |
EventHandler () | |
virtual | ~EventHandler () |
![]() | |
virtual CullResult | cull () |
Static Public Member Functions | |
static void | FillResourceRecord (ResourceRecord *rr, const unsigned char *input) |
static void | FillHeader (DNSHeader *header, const unsigned char *input, const int length) |
static void | EmptyHeader (unsigned char *output, const DNSHeader *header, const int length) |
static void | MakeIP6Int (char *query, const in6_addr *ip) |
Public Attributes | |
irc::sockets::sockaddrs | myserver |
Resolver * | Classes [MAX_REQUEST_ID] |
DNSRequest * | requests [MAX_REQUEST_ID] |
Static Public Attributes | |
static const int | QUERY_PORT = 53 |
Additional Inherited Members | |
![]() | |
int | fd |
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 should never use this class yourself.
DNS::DNS | ( | ) |
The constructor initialises the dns socket, and clears the request lists.
Initialise the DNS UDP socket so that we can send requests
DNS::~DNS | ( | ) |
Destructor
Close the master socket
DNSRequest * DNS::AddQuery | ( | DNSHeader * | header, |
int & | id, | ||
const char * | original | ||
) |
Add a query to the list to be sent
Add a query with a predefined header, and allocate an ID for it.
bool DNS::AddResolverClass | ( | Resolver * | r | ) |
Add a Resolver* to the list of active classes
Add a derived Resolver to the working set
void DNS::CleanResolvers | ( | Module * | module | ) |
Clean out all dns resolvers owned by a particular module, to make unloading a module safe if there are dns requests currently in progress.
int DNS::ClearCache | ( | ) |
Clear all items from the DNS cache immediately.
void DNS::DelCache | ( | const std::string & | source | ) |
Delete a cached item from the DNS cache.
source | An IP or hostname to remove |
|
inlinestatic |
Empty out a header into a data stream ready for transmission "on the wire"
Empty a DNSHeader class out into raw data, ready for transmission
|
inlinestatic |
Fill a header with data from input limited by a length
Fill a DNSHeader class based on raw data input of a given length
|
inlinestatic |
Fill an rr (resource record) with data from input
Fill a ResourceRecord class based on raw data input
CachedQuery * DNS::GetCache | ( | const std::string & | source | ) |
Return the cached value of an IP or hostname
source | An IP or hostname to find in the cache. |
int DNS::GetCName | ( | const char * | alias | ) |
Start lookup of a CNAME from another hostname
Start lookup of a cname to another name
int DNS::GetIP | ( | const char * | name | ) |
Start the lookup of an ipv4 from a hostname
Start lookup of an hostname to an IP address
int DNS::GetIP6 | ( | const char * | name | ) |
Start lookup of an ipv6 from a hostname
Start lookup of an hostname to an IPv6 address
int DNS::GetNameForce | ( | const char * | ip, |
ForceProtocol | fp | ||
) |
Start lookup of a hostname from an ip, but force a specific protocol to be used for the lookup for example to perform an ipv6 reverse lookup.
Start lookup of an IP address to a hostname
DNSResult DNS::GetResult | ( | ) |
Fetch the result string (an ip or host) and/or an error message to go with it.
Return the next id which is ready, and the result attached to it
|
virtual |
Handle a SocketEngine read event Inherited from EventHandler
Process a socket read event
Implements EventHandler.
|
static |
Turn an in6_addr into a .ip6.arpa domain
Build an ipv6 reverse domain from an in6_addr
int DNS::PruneCache | ( | ) |
Prune the DNS cache, e.g. remove all expired items and rehash the cache buckets, but leave items in the hash which are still valid.
void DNS::Rehash | ( | ) |
Re-initialize the DNS subsystem.
|
static |
The port number DNS requests are made on, and replies have as a source-port number.
DNSRequest* DNS::requests[MAX_REQUEST_ID] |
Requests that are currently 'in flight'