uint32_t LCP_init ( _ppp_handle handle /* [IN] - the PPP state structure */ ) { /* Body */ #if RTCSCFG_ENABLE_IP4 PPP_CFG_PTR ppp_ptr = handle; ppp_ptr->LCP_STATE.DEVICE = ppp_ptr->DEVICE; /* Start CR 2207 */ #if PPP_SECRETS_NOT_SHARED ppp_ptr->LCP_STATE.HANDLE = handle; #endif /* End CR 2207 */ /* Initialize the FSM */ return PPPFSM_init(&ppp_ptr->LCP_FSM, handle, &LCP_CALL, &ppp_ptr->LCP_STATE); #else return RTCSERR_IP_IS_DISABLED; #endif /* RTCSCFG_ENABLE_IP4 */ } /* Endbody */
uint_32 CCP_init ( _ppp_handle handle /* [IN] - the PPP state structure */ ) { /* Body */ PPP_CFG_PTR ppp_ptr = handle; /* Initialize the FSM */ return PPPFSM_init(&ppp_ptr->CCP_FSM, handle, &CCP_CALL, &ppp_ptr->CCP_STATE); } /* Endbody */
uint_32 IPCP_init ( IP_IF_PTR if_ptr /* [IN] the IP interface structure */ ) { /* Body */ _ppp_handle handle = if_ptr->HANDLE; IPCP_CFG_STRUCT_PTR ipcp_ptr; PPPFSM_CFG_PTR fsm; uint_32 error; if (handle==NULL) { return RTCSERR_INVALID_PARAMETER; } /* Endif */ /* Allocate state for this interface */ ipcp_ptr = RTCS_mem_alloc(sizeof(IPCP_CFG_STRUCT)); if (!ipcp_ptr) { return RTCSERR_IPCP_CFG; } /* Endif */ /* Initialize the IPCP FSM */ fsm = &ipcp_ptr->FSM; error = PPPFSM_init(fsm, handle, &IPCP_FSM_CALL, if_ptr); if (error) { _mem_free(ipcp_ptr); return PPP_TO_RTCS_ERROR(error); } /* Endif */ /* Register IPCP */ error = PPP_register(handle, PPP_PROT_IPCP, PPPFSM_input, fsm); if (error) { PPPFSM_destroy(fsm); _mem_free(ipcp_ptr); return PPP_TO_RTCS_ERROR(error); } /* Endif */ /* Register IP */ error = PPP_register(handle, PPP_PROT_IP, IPCP_recv, if_ptr); if (error) { PPP_unregister(handle, PPP_PROT_IPCP); PPPFSM_destroy(fsm); _mem_free(ipcp_ptr); return PPP_TO_RTCS_ERROR(error); } /* Endif */ ipcp_ptr->HANDLE = handle; if_ptr->HANDLE = ipcp_ptr; if_ptr->MTU = IP_DEFAULT_MTU; if_ptr->ARP = NULL; if_ptr->DEV_TYPE = 20; if_ptr->DEV_ADDRLEN = 1; if_ptr->DEV_ADDR[0] = 0xFF; #if RTCSCFG_ENABLE_SNMP if_ptr->SNMP_IF_TYPE = IPIFTYPE_PPP; #endif return RTCS_OK; } /* Endbody */