Telnet Server Service
6-6
6.2.3
Specifying Service Using the Configuration
The service can be specified as public in that it can connect using any IP ad-
dress, or an IP address of a specific interface. When accepting connections
to any system IP address, the service is specified with the “CALLBYIP” flag
and an IP address of INADDR_ANY. When a private connection is desired, the
service is specified by the physical interface on which connections are allowed
to occur. Since an IP address is required to initialize the service, the ”RESOL-
VEIP” flag should also be set in the latter case.
For example, the following code specifies that the telnet server should run us-
ing the IP address INADDR_ANY.
telnet_example()
{
CI_SERVICE_TELNET telnet;
bzero( &telnet, sizeof(telnet) );
telnet.cisargs.IPAddr = INADDR_ANY;
telnet.cisargs.pCbSrv = &ServiceReport;
telnet.param.MaxCon = 2;
telnet.param.Callback = &ConsoleOpen;
CfgAddEntry( hCfg, CFGTAG_SERVICE, CFGITEM_SERVICE_TELNET, 0,
sizeof(telnet), (UINT8 *)&telnet, 0 );
}
The above code is all that is required when using the configuration system to
invoke this service.
6.2.4
Invoking the Service via NETTOOLS API
In addition to the configuration option, this service can also be created and de-
stroyed directly through this NETTOOLS API. If an application wishes to by-
pass the configuration system and launch the service directly, these calls can
be used.
Create an Instance of the Telnet Server
TelnetOpen
Syntax
HANDLE TelnetOpen( NTARGS *pNTA, NTPARM_TELNET *pNTP );
Parameter(s)
pNTA
Pointer to common argument structure used by all services
pNTP
Pointer to Telnet parameter structure