TELNETs_Init()
Initialize the TELNET server.
Files
telnet-s.h/telnet-s.c
Prototype
CPU_BOOLEAN TELNETs_Init (CPU_BOOLEAN secure); |
Arguments
secure Desired value for secure mode.
Returned Values
DEF_OK, TELNET server initialization successful;
DEF_FAIL, TELNET server initialization failed.
Required Configuration
The network security manager MUST be available and enabled to accept a secure TELNET connection (i.e: in “net_cfg.h”, NET_SECURE_CFG_EN should be DEF_ENABLED AND NET_CFG_TRANSPORT_LAYER_SEL should be configured for TCP). See µC/TCPIP user manual for more information about the network security manager.
A network security module MUST be included in the project (i.e: µC/SSL) to use the network security manager functionalities.
Notes / Warnings
TELNETs_Init() must be called after product’s OS and network have been initialized.
Before accepting a secure TELNET connection, a public key certificate/private key pair MUST be installed.
Example Usage
#define SERVER_CERT_DER "\\server-cert.der" #define SERVER_KEY_PEM "\\server-key.pem" CPU_BOOLEAN init; NET_ERR net_err;
#ifdef NET_SECURE_MODULE_PRESENT NetSecureMgr_InstallFile(SERVER_CERT_DER, NET_SECURE_INSTALL_TYPE_CERT, NET_SECURE_INSTALL_FMT_DER, &net_err) if (*net_err != NET_SECURE_MGR_ERR_NONE) { printf("Public key certificate installation failed.\n\r"); return; }
NetSecureMgr_InstallFile(SERVER_KEY_PEM, NET_SECURE_INSTALL_TYPE_KEY, NET_SECURE_INSTALL_FMT_PEM, &net_err); if (*net_err != NET_SECURE_MGR_ERR_NONE) { printf("Private key installation failed.\n\r"); return; } init = TELNETs_Init(DEF_ENABLED; #else init = TELNETs_Init(DEF_DISABLED); #endif if (init == DEF_OK) { printf("Init successful\n\r"); } else { printf("Init failed\n\r"); } |