AzureMXChip/MXCHIPAZ3166/core/lib/netxduo/addons/pppoe/nx_pppoe_client.c
UINT  _nxe_pppoe_client_create(NX_PPPOE_CLIENT *pppoe_client_ptr, UCHAR *name, NX_IP *ip_ptr, UINT interface_index,
                               NX_PACKET_POOL *pool_ptr, VOID *stack_ptr, ULONG stack_size, UINT priority,
                               VOID (*pppoe_link_driver)(struct NX_IP_DRIVER_STRUCT *),
                               VOID (*pppoe_packet_receive)(NX_PACKET *packet_ptr))
{   

UINT    status;

    /* Check for invalid input pointers.  */
    if ((pppoe_client_ptr == NX_NULL) || (pppoe_client_ptr -> nx_pppoe_id == NX_PPPOE_CLIENT_ID) || 
        (ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || 
        (pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) ||
        (stack_ptr == NX_NULL) || (pppoe_link_driver == NX_NULL) || (pppoe_packet_receive == NX_NULL)) 
        return(NX_PPPOE_CLIENT_PTR_ERROR);
                                         
    /* Check for invalid interface ID */
    if(interface_index >= NX_MAX_PHYSICAL_INTERFACES)
        return(NX_PPPOE_CLIENT_INVALID_INTERFACE);
                                                   
    /* Check for interface being valid. */
    if(!ip_ptr -> nx_ip_interface[interface_index].nx_interface_valid)
        return(NX_PPPOE_CLIENT_INVALID_INTERFACE);

    /* Check for payload size of packet pool.  */
    if (pool_ptr -> nx_packet_pool_payload_size < NX_PPPOE_CLIENT_MIN_PACKET_PAYLOAD_SIZE)
        return(NX_PPPOE_CLIENT_PACKET_PAYLOAD_ERROR);

    /* Check for a memory size error.  */
    if (stack_size < TX_MINIMUM_STACK)
        return(NX_PPPOE_CLIENT_MEMORY_SIZE_ERROR);
                          
    /* Check the priority specified.  */
    if (priority >= TX_MAX_PRIORITIES)
        return(NX_PPPOE_CLIENT_PRIORITY_ERROR);

    /* Call actual PPPoE client instance create function.  */
    status =  _nx_pppoe_client_create(pppoe_client_ptr, name, ip_ptr, interface_index, 
                                      pool_ptr, stack_ptr, stack_size, priority, 
                                      pppoe_link_driver, pppoe_packet_receive); 

    /* Return completion status.  */
    return(status);
}
/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _nxe_pppoe_client_create                            PORTABLE C      */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Yuxin Zhou, Microsoft Corporation                                   */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function checks for errors in the PPPoE Client instance create */
/*    function call.                                                      */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    pppoe_client_ptr                      Pointer to PPPoE control block*/
/*    name                                  Name of this PPPoE instance   */
/*    ip_ptr                                Pointer to IP control block   */
/*    interface_index                       IP Interface Index            */
/*    pool_ptr                              packet pool                   */
/*    stack_ptr                             Pointer stack area for PPPoE  */
/*    stack_size                            Size of PPPoE stack area      */
/*    priority                              Priority of PPPoE  thread     */
/*    pppoe_link_driver                     User supplied link driver     */
/*    pppoe_packet_receive                  User supplied function to     */
/*                                            receive PPPoE packet        */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    status                                Completion status             */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    _nx_pppoe_client_create               Actual PPPoE instance create  */
/*                                            function                    */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    Application                                                         */
/*                                                                        */
/*  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

_nxe_pppoe_client_create                            PORTABLE C
6.1
AUTHOR

Yuxin Zhou, Microsoft Corporation

DESCRIPTION

This function checks for errors in the PPPoE Client instance create
function call.

INPUT

pppoe_client_ptr                      Pointer to PPPoE control block
name                                  Name of this PPPoE instance
ip_ptr                                Pointer to IP control block
interface_index                       IP Interface Index
pool_ptr                              packet pool
stack_ptr                             Pointer stack area for PPPoE
stack_size                            Size of PPPoE stack area
priority                              Priority of PPPoE  thread
pppoe_link_driver                     User supplied link driver
pppoe_packet_receive                  User supplied function to
receive PPPoE packet

OUTPUT

status                                Completion status

CALLS



CALLED BY

Application

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 _nxe_pppoe_client_create PORTABLE C 6 . 1 AUTHOR Yuxin Zhou Microsoft Corporation DESCRIPTION This function checks for errors in the PPPoE Client instance create function call . INPUT pppoe_client_ptr Pointer to PPPoE control block name Name of this PPPoE instance ip_ptr Pointer to IP control block interface_index IP Interface Index pool_ptr packet pool stack_ptr Pointer stack area for PPPoE stack_size Size of PPPoE stack area priority Priority of PPPoE thread pppoe_link_driver User supplied link driver pppoe_packet_receive User supplied function to receive PPPoE packet OUTPUT status Completion status CALLS CALLED BY Application 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  _nxe_pppoe_client_create(NX_PPPOE_CLIENT *pppoe_client_ptr, UCHAR *name, NX_IP *ip_ptr, UINT interface_index,
                               NX_PACKET_POOL *pool_ptr, VOID *stack_ptr, ULONG stack_size, UINT priority,
                               VOID (*pppoe_link_driver)(struct NX_IP_DRIVER_STRUCT *),
                               VOID (*pppoe_packet_receive)(NX_PACKET *packet_ptr))
{   
UINT    status;
    if ((pppoe_client_ptr == NX_NULL) || (pppoe_client_ptr -> nx_pppoe_id == NX_PPPOE_CLIENT_ID) || 
        (ip_ptr == NX_NULL) || (ip_ptr -> nx_ip_id != NX_IP_ID) || 
        (pool_ptr == NX_NULL) || (pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID) ||
        (stack_ptr == NX_NULL) || (pppoe_link_driver == NX_NULL) || (pppoe_packet_receive == NX_NULL)) 
        return(NX_PPPOE_CLIENT_PTR_ERROR);
    if(interface_index >= NX_MAX_PHYSICAL_INTERFACES)
        return(NX_PPPOE_CLIENT_INVALID_INTERFACE);
    if(!ip_ptr -> nx_ip_interface[interface_index].nx_interface_valid)
        return(NX_PPPOE_CLIENT_INVALID_INTERFACE);
    if (pool_ptr -> nx_packet_pool_payload_size < NX_PPPOE_CLIENT_MIN_PACKET_PAYLOAD_SIZE)
        return(NX_PPPOE_CLIENT_PACKET_PAYLOAD_ERROR);
    if (stack_size < TX_MINIMUM_STACK)
        return(NX_PPPOE_CLIENT_MEMORY_SIZE_ERROR);
    if (priority >= TX_MAX_PRIORITIES)
        return(NX_PPPOE_CLIENT_PRIORITY_ERROR);
    status =  _nx_pppoe_client_create(pppoe_client_ptr, name, ip_ptr, interface_index, 
                                      pool_ptr, stack_ptr, stack_size, priority, 
                                      pppoe_link_driver, pppoe_packet_receive); 
    return(status);
}
UINT _nxe_pppoe_client_create ( NX_PPPOE_CLIENT * pppoe_client_ptr , UCHAR * name , NX_IP * ip_ptr , UINT interface_index , NX_PACKET_POOL * pool_ptr , VOID * stack_ptr , ULONG stack_size , UINT priority , VOID ( * pppoe_link_driver ) ( struct NX_IP_DRIVER_STRUCT * ) , VOID ( * pppoe_packet_receive ) ( NX_PACKET * packet_ptr ) ) { UINT status ; if ( ( pppoe_client_ptr == NX_NULL ) || ( pppoe_client_ptr -> nx_pppoe_id == NX_PPPOE_CLIENT_ID ) || ( ip_ptr == NX_NULL ) || ( ip_ptr -> nx_ip_id != NX_IP_ID ) || ( pool_ptr == NX_NULL ) || ( pool_ptr -> nx_packet_pool_id != NX_PACKET_POOL_ID ) || ( stack_ptr == NX_NULL ) || ( pppoe_link_driver == NX_NULL ) || ( pppoe_packet_receive == NX_NULL ) ) return ( NX_PPPOE_CLIENT_PTR_ERROR ) ; if ( interface_index >= NX_MAX_PHYSICAL_INTERFACES ) return ( NX_PPPOE_CLIENT_INVALID_INTERFACE ) ; if ( ! ip_ptr -> nx_ip_interface [ interface_index ] . nx_interface_valid ) return ( NX_PPPOE_CLIENT_INVALID_INTERFACE ) ; if ( pool_ptr -> nx_packet_pool_payload_size < NX_PPPOE_CLIENT_MIN_PACKET_PAYLOAD_SIZE ) return ( NX_PPPOE_CLIENT_PACKET_PAYLOAD_ERROR ) ; if ( stack_size < TX_MINIMUM_STACK ) return ( NX_PPPOE_CLIENT_MEMORY_SIZE_ERROR ) ; if ( priority >= TX_MAX_PRIORITIES ) return ( NX_PPPOE_CLIENT_PRIORITY_ERROR ) ; status = _nx_pppoe_client_create ( pppoe_client_ptr , name , ip_ptr , interface_index , pool_ptr , stack_ptr , stack_size , priority , pppoe_link_driver , pppoe_packet_receive ) ; return ( status ) ; }
FUNCTION                                               RELEASE
FUNCTION RELEASE
/* Check for invalid input pointers.  */ /* Check for invalid interface ID */ /* Check for interface being valid. */ /* Check for payload size of packet pool.  */ /* Check for a memory size error.  */ /* Check the priority specified.  */ /* Call actual PPPoE client instance create function.  */ /* Return completion status.  */