AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/addons/dhcp/nxd_dhcpv6_server.c
UINT  _nx_dhcpv6_update_client_record(NX_DHCPV6_SERVER *dhcpv6_server_ptr, 
                                      NX_DHCPV6_CLIENT *from_extracted_client_data_ptr, 
                                      NX_DHCPV6_CLIENT *to_client_data_on_record_ptr)
{

    NX_PARAMETER_NOT_USED(dhcpv6_server_ptr);

    /* If this is a solicit message update the entire copy into the specified record. */
    if (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_SOLICIT)
    {

        /* Ok to copy the whole record over. */
        memcpy(to_client_data_on_record_ptr, from_extracted_client_data_ptr, sizeof(NX_DHCPV6_CLIENT)); /* Use case of memcpy is verified. */

        /* Update various fields now that the client is in a DHCPv6 session with the server. */
        to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 1;
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */
    }
    else if (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_INFORM_REQUEST)
    {

        /* Update selected fields for an INFORM REQUEST. */
        to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id;                               
        to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid;             
        to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type;            
        to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server;   

        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_version = NX_IP_VERSION_V6;

        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_version = NX_IP_VERSION_V6;

        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_option_request, &from_extracted_client_data_ptr -> nx_dhcpv6_option_request, sizeof(NX_DHCPV6_SERVER_OPTIONREQUEST)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */

    }
    /* If this is not a solicit message, update the selected fields into the specified record. */
    else if ((from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW)   ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND)  ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RELEASE) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_DECLINE) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_CONFIRM))
    {


        /* Ok to update the existing client record. 

            Note: if this is a duplicate client request we update the client record just 
            the same. */
        to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id;                               
        to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid;             
        to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type;            
        to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server;        
     
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_elapsed_time, &from_extracted_client_data_ptr -> nx_dhcpv6_elapsed_time, sizeof(NX_DHCPV6_SERVER_ELAPSED_TIME)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_iana, &from_extracted_client_data_ptr -> nx_dhcpv6_iana, sizeof(NX_DHCPV6_SERVER_IA_NA)); /* Use case of memcpy is verified. */
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_ia, &from_extracted_client_data_ptr -> nx_dhcpv6_ia, sizeof(NX_DHCPV6_SERVER_IA_ADDRESS)); /* Use case of memcpy is verified. */

        /* Update the IANA status option code, length and status message. The DHCPv6 server 
            will figure out the actual lenght with the status message text added in later. */
        to_client_data_on_record_ptr -> nx_dhcpv6_iana_status.nx_status_code = from_extracted_client_data_ptr -> nx_dhcpv6_iana_status.nx_status_code;
        to_client_data_on_record_ptr -> nx_dhcpv6_iana_status.nx_option_length = sizeof(USHORT);

        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0]);

        to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_version = NX_IP_VERSION_V6;

        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0]);

        to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_version = NX_IP_VERSION_V6;

        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_option_request, &from_extracted_client_data_ptr -> nx_dhcpv6_option_request, sizeof(NX_DHCPV6_SERVER_OPTIONREQUEST)); /* Use case of memcpy is verified. */

        /* Update fields based on the state of the client. At this point the client is bound to a 
           valid IP address to the session is 'over'.  Set timeout fields to stop the session timer
           and begin the lease life timer. */
        to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 0;

        /* Start the lease timer if we have just (re)assigned an IP lease. */
        if ((from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST) ||
            (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW)   ||
            (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND))
        {

            to_client_data_on_record_ptr -> nx_dhcpv6_IP_lease_time_accrued = 1; 
            to_client_data_on_record_ptr -> nx_dhcpv6_state = NX_DHCPV6_STATE_BOUND;
        }

        /* No need to set the client state to unbound. We will remove the client record and restore the
           IP address status back to available after sending the server reply. */
    }
    /* else
         Confirm, Inform Request and other messages should not change the client record.  */

    return NX_SUCCESS;
}
/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _nx_dhcpv6_update_client_record                     PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function updates the client record based on the most recent    */
/*    message received from the client. A typical example is after a      */
/*    Solicit message is received the server gets a Request message which */
/*    it will add to the client record it has in its table.               */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    dhcpv6_server_ptr                    Pointer to DHCPV6 Server       */
/*    to_server_ptr                        Pointer to client to update    */
/*    from_client_ptr                      Pointer to client updated from */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    NX_SUCCESS                           Successful outcome             */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    memcpy                               Copy specified area of memory  */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    _nx_dhcpv6_server_extract_packet_information                        */
/*                                         Process DHCPv6 data in packet  */
/*                                                                        */
/*  RELEASE HISTORY                                                       */
/*                                                                        */
/*    DATE              NAME                      DESCRIPTION             */
/*                                                                        */
/*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
/*  09-30-2020     Yuxin Zhou               Modified comment(s), and      */
/*                                            verified memcpy use cases,  */
/*                                            resulting in version 6.1    */
/*                                                                        */
/**************************************************************************/
FUNCTION                                               RELEASE

_nx_dhcpv6_update_client_record                     PORTABLE C
6.1
AUTHOR

Yuxin Zhou, Microsoft Corporation

DESCRIPTION

This function updates the client record based on the most recent
message received from the client. A typical example is after a
Solicit message is received the server gets a Request message which
it will add to the client record it has in its table.

INPUT

dhcpv6_server_ptr                    Pointer to DHCPV6 Server
to_server_ptr                        Pointer to client to update
from_client_ptr                      Pointer to client updated from

OUTPUT



CALLS

memcpy                               Copy specified area of memory

CALLED BY



RELEASE HISTORY

DATE              NAME                      DESCRIPTION

05-19-2020     Yuxin Zhou               Initial Version 6.0
09-30-2020     Yuxin Zhou               Modified comment(s), and
verified memcpy use cases,
resulting in version 6.1
FUNCTION RELEASE _nx_dhcpv6_update_client_record PORTABLE C 6 . 1 AUTHOR Yuxin Zhou Microsoft Corporation DESCRIPTION This function updates the client record based on the most recent message received from the client . A typical example is after a Solicit message is received the server gets a Request message which it will add to the client record it has in its table . INPUT dhcpv6_server_ptr Pointer to DHCPV6 Server to_server_ptr Pointer to client to update from_client_ptr Pointer to client updated from OUTPUT CALLS memcpy Copy specified area of memory CALLED BY RELEASE HISTORY DATE NAME DESCRIPTION 05 - 19 - 2020 Yuxin Zhou Initial Version 6 . 0 09 - 30 - 2020 Yuxin Zhou Modified comment ( s ) and verified memcpy use cases resulting in version 6 . 1
UINT  _nx_dhcpv6_update_client_record(NX_DHCPV6_SERVER *dhcpv6_server_ptr, 
                                      NX_DHCPV6_CLIENT *from_extracted_client_data_ptr, 
                                      NX_DHCPV6_CLIENT *to_client_data_on_record_ptr)
{
    NX_PARAMETER_NOT_USED(dhcpv6_server_ptr);
    if (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_SOLICIT)
    {
        memcpy(to_client_data_on_record_ptr, from_extracted_client_data_ptr, sizeof(NX_DHCPV6_CLIENT)); 
        to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 1;
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
    }
    else if (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_INFORM_REQUEST)
    {
        to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id;                               
        to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid;             
        to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type;            
        to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server;   
        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_version = NX_IP_VERSION_V6;
        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_version = NX_IP_VERSION_V6;
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_option_request, &from_extracted_client_data_ptr -> nx_dhcpv6_option_request, sizeof(NX_DHCPV6_SERVER_OPTIONREQUEST)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
    }
    else if ((from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW)   ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND)  ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RELEASE) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_DECLINE) ||
             (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_CONFIRM))
    {
        to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id;                               
        to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid;             
        to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type;            
        to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server;        
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_client_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_client_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_server_duid, &from_extracted_client_data_ptr -> nx_dhcpv6_server_duid, sizeof(NX_DHCPV6_SVR_DUID)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_elapsed_time, &from_extracted_client_data_ptr -> nx_dhcpv6_elapsed_time, sizeof(NX_DHCPV6_SERVER_ELAPSED_TIME)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_iana, &from_extracted_client_data_ptr -> nx_dhcpv6_iana, sizeof(NX_DHCPV6_SERVER_IA_NA)); 
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_ia, &from_extracted_client_data_ptr -> nx_dhcpv6_ia, sizeof(NX_DHCPV6_SERVER_IA_ADDRESS)); 
        to_client_data_on_record_ptr -> nx_dhcpv6_iana_status.nx_status_code = from_extracted_client_data_ptr -> nx_dhcpv6_iana_status.nx_status_code;
        to_client_data_on_record_ptr -> nx_dhcpv6_iana_status.nx_option_length = sizeof(USHORT);
        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_source_ip_address.nxd_ip_version = NX_IP_VERSION_V6;
        COPY_IPV6_ADDRESS(&from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0], 
                          &to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_address.v6[0]);
        to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address.nxd_ip_version = NX_IP_VERSION_V6;
        memcpy(&to_client_data_on_record_ptr -> nx_dhcpv6_option_request, &from_extracted_client_data_ptr -> nx_dhcpv6_option_request, sizeof(NX_DHCPV6_SERVER_OPTIONREQUEST)); 
        to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 0;
        if ((from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST) ||
            (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW)   ||
            (from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND))
        {
            to_client_data_on_record_ptr -> nx_dhcpv6_IP_lease_time_accrued = 1; 
            to_client_data_on_record_ptr -> nx_dhcpv6_state = NX_DHCPV6_STATE_BOUND;
        }
    }
    return NX_SUCCESS;
}
UINT _nx_dhcpv6_update_client_record ( NX_DHCPV6_SERVER * dhcpv6_server_ptr , NX_DHCPV6_CLIENT * from_extracted_client_data_ptr , NX_DHCPV6_CLIENT * to_client_data_on_record_ptr ) { NX_PARAMETER_NOT_USED ( dhcpv6_server_ptr ) ; if ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_SOLICIT ) { memcpy ( to_client_data_on_record_ptr , from_extracted_client_data_ptr , sizeof ( NX_DHCPV6_CLIENT ) ) ; to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 1 ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_client_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_client_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_server_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_server_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; } else if ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_INFORM_REQUEST ) { to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id ; to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid ; to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type ; to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server ; COPY_IPV6_ADDRESS ( & from_extracted_client_data_ptr -> nx_dhcp_source_ip_address . nxd_ip_address . v6 [ 0 ] , & to_client_data_on_record_ptr -> nx_dhcp_source_ip_address . nxd_ip_address . v6 [ 0 ] ) ; to_client_data_on_record_ptr -> nx_dhcp_source_ip_address . nxd_ip_version = NX_IP_VERSION_V6 ; COPY_IPV6_ADDRESS ( & from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address . nxd_ip_address . v6 [ 0 ] , & to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address . nxd_ip_address . v6 [ 0 ] ) ; to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address . nxd_ip_version = NX_IP_VERSION_V6 ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_option_request , & from_extracted_client_data_ptr -> nx_dhcpv6_option_request , sizeof ( NX_DHCPV6_SERVER_OPTIONREQUEST ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_client_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_client_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_server_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_server_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; } else if ( ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RELEASE ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_DECLINE ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_CONFIRM ) ) { to_client_data_on_record_ptr -> nx_dhcpv6_id = from_extracted_client_data_ptr -> nx_dhcpv6_id ; to_client_data_on_record_ptr -> nx_dhcpv6_message_xid = from_extracted_client_data_ptr -> nx_dhcpv6_message_xid ; to_client_data_on_record_ptr -> nx_dhcpv6_message_type = from_extracted_client_data_ptr -> nx_dhcpv6_message_type ; to_client_data_on_record_ptr -> nx_dhcpv6_response_back_from_server = from_extracted_client_data_ptr -> nx_dhcpv6_response_back_from_server ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_client_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_client_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_server_duid , & from_extracted_client_data_ptr -> nx_dhcpv6_server_duid , sizeof ( NX_DHCPV6_SVR_DUID ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_elapsed_time , & from_extracted_client_data_ptr -> nx_dhcpv6_elapsed_time , sizeof ( NX_DHCPV6_SERVER_ELAPSED_TIME ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_iana , & from_extracted_client_data_ptr -> nx_dhcpv6_iana , sizeof ( NX_DHCPV6_SERVER_IA_NA ) ) ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_ia , & from_extracted_client_data_ptr -> nx_dhcpv6_ia , sizeof ( NX_DHCPV6_SERVER_IA_ADDRESS ) ) ; to_client_data_on_record_ptr -> nx_dhcpv6_iana_status . nx_status_code = from_extracted_client_data_ptr -> nx_dhcpv6_iana_status . nx_status_code ; to_client_data_on_record_ptr -> nx_dhcpv6_iana_status . nx_option_length = sizeof ( USHORT ) ; COPY_IPV6_ADDRESS ( & from_extracted_client_data_ptr -> nx_dhcp_source_ip_address . nxd_ip_address . v6 [ 0 ] , & to_client_data_on_record_ptr -> nx_dhcp_source_ip_address . nxd_ip_address . v6 [ 0 ] ) ; to_client_data_on_record_ptr -> nx_dhcp_source_ip_address . nxd_ip_version = NX_IP_VERSION_V6 ; COPY_IPV6_ADDRESS ( & from_extracted_client_data_ptr -> nx_dhcp_destination_ip_address . nxd_ip_address . v6 [ 0 ] , & to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address . nxd_ip_address . v6 [ 0 ] ) ; to_client_data_on_record_ptr -> nx_dhcp_destination_ip_address . nxd_ip_version = NX_IP_VERSION_V6 ; memcpy ( & to_client_data_on_record_ptr -> nx_dhcpv6_option_request , & from_extracted_client_data_ptr -> nx_dhcpv6_option_request , sizeof ( NX_DHCPV6_SERVER_OPTIONREQUEST ) ) ; to_client_data_on_record_ptr -> nx_dhcpv6_client_session_time = 0 ; if ( ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REQUEST ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_RENEW ) || ( from_extracted_client_data_ptr -> nx_dhcpv6_message_type == NX_DHCPV6_MESSAGE_TYPE_REBIND ) ) { to_client_data_on_record_ptr -> nx_dhcpv6_IP_lease_time_accrued = 1 ; to_client_data_on_record_ptr -> nx_dhcpv6_state = NX_DHCPV6_STATE_BOUND ; } } return NX_SUCCESS ; }
FUNCTION                                               RELEASE
FUNCTION RELEASE
/* If this is a solicit message update the entire copy into the specified record. */ /* Ok to copy the whole record over. */ /* Use case of memcpy is verified. */ /* Update various fields now that the client is in a DHCPv6 session with the server. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Update selected fields for an INFORM REQUEST. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* If this is not a solicit message, update the selected fields into the specified record. */ /* Ok to update the existing client record. 

            Note: if this is a duplicate client request we update the client record just 
            the same. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Use case of memcpy is verified. */ /* Update the IANA status option code, length and status message. The DHCPv6 server 
            will figure out the actual lenght with the status message text added in later. */ /* Use case of memcpy is verified. */ /* Update fields based on the state of the client. At this point the client is bound to a 
           valid IP address to the session is 'over'.  Set timeout fields to stop the session timer
           and begin the lease life timer. */ /* Start the lease timer if we have just (re)assigned an IP lease. */ /* No need to set the client state to unbound. We will remove the client record and restore the
           IP address status back to available after sending the server reply. */ /* else
         Confirm, Inform Request and other messages should not change the client record.  */