1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _CALLOUT_H_
7#define _CALLOUT_H_
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13  typedef DWORD DHCP_IP_ADDRESS;
14  typedef struct _DHCP_SERVER_OPTIONS {
15    BYTE *MessageType;
16    DHCP_IP_ADDRESS UNALIGNED *SubnetMask;
17    DHCP_IP_ADDRESS UNALIGNED *RequestedAddress;
18    DWORD UNALIGNED *RequestLeaseTime;
19    BYTE *OverlayFields;
20    DHCP_IP_ADDRESS UNALIGNED *RouterAddress;
21    DHCP_IP_ADDRESS UNALIGNED *Server;
22    BYTE *ParameterRequestList;
23    DWORD ParameterRequestListLength;
24    CHAR *MachineName;
25    DWORD MachineNameLength;
26    BYTE ClientHardwareAddressType;
27    BYTE ClientHardwareAddressLength;
28    BYTE *ClientHardwareAddress;
29    CHAR *ClassIdentifier;
30    DWORD ClassIdentifierLength;
31    BYTE *VendorClass;
32    DWORD VendorClassLength;
33    DWORD DNSFlags;
34    DWORD DNSNameLength;
35    LPBYTE DNSName;
36    BOOLEAN DSDomainNameRequested;
37    CHAR *DSDomainName;
38    DWORD DSDomainNameLen;
39    DWORD UNALIGNED *ScopeId;
40  } DHCP_SERVER_OPTIONS,*LPDHCP_SERVER_OPTIONS;
41
42#define DHCP_CALLOUT_LIST_KEY L"System\\CurrentControlSet\\Services\\DHCPServer\\Parameters"
43#define DHCP_CALLOUT_LIST_VALUE L"CalloutDlls"
44#define DHCP_CALLOUT_LIST_TYPE REG_MULTI_SZ
45#define DHCP_CALLOUT_ENTRY_POINT "DhcpServerCalloutEntry"
46
47#define DHCP_CONTROL_START 0x00000001
48#define DHCP_CONTROL_STOP 0x00000002
49#define DHCP_CONTROL_PAUSE 0x00000003
50#define DHCP_CONTROL_CONTINUE 0x00000004
51
52#define DHCP_DROP_DUPLICATE 0x00000001
53#define DHCP_DROP_NOMEM 0x00000002
54#define DHCP_DROP_INTERNAL_ERROR 0x00000003
55#define DHCP_DROP_TIMEOUT 0x00000004
56#define DHCP_DROP_UNAUTH 0x00000005
57#define DHCP_DROP_PAUSED 0x00000006
58#define DHCP_DROP_NO_SUBNETS 0x00000007
59#define DHCP_DROP_INVALID 0x00000008
60#define DHCP_DROP_WRONG_SERVER 0x00000009
61#define DHCP_DROP_NOADDRESS 0x0000000A
62#define DHCP_DROP_PROCESSED 0x0000000B
63#define DHCP_DROP_GEN_FAILURE 0x00000100
64#define DHCP_SEND_PACKET 0x10000000
65#define DHCP_PROB_CONFLICT 0x20000001
66#define DHCP_PROB_DECLINE 0x20000002
67#define DHCP_PROB_RELEASE 0x20000003
68#define DHCP_PROB_NACKED 0x20000004
69#define DHCP_GIVE_ADDRESS_NEW 0x30000001
70#define DHCP_GIVE_ADDRESS_OLD 0x30000002
71#define DHCP_CLIENT_BOOTP 0x30000003
72#define DHCP_CLIENT_DHCP 0x30000004
73
74  typedef DWORD (WINAPI *LPDHCP_CONTROL)(DWORD dwControlCode,LPVOID lpReserved);
75  typedef DWORD (WINAPI *LPDHCP_NEWPKT)(LPBYTE *Packet,DWORD *PacketSize,DWORD IpAddress,LPVOID Reserved,LPVOID *PktContext,LPBOOL ProcessIt);
76  typedef DWORD (WINAPI *LPDHCP_DROP_SEND)(LPBYTE *Packet,DWORD *PacketSize,DWORD ControlCode,DWORD IpAddress,LPVOID Reserved,LPVOID PktContext);
77  typedef DWORD (WINAPI *LPDHCP_PROB)(LPBYTE Packet,DWORD PacketSize,DWORD ControlCode,DWORD IpAddress,DWORD AltAddress,LPVOID Reserved,LPVOID PktContext);
78  typedef DWORD (WINAPI *LPDHCP_GIVE_ADDRESS)(LPBYTE Packet,DWORD PacketSize,DWORD ControlCode,DWORD IpAddress,DWORD AltAddress,DWORD AddrType,DWORD LeaseTime,LPVOID Reserved,LPVOID PktContext);
79  typedef DWORD (WINAPI *LPDHCP_HANDLE_OPTIONS)(LPBYTE Packet,DWORD PacketSize,LPVOID Reserved,LPVOID PktContext,LPDHCP_SERVER_OPTIONS ServerOptions);
80  typedef DWORD (WINAPI *LPDHCP_DELETE_CLIENT)(DWORD IpAddress,LPBYTE HwAddress,ULONG HwAddressLength,DWORD Reserved,DWORD ClientType);
81
82  typedef struct _DHCP_CALLOUT_TABLE {
83    LPDHCP_CONTROL DhcpControlHook;
84    LPDHCP_NEWPKT DhcpNewPktHook;
85    LPDHCP_DROP_SEND DhcpPktDropHook;
86    LPDHCP_DROP_SEND DhcpPktSendHook;
87    LPDHCP_PROB DhcpAddressDelHook;
88    LPDHCP_GIVE_ADDRESS DhcpAddressOfferHook;
89    LPDHCP_HANDLE_OPTIONS DhcpHandleOptionsHook;
90    LPDHCP_DELETE_CLIENT DhcpDeleteClientHook;
91    LPVOID DhcpExtensionHook;
92    LPVOID DhcpReservedHook;
93  } DHCP_CALLOUT_TABLE,*LPDHCP_CALLOUT_TABLE;
94
95  typedef DWORD (WINAPI *LPDHCP_ENTRY_POINT_FUNC)(LPWSTR ChainDlls,DWORD CalloutVersion,LPDHCP_CALLOUT_TABLE CalloutTbl);
96
97#ifdef __cplusplus
98}
99#endif
100#endif
101