dhcp_server_misc.h
Go to the documentation of this file.
1 /**
2  * @file dhcp_server_misc.h
3  * @brief Helper functions for DHCP server
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.0
29  **/
30 
31 #ifndef _DHCP_SERVER_MISC_H
32 #define _DHCP_SERVER_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dhcp/dhcp_server.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Tick counter to handle periodic operations
45 
46 //DHCP server related functions
47 void dhcpServerTick(DhcpServerContext *context);
48 
50  const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
51  const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
52  void *param);
53 
55  const DhcpMessage *message, size_t length);
56 
58  const DhcpMessage *message, size_t length);
59 
61  const DhcpMessage *message, size_t length);
62 
64  const DhcpMessage *message, size_t length);
65 
67  const DhcpMessage *message, size_t length);
68 
70  Ipv4Addr yourIpAddr, const DhcpMessage *request, size_t requestLen);
71 
73 
75  const MacAddr *macAddr);
76 
79 
81 
82 //C++ guard
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
uint8_t message[]
Definition: chap.h:154
uint8_t type
Definition: coap_common.h:176
DhcpMessage
Definition: dhcp_common.h:226
DHCP server (Dynamic Host Configuration Protocol)
#define DhcpServerContext
Definition: dhcp_server.h:79
DhcpServerBinding * dhcpServerFindBindingByMacAddr(DhcpServerContext *context, const MacAddr *macAddr)
Search the list of bindings for a given MAC address.
systime_t dhcpServerTickCounter
error_t dhcpServerSendReply(DhcpServerContext *context, uint8_t type, Ipv4Addr yourIpAddr, const DhcpMessage *request, size_t requestLen)
Send DHCP reply message.
void dhcpServerTick(DhcpServerContext *context)
DHCP server timer handler.
void dhcpServerParseRequest(DhcpServerContext *context, const DhcpMessage *message, size_t length)
Parse DHCPREQUEST message.
void dhcpServerParseRelease(DhcpServerContext *context, const DhcpMessage *message, size_t length)
Parse DHCPRELEASE message.
error_t dhcpServerGetNextIpAddr(DhcpServerContext *context, Ipv4Addr *ipAddr)
Retrieve the next IP address to be used.
void dhcpServerParseDiscover(DhcpServerContext *context, const DhcpMessage *message, size_t length)
Parse DHCPDISCOVER message.
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.
void dhcpServerParseInform(DhcpServerContext *context, const DhcpMessage *message, size_t length)
Parse DHCPINFORM message.
DhcpServerBinding * dhcpServerCreateBinding(DhcpServerContext *context)
Create a new binding.
void dhcpServerParseDecline(DhcpServerContext *context, const DhcpMessage *message, size_t length)
Parse DHCPDECLINE message.
DhcpServerBinding * dhcpServerFindBindingByIpAddr(DhcpServerContext *context, Ipv4Addr ipAddr)
Search the list of bindings for a given IP address.
error_t
Error codes.
Definition: error.h:43
MacAddr
Definition: ethernet.h:195
Ipv4Addr ipAddr
Definition: ipcp.h:105
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:267
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define NetRxAncillary
Definition: net_misc.h:40
uint32_t systime_t
System time.
DHCP binding.
Definition: dhcp_server.h:112
IP pseudo header.
Definition: ip.h:99
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:89
uint8_t length
Definition: tcp.h:368
UdpHeader
Definition: udp.h:85