' ########################################################################################
' 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
%DHCPCSDK_INC = 1
#IF NOT %DEF(%DHCP_OPTIONS_DEFINED)
%DHCP_OPTIONS_DEFINED = 1
'//
'// DHCP Standard Options.
'//
%OPTION_PAD = 0
%OPTION_SUBNET_MASK = 1
%OPTION_TIME_OFFSET = 2
%OPTION_ROUTER_ADDRESS = 3
%OPTION_TIME_SERVERS = 4
%OPTION_IEN116_NAME_SERVERS = 5
%OPTION_DOMAIN_NAME_SERVERS = 6
%OPTION_LOG_SERVERS = 7
%OPTION_COOKIE_SERVERS = 8
%OPTION_LPR_SERVERS = 9
%OPTION_IMPRESS_SERVERS = 10
%OPTION_RLP_SERVERS = 11
%OPTION_HOST_NAME = 12
%OPTION_BOOT_FILE_SIZE = 13
%OPTION_MERIT_DUMP_FILE = 14
%OPTION_DOMAIN_NAME = 15
%OPTION_SWAP_SERVER = 16
%OPTION_ROOT_DISK = 17
%OPTION_EXTENSIONS_PATH = 18
'//
'// IP layer parameters - per host
'//
%OPTION_BE_A_ROUTER = 19
%OPTION_NON_LOCAL_SOURCE_ROUTING = 20
%OPTION_POLICY_FILTER_FOR_NLSR = 21
%OPTION_MAX_REASSEMBLY_SIZE = 22
%OPTION_DEFAULT_TTL = 23
%OPTION_PMTU_AGING_TIMEOUT = 24
%OPTION_PMTU_PLATEAU_TABLE = 25
'//
'// Link layer parameters - per interface.
'//
%OPTION_MTU = 26
%OPTION_ALL_SUBNETS_MTU = 27
%OPTION_BROADCAST_ADDRESS = 28
%OPTION_PERFORM_MASK_DISCOVERY = 29
%OPTION_BE_A_MASK_SUPPLIER = 30
%OPTION_PERFORM_ROUTER_DISCOVERY = 31
%OPTION_ROUTER_SOLICITATION_ADDR = 32
%OPTION_STATIC_ROUTES = 33
%OPTION_TRAILERS = 34
%OPTION_ARP_CACHE_TIMEOUT = 35
%OPTION_ETHERNET_ENCAPSULATION = 36
'//
'// TCP Paramters - per host
'//
%OPTION_TTL = 37
%OPTION_KEEP_ALIVE_INTERVAL = 38
%OPTION_KEEP_ALIVE_DATA_SIZE = 39
'//
'// Application Layer Parameters
'//
%OPTION_NETWORK_INFO_SERVICE_DOM = 40
%OPTION_NETWORK_INFO_SERVERS = 41
%OPTION_NETWORK_TIME_SERVERS = 42
'//
'// Vender specific information option
'//
%OPTION_VENDOR_SPEC_INFO = 43
'//
'// NetBIOS over TCP/IP Name server option
'//
%OPTION_NETBIOS_NAME_SERVER = 44
%OPTION_NETBIOS_DATAGRAM_SERVER = 45
%OPTION_NETBIOS_NODE_TYPE = 46
%OPTION_NETBIOS_SCOPE_OPTION = 47
'//
'// X Window System Options.
'//
%OPTION_XWINDOW_FONT_SERVER = 48
%OPTION_XWINDOW_DISPLAY_MANAGER = 49
'//
'// Other extensions
'//
%OPTION_REQUESTED_ADDRESS = 50
%OPTION_LEASE_TIME = 51
%OPTION_OK_TO_OVERLAY = 52
%OPTION_MESSAGE_TYPE = 53
%OPTION_SERVER_IDENTIFIER = 54
%OPTION_PARAMETER_REQUEST_LIST = 55
%OPTION_MESSAGE = 56
%OPTION_MESSAGE_LENGTH = 57
%OPTION_RENEWAL_TIME = 58 ' // T1
%OPTION_REBIND_TIME = 59 ' // T2
%OPTION_CLIENT_CLASS_INFO = 60
%OPTION_CLIENT_ID = 61
%OPTION_TFTP_SERVER_NAME = 66
%OPTION_BOOTFILE_NAME = 67
%OPTION_END = 255
#ENDIF ' DHCP_OPTIONS_DEFINED
#IF NOT %DEF(%DHCPAPI_PARAMS_DEFINED)
%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
%DHCPCAPI_REQUEST_PERSISTENT = &H01 ' // request this options "permanently"
%DHCPCAPI_REQUEST_SYNCHRONOUS = &H02 ' // request and block on it
%DHCPCAPI_REQUEST_ASYNCHRONOUS = &H04 ' // request and return, set event on completion
%DHCPCAPI_REQUEST_CANCEL = &H08 ' // cancel request
%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
%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
%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