Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

dhcpv6_common.c File Reference

dhcpv6_common.c File Reference

Functions common to DHCPv6 client, server and relay agent. More...

Go to the source code of this file.

Functions

Dhcpv6StatusCode dhcpv6GetStatusCode (const uint8_t *options, size_t length)
 Retrieve status code.
Dhcpv6Option * dhcpv6AddOption (void *message, size_t *messageLength, uint16_t optionCode, const void *optionValue, size_t optionLength)
 Add an option to a DHCPv6 message.
Dhcpv6Option * dhcpv6AddSubOption (Dhcpv6Option *baseOption, size_t *messageLength, uint16_t optionCode, const void *optionValue, size_t optionLength)
 Add a suboption under an existing base option.
Dhcpv6Option * dhcpv6GetOption (const uint8_t *options, size_t optionsLength, uint16_t optionCode)
 Find the specified option in a DHCPv6 message.
int32_t dhcpv6Rand (int32_t value)
 Multiplication by a randomization factor.
int32_t dhcpv6RandRange (int32_t min, int32_t max)
 Get a random value in the specified range.

Detailed Description

Functions common to DHCPv6 client, server and relay agent.

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.

Description

The Dynamic Host Configuration Protocol for IPv6 enables DHCP servers to pass configuration parameters such as IPv6 network addresses to IPv6 nodes. This protocol is a stateful counterpart to IPv6 Stateless Address Autoconfiguration (RFC 2462), and can be used separately or concurrently with the latter to obtain configuration parameters. Refer to RFC 3315

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file dhcpv6_common.c.


Function Documentation

Dhcpv6Option* dhcpv6AddOption ( void *  message,
size_t *  messageLength,
uint16_t  optionCode,
const void *  optionValue,
size_t  optionLength 
)

Add an option to a DHCPv6 message.

Parameters:
[in]messagePointer to the DHCPv6 message
[in,out]messageLengthLength of the overall DHCPv6 message
[in]optionCodeOption code
[in]optionValueOption value
[in]optionLengthLength of the option value
Returns:
If the option was successfully added, a pointer to the freshly created option is returned. Otherwise NULL pointer is returned

Definition at line 109 of file dhcpv6_common.c.

Dhcpv6Option* dhcpv6AddSubOption ( Dhcpv6Option *  baseOption,
size_t *  messageLength,
uint16_t  optionCode,
const void *  optionValue,
size_t  optionLength 
)

Add a suboption under an existing base option.

Parameters:
[in]baseOptionPointer to the base option
[in,out]messageLengthLength of the overall DHCPv6 message
[in]optionCodeOption code
[in]optionValueOption value
[in]optionLengthLength of the option value
Returns:
If the option was successfully added, a pointer to the freshly created option is returned. Otherwise NULL pointer is returned

Definition at line 151 of file dhcpv6_common.c.

Dhcpv6Option* dhcpv6GetOption ( const uint8_t *  options,
size_t  optionsLength,
uint16_t  optionCode 
)

Find the specified option in a DHCPv6 message.

Parameters:
[in]optionsPointer to the Options field
[in]optionsLengthLength of the Options field
[in]optionCodeCode of the option to find
Returns:
If the specified option was found, a pointer to the corresponding option is returned. Otherwise NULL pointer is returned

Definition at line 204 of file dhcpv6_common.c.

Dhcpv6StatusCode dhcpv6GetStatusCode ( const uint8_t *  options,
size_t  length 
)

Retrieve status code.

This function returns a status indication related to the DHCPv6 message or option in which it appears

Parameters:
[in]optionsPointer to the Options field
[in]lengthLength of the Options field
Returns:
Status code

Definition at line 68 of file dhcpv6_common.c.

int32_t dhcpv6Rand ( int32_t  value )

Multiplication by a randomization factor.

Each of the computations of a new RT include a randomization factor RAND, which is a random number chosen with a uniform distribution between -0.1 and +0.1. The randomization factor is included to minimize synchronization of messages transmitted by DHCPv6 clients

Parameters:
[in]valueInput value
Returns:
Value resulting from the randomization process

Definition at line 248 of file dhcpv6_common.c.

int32_t dhcpv6RandRange ( int32_t  min,
int32_t  max 
)

Get a random value in the specified range.

Parameters:
[in]minLower bound
[in]maxUpper bound
Returns:
Random value in the specified range

Definition at line 263 of file dhcpv6_common.c.