Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

dhcpv6_client.h File Reference

dhcpv6_client.h File Reference

DHCPv6 client (Dynamic Host Configuration Protocol for IPv6) More...

Go to the source code of this file.

Data Structures

struct  Dhcpv6ClientSettings
 DHCPv6 client settings. More...
struct  Dhcpv6ClientAddrEntry
 IA address entry. More...
struct  Dhcpv6ClientIa
 Client's IA (Identity Association) More...
struct  _Dhcpv6ClientContext
 DHCPv6 client context. More...

Typedefs

typedef void(* Dhcpv6TimeoutCallback )(Dhcpv6ClientContext *context, NetInterface *interface)
 DHCPv6 configuration timeout callback.
typedef void(* Dhcpv6LinkChangeCallback )(Dhcpv6ClientContext *context, NetInterface *interface, bool_t linkState)
 Link state change callback.
typedef void(* Dhcpv6StateChangeCallback )(Dhcpv6ClientContext *context, NetInterface *interface, Dhcpv6State state)
 FSM state change callback.

Enumerations

enum  Dhcpv6State
 

DHCPv6 client FSM states.

More...

Functions

void dhcpv6ClientGetDefaultSettings (Dhcpv6ClientSettings *settings)
 Initialize settings with default values.
error_t dhcpv6ClientInit (Dhcpv6ClientContext *context, const Dhcpv6ClientSettings *settings)
 DHCPv6 client initialization.
error_t dhcpv6ClientStart (Dhcpv6ClientContext *context)
 Start DHCPv6 client.
error_t dhcpv6ClientStop (Dhcpv6ClientContext *context)
 Stop DHCPv6 client.
error_t dhcpv6ClientRelease (Dhcpv6ClientContext *context)
 Release DHCPv6 lease.
Dhcpv6State dhcpv6ClientGetState (Dhcpv6ClientContext *context)
 Retrieve current state.
void dhcpv6ClientTick (Dhcpv6ClientContext *context)
 DHCPv6 client timer handler.
void dhcpv6ClientLinkChangeEvent (Dhcpv6ClientContext *context)
 Callback function for link change event.
void dhcpv6ClientStateInit (Dhcpv6ClientContext *context)
 INIT state.
void dhcpv6ClientStateSolicit (Dhcpv6ClientContext *context)
 SOLICIT state.
void dhcpv6ClientStateRequest (Dhcpv6ClientContext *context)
 REQUEST state.
void dhcpv6ClientStateInitConfirm (Dhcpv6ClientContext *context)
 INIT-CONFIRM state.
void dhcpv6ClientStateConfirm (Dhcpv6ClientContext *context)
 CONFIRM state.
void dhcpv6ClientStateDad (Dhcpv6ClientContext *context)
 DAD state.
void dhcpv6ClientStateBound (Dhcpv6ClientContext *context)
 BOUND state.
void dhcpv6ClientStateRenew (Dhcpv6ClientContext *context)
 RENEW state.
void dhcpv6ClientStateRebind (Dhcpv6ClientContext *context)
 REBIND state.
void dhcpv6ClientStateRelease (Dhcpv6ClientContext *context)
 RELEASE state.
void dhcpv6ClientStateDecline (Dhcpv6ClientContext *context)
 DECLINE state.
error_t dhcpv6ClientSendMessage (Dhcpv6ClientContext *context, Dhcpv6MessageType type)
 Send Solicit message.
void dhcpv6ClientProcessMessage (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, void *params)
 Process incoming DHCPv6 message.
void dhcpv6ClientParseAdvertise (Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
 Parse Advertise message.
void dhcpv6ClientParseReply (Dhcpv6ClientContext *context, const Dhcpv6Message *message, size_t length)
 Parse Reply message.
error_t dhcpv6ClientParseIaNaOption (Dhcpv6ClientContext *context, const Dhcpv6Option *option)
 Parse IA_NA option.
error_t dhcpv6ClientParseIaAddrOption (Dhcpv6ClientContext *context, const Dhcpv6Option *option)
 Parse IA Address option.
void dhcpv6ClientAddAddr (Dhcpv6ClientContext *context, const Ipv6Addr *addr, uint32_t validLifetime, uint32_t preferredLifetime)
 Add an IPv6 address to the IA.
void dhcpv6ClientRemoveAddr (Dhcpv6ClientContext *context, const Ipv6Addr *addr)
 Remove an IPv6 address from the IA.
void dhcpv6ClientFlushAddrList (Dhcpv6ClientContext *context)
 Flush the list of IPv6 addresses from the IA.
error_t dhcpv6ClientGenerateDuid (Dhcpv6ClientContext *context)
 Generate client's DUID.
error_t dhcpv6ClientGenerateFqdn (Dhcpv6ClientContext *context)
 Generate client's fully qualified domain name.
error_t dhcpv6ClientGenerateLinkLocalAddr (Dhcpv6ClientContext *context)
 Generate a link-local address.
bool_t dhcpv6ClientCheckServerId (Dhcpv6ClientContext *context, Dhcpv6Option *serverIdOption)
 Check the Server Identifier option.
void dhcpv6ClientCheckTimeout (Dhcpv6ClientContext *context)
 Manage DHCPv6 configuration timeout.
uint16_t dhcpv6ClientComputeElapsedTime (Dhcpv6ClientContext *context)
 Compute the time elapsed since the client sent the first message.
void dhcpv6ClientChangeState (Dhcpv6ClientContext *context, Dhcpv6State newState, systime_t delay)
 Update DHCPv6 FSM state.
void dhcpv6ClientDumpConfig (Dhcpv6ClientContext *context)
 Dump DHCPv6 configuration for debugging purpose.

Detailed Description

DHCPv6 client (Dynamic Host Configuration Protocol for IPv6)

License

Copyright (C) 2010-2017 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:
1.7.6

Definition in file dhcpv6_client.h.


Typedef Documentation

typedef void(* Dhcpv6LinkChangeCallback)(Dhcpv6ClientContext *context, NetInterface *interface, bool_t linkState)

Link state change callback.

Definition at line 262 of file dhcpv6_client.h.

typedef void(* Dhcpv6StateChangeCallback)(Dhcpv6ClientContext *context, NetInterface *interface, Dhcpv6State state)

FSM state change callback.

Definition at line 270 of file dhcpv6_client.h.

typedef void(* Dhcpv6TimeoutCallback)(Dhcpv6ClientContext *context, NetInterface *interface)

DHCPv6 configuration timeout callback.

Definition at line 254 of file dhcpv6_client.h.


Enumeration Type Documentation

DHCPv6 client FSM states.

Definition at line 234 of file dhcpv6_client.h.


Function Documentation

void dhcpv6ClientAddAddr ( Dhcpv6ClientContext *  context,
const Ipv6Addr *  addr,
uint32_t  validLifetime,
uint32_t  preferredLifetime 
)

Add an IPv6 address to the IA.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]addrIPv6 address to be added
[in]validLifetimeValid lifetime, in seconds
[in]preferredLifetimePreferred lifetime, in seconds

Definition at line 2154 of file dhcpv6_client.c.

void dhcpv6ClientChangeState ( Dhcpv6ClientContext *  context,
Dhcpv6State  newState,
systime_t  delay 
)

Update DHCPv6 FSM state.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]newStateNew DHCPv6 state to switch to
[in]delayInitial delay

Definition at line 2498 of file dhcpv6_client.c.

bool_t dhcpv6ClientCheckServerId ( Dhcpv6ClientContext *  context,
Dhcpv6Option *  serverIdOption 
)

Check the Server Identifier option.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]serverIdOptionPointer to the Server Identifier option
Returns:
TRUE if the option matches the server’s DUID, else FALSE

Definition at line 2401 of file dhcpv6_client.c.

void dhcpv6ClientCheckTimeout ( Dhcpv6ClientContext *  context )

Manage DHCPv6 configuration timeout.

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 2424 of file dhcpv6_client.c.

uint16_t dhcpv6ClientComputeElapsedTime ( Dhcpv6ClientContext *  context )

Compute the time elapsed since the client sent the first message.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
The elapsed time expressed in hundredths of a second

Definition at line 2465 of file dhcpv6_client.c.

void dhcpv6ClientDumpConfig ( Dhcpv6ClientContext *  context )

Dump DHCPv6 configuration for debugging purpose.

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 2564 of file dhcpv6_client.c.

void dhcpv6ClientFlushAddrList ( Dhcpv6ClientContext *  context )

Flush the list of IPv6 addresses from the IA.

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 2246 of file dhcpv6_client.c.

error_t dhcpv6ClientGenerateDuid ( Dhcpv6ClientContext *  context )

Generate client's DUID.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 2281 of file dhcpv6_client.c.

error_t dhcpv6ClientGenerateFqdn ( Dhcpv6ClientContext *  context )

Generate client's fully qualified domain name.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 2318 of file dhcpv6_client.c.

error_t dhcpv6ClientGenerateLinkLocalAddr ( Dhcpv6ClientContext *  context )

Generate a link-local address.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 2350 of file dhcpv6_client.c.

void dhcpv6ClientGetDefaultSettings ( Dhcpv6ClientSettings settings )

Initialize settings with default values.

Parameters:
[out]settingsStructure that contains DHCPv6 client settings

Definition at line 73 of file dhcpv6_client.c.

Dhcpv6State dhcpv6ClientGetState ( Dhcpv6ClientContext *  context )

Retrieve current state.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Current DHCPv6 client state

Definition at line 313 of file dhcpv6_client.c.

error_t dhcpv6ClientInit ( Dhcpv6ClientContext *  context,
const Dhcpv6ClientSettings settings 
)

DHCPv6 client initialization.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]settingsDHCPv6 client specific settings
Returns:
Error code

Definition at line 100 of file dhcpv6_client.c.

void dhcpv6ClientLinkChangeEvent ( Dhcpv6ClientContext *  context )

Callback function for link change event.

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 434 of file dhcpv6_client.c.

void dhcpv6ClientParseAdvertise ( Dhcpv6ClientContext *  context,
const Dhcpv6Message *  message,
size_t  length 
)

Parse Advertise message.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]messagePointer to the incoming message to parse
[in]lengthLength of the incoming message

Definition at line 1495 of file dhcpv6_client.c.

error_t dhcpv6ClientParseIaAddrOption ( Dhcpv6ClientContext *  context,
const Dhcpv6Option *  option 
)

Parse IA Address option.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]optionPointer to the IA Address option to parse
Returns:
Error code

Definition at line 2092 of file dhcpv6_client.c.

error_t dhcpv6ClientParseIaNaOption ( Dhcpv6ClientContext *  context,
const Dhcpv6Option *  option 
)

Parse IA_NA option.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]optionPointer to the IA_NA option to parse
Returns:
Error code

Definition at line 1979 of file dhcpv6_client.c.

void dhcpv6ClientParseReply ( Dhcpv6ClientContext *  context,
const Dhcpv6Message *  message,
size_t  length 
)

Parse Reply message.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]messagePointer to the incoming message to parse
[in]lengthLength of the incoming message

Definition at line 1654 of file dhcpv6_client.c.

void dhcpv6ClientProcessMessage ( NetInterface *  interface,
const IpPseudoHeader pseudoHeader,
const UdpHeader *  udpHeader,
const NetBuffer buffer,
size_t  offset,
void *  params 
)

Process incoming DHCPv6 message.

Parameters:
[in]interfaceUnderlying network interface
[in]pseudoHeaderUDP pseudo header
[in]udpHeaderUDP header
[in]bufferMulti-part buffer containing the incoming DHCPv6 message
[in]offsetOffset to the first byte of the DHCPv6 message
[in]paramsPointer to the DHCPv6 client context

Definition at line 1439 of file dhcpv6_client.c.

error_t dhcpv6ClientRelease ( Dhcpv6ClientContext *  context )

Release DHCPv6 lease.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 247 of file dhcpv6_client.c.

void dhcpv6ClientRemoveAddr ( Dhcpv6ClientContext *  context,
const Ipv6Addr *  addr 
)

Remove an IPv6 address from the IA.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]addrIPv6 address to be removed

Definition at line 2208 of file dhcpv6_client.c.

error_t dhcpv6ClientSendMessage ( Dhcpv6ClientContext *  context,
Dhcpv6MessageType  type 
)

Send Solicit message.

Parameters:
[in]contextPointer to the DHCPv6 client context
[in]typeDHCPv6 message type
Returns:
Error code

Definition at line 1242 of file dhcpv6_client.c.

error_t dhcpv6ClientStart ( Dhcpv6ClientContext *  context )

Start DHCPv6 client.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 162 of file dhcpv6_client.c.

void dhcpv6ClientStateBound ( Dhcpv6ClientContext *  context )

BOUND state.

Client has a valid lease and is in its normal operating state

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 898 of file dhcpv6_client.c.

void dhcpv6ClientStateConfirm ( Dhcpv6ClientContext *  context )

CONFIRM state.

Whenever a client may have moved to a new link, the prefixes from the addresses assigned to the interfaces on that link may no longer be appropriate for the link to which the client is attached. In such the client must initiate a Confirm/Reply message exchange

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 759 of file dhcpv6_client.c.

void dhcpv6ClientStateDad ( Dhcpv6ClientContext *  context )

DAD state.

The client perform duplicate address detection on each of the addresses in any IAs it receives in the Reply message before using that address for traffic

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 844 of file dhcpv6_client.c.

void dhcpv6ClientStateDecline ( Dhcpv6ClientContext *  context )

DECLINE state.

If a client detects that one or more addresses assigned to it by a server are already in use by another node, the client sends a Decline message to the server to inform it that the address is suspect

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 1181 of file dhcpv6_client.c.

void dhcpv6ClientStateInit ( Dhcpv6ClientContext *  context )

INIT state.

This is the initialization state, where a client begins the process of acquiring a lease. It also returns here when a lease ends, or when a lease negotiation fails

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 511 of file dhcpv6_client.c.

void dhcpv6ClientStateInitConfirm ( Dhcpv6ClientContext *  context )

INIT-CONFIRM state.

When a client that already has a valid lease starts up after a power-down or reboot, it starts here instead of the INIT state

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 713 of file dhcpv6_client.c.

void dhcpv6ClientStateRebind ( Dhcpv6ClientContext *  context )

REBIND state.

The client sends a Rebind message to any available server to extend the lifetimes on the addresses assigned to the client and to update other configuration parameters. This message is sent after a client receives no response to a Renew message

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 1026 of file dhcpv6_client.c.

void dhcpv6ClientStateRelease ( Dhcpv6ClientContext *  context )

RELEASE state.

To release one or more addresses, a client sends a Release message to the server

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 1114 of file dhcpv6_client.c.

void dhcpv6ClientStateRenew ( Dhcpv6ClientContext *  context )

RENEW state.

The client sends a Renew message to the server that originally provided the client's addresses and configuration parameters to extend the lifetimes on the addresses assigned to the client and to update other configuration parameters

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 940 of file dhcpv6_client.c.

void dhcpv6ClientStateRequest ( Dhcpv6ClientContext *  context )

REQUEST state.

The client uses a Request message to populate IAs with addresses and obtain other configuration information. The client includes one or more more IA options in the Request message. The server then returns addresses and other information about the IAs to the client in IA options in a Reply message

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 639 of file dhcpv6_client.c.

void dhcpv6ClientStateSolicit ( Dhcpv6ClientContext *  context )

SOLICIT state.

A client uses the Solicit message to discover DHCPv6 servers

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 557 of file dhcpv6_client.c.

error_t dhcpv6ClientStop ( Dhcpv6ClientContext *  context )

Stop DHCPv6 client.

Parameters:
[in]contextPointer to the DHCPv6 client context
Returns:
Error code

Definition at line 216 of file dhcpv6_client.c.

void dhcpv6ClientTick ( Dhcpv6ClientContext *  context )

DHCPv6 client timer handler.

This routine must be periodically called by the TCP/IP stack to manage DHCPv6 client operation

Parameters:
[in]contextPointer to the DHCPv6 client context

Definition at line 339 of file dhcpv6_client.c.