PxeDhcpIsValid function (wdspxe.h)
Validates that a packet is a DHCP packet.
Syntax
DWORD PXEAPI PxeDhcpIsValid(
[in] PVOID pPacket,
[in] ULONG uPacketLen,
[in] BOOL bRequestPacket,
[out] PBOOL pbPxeOptionPresent
);
Parameters
[in] pPacket
Pointer to a reply packet allocated with the PxePacketAllocate function.
[in] uPacketLen
Length of the packet pointed to by the pPacket parameter.
[in] bRequestPacket
Indicates whether the packet is a request packet. The following table lists the possible values.
Value | Meaning |
---|---|
|
Packet to be validated is a request packet from the client. |
|
Packet to be validated is a packet generated by the server. |
[out] pbPxeOptionPresent
Address of a BOOL that is set to TRUE if the packet is a valid DHCP packet that contains the Vendor Class Identifier option (60) with the value set to "PXEClient".
Return value
If the function succeeds, the return value is ERROR_SUCCESS.
Remarks
Providers use this function when the filter set with the PxeProviderSetAttribute function is set to receive all packets to determine if a specified packet is a valid DHCP packet. Providers can also use this function to validate reply packets; typically this is done only for debug or test builds of the provider.
The validation tests include the following tests.
DHCP field | Initialized value |
---|---|
Operation (op) | If the bClientRequest parameter is TRUE, this field must be 1 (BOOTP Request), otherwise this field must be 2 (BOOTP Reply). |
Hardware Address Length (hlen) | Must be less than or equal to 16. |
Host Name (sname) | Must be NULL terminated. |
Boot file name (file) | Must be NULL terminated. |
Magic Cookie (first 4 octets of vend) | Must contain valid DHCP Magic Cookie (99 130 83 99). |
Option Length | All options must have a valid length and do not overrun the packet. |
DHCP Message Type (53) | Must be present. |
End Option (255) | Packet must end with DHCP End Option. Due to minimum packet lengths, the packet may be larger but no options may follow the End Option. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2008, Windows Server 2003 with SP2 [desktop apps only] |
Target Platform | Windows |
Header | wdspxe.h |
Library | WdsPxe.lib |
DLL | WdsPxe.dll |