Updated Jul 2025
xApplicationDHCPHook_Multi()
[FreeRTOS-Plus-TCP API Reference]
FreeRTOS_sockets.h
Note: this hook needs to be defined only when
1eDHCPCallbackAnswer_t xApplicationDHCPHook_Multi( eDHCPCallbackPhase_t eDHCPPhase,2 struct xNetworkEndPoint * pxEndPoint,3 IP_Address_t * pxIPAddress4 );
xApplicationDHCPHook_Multi
Callback functions are implemented by the application writer, but called by the TCP/IP stack. The prototype of the callback function must exactly match the prototype above (including the function name). The code in an application hook should not call FreeRTOS-Plus-TCP API's that are blocking. That could easily lead to a dead-lock.
When an application hook executes, it borrows the task priority and the stack of the IP-task. Therefore, we recommend that you keep your application hook short—it may want to wake up some application task which will do further processing.
Parameters:
-
eDHCPPhase
For DHCPv4, this parameter can be either eDHCPPhasePreRequest or eDHCPPhasePreDiscover when the TCP stack is about to send either a Request or a Discover message, respectively. For DHCPv6, this parameter can be either eDHCPPhasePreRequest or eDHCPPhasePreDiscoverwhen the TCP stack is about to send either a Solicitation or Request message, respectively.
-
pxEndPoint
The end-point currently executes the DHCP(v4 or v6).
-
pxIPAddress
This parameter will contain the default IP address when the parameter eDHCPPhase is eDHCPPhasePreDiscover, otherwise (when eDHCPPhase is eDHCPPhasePreRequest) it will contain the IP address offered by the DHCP server.
Return value:
The return value can be one of these enum values:
- if the application wants to continue the DHCP transaction.eDHCPContinue
- if the application wants to use the default network parameters.eDHCPUseDefaults
- in case the DHCP processing must be stopped, while keeping all network parameters as they were before.eDHCPStopNoChanges