/********************************************************************* * Function: void StackInit(void) * * PreCondition: None * * Input: None * * Output: Stack and its componets are initialized * * Side Effects: None * * Note: This function must be called before any of the * stack or its component routines are used. * ********************************************************************/ void StackInit(void) { smStack = SM_STACK_IDLE; #if defined(STACK_USE_IP_GLEANING) || defined(STACK_USE_DHCP_CLIENT) /* * If DHCP or IP Gleaning is enabled, * startup in Config Mode. */ AppConfig.Flags.bInConfigMode = TRUE; #endif // Seed the rand() function srand(GenerateRandomDWORD()); MACInit(); #if defined( ZG_CS_TRIS ) #if defined(ZG_CONFIG_LINKMGRII) ZGLibInitialize(); ZGLinkMgrInit(); #endif #endif ARPInit(); #if defined(STACK_USE_UDP) UDPInit(); #endif #if defined(STACK_USE_TCP) TCPInit(); #endif #if defined(STACK_USE_BERKELEY_API) BerkeleySocketInit(); #endif #if defined(STACK_USE_HTTP_SERVER) || defined(STACK_USE_HTTP2_SERVER) HTTPInit(); #endif #if defined(STACK_USE_RSA) RSAInit(); #endif #if defined(STACK_USE_SSL) SSLInit(); #endif #if defined(STACK_USE_FTP_SERVER) && defined(STACK_USE_MPFS) FTPInit(); #endif #if defined(STACK_USE_SNMP_SERVER) SNMPInit(); #endif #if defined(STACK_USE_DHCP_CLIENT) DHCPInit(0); if(!AppConfig.Flags.bIsDHCPEnabled) { DHCPDisable(0); } #endif #if defined(STACK_USE_DYNAMICDNS_CLIENT) DDNSInit(); #endif }
/********************************************************************* * Function: void StackInit(void) * * PreCondition: None * * Input: None * * Output: Stack and its componets are initialized * * Side Effects: None * * Note: This function must be called before any of the * stack or its component routines are used. * ********************************************************************/ void StackInit(void) { smStack = SM_STACK_IDLE; #if defined(STACK_USE_IP_GLEANING) || defined(STACK_USE_DHCP_CLIENT) /* * If DHCP or IP Gleaning is enabled, * startup in Config Mode. */ AppConfig.Flags.bInConfigMode = TRUE; #endif // Seed the LFSRRand() function LFSRSeedRand(GenerateRandomDWORD()); MACInit(); #if defined(WF_CS_TRIS) && defined(STACK_USE_EZ_CONFIG) && !defined(__18CXX) WFEasyConfigInit(); #endif ARPInit(); #if defined(STACK_USE_UDP) UDPInit(); #endif #if defined(STACK_USE_TCP) TCPInit(); #endif #if defined(STACK_USE_BERKELEY_API) BerkeleySocketInit(); #endif #if defined(STACK_USE_HTTP2_SERVER) HTTPInit(); #endif #if defined(STACK_USE_RSA) RSAInit(); #endif #if defined(STACK_USE_SSL) SSLInit(); #endif #if defined(STACK_USE_FTP_SERVER) && defined(STACK_USE_MPFS2) FTPInit(); #endif #if defined(STACK_USE_SNMP_SERVER) SNMPInit(); #endif #if defined(STACK_USE_DHCP_CLIENT) DHCPInit(0); if(!AppConfig.Flags.bIsDHCPEnabled) { DHCPDisable(0); } #endif #if defined(STACK_USE_AUTO_IP) AutoIPInit(0); #endif #if defined(STACK_USE_DYNAMICDNS_CLIENT) DDNSInit(); #endif #if defined(STACK_USE_RANDOM) RandomInit(); #endif }
/********************************************************************* * Function: void StackInit(void) * * PreCondition: None * * Input: None * * Output: Stack and its componets are initialized * * Side Effects: None * * Note: This function must be called before any of the * stack or its component routines are used. * ********************************************************************/ void StackInit(void) { static BOOL once = FALSE; smStack = SM_STACK_IDLE; #if defined(STACK_USE_IP_GLEANING) || defined(STACK_USE_DHCP_CLIENT) /* * If DHCP or IP Gleaning is enabled, * startup in Config Mode. */ AppConfig.Flags.bInConfigMode = TRUE; #endif #if defined (WF_CS_TRIS) && defined (STACK_USE_DHCP_CLIENT) g_DhcpRenew = FALSE; g_DhcpRetryTimer = 0; #endif if (!once) { // Seed the LFSRRand() function LFSRSeedRand(GenerateRandomDWORD()); once = TRUE; } MACInit(); #if defined (WF_AGGRESSIVE_PS) && defined (WF_CS_TRIS) WFEnableAggressivePowerSave(); #endif #if defined(WF_CS_TRIS) && defined(STACK_USE_EZ_CONFIG) && !defined(__18CXX) WFEasyConfigInit(); #endif ARPInit(); #if defined(STACK_USE_UDP) UDPInit(); #endif #if defined(STACK_USE_TCP) TCPInit(); #endif #if defined(STACK_USE_BERKELEY_API) BerkeleySocketInit(); #endif #if defined(STACK_USE_HTTP2_SERVER) HTTPInit(); #endif #if defined(STACK_USE_RSA) RSAInit(); #endif #if defined(STACK_USE_SSL) SSLInit(); #endif #if defined(STACK_USE_FTP_SERVER) && defined(STACK_USE_MPFS2) FTPInit(); #endif #if defined(STACK_USE_SNMP_SERVER) SNMPInit(); #endif #if defined(STACK_USE_DHCP_CLIENT) DHCPInit(0); if(!AppConfig.Flags.bIsDHCPEnabled) { DHCPDisable(0); } #endif #if defined(STACK_USE_AUTO_IP) AutoIPInit(0); #endif #if defined(STACK_USE_DYNAMICDNS_CLIENT) DDNSInit(); #endif #if defined(STACK_USE_RANDOM) RandomInit(); #endif #if defined(STACK_USE_CCS_SMTP) SMTPInit(); #endif #if defined(STACK_USE_CCS_SNTP_CLIENT) NTPInit(); #endif #if defined(STACK_USE_CCS_GRATUITOUS_ARP) GratArpInit(); #endif #if defined(STACK_USE_CCS_HTTP1_SERVER) || defined(STACK_USE_CCS_HTTP2_SERVER) HTTPInit(); #endif #if defined(STACK_USE_CCS_TFTP_SERVER) TFTPSInit(); #endif }