' ########################################################################################
' Microsoft Windows
' File: dhcpv6csdk.inc
' Contents: Exported dhcpv6 client api function definitions
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_dhcpv6csdk_PBI)
#DEFINE PBX_dhcpv6csdk_PBI
%EQUATE `DHCPV6CSDK_INC = 1
#IF NOT %DEF(%DHCPV6_OPTIONS_DEFINED)
%EQUATE `DHCPV6_OPTIONS_DEFINED = 1
'//
'// DHCPv6 Standard Options(non-encapsulated).
'//
%EQUATE `DHCPV6_OPTION_CLIENTID = 1
%EQUATE `DHCPV6_OPTION_SERVERID = 2
%EQUATE `DHCPV6_OPTION_IA_NA = 3
%EQUATE `DHCPV6_OPTION_IA_TA = 4
%EQUATE `DHCPV6_OPTION_ORO = 6
%EQUATE `DHCPV6_OPTION_PREFERENCE = 7
%EQUATE `DHCPV6_OPTION_UNICAST = 12
%EQUATE `DHCPV6_OPTION_RAPID_COMMIT = 14
%EQUATE `DHCPV6_OPTION_USER_CLASS = 15
%EQUATE `DHCPV6_OPTION_VENDOR_CLASS = 16
%EQUATE `DHCPV6_OPTION_VENDOR_OPTS = 17
%EQUATE `DHCPV6_OPTION_RECONF_MSG = 19
%EQUATE `DHCPV6_OPTION_SIP_SERVERS_NAMES = 21
%EQUATE `DHCPV6_OPTION_SIP_SERVERS_ADDRS = 22
%EQUATE `DHCPV6_OPTION_DNS_SERVERS = 23
%EQUATE `DHCPV6_OPTION_DOMAIN_LIST = 24
%EQUATE `DHCPV6_OPTION_IA_PD = 25
%EQUATE `DHCPV6_OPTION_NIS_SERVERS = 27
%EQUATE `DHCPV6_OPTION_NISP_SERVERS = 28
%EQUATE `DHCPV6_OPTION_NIS_DOMAIN_NAME = 29
%EQUATE `DHCPV6_OPTION_NISP_DOMAIN_NAME = 30
#ENDIF ' DHCPV6_OPTIONS_DEFINED
#IF NOT %DEF(%DHCPV6API_PARAMS_DEFINED)
%EQUATE `DHCPV6API_PARAMS_DEFINED = 1
' // Size = 20 bytes
TYPE DHCPV6CAPI_PARAMS DWORD ' // use this structure to request params
 Flags AS DWORD ' ULONG // for future use
 OptionId AS DWORD ' ULONG // what option is this?
 IsVendor AS LONG ' BOOL // is this vendor specific?
 Data AS BYTE PTR ' LPBYTE // the actual data
 nBytesData AS DWORD ' DWORD // how many bytes of data are there in Data?
END TYPE
#ENDIF ' DHCPV6API_PARAMS_DEFINED
' // Size = 8 bytes
TYPE DHCPV6CAPI_PARAMS_ARRAY DWORD ' // array of params..
 nParams AS DWORD ' ULONG // size of array
 Params AS DHCPV6CAPI_PARAMS PTR ' LPDHCPV6CAPI_PARAMS // actual array
END TYPE
' // Size = 12 bytes
TYPE DHCPV6CAPI_CLASSID DWORD ' // defines a client class id.
 Flags AS DWORD ' ULONG // must be zero currently.
 Data AS BYTE PTR ' LPBYTE // classid binary data.
 nBytesData AS DWORD ' ULONG // how many bytes of data are there?
END TYPE
' enum StatusCode
%EQUATE `STATUS_NO_ERROR = 0 ' // Prefix successfully leased, renewed.
%EQUATE `STATUS_UNSPECIFIED_FAILURE = 1 ' // Some unspecified failure occurred while trying to process the prefix.
%EQUATE `STATUS_NO_BINDING = 3 ' // The server doesn't have binding for the prefix.
%EQUATE `STATUS_NOPREFIX_AVAIL = 6 ' // The server doesn't have prefix to offer to the requesting client.
' // Size = 32 bytes
TYPE DHCPV6Prefix DWORD
 prefix AS STRING * 16 ' // UCHAR 128 bit prefix
 prefixLength AS DWORD ' DWORD // (48-64 bits)
 preferredLifeTime AS DWORD ' DWORD // The Preferred Lifetime of the Prefix returned or requested in seconds
 validLifeTime AS DWORD ' DWORD // The Valid Lifetime of the Prefix returned or requested in seconds
 status AS LONG ' StatusCode // The status code returned by the server for the prefix
END TYPE
' // Size = 40 bytes
TYPE DHCPV6PrefixLeaseInformation DWORD
 nPrefixes AS DWORD ' DWORD // number of prefixes.
 prefixArray AS DHCPV6Prefix PTR ' LPDHCPV6Prefix // Array of prefixes
 iaid AS DWORD ' DWORD // The 32 bit Identity Association identifier for the prefix option.
 T1 AS LONG ' time_t // The absolute renewal time for the prefixes in seconds
 T2 AS LONG ' time_t // The absolute rebind time for the prefixes in seconds
 MaxLeaseExpirationTime AS LONG ' time_t // The absolute maximum lease expiration time of all the prefix leases in this structure.
 LastRenewalTime AS LONG ' time_t // The absolute time at which the last renewal for the prefixes happened.
 status AS LONG ' StatusCode // The status code returned by the server for the IAPD
 ServerId AS BYTE PTR ' LPBYTE // The server DUID from which the prefix is received. This is used in subsequent Renews.
 ServerIdLen AS DWORD ' DWORD // The length of the above DUID data.
END TYPE
DECLARE SUB Dhcpv6CApiInitialize LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6CApiInitialize" ( BYREF Version AS QUAD ) ' void
DECLARE SUB Dhcpv6CApiCleanup LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6CApiCleanup" ( ) ' void
DECLARE FUNCTION Dhcpv6RequestParams LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6RequestParams" ( BYVAL forceNewInform AS LONG , BYVAL reserved AS QUAD , BYREF adapterName AS WSTRINGZ , BYREF classId AS DHCPV6CAPI_CLASSID , BYREF recdParams AS DHCPV6CAPI_PARAMS_ARRAY , BYVAL buffer AS BYTE PTR , BYREF pSize AS QUAD ) AS QUAD
' *** Removed in the Windows 7 SDK ***
'DECLARE FUNCTION DHCPv6RegisterPersistentRequestParams LIB "dhcpcsvc6.dll" ALIAS "DHCPv6RegisterPersistentRequestParams" ( ' BYREF adapterName AS WSTRINGZ
' , BYREF classId AS DHCPV6CAPI_CLASSID
' , BYREF requestedParams AS DHCPV6CAPI_PARAMS_ARRAY
' , BYREF registryNameString AS WSTRINGZ
' ) AS DWORD
' *** Removed in the Windows 7 SDK ***
'DECLARE FUNCTION DHCPv6DeRegisterPersistentRequestParams LIB "dhcpcsvc6.dll" ALIAS "DHCPv6DeRegisterPersistentRequestParams" ( ' BYREF adapterName AS WSTRINGZ
' , BYREF registryNameString AS WSTRINGZ
' ) AS DWORD
DECLARE FUNCTION Dhcpv6RequestPrefix LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6RequestPrefix" ( BYREF adapterName AS WSTRINGZ
 , BYREF pclassId AS DHCPV6CAPI_CLASSID
 , BYREF prefixleaseInfo AS DHCPV6PrefixLeaseInformation
 , BYREF pdwTimeToWait AS DWORD
 ) AS DWORD
DECLARE FUNCTION Dhcpv6RenewPrefix LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6RenewPrefix" ( BYREF adapterName AS WSTRINGZ
 , BYREF pclassId AS DHCPV6CAPI_CLASSID
 , BYREF prefixleaseInfo AS DHCPV6PrefixLeaseInformation
 , BYREF pdwTimeToWait AS DWORD
 , BYVAL bValidatePrefix AS DWORD
 ) AS DWORD
DECLARE FUNCTION Dhcpv6ReleasePrefix LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6ReleasePrefix" ( BYREF adapterName AS WSTRINGZ
 , BYREF classId AS DHCPV6CAPI_CLASSID
 , BYREF leaseInfo AS DHCPV6PrefixLeaseInformation
 ) AS DWORD
' *** Removed in the Windows 7 SDK ***
'%DHCPV6CAPI_REGISTER_HANDLE_EVENT = &H01 ' // handle returned is to an event
' *** Removed in the Windows 7 SDK ***
'DECLARE FUNCTION Dhcpv6RegisterParamChange LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6RegisterParamChange" ( ' BYVAL flags AS DWORD
' , BYVAL reserved AS DWORD
' , BYREF adapterName AS WSTRINGZ
' , BYREF classId AS DHCPV6CAPI_CLASSID
' , BYREF params AS DHCPV6CAPI_PARAMS_ARRAY
' , BYREF handle AS DWORD
' , BYREF eventName AS WSTRINGZ
' ) AS DWORD
' *** Removed in the Windows 7 SDK ***
'%DHCPV6CAPI_DEREGISTER_HANDLE_EVENT = &H01 ' // de-register handle that is an event
' *** Removed in the Windows 7 SDK ***
'DECLARE FUNCTION Dhcpv6DeRegisterParamChange LIB "dhcpcsvc6.dll" ALIAS "Dhcpv6DeRegisterParamChange" ( ' BYVAL flags AS DWORD
' , BYVAL reserved AS DWORD
' , BYREF eventName AS WSTRINGZ
' ) AS DWORD
#ENDIF
