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 _INC_WDSPXE
7#define _INC_WDSPXE
8#if (_WIN32_WINNT >= 0x0600)
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#define PXE_ADDR_BROADCAST 0x0001
15#define PXE_ADDR_USE_PORT 0x0002
16#define PXE_ADDR_USE_ADDR 0x0004
17#define PXE_ADDR_USE_DHCP_RULES 0x0008
18
19#ifndef PXEAPI
20#define PXEAPI WINAPI
21#endif
22
23typedef ULONG PXE_BOOT_ACTION;
24typedef ULONG PXE_REG_INDEX;
25typedef ULONG PXE_PROVIDER_ATTRIBUTE;
26
27typedef struct tagPXE_ADDRESS {
28  ULONG  uFlags;
29  __C89_NAMELESS union {
30    BYTE  bAddress[PXE_MAX_ADDRESS];
31    ULONG uIpAddress;
32  } DUMMYUNIONNAME;
33  ULONG  uAddrLen;
34  USHORT uPort;
35} PXE_ADDRESS, *PPXE_ADDRESS;
36
37typedef struct _PXE_DHCP_MESSAGE {
38  BYTE  Operation;
39  BYTE  HardwareAddressType;
40  BYTE  HardwareAddressLength;
41  BYTE  HopCount;
42  DWORD TransactionID;
43  WORD  SecondsSinceBoot;
44  WORD  Reserved;
45  ULONG ClientIpAddress;
46  ULONG YourIPAddress;
47  ULONG BootstrapServerAddress;
48  ULONG RelayAgentIpAddress;
49  BYTE  HardwareAddress[PXE_DHCP_HWAADR_SIZE];
50  BYTE  HostName[PXE_DHCP_SERVER_SIZE];
51  BYTE  BootFileName;
52  __C89_NAMELESS union {
53    BYTE  bMagicCookie[PXE_DHCP_MAGIC_COOKIE_SIZE];
54    ULONG uMagicCookie;
55  } DUMMYUNIONNAME;
56} PXE_DHCP_MESSAGE, *PPXE_DHCP_MESSAGE;
57
58typedef struct _PXE_DHCP_OPTION {
59  BYTE OptionType;
60  BYTE OptionLength;
61  BYTE OptionValue[1];
62} PXE_DHCP_OPTION, *PPXE_DHCP_OPTION;
63
64#define PXE_BA_NBP 1
65#define PXE_BA_CUSTOM 2
66#define PXE_BA_IGNORE 3
67#define PXE_BA_REJECTED 4
68
69typedef struct tagPXE_PROVIDER {
70  ULONG  uSizeOfStruct;
71  LPWSTR pwszName;
72  LPWSTR pwszFilePath;
73  WINBOOL   bIsCritical;
74  ULONG  uIndex;
75} PXE_PROVIDER, *PPXE_PROVIDER;
76
77DWORD PXEAPI PxeDhcpAppendOption(PVOID pReplyPacket,ULONG uMaxReplyPacketLen,PULONG puReplyPacketLen,BYTE bOption,BYTE bOptionLen,PVOID pValue);
78DWORD PXEAPI PxeDhcpGetOptionValue(PVOID pPacket,ULONG uPacketLen,ULONG uInstance,BYTE bOption,PBYTE pbOptionLen,PVOID *ppOptionValue);
79DWORD PXEAPI PxeDhcpGetVendorOptionValue(PVOID pPacket,ULONG uPacketLen,BYTE bOption,ULONG uInstance,PBYTE pbOptionLen,PVOID *ppOptionValue);
80DWORD PXEAPI PxeDhcpInitialize(PVOID pRecvPacket,ULONG uRecvPacketLen,PVOID pReplyPacket,ULONG uMaxReplyPacketLen,PULONG puReplyPacketLen);
81DWORD PXEAPI PxeDhcpIsValid(PVOID pPacket,ULONG uPacketLen,WINBOOL bRequestPacket,PBOOL pbPxeOptionPresent);
82
83typedef enum _PXE_GSI_TYPE {
84  PXE_GSI_TRACE_ENABLED = 1
85} PXE_GSI_TYPE;
86
87DWORD PXEAPI PxeGetServerInfo(PXE_GSI_TYPE uInfoType,PVOID pBuffer,ULONG uBufferLen);
88PVOID PXEAPI PxePacketAllocate(HANDLE hProvider,HANDLE hClientRequest,ULONG uSize);
89DWORD PXEAPI PxePacketFree(HANDLE hProvider,HANDLE hClientRequest,PVOID pPacket);
90DWORD PXEAPI PxeProviderEnumClose(HANDLE hEnum);
91DWORD PXEAPI PxeProviderEnumFirst(HANDLE *phEnum);
92DWORD PXEAPI PxeProviderEnumNext(HANDLE hEnum,PPXE_PROVIDER *ppProvider);
93DWORD PXEAPI PxeProviderFreeInfo(PPXE_PROVIDER pProvider);
94DWORD PXEAPI PxeProviderInitialize(HANDLE hProvider,HKEY hProviderKey);
95DWORD PXEAPI PxeProviderQueryIndex(LPCWSTR pszProviderName,PULONG puIndex);
96DWORD PXEAPI PxeProviderRecvRequest(HANDLE hClientRequest,PVOID pPacket,ULONG uPacketLen,PXE_ADDRESS *pLocalAddress,PXE_ADDRESS *pRemoteAddress,PXE_BOOT_ACTION pAction,PVOID pContext);
97
98#define PXE_REG_INDEX_TOP	__MSABI_LONG(0U)
99#define PXE_REG_INDEX_BOTTOM	__MSABI_LONG(0xFFFFFFFFU)
100
101DWORD PXEAPI PxeProviderRegister(LPCWSTR pszProviderName,LPCWSTR pszModulePath,PXE_REG_INDEX Index,WINBOOL bIsCritical,PHKEY phProviderKey);
102DWORD PXEAPI PxeProviderServiceControl(PVOID pContext,DWORD dwControl);
103DWORD PXEAPI PxeProviderSetAttribute(HANDLE hProvider,PXE_PROVIDER_ATTRIBUTE Attribute,PVOID pParameterBuffer,ULONG uParamLen);
104
105#define PXE_PROV_ATTR_FILTER 0
106
107#define PXE_PROV_FILTER_ALL 0x0000
108#define PXE_PROV_FILTER_DHCP_ONLY 0x0001
109#define PXE_PROV_FILTER_PXE_ONLY 0x0002
110
111DWORD PXEAPI PxeProviderSetAttribute(HANDLE hProvider,PXE_PROVIDER_ATTRIBUTE Attribute,PVOID pParameterBuffer,ULONG uParamLen);
112DWORD PXEAPI PxeProviderShutdown(PVOID pContext);
113DWORD PXEAPI PxeProviderUnRegister(LPCWSTR pszProviderName);
114
115typedef enum _PXE_CALLBACK_TYPE {
116  PXE_CALLBACK_RECV_REQUEST = 0,
117  PXE_CALLBACK_SHUTDOWN,
118  PXE_CALLBACK_SERVICE_CONTROL,
119  PXE_CALLBACK_MAX
120} PXE_CALLBACK_TYPE;
121
122DWORD PXEAPI PxeSendReply(HANDLE hClientRequest,PVOID pPacket,ULONG uPacketLen,PXE_ADDRESS *pAddress);
123DWORD PXEAPI PxeRegisterCallback(HANDLE hProvider,PXE_CALLBACK_TYPE CallbackType,PVOID pCallbackFunction,PVOID pContext);
124
125typedef DWORD PXE_SEVERITY;
126
127#define PXE_TRACE_VERBOSE 0x00010000
128#define PXE_TRACE_INFO 0x00020000
129#define PXE_TRACE_WARNING 0x00040000
130#define PXE_TRACE_ERROR 0x00080000
131#define PXE_TRACE_FATAL 0x00100000
132
133DWORD WINAPIV PxeTrace(HANDLE hProvider,PXE_SEVERITY Severity,LPCWSTR pszFormat,...);
134
135#ifdef __cplusplus
136}
137#endif
138#endif /*(_WIN32_WINNT >= 0x0600)*/
139#endif /*_INC_WDSPXE*/
140