AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/addons/dhcp/nxd_dhcpv6_server.c
UINT  _nx_dhcpv6_server_utility_get_data(UCHAR *buffer, UINT size, ULONG *value)
{


    /* Check that the size of the data fits in a ULONG. */
    if (size > sizeof(ULONG))
    {
        return NX_DHCPV6_INVALID_DATA_SIZE;
    }

    *value = 0;
    
    /* Process the data retrieval request.  */
    while (size-- > 0)
    {

        /* Build return value.  */
        *value = (*value << 8) | *buffer++;
    }

    /* Return value.  */
    return NX_SUCCESS;
}
/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _nx_dhcpv6_server_utility_get_data                  PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function parses the input buffer and returns numeric data      */
/*    specified by the size argument, up to 4 bytes long.  Note that if   */
/*    caller is using this utility to extract bytes from a DHCPv6 packet  */
/*    there is no need for byte swapping, as compared to using memcpy in  */
/*    which case there is for little endian processors.                   */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    buffer                            Pointer to data buffer            */
/*    value                             Pointer to data parsed from buffer*/
/*    size                              Size of buffer                    */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    NX_DHCPV6_INVALID_DATA_SIZE       Requested data size too large     */
/*    NX_SUCCESS                        Successful completion status      */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLED BY                                                             */
/*    _nx_dhcpv6_process_server_duid   Process server duid in server reply*/
/*    _nx_dhcpv6_process_client_duid   Process server duid in server reply*/
/*    _nx_dhcpv6_server_utility_get_block_option_length                   */
/*                                     Parses option code and length      */
/*    _nx_dhcpv6_server_extract_packet_information                        */
/*                                     Parses each option from server     */
/*                                        reply and updates Client record */
/*                                                                        */
/*  RELEASE HISTORY                                                       */
/*                                                                        */
/*    DATE              NAME                      DESCRIPTION             */
/*                                                                        */
/*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
/*  09-30-2020     Yuxin Zhou               Modified comment(s),          */
/*                                            resulting in version 6.1    */
/*                                                                        */
/**************************************************************************/
FUNCTION                                               RELEASE

_nx_dhcpv6_server_utility_get_data                  PORTABLE C
6.1
AUTHOR

Yuxin Zhou, Microsoft Corporation

DESCRIPTION

This function parses the input buffer and returns numeric data
specified by the size argument, up to 4 bytes long.  Note that if
caller is using this utility to extract bytes from a DHCPv6 packet
there is no need for byte swapping, as compared to using memcpy in
which case there is for little endian processors.

INPUT

buffer                            Pointer to data buffer
value                             Pointer to data parsed from buffer
size                              Size of buffer

OUTPUT

NX_DHCPV6_INVALID_DATA_SIZE       Requested data size too large
NX_SUCCESS                        Successful completion status

CALLS

None

CALLED BY
_nx_dhcpv6_process_server_duid   Process server duid in server reply
_nx_dhcpv6_process_client_duid   Process server duid in server reply
_nx_dhcpv6_server_utility_get_block_option_length
Parses option code and length
_nx_dhcpv6_server_extract_packet_information
Parses each option from server
reply and updates Client record

RELEASE HISTORY

DATE              NAME                      DESCRIPTION

05-19-2020     Yuxin Zhou               Initial Version 6.0
09-30-2020     Yuxin Zhou               Modified comment(s),
resulting in version 6.1
FUNCTION RELEASE _nx_dhcpv6_server_utility_get_data PORTABLE C 6 . 1 AUTHOR Yuxin Zhou Microsoft Corporation DESCRIPTION This function parses the input buffer and returns numeric data specified by the size argument up to 4 bytes long . Note that if caller is using this utility to extract bytes from a DHCPv6 packet there is no need for byte swapping as compared to using memcpy in which case there is for little endian processors . INPUT buffer Pointer to data buffer value Pointer to data parsed from buffer size Size of buffer OUTPUT NX_DHCPV6_INVALID_DATA_SIZE Requested data size too large NX_SUCCESS Successful completion status CALLS None CALLED BY _nx_dhcpv6_process_server_duid Process server duid in server reply _nx_dhcpv6_process_client_duid Process server duid in server reply _nx_dhcpv6_server_utility_get_block_option_length Parses option code and length _nx_dhcpv6_server_extract_packet_information Parses each option from server reply and updates Client record RELEASE HISTORY DATE NAME DESCRIPTION 05 - 19 - 2020 Yuxin Zhou Initial Version 6 . 0 09 - 30 - 2020 Yuxin Zhou Modified comment ( s ) resulting in version 6 . 1
UINT  _nx_dhcpv6_server_utility_get_data(UCHAR *buffer, UINT size, ULONG *value)
{
    if (size > sizeof(ULONG))
    {
        return NX_DHCPV6_INVALID_DATA_SIZE;
    }
    *value = 0;
    while (size-- > 0)
    {
        *value = (*value << 8) | *buffer++;
    }
    return NX_SUCCESS;
}
UINT _nx_dhcpv6_server_utility_get_data ( UCHAR * buffer , UINT size , ULONG * value ) { if ( size > sizeof ( ULONG ) ) { return NX_DHCPV6_INVALID_DATA_SIZE ; } * value = 0 ; while ( size -- > 0 ) { * value = ( * value << 8 ) | * buffer ++ ; } return NX_SUCCESS ; }
FUNCTION                                               RELEASE
FUNCTION RELEASE
/* Check that the size of the data fits in a ULONG. */ /* Process the data retrieval request.  */ /* Build return value.  */ /* Return value.  */