pdns.h File Reference
`#include <ptlib/sockets.h>`
`#include <ptclib/random.h>`
`#include <ptclib/url.h>`
`#include <arpa/nameser.h>`
`#include <resolv.h>`

Go to the source code of this file.

## Classes

struct | DNS_A_DATA
struct | DNS_AAAA_DATA
struct | DNS_MX_DATA
struct | DNS_PTR_DATA
struct | DNS_SRV_DATA
struct | DNS_NULL_DATA
struct | DNS_RECORD_FLAGS
class | DnsRecord
class | PDNS::SRVRecord
class | MXRecord

## Namespaces

| PDNS

## Macros

#define | P_HAS_RESOLVER 1
#define | T_SRV 33
#define | T_NAPTR 35
#define | DNS_STATUS int
#define | DNS_TYPE_SRV T_SRV
#define | DNS_TYPE_MX T_MX
#define | DNS_TYPE_A T_A
#define | DNS_TYPE_AAAA T_AAAA
#define | DNS_TYPE_NAPTR T_NAPTR
#define | DnsFreeRecordList 1
#define | DNS_QUERY_STANDARD 0
#define | DNS_QUERY_BYPASS_CACHE 0

## Typedefs

typedef DnsRecord | DNS_RECORD
typedef DnsRecord * | PDNS_RECORD

## Enumerations

enum | DNS_SECTION { DnsSectionQuestion, DnsSectionAnswer, DnsSectionAuthority, DnsSectionAdditional }

## Functions

void | DnsRecordListFree (PDNS_RECORD rec, int FreeType)
PDNS_RECORD | DnsRecordSetCopy (PDNS_RECORD src)
DNS_STATUS | DnsQuery_A (const char *service, WORD requestType, DWORD options, void *, PDNS_RECORD *results, void *)
DNS_STATUS | PDNS::Cached_DnsQuery (const char *name, WORD type, DWORD options, void *extra, PDNS_RECORD *queryResults, void *reserved)
template<unsigned type, class RecordListType , class RecordType >
PBoolean | PDNS::Lookup (const PString &name, RecordListType &recordList)
void | PDNS::PrintOn (ostream &strm) const
SRVRecord * | PDNS::GetFirst ()
SRVRecord * | PDNS::GetNext ()
PDNS::NAPTRRecord * | PDNS::HandleDNSRecord (PDNS_RECORD dnsRecord, PDNS_RECORD results)
PBoolean | GetRecords (const PString &service, SRVRecordList &serviceList)
| return a list of DNS SRV record with the specified service type More...
PBoolean | GetSRVRecords (const PString &service, SRVRecordList &serviceList)
| provided for backwards compatibility More...
PBoolean | GetSRVRecords (const PString &service, const PString &type, const PString &domain, SRVRecordList &serviceList)
| return a list of DNS SRV record with the specified service, type and domain More...
PBoolean | LookupSRV (const PString &srvQuery, WORD defaultPort, PIPSocketAddressAndPortVector &addrList)
| Perform a DNS lookup of the specified service. More...
PBoolean | LookupSRV (const PString &domain, const PString &service, WORD defaultPort, PIPSocketAddressAndPortVector &addrList)
PBoolean | LookupSRV (const PURL &url, const PString &service, PStringList &returnStr)
void | PrintOn (ostream &strm) const
MXRecord * | GetFirst ()
MXRecord * | GetNext ()
PDNS::MXRecord * | HandleDNSRecord (PDNS_RECORD dnsRecord, PDNS_RECORD results)
PBoolean | GetRecords (const PString &domain, MXRecordList &serviceList)
| return a list of MX records for the specified domain More...
PBoolean | GetMXRecords (const PString &domain, MXRecordList &serviceList)
| provided for backwards compatibility More...

## Variables

PINDEX | PDNS::priPos
PWORDArray | PDNS::priList
PINDEX | lastIndex

## Macro Definition Documentation

#define DNS_QUERY_BYPASS_CACHE 0

#define DNS_QUERY_STANDARD 0

Referenced by PDNS::Lookup().

#define DNS_STATUS int

Referenced by PDNS::Lookup().

#define DNS_TYPE_A T_A

#define DNS_TYPE_AAAA T_AAAA

#define DNS_TYPE_MX T_MX

#define DNS_TYPE_NAPTR T_NAPTR

#define DNS_TYPE_SRV T_SRV

#define DnsFreeRecordList 1

Referenced by PDNS::Lookup().

#define P_HAS_RESOLVER 1

#define T_NAPTR 35

#define T_SRV 33

## Typedef Documentation

typedef DnsRecord DNS_RECORD

typedef DnsRecord* PDNS_RECORD

## Enumeration Type Documentation

enum DNS_SECTION

Enumerator
DnsSectionQuestion |
DnsSectionAnswer |
DnsSectionAuthority |
DnsSectionAdditional |

## Function Documentation

DNS_STATUS DnsQuery_A | ( | const char * | service,
|  | WORD | requestType,
|  | DWORD | options,
|  | void * | ,
|  | PDNS_RECORD * | results,
|  | void * |
| ) |  |

void DnsRecordListFree | ( | PDNS_RECORD | rec,
|  | int | FreeType
| ) |  |

Referenced by PDNS::Lookup().

PDNS_RECORD DnsRecordSetCopy | ( | PDNS_RECORD | src | ) |

MXRecord* GetFirst | ( |  | ) |

PBoolean GetMXRecords | ( | const PString & | domain,
|  | MXRecordList & | serviceList
| ) |  |

inline protected

provided for backwards compatibility

References GetRecords().

MXRecord* GetNext | ( |  | ) |

PBoolean GetRecords | ( | const PString & | service,
|  | SRVRecordList & | serviceList
| ) |  |

inline

return a list of DNS SRV record with the specified service type

Referenced by GetMXRecords(), and GetSRVRecords().

PBoolean GetRecords | ( | const PString & | domain,
|  | MXRecordList & | serviceList
| ) |  |

inline protected

return a list of MX records for the specified domain

PBoolean GetSRVRecords | ( | const PString & | service,
|  | SRVRecordList & | serviceList
| ) |  |

inline

provided for backwards compatibility

References GetRecords().

PBoolean GetSRVRecords | ( | const PString & | service,
|  | const PString & | type,
|  | const PString & | domain,
|  | SRVRecordList & | serviceList
| ) |  |

return a list of DNS SRV record with the specified service, type and domain

PDNS::MXRecord* HandleDNSRecord | ( | PDNS_RECORD | dnsRecord,
|  | PDNS_RECORD | results
| ) |  |

PBoolean LookupSRV | ( | const PString & | srvQuery,
|  | WORD | defaultPort,
|  | PIPSocketAddressAndPortVector & | addrList
| ) |  |

Perform a DNS lookup of the specified service.

Returns
  true if the service could be resolved, else false

PBoolean LookupSRV | ( | const PString & | domain,
|  | const PString & | service,
|  | WORD | defaultPort,
|  | PIPSocketAddressAndPortVector & | addrList
| ) |  |

Parameters

  domain | domain to lookup
  service | service to use
  defaultPort | default por to use
  addrList | returned list of sockets and ports

PBoolean LookupSRV | ( | const PURL & | url,
|  | const PString & | service,
|  | PStringList & | returnStr
| ) |  |

Parameters

  url | URL to lookup
  service | service to use
  returnStr | resolved addresses, if return value is true

void PrintOn | ( | ostream & | strm | ) | const

## Variable Documentation

PINDEX lastIndex