LPDHCP_GIVE_ADDRESS callback function (dhcpssdk.h)

The DhcpAddressOfferHook function is called by Microsoft DHCP Server directly before Microsoft DHCP Server sends an acknowledgment (ACK) to a DHCP REQUEST message. The DhcpAddressOfferHook is implemented by a third-party DLL that registers for notification of significant Microsoft DHCP Server events.

The DhcpAddressOfferHook function should not block.

Syntax

LPDHCP_GIVE_ADDRESS LpdhcpGiveAddress;

DWORD LpdhcpGiveAddress(
  [in] LPBYTE Packet,
  [in] DWORD PacketSize,
  [in] DWORD ControlCode,
  [in] DWORD IpAddress,
  [in] DWORD AltAddress,
  [in] DWORD AddrType,
  [in] DWORD LeaseTime,
  [in] LPVOID Reserved,
  [in] LPVOID PktContext
)
{...}

Parameters

[in] Packet

Buffer for the packet being processed.

[in] PacketSize

Size of the Packet parameter, in bytes.

[in] ControlCode

Specifies the type of lease being approved. If the acknowledgment is for a new lease, ControlCode is DHCP_GIVE_ADDRESS_NEW. If the acknowledgment is for the renewal of an existing lease, ControlCode is DHCP_GIVE_ADDRESS_OLD.

[in] IpAddress

Internet Protocol (IP) address of the socket on which the packet was received. The IP address is in host order.

[in] AltAddress

Internet Protocol (IP) address being handed out in the lease.

[in] AddrType

Specifies whether the address is a DHCP or BOOTP address. The default value is DHCP_CLIENT_DHCP.

Value Meaning
DHCP_CLIENT_DHCP
The address is a DHCP-served address.
DHCP_CLIENT_BOOTP
The address is a BOOTP-served address.

[in] LeaseTime

Lease duration being passed, in seconds.

[in] Reserved

Reserve for future use.

[in] PktContext

Context identifying the packet, as provided in the PktContext parameter of a previous DhcpNewPktHook function call.

Return value

Return values are defined by the application providing the callback.

Remarks

Implementations of the DhcpAddressOfferHook should not block.

Requirements

Requirement Value
Minimum supported client None supported
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header dhcpssdk.h

See also

DHCP_CALLOUT_TABLE

DhcpNewPktHook