dhcp_client_misc.h
Go to the documentation of this file.
1 /**
2  * @file dhcp_client_misc.h
3  * @brief Helper functions for DHCP client
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_CLIENT_MISC_H
32 #define _DHCP_CLIENT_MISC_H
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dhcp/dhcp_client.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Tick counter to handle periodic operations
45 
46 //DHCP client related functions
47 void dhcpClientTick(DhcpClientContext *context);
49 
54 
56  const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
57  const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
58  void *param);
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 
72 
74  DhcpState newState, systime_t delay);
75 
78 
79 //C++ guard
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
uint8_t message[]
Definition: chap.h:154
DHCP client (Dynamic Host Configuration Protocol)
#define DhcpClientContext
Definition: dhcp_client.h:145
DhcpState
DHCP FSM states.
Definition: dhcp_client.h:158
void dhcpClientTick(DhcpClientContext *context)
DHCP client timer handler.
void dhcpClientParseNak(DhcpClientContext *context, const DhcpMessage *message, size_t length)
Parse DHCPNAK message.
error_t dhcpClientSendDecline(DhcpClientContext *context)
Send DHCPDECLINE message.
void dhcpClientParseAck(DhcpClientContext *context, const DhcpMessage *message, size_t length)
Parse DHCPACK message.
systime_t dhcpClientTickCounter
error_t dhcpClientSendRelease(DhcpClientContext *context)
Send DHCPRELEASE message.
error_t dhcpClientSendDiscover(DhcpClientContext *context)
Send DHCPDISCOVER message.
void dhcpClientResetConfig(DhcpClientContext *context)
Reset DHCP configuration.
void dhcpClientCheckTimeout(DhcpClientContext *context)
Manage DHCP configuration timeout.
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.
void dhcpClientLinkChangeEvent(DhcpClientContext *context)
Callback function for link change event.
void dhcpClientDumpConfig(DhcpClientContext *context)
Dump DHCP configuration for debugging purpose.
void dhcpClientParseOffer(DhcpClientContext *context, const DhcpMessage *message, size_t length)
Parse DHCPOFFER message.
error_t dhcpClientSendRequest(DhcpClientContext *context)
Send DHCPREQUEST message.
void dhcpClientChangeState(DhcpClientContext *context, DhcpState newState, systime_t delay)
Update DHCP FSM state.
uint16_t dhcpClientComputeElapsedTime(DhcpClientContext *context)
Compute the appropriate secs field.
DhcpMessage
Definition: dhcp_common.h:226
error_t
Error codes.
Definition: error.h:43
TCP/IP stack core.
#define NetInterface
Definition: net.h:36
#define NetRxAncillary
Definition: net_misc.h:40
uint32_t systime_t
System time.
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