dhcp_client_misc.h File Reference

Helper functions for DHCP client. More...

#include "core/net.h"
#include "dhcp/dhcp_client.h"

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-2024 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.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]contextPointer to the DHCP client context
[in]newStateNew DHCP state to switch to
[in]delayInitial delay

Definition at line 1280 of file dhcp_client_misc.c.

◆ dhcpClientCheckTimeout()

void dhcpClientCheckTimeout ( DhcpClientContext context)

Manage DHCP configuration timeout.

Parameters
[in]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer to the DHCP client context
[in]messagePointer to the incoming DHCP message
[in]lengthLength 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]contextPointer to the DHCP client context
[in]messagePointer to the incoming DHCP message
[in]lengthLength 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]contextPointer to the DHCP client context
[in]messagePointer to the incoming DHCP message
[in]lengthLength 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]interfaceUnderlying network interface
[in]pseudoHeaderUDP pseudo header
[in]udpHeaderUDP header
[in]bufferMulti-part buffer containing the incoming DHCP message
[in]offsetOffset to the first byte of the DHCP message
[in]ancillaryAdditional options passed to the stack along with the packet
[in]paramPointer 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]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer to the DHCP client context

Definition at line 73 of file dhcp_client_misc.c.

Variable Documentation

◆ dhcpClientTickCounter

systime_t dhcpClientTickCounter
extern

Definition at line 49 of file dhcp_client_misc.c.