Helper functions for DHCP client. More...
Go to the source code of this file.
| Functions | |
| void | dhcpClientTick (DhcpClientContext *context) | 
| DHCP client timer handler.  More... | |
| void | dhcpClientLinkChangeEvent (DhcpClientContext *context) | 
| Callback function for link change event.  More... | |
| error_t | dhcpClientSendDiscover (DhcpClientContext *context) | 
| Send DHCPDISCOVER message.  More... | |
| error_t | dhcpClientSendRequest (DhcpClientContext *context) | 
| Send DHCPREQUEST message.  More... | |
| error_t | dhcpClientSendDecline (DhcpClientContext *context) | 
| Send DHCPDECLINE message.  More... | |
| error_t | dhcpClientSendRelease (DhcpClientContext *context) | 
| Send DHCPRELEASE message.  More... | |
| void | dhcpClientProcessMessage (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param) | 
| Process incoming DHCP message.  More... | |
| void | dhcpClientParseOffer (DhcpClientContext *context, const DhcpMessage *message, size_t length) | 
| Parse DHCPOFFER message.  More... | |
| void | dhcpClientParseAck (DhcpClientContext *context, const DhcpMessage *message, size_t length) | 
| Parse DHCPACK message.  More... | |
| void | dhcpClientParseNak (DhcpClientContext *context, const DhcpMessage *message, size_t length) | 
| Parse DHCPNAK message.  More... | |
| void | dhcpClientCheckTimeout (DhcpClientContext *context) | 
| Manage DHCP configuration timeout.  More... | |
| uint16_t | dhcpClientComputeElapsedTime (DhcpClientContext *context) | 
| Compute the appropriate secs field.  More... | |
| void | dhcpClientChangeState (DhcpClientContext *context, DhcpState newState, systime_t delay) | 
| Update DHCP FSM state.  More... | |
| void | dhcpClientResetConfig (DhcpClientContext *context) | 
| Reset DHCP configuration.  More... | |
| void | dhcpClientDumpConfig (DhcpClientContext *context) | 
| Dump DHCP configuration for debugging purpose.  More... | |
| Variables | |
| systime_t | dhcpClientTickCounter | 
Detailed Description
Helper functions for DHCP client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file dhcp_client_misc.h.
Function Documentation
◆ dhcpClientChangeState()
| void dhcpClientChangeState | ( | DhcpClientContext * | context, | 
| DhcpState | newState, | ||
| systime_t | delay | ||
| ) | 
Update DHCP FSM state.
- Parameters
- 
  [in] context Pointer to the DHCP client context [in] newState New DHCP state to switch to [in] delay Initial delay 
Definition at line 1280 of file dhcp_client_misc.c.
◆ dhcpClientCheckTimeout()
| void dhcpClientCheckTimeout | ( | DhcpClientContext * | context | ) | 
Manage DHCP configuration timeout.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
Definition at line 1212 of file dhcp_client_misc.c.
◆ dhcpClientComputeElapsedTime()
| uint16_t dhcpClientComputeElapsedTime | ( | DhcpClientContext * | context | ) | 
Compute the appropriate secs field.
Compute the number of seconds elapsed since the client began address acquisition or renewal process
- Parameters
- 
  [in] context Pointer to the DHCP client context 
- Returns
- The elapsed time expressed in seconds
Definition at line 1257 of file dhcp_client_misc.c.
◆ dhcpClientDumpConfig()
| void dhcpClientDumpConfig | ( | DhcpClientContext * | context | ) | 
Dump DHCP configuration for debugging purpose.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
Definition at line 1384 of file dhcp_client_misc.c.
◆ dhcpClientLinkChangeEvent()
| void dhcpClientLinkChangeEvent | ( | DhcpClientContext * | context | ) | 
Callback function for link change event.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
Definition at line 167 of file dhcp_client_misc.c.
◆ dhcpClientParseAck()
| void dhcpClientParseAck | ( | DhcpClientContext * | context, | 
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) | 
Parse DHCPACK message.
- Parameters
- 
  [in] context Pointer to the DHCP client context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse 
Definition at line 888 of file dhcp_client_misc.c.
◆ dhcpClientParseNak()
| void dhcpClientParseNak | ( | DhcpClientContext * | context, | 
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) | 
Parse DHCPNAK message.
- Parameters
- 
  [in] context Pointer to the DHCP client context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse 
Definition at line 1136 of file dhcp_client_misc.c.
◆ dhcpClientParseOffer()
| void dhcpClientParseOffer | ( | DhcpClientContext * | context, | 
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) | 
Parse DHCPOFFER message.
- Parameters
- 
  [in] context Pointer to the DHCP client context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse 
Definition at line 823 of file dhcp_client_misc.c.
◆ dhcpClientProcessMessage()
| void dhcpClientProcessMessage | ( | NetInterface * | interface, | 
| const IpPseudoHeader * | pseudoHeader, | ||
| const UdpHeader * | udpHeader, | ||
| const NetBuffer * | buffer, | ||
| size_t | offset, | ||
| const NetRxAncillary * | ancillary, | ||
| void * | param | ||
| ) | 
Process incoming DHCP message.
- Parameters
- 
  [in] interface Underlying network interface [in] pseudoHeader UDP pseudo header [in] udpHeader UDP header [in] buffer Multi-part buffer containing the incoming DHCP message [in] offset Offset to the first byte of the DHCP message [in] ancillary Additional options passed to the stack along with the packet [in] param Pointer to the DHCP client context 
Definition at line 735 of file dhcp_client_misc.c.
◆ dhcpClientResetConfig()
| void dhcpClientResetConfig | ( | DhcpClientContext * | context | ) | 
Reset DHCP configuration.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
Definition at line 1345 of file dhcp_client_misc.c.
◆ dhcpClientSendDecline()
| error_t dhcpClientSendDecline | ( | DhcpClientContext * | context | ) | 
Send DHCPDECLINE message.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
- Returns
- Error code
Definition at line 500 of file dhcp_client_misc.c.
◆ dhcpClientSendDiscover()
| error_t dhcpClientSendDiscover | ( | DhcpClientContext * | context | ) | 
Send DHCPDISCOVER message.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
- Returns
- Error code
Definition at line 221 of file dhcp_client_misc.c.
◆ dhcpClientSendRelease()
| error_t dhcpClientSendRelease | ( | DhcpClientContext * | context | ) | 
Send DHCPRELEASE message.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
- Returns
- Error code
Definition at line 614 of file dhcp_client_misc.c.
◆ dhcpClientSendRequest()
| error_t dhcpClientSendRequest | ( | DhcpClientContext * | context | ) | 
Send DHCPREQUEST message.
- Parameters
- 
  [in] context Pointer to the DHCP client context 
- Returns
- Error code
Definition at line 337 of file dhcp_client_misc.c.
◆ dhcpClientTick()
| void dhcpClientTick | ( | DhcpClientContext * | context | ) | 
DHCP client timer handler.
This routine must be periodically called by the TCP/IP stack to manage DHCP client operation
- Parameters
- 
  [in] context Pointer to the DHCP client context 
Definition at line 73 of file dhcp_client_misc.c.
Variable Documentation
◆ dhcpClientTickCounter
| 
 | extern | 
Definition at line 49 of file dhcp_client_misc.c.
