Helper functions for DHCP server. More...
Go to the source code of this file.
Functions | |
| void | dhcpServerTick (DhcpServerContext *context) |
| DHCP server timer handler. More... | |
| void | dhcpServerProcessMessage (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 | dhcpServerParseDiscover (DhcpServerContext *context, const DhcpMessage *message, size_t length) |
| Parse DHCPDISCOVER message. More... | |
| void | dhcpServerParseRequest (DhcpServerContext *context, const DhcpMessage *message, size_t length) |
| Parse DHCPREQUEST message. More... | |
| void | dhcpServerParseDecline (DhcpServerContext *context, const DhcpMessage *message, size_t length) |
| Parse DHCPDECLINE message. More... | |
| void | dhcpServerParseRelease (DhcpServerContext *context, const DhcpMessage *message, size_t length) |
| Parse DHCPRELEASE message. More... | |
| void | dhcpServerParseInform (DhcpServerContext *context, const DhcpMessage *message, size_t length) |
| Parse DHCPINFORM message. More... | |
| error_t | dhcpServerSendReply (DhcpServerContext *context, uint8_t type, Ipv4Addr yourIpAddr, const DhcpMessage *request, size_t requestLen) |
| Send DHCP reply message. More... | |
| DhcpServerBinding * | dhcpServerCreateBinding (DhcpServerContext *context) |
| Create a new binding. More... | |
| DhcpServerBinding * | dhcpServerFindBindingByMacAddr (DhcpServerContext *context, const MacAddr *macAddr) |
| Search the list of bindings for a given MAC address. More... | |
| DhcpServerBinding * | dhcpServerFindBindingByIpAddr (DhcpServerContext *context, Ipv4Addr ipAddr) |
| Search the list of bindings for a given IP address. More... | |
| error_t | dhcpServerGetNextIpAddr (DhcpServerContext *context, Ipv4Addr *ipAddr) |
| Retrieve the next IP address to be used. More... | |
Variables | |
| systime_t | dhcpServerTickCounter |
Detailed Description
Helper functions for DHCP server.
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_server_misc.h.
Function Documentation
◆ dhcpServerCreateBinding()
| DhcpServerBinding* dhcpServerCreateBinding | ( | DhcpServerContext * | context | ) |
Create a new binding.
- Parameters
-
[in] context Pointer to the DHCP server context
- Returns
- Pointer to the newly created binding
Definition at line 798 of file dhcp_server_misc.c.
◆ dhcpServerFindBindingByIpAddr()
| DhcpServerBinding* dhcpServerFindBindingByIpAddr | ( | DhcpServerContext * | context, |
| Ipv4Addr | ipAddr | ||
| ) |
Search the list of bindings for a given IP address.
- Parameters
-
[in] context Pointer to the DHCP server context [in] ipAddr IP address
- Returns
- Pointer to the corresponding DHCP binding
Definition at line 898 of file dhcp_server_misc.c.
◆ dhcpServerFindBindingByMacAddr()
| DhcpServerBinding* dhcpServerFindBindingByMacAddr | ( | DhcpServerContext * | context, |
| const MacAddr * | macAddr | ||
| ) |
Search the list of bindings for a given MAC address.
- Parameters
-
[in] context Pointer to the DHCP server context [in] macAddr MAC address
- Returns
- Pointer to the corresponding DHCP binding
Definition at line 862 of file dhcp_server_misc.c.
◆ dhcpServerGetNextIpAddr()
| error_t dhcpServerGetNextIpAddr | ( | DhcpServerContext * | context, |
| Ipv4Addr * | ipAddr | ||
| ) |
Retrieve the next IP address to be used.
- Parameters
-
[in] context Pointer to the DHCP server context [out] ipAddr Next IP address to be used
- Returns
- Error code
Definition at line 934 of file dhcp_server_misc.c.
◆ dhcpServerParseDecline()
| void dhcpServerParseDecline | ( | DhcpServerContext * | context, |
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) |
Parse DHCPDECLINE message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse
Definition at line 488 of file dhcp_server_misc.c.
◆ dhcpServerParseDiscover()
| void dhcpServerParseDiscover | ( | DhcpServerContext * | context, |
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) |
Parse DHCPDISCOVER message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse
Definition at line 230 of file dhcp_server_misc.c.
◆ dhcpServerParseInform()
| void dhcpServerParseInform | ( | DhcpServerContext * | context, |
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) |
Parse DHCPINFORM message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse
Definition at line 556 of file dhcp_server_misc.c.
◆ dhcpServerParseRelease()
| void dhcpServerParseRelease | ( | DhcpServerContext * | context, |
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) |
Parse DHCPRELEASE message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse
Definition at line 528 of file dhcp_server_misc.c.
◆ dhcpServerParseRequest()
| void dhcpServerParseRequest | ( | DhcpServerContext * | context, |
| const DhcpMessage * | message, | ||
| size_t | length | ||
| ) |
Parse DHCPREQUEST message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] message Pointer to the incoming DHCP message [in] length Length of the incoming message to parse
Definition at line 364 of file dhcp_server_misc.c.
◆ dhcpServerProcessMessage()
| void dhcpServerProcessMessage | ( | 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 server context
Definition at line 119 of file dhcp_server_misc.c.
◆ dhcpServerSendReply()
| error_t dhcpServerSendReply | ( | DhcpServerContext * | context, |
| uint8_t | type, | ||
| Ipv4Addr | yourIpAddr, | ||
| const DhcpMessage * | request, | ||
| size_t | requestLen | ||
| ) |
Send DHCP reply message.
- Parameters
-
[in] context Pointer to the DHCP server context [in] type DHCP message type (DHCPOFFER, DHCPACK or DHCPNAK) [in] yourIpAddr The IP address to be placed in the 'yiaddr' field [in] request Pointer to DHCP message received from the client [in] requestLen Length of the DHCP message received from the client
- Returns
- Error code
Definition at line 580 of file dhcp_server_misc.c.
◆ dhcpServerTick()
| void dhcpServerTick | ( | DhcpServerContext * | context | ) |
DHCP server timer handler.
This routine must be periodically called by the TCP/IP stack to manage DHCP server operation
- Parameters
-
[in] context Pointer to the DHCP server context
Definition at line 59 of file dhcp_server_misc.c.
Variable Documentation
◆ dhcpServerTickCounter
|
extern |
Definition at line 47 of file dhcp_server_misc.c.
