Jump to main content

##

# TCPIP_DHCP_HandlerRegister Function

## C

    TCPIP_DHCP_HANDLE TCPIP_DHCP_HandlerRegister(
        TCPIP_NET_HANDLE hNet,
        TCPIP_DHCP_EVENT_HANDLER handler,
        const void* hParam
    );

## Description

This function registers a DHCP event handler. The DHCP module will call the registered handler when a DHCP event (TCPIP_DHCP_EVENT_TYPE) occurs.

## Preconditions

The DHCP module must be initialized.

## Parameters

Parameters | Description
--- | ---
hNet | Interface handle. Use hNet == 0 to register on all interfaces available.
handler | Handler to be called when a DHCP event occurs.
hParam | Parameter to be used in the handler call. This is user supplied and is not used by the DHCP module.

## Returns

- A valid handle - If the call succeeds.
- A null handle - If the call failed (out of memory, for example).

## Remarks

The handler has to be short and fast. It is meant for setting an event flag, not for lengthy processing.

The hParam is passed by the client and will be used by the DHCP when the notification is made. It is used for per-thread content or if more modules, for example, share the same handler and need a way to differentiate the callback.