' PBXA64/PBXB64 DNS API declarations for dnsapi.dll/windns.h.
#IF NOT %DEF(PBX_DNSAPI_PBI)
#DEFINE PBX_DNSAPI_PBI
#INCLUDE ONCE "Legacy/Platform/win_types.inc"
#INCLUDE ONCE "Legacy/Platform/win_consts.inc"

%EQUATE `DNS_TYPE_A = &H0001
%EQUATE `DNS_TYPE_NS = &H0002
%EQUATE `DNS_TYPE_CNAME = &H0005
%EQUATE `DNS_TYPE_SOA = &H0006
%EQUATE `DNS_TYPE_PTR = &H000C
%EQUATE `DNS_TYPE_MX = &H000F
%EQUATE `DNS_TYPE_TXT = &H0010
%EQUATE `DNS_TYPE_AAAA = &H001C
%EQUATE `DNS_TYPE_SRV = &H0021
%EQUATE `DNS_TYPE_OPT = &H0029
%EQUATE `DNS_TYPE_DS = &H002B
%EQUATE `DNS_TYPE_RRSIG = &H002E
%EQUATE `DNS_TYPE_NSEC = &H002F
%EQUATE `DNS_TYPE_DNSKEY = &H0030
%EQUATE `DNS_TYPE_TLSA = &H0034
%EQUATE `DNS_TYPE_HTTPS = &H0041
%EQUATE `DNS_TYPE_SVCB = &H0040
%EQUATE `DNS_QUERY_STANDARD = &H00000000
%EQUATE `DNS_QUERY_ACCEPT_TRUNCATED_RESPONSE = &H00000001
%EQUATE `DNS_QUERY_USE_TCP_ONLY = &H00000002
%EQUATE `DNS_QUERY_NO_RECURSION = &H00000004
%EQUATE `DNS_QUERY_BYPASS_CACHE = &H00000008
%EQUATE `DNS_QUERY_NO_WIRE_QUERY = &H00000010
%EQUATE `DNS_QUERY_NO_LOCAL_NAME = &H00000020
%EQUATE `DNS_QUERY_NO_HOSTS_FILE = &H00000040
%EQUATE `DNS_QUERY_NO_NETBT = &H00000080
%EQUATE `DNS_QUERY_WIRE_ONLY = &H00000100
%EQUATE `DNS_QUERY_TREAT_AS_FQDN = &H00001000
%EQUATE `DNS_QUERY_DONT_RESET_TTL_VALUES = &H00100000
%EQUATE `DNS_QUERY_DISABLE_IDN_ENCODING = &H00200000
%EQUATE `DNS_FREE_FLAT = 0
%EQUATE `DNS_FREE_RECORD_LIST = 1
%EQUATE `DNS_FREE_PARSED_MESSAGE_FIELDS = 2
%EQUATE `DNS_NAME_DOMAIN = 0
%EQUATE `DNS_NAME_DOMAIN_LABEL = 1
%EQUATE `DNS_NAME_HOST = 2
%EQUATE `DNS_NAME_HOST_LABEL = 3
%EQUATE `DNS_NAME_WILDCARD = 4
%EQUATE `DNS_NAME_SRV = 5
%EQUATE `DNS_NAME_MULTILABEL = 6

TYPE DNS_A_DATA
    IpAddress AS DWORD
END TYPE

TYPE DNS_AAAA_DATA
    Ip6Address AS PBX_BYTE16
END TYPE

TYPE DNS_PTR_DATA
    pNameHost AS QUAD
END TYPE

TYPE DNS_MX_DATA
    pNameExchange AS QUAD
    wPreference AS WORD
    Pad AS WORD
END TYPE

TYPE DNS_SRV_DATA
    pNameTarget AS QUAD
    wPriority AS WORD
    wWeight AS WORD
    wPort AS WORD
    Pad AS WORD
END TYPE

TYPE DNS_RECORD_FIXED
    pNextRecord AS QUAD
    pName AS QUAD
    wType AS WORD
    wDataLength AS WORD
    Flags AS DWORD
    dwTtl AS DWORD
    dwReserved AS DWORD
    Data AS PBX_BYTE512
END TYPE

DECLARE FUNCTION DnsQuery_A LIB "dnsapi.dll" ALIAS "DnsQuery_A" (BYVAL pszName AS ASCIIZ PTR, BYVAL wType AS WORD, BYVAL Options AS DWORD, BYVAL pExtra AS QUAD, BYVAL ppQueryResults AS QUAD, BYVAL pReserved AS QUAD) AS LONG
DECLARE FUNCTION DnsQuery_W LIB "dnsapi.dll" ALIAS "DnsQuery_W" (BYVAL pszName AS WSTRING, BYVAL wType AS WORD, BYVAL Options AS DWORD, BYVAL pExtra AS QUAD, BYVAL ppQueryResults AS QUAD, BYVAL pReserved AS QUAD) AS LONG
DECLARE SUB DnsRecordListFree LIB "dnsapi.dll" ALIAS "DnsRecordListFree" (BYVAL pRecordList AS QUAD, BYVAL FreeType AS LONG)
DECLARE SUB DnsFree LIB "dnsapi.dll" ALIAS "DnsFree" (BYVAL pData AS QUAD, BYVAL FreeType AS LONG)
DECLARE FUNCTION DnsValidateName_A LIB "dnsapi.dll" ALIAS "DnsValidateName_A" (BYVAL pszName AS ASCIIZ PTR, BYVAL Format AS LONG) AS LONG
DECLARE FUNCTION DnsValidateName_W LIB "dnsapi.dll" ALIAS "DnsValidateName_W" (BYVAL pszName AS WSTRING, BYVAL Format AS LONG) AS LONG
DECLARE FUNCTION DnsFlushResolverCache LIB "dnsapi.dll" ALIAS "DnsFlushResolverCache" () AS LONG
DECLARE FUNCTION DnsModifyRecordsInSet_A LIB "dnsapi.dll" ALIAS "DnsModifyRecordsInSet_A" (BYVAL pAddRecords AS QUAD, BYVAL pDeleteRecords AS QUAD, BYVAL Options AS DWORD, BYVAL hCredentials AS QUAD, BYVAL pExtraList AS QUAD, BYVAL pReserved AS QUAD) AS LONG
DECLARE FUNCTION DnsModifyRecordsInSet_W LIB "dnsapi.dll" ALIAS "DnsModifyRecordsInSet_W" (BYVAL pAddRecords AS QUAD, BYVAL pDeleteRecords AS QUAD, BYVAL Options AS DWORD, BYVAL hCredentials AS QUAD, BYVAL pExtraList AS QUAD, BYVAL pReserved AS QUAD) AS LONG

#ENDIF
