' ########################################################################################
' Microsoft Windows
' File: dhcpcsdk.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_DhcpCSdk_PBI)
#DEFINE PBX_DhcpCSdk_PBI
%EQUATE `DHCPCSDK_INC = 1
#IF NOT %DEF(%DHCP_OPTIONS_DEFINED)
%EQUATE `DHCP_OPTIONS_DEFINED = 1
'//
'// DHCP Standard Options.
'//
%EQUATE `OPTION_PAD = 0
%EQUATE `OPTION_SUBNET_MASK = 1
%EQUATE `OPTION_TIME_OFFSET = 2
%EQUATE `OPTION_ROUTER_ADDRESS = 3
%EQUATE `OPTION_TIME_SERVERS = 4
%EQUATE `OPTION_IEN116_NAME_SERVERS = 5
%EQUATE `OPTION_DOMAIN_NAME_SERVERS = 6
%EQUATE `OPTION_LOG_SERVERS = 7
%EQUATE `OPTION_COOKIE_SERVERS = 8
%EQUATE `OPTION_LPR_SERVERS = 9
%EQUATE `OPTION_IMPRESS_SERVERS = 10
%EQUATE `OPTION_RLP_SERVERS = 11
%EQUATE `OPTION_HOST_NAME = 12
%EQUATE `OPTION_BOOT_FILE_SIZE = 13
%EQUATE `OPTION_MERIT_DUMP_FILE = 14
%EQUATE `OPTION_DOMAIN_NAME = 15
%EQUATE `OPTION_SWAP_SERVER = 16
%EQUATE `OPTION_ROOT_DISK = 17
%EQUATE `OPTION_EXTENSIONS_PATH = 18
'//
'// IP layer parameters - per host
'//
%EQUATE `OPTION_BE_A_ROUTER = 19
%EQUATE `OPTION_NON_LOCAL_SOURCE_ROUTING = 20
%EQUATE `OPTION_POLICY_FILTER_FOR_NLSR = 21
%EQUATE `OPTION_MAX_REASSEMBLY_SIZE = 22
%EQUATE `OPTION_DEFAULT_TTL = 23
%EQUATE `OPTION_PMTU_AGING_TIMEOUT = 24
%EQUATE `OPTION_PMTU_PLATEAU_TABLE = 25
'//
'// Link layer parameters - per interface.
'//
%EQUATE `OPTION_MTU = 26
%EQUATE `OPTION_ALL_SUBNETS_MTU = 27
%EQUATE `OPTION_BROADCAST_ADDRESS = 28
%EQUATE `OPTION_PERFORM_MASK_DISCOVERY = 29
%EQUATE `OPTION_BE_A_MASK_SUPPLIER = 30
%EQUATE `OPTION_PERFORM_ROUTER_DISCOVERY = 31
%EQUATE `OPTION_ROUTER_SOLICITATION_ADDR = 32
%EQUATE `OPTION_STATIC_ROUTES = 33
%EQUATE `OPTION_TRAILERS = 34
%EQUATE `OPTION_ARP_CACHE_TIMEOUT = 35
%EQUATE `OPTION_ETHERNET_ENCAPSULATION = 36
'//
'// TCP Paramters - per host
'//
%EQUATE `OPTION_TTL = 37
%EQUATE `OPTION_KEEP_ALIVE_INTERVAL = 38
%EQUATE `OPTION_KEEP_ALIVE_DATA_SIZE = 39
'//
'// Application Layer Parameters
'//
%EQUATE `OPTION_NETWORK_INFO_SERVICE_DOM = 40
%EQUATE `OPTION_NETWORK_INFO_SERVERS = 41
%EQUATE `OPTION_NETWORK_TIME_SERVERS = 42
'//
'// Vender specific information option
'//
%EQUATE `OPTION_VENDOR_SPEC_INFO = 43
'//
'// NetBIOS over TCP/IP Name server option
'//
%EQUATE `OPTION_NETBIOS_NAME_SERVER = 44
%EQUATE `OPTION_NETBIOS_DATAGRAM_SERVER = 45
%EQUATE `OPTION_NETBIOS_NODE_TYPE = 46
%EQUATE `OPTION_NETBIOS_SCOPE_OPTION = 47
'//
'// X Window System Options.
'//
%EQUATE `OPTION_XWINDOW_FONT_SERVER = 48
%EQUATE `OPTION_XWINDOW_DISPLAY_MANAGER = 49
'//
'// Other extensions
'//
%EQUATE `OPTION_REQUESTED_ADDRESS = 50
%EQUATE `OPTION_LEASE_TIME = 51
%EQUATE `OPTION_OK_TO_OVERLAY = 52
%EQUATE `OPTION_MESSAGE_TYPE = 53
%EQUATE `OPTION_SERVER_IDENTIFIER = 54
%EQUATE `OPTION_PARAMETER_REQUEST_LIST = 55
%EQUATE `OPTION_MESSAGE = 56
%EQUATE `OPTION_MESSAGE_LENGTH = 57
%EQUATE `OPTION_RENEWAL_TIME = 58 ' // T1
%EQUATE `OPTION_REBIND_TIME = 59 ' // T2
%EQUATE `OPTION_CLIENT_CLASS_INFO = 60
%EQUATE `OPTION_CLIENT_ID = 61
%EQUATE `OPTION_TFTP_SERVER_NAME = 66
%EQUATE `OPTION_BOOTFILE_NAME = 67
%EQUATE `OPTION_END = 255
#ENDIF ' DHCP_OPTIONS_DEFINED
#IF NOT %DEF(%DHCPAPI_PARAMS_DEFINED)
%EQUATE `DHCPAPI_PARAMS_DEFINED = 1
' // Serie = 20 bytes
TYPE DHCPAPI_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 ' DHCPAPI_PARAMS_DEFINED
' // Serie = 8 bytes
TYPE DHCPCAPI_PARAMS_ARRAY DWORD ' // array of params..
 nParams AS DWORD ' ULONG // size of array
 Params AS DHCPAPI_PARAMS PTR ' LPDHCPCAPI_PARAMS // actual array
END TYPE
' // Serie = 12 bytes
TYPE DHCPCAPI_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
%EQUATE `DHCPCAPI_REQUEST_PERSISTENT = &H01 ' // request this options "permanently"
%EQUATE `DHCPCAPI_REQUEST_SYNCHRONOUS = &H02 ' // request and block on it
%EQUATE `DHCPCAPI_REQUEST_ASYNCHRONOUS = &H04 ' // request and return, set event on completion
%EQUATE `DHCPCAPI_REQUEST_CANCEL = &H08 ' // cancel request
%EQUATE `DHCPCAPI_REQUEST_MASK = &H0F ' // allowed flags..
DECLARE FUNCTION DhcpCApiInitialize LIB "dhcpcsvc.dll" ALIAS "DhcpCApiInitialize" ( BYREF Version AS QUAD ) AS QUAD
DECLARE SUB DhcpCApiCleanup LIB "dhcpcsvc.dll" ALIAS "DhcpCApiCleanup" ( ) ' void
' // request parameters of client
DECLARE FUNCTION DhcpRequestParams LIB "dhcpcsvc.dll" ALIAS "DhcpRequestParams" ( BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD , BYREF AdapterName AS WSTRINGZ , BYREF ClassId AS DHCPCAPI_CLASSID , BYREF SendParams AS DHCPCAPI_PARAMS_ARRAY , BYREF RecdParams AS DHCPCAPI_PARAMS_ARRAY , BYVAL Buffer AS BYTE PTR , BYREF pSize AS QUAD , BYREF RequestIdStr AS WSTRINGZ ) AS QUAD ' DWORD // win32 status
' // returns ERROR_MORE_DATA if o/p buffer is of insufficient size, and fills in reqd size in # of bytes
' // undo the effect of a persistent request -- currently undo from registry
DECLARE FUNCTION DhcpUndoRequestParams LIB "dhcpcsvc.dll" ALIAS "DhcpUndoRequestParams" ( BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD , BYREF AdapterName AS WSTRINGZ , BYREF RequestIdStr AS WSTRINGZ ) AS QUAD ' DWORD // win32 status
' // returns ERROR_MORE_DATA if o/p buffer is of insufficient size, and fills in reqd size in # of bytes
%EQUATE `DHCPCAPI_REGISTER_HANDLE_EVENT = &H01 ' // handle returned is to an event
' // notify if a parameter has changed
DECLARE FUNCTION DhcpRegisterParamChange LIB "dhcpcsvc.dll" ALIAS "DhcpRegisterParamChange" ( BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD , BYREF AdapterName AS WSTRINGZ , BYREF ClassId AS DHCPCAPI_CLASSID , BYREF Params AS DHCPCAPI_PARAMS_ARRAY , BYREF Handle AS QUAD ) AS QUAD ' DWORD // win32 status
%EQUATE `DHCPCAPI_DEREGISTER_HANDLE_EVENT = &H01 ' // de-register handle that is an event
' // undo the registration
DECLARE FUNCTION DhcpDeRegisterParamChange LIB "dhcpcsvc.dll" ALIAS "DhcpDeRegisterParamChange" ( BYVAL Flags AS QUAD , BYVAL Reserved AS QUAD , BYVAL Event AS QUAD ) AS QUAD
DECLARE FUNCTION DhcpRemoveDNSRegistrations LIB "dhcpcsvc.dll" ALIAS "DhcpRemoveDNSRegistrations" ( ) AS QUAD
' *** Removed from the Windows 7 SDK ***
'DECLARE FUNCTION DhcpGetOriginalSubnetMask LIB "dhcpcsvc.dll" ALIAS "DhcpGetOriginalSubnetMask" ( ' BYREF AdapterName AS WSTRINGZ
' , BYREF pSubnetMask AS DWORD
' ) AS DWORD
#ENDIF
