⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jwadhcpssdk.pas

📁 比较全面的win32api开发包
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{******************************************************************************}
{                                                       	               }
{ DHCP Callout DLL API interface unit for Object Pascal                        }
{                                                       	               }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{ 								               }
{ The original file is: dhcpssdk.h, released June 2000. The original Pascal    }
{ code is: DhcpSSdk.pas, released December 2000. The initial developer of the  }
{ Pascal code is Marcel van Brakel (brakelm@chello.nl).                        }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{ 								               }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{								               }
{ You may retrieve the latest version of this file at the Project JEDI home    }
{ page, located at http://delphi-jedi.org or my personal homepage located at   }
{ http://members.chello.nl/m.vanbrakel2                                        }
{								               }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{ 								               }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{ 								               }
{******************************************************************************}

unit JwaDhcpSSdk;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "dhcpssdk.h"'}
{$HPPEMIT ''}
{$HPPEMIT 'typedef DHCP_IP_ADDRESS *LPDHCP_IP_ADDRESS;'}
{$HPPEMIT ''}

{$I WINDEFINES.INC}

interface

uses
  JwaWinNT, JwaWinType;

//  This structure could change any day.  This will be accurate only for version 0 -- which
//  has to be checked for by any CalloutDLL that is hooking onto the DhcpHandleOptionsHook.

type
  DHCP_IP_ADDRESS = DWORD;
  {$EXTERNALSYM DHCP_IP_ADDRESS}
  LPDHCP_IP_ADDRESS = ^DHCP_IP_ADDRESS;
  {$NODEFINE LPDHCP_IP_ADDRESS}
  TDhcpIpAddress = DHCP_IP_ADDRESS;

  _DHCP_SERVER_OPTIONS = record
    MessageType: LPBYTE;
    SubnetMask: LPDHCP_IP_ADDRESS;
    RequestedAddress: LPDHCP_IP_ADDRESS;
    RequestLeaseTime: LPDWORD;
    OverlayFields: LPBYTE;
    RouterAddress: LPDHCP_IP_ADDRESS;
    Server: LPDHCP_IP_ADDRESS;
    ParameterRequestList: LPBYTE;
    ParameterRequestListLength: DWORD;
    MachineName: PCHAR;
    MachineNameLength: DWORD;
    ClientHardwareAddressType: BYTE;
    ClientHardwareAddressLength: BYTE;
    ClientHardwareAddress: LPBYTE;
    ClassIdentifier: PCHAR;
    ClassIdentifierLength: DWORD;
    VendorClass: LPBYTE;
    VendorClassLength: DWORD;
    DNSFlags: DWORD;
    DNSNameLength: DWORD;
    DNSName: LPBYTE;
    DSDomainNameRequested: LongBool;
    DSDomainName: PCHAR;
    DSDomainNameLen: DWORD;
    ScopeId: LPDWORD;
  end;
  {$EXTERNALSYM _DHCP_SERVER_OPTIONS}
  DHCP_SERVER_OPTIONS = _DHCP_SERVER_OPTIONS;
  {$EXTERNALSYM DHCP_SERVER_OPTIONS}
  LPDHCP_SERVER_OPTIONS = ^DHCP_SERVER_OPTIONS;
  {$EXTERNALSYM LPDHCP_SERVER_OPTIONS}
  TDhcpServerOptions = DHCP_SERVER_OPTIONS;
  PDhcpServerOptions = LPDHCP_SERVER_OPTIONS;

//
// The location in registry where the REG_MULTI_SZ list of callout DLLs
// that the DHCP Server will try to load.
//

const
  DHCP_CALLOUT_LIST_KEY    = WideString('System\CurrentControlSet\Services\DHCPServer\Parameters');
  {$EXTERNALSYM DHCP_CALLOUT_LIST_KEY}
  DHCP_CALLOUT_LIST_VALUE  = WideString('CalloutDlls');
  {$EXTERNALSYM DHCP_CALLOUT_LIST_VALUE}
  DHCP_CALLOUT_LIST_TYPE   = REG_MULTI_SZ;
  {$EXTERNALSYM DHCP_CALLOUT_LIST_TYPE}
  DHCP_CALLOUT_ENTRY_POINT = 'DhcpServerCalloutEntry';
  {$EXTERNALSYM DHCP_CALLOUT_ENTRY_POINT}

//
// Control CODES used by DHCP Server to notify server state change.
//

  DHCP_CONTROL_START    = $00000001;
  {$EXTERNALSYM DHCP_CONTROL_START}
  DHCP_CONTROL_STOP     = $00000002;
  {$EXTERNALSYM DHCP_CONTROL_STOP}
  DHCP_CONTROL_PAUSE    = $00000003;
  {$EXTERNALSYM DHCP_CONTROL_PAUSE}
  DHCP_CONTROL_CONTINUE = $00000004;
  {$EXTERNALSYM DHCP_CONTROL_CONTINUE}

//
// Other ControlCodes used by various Callout HOOKS.
//

  DHCP_DROP_DUPLICATE      = $00000001; // duplicate of pkt being processed
  {$EXTERNALSYM DHCP_DROP_DUPLICATE}
  DHCP_DROP_NOMEM          = $00000002; // not enough server mem in queues
  {$EXTERNALSYM DHCP_DROP_NOMEM}
  DHCP_DROP_INTERNAL_ERROR = $00000003; // ooops?
  {$EXTERNALSYM DHCP_DROP_INTERNAL_ERROR}
  DHCP_DROP_TIMEOUT        = $00000004; // too late, pkt is too old
  {$EXTERNALSYM DHCP_DROP_TIMEOUT}
  DHCP_DROP_UNAUTH         = $00000005; // server is not authorized to run
  {$EXTERNALSYM DHCP_DROP_UNAUTH}
  DHCP_DROP_PAUSED         = $00000006; // service is paused
  {$EXTERNALSYM DHCP_DROP_PAUSED}
  DHCP_DROP_NO_SUBNETS     = $00000007; // no subnets configured on server
  {$EXTERNALSYM DHCP_DROP_NO_SUBNETS}
  DHCP_DROP_INVALID        = $00000008; // invalid packet or client
  {$EXTERNALSYM DHCP_DROP_INVALID}
  DHCP_DROP_WRONG_SERVER   = $00000009; // client in different DS enterprise
  {$EXTERNALSYM DHCP_DROP_WRONG_SERVER}
  DHCP_DROP_NOADDRESS      = $0000000A; // no address available to offer
  {$EXTERNALSYM DHCP_DROP_NOADDRESS}
  DHCP_DROP_PROCESSED      = $0000000B; // packet has been processed
  {$EXTERNALSYM DHCP_DROP_PROCESSED}
  DHCP_DROP_GEN_FAILURE    = $00000100; // catch-all error
  {$EXTERNALSYM DHCP_DROP_GEN_FAILURE}
  DHCP_SEND_PACKET         = $10000000; // send the packet on wire
  {$EXTERNALSYM DHCP_SEND_PACKET}
  DHCP_PROB_CONFLICT       = $20000001; // address conflicted..
  {$EXTERNALSYM DHCP_PROB_CONFLICT}
  DHCP_PROB_DECLINE        = $20000002; // an addr got declined
  {$EXTERNALSYM DHCP_PROB_DECLINE}
  DHCP_PROB_RELEASE        = $20000003; // an addr got released
  {$EXTERNALSYM DHCP_PROB_RELEASE}
  DHCP_PROB_NACKED         = $20000004; // a client is being nacked.
  {$EXTERNALSYM DHCP_PROB_NACKED}
  DHCP_GIVE_ADDRESS_NEW    = $30000001; // give client a "new" address
  {$EXTERNALSYM DHCP_GIVE_ADDRESS_NEW}
  DHCP_GIVE_ADDRESS_OLD    = $30000002; // renew client's "old" address
  {$EXTERNALSYM DHCP_GIVE_ADDRESS_OLD}
  DHCP_CLIENT_BOOTP        = $30000003; // client is a BOOTP client
  {$EXTERNALSYM DHCP_CLIENT_BOOTP}
  DHCP_CLIENT_DHCP         = $30000004; // client is a DHCP client
  {$EXTERNALSYM DHCP_CLIENT_DHCP}

type
  LPDHCP_CONTROL = function (dwControlCode: DWORD; lpReserved: LPVOID): DWORD; stdcall;
  {$EXTERNALSYM LPDHCP_CONTROL}
  PDhcpControl = LPDHCP_CONTROL;

{
Routine Description:

    This routine is called whenever the DHCP Server service is
    started, stopped, paused or continued as defined by the values of
    the dwControlCode parameter.  The lpReserved parameter is reserved
    for future use and it should not be interpreted in any way.   This
    routine should not block.

Arguments:

    dwControlCode - one of the DHCP_CONTROL_* values
    lpReserved - reserved for future use.

}


type
  LPDHCP_NEWPKT = function (var Packet: LPBYTE; var PacketSize: DWORD; IpAddress: DWORD;
    Reserved: LPVOID; var PktContext: LPVOID; ProcessIt: LPBOOL): DWORD; stdcall;
  {$EXTERNALSYM LPDHCP_NEWPKT}
  PDhcpNewPkt = LPDHCP_NEWPKT;

{
Routine Description:

    This routine is called soon after the DHCP Server receives a
    packet that it attempts to process.  This routine is in the
    critical path of server execution and should return very fast, as
    otherwise server performance will be impacted.  The Callout DLL
    can modify the buffer or return a new buffer via the Packet,
    PacketSize arguments.  Also, if the callout DLL has internal
    structures to keep track of the packet and its progress, it can
    then return a context to this packet in the PktContext parameter.
    This context will be passed to almost all other hooks to indicate
    the packet being referred to.  Also, if the Callout DLL is
    planning on processing the packet or for some other reason the
    DHCP server is not expected to process this packet, then it can
    set the ProcessIt flag to FALSE to indicate that the packet is to
    be dropped.

Arguments:

    Packet - This parameter points to a character buffer that holds
    the actual packet received by the DHCP Server.

    PacketSize - This parameter points to a variable that holds the
    size of the above buffer.

    IpAddress - This parameter points to an IPV4 host order IP address
    of the socket that this packet was received on.

    Reserved -Reserved for future use.

    PktContect - This is an opaque pointer used by the DHCP Server for
    future references to this packet.  It is expected that the callout
    DLL will provide this pointer if it is interested in keeping track
    of the packet.  (See the descriptions for the hooks below for
    other usage of this Context).

    ProcessIt - This is a BOOL flag that the CalloutDll can set to
    TRUE or reset to indicate if the DHCP Server should continue
    processing this packet or not, respectively.
}

type
  LPDHCP_DROP_SEND = function (var Packet: LPBYTE; var PacketSize: DWORD;
    ControlCode, IpAddress: DWORD; Reserved, PktContext: LPVOID): DWORD; stdcall;
  {$EXTERNALSYM LPDHCP_DROP_SEND}
  PDhcpDropSend = LPDHCP_DROP_SEND;

{
Routine Description:

    This hook is called if a packet is (DropPktHook) dropped for some
    reason or if the packet is completely processed.   (If a packet is

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -