Telnet Server API Setting up the Server Callback
Telnet Server API Setting up the Server Callback Functions Setting Server and Client Options Other Telnet API Functions
Integrating a Telnet Server Application Entry TSInit. Server(TS_ICONFIG_TYPE *ptr) TSOpen. Port(unsigned long *port, TS_UCONFIG_TYPE *ptr) Structure that defines: • Number of ports to Listen on • Telnet Port • Login retries • Client and server options TS_ECHO, TS_BINARY, TS_NOGA • Callbacks for connect, login, disconnect, receive and buffer management
Sample Telnet Port Setup TS_UCONFIG_TYPE; Properties & Callbacks Setup Telnet Listener Using Above Properties
Callback functions int (*connect_callback) (unsigned int session_id) int (*login_callback) (unsigned int session_id, int user_id) int (*disconnect_callback) (unsigned int session_id) int (*getbuf_callback) (unsigned int session_id, void **buf, int *buf. Size) int (*receive_callback) (unsigned int session_id, void *buf, int len)
Setting Server and Client Options int TSSet. Server. Option( unsigned long session_id, unsigned long option, int mode) int TSSet. Client. Option( unsigned long session_id, unsigned long option, int mode) • • mode – 0 off/1 on Option – – TS_TXBINARY TS_NOECHO TS_NOGA TS_CAMOUFLAGE (xmit binary data) (echo) (go-ahead characters) (server only – “camouflage” password) (Note: “session_id” comes from connect or logon callback)
Other Telnet API Functions int TSClose. Port (unsigned long port_id) int TSSend. Data (unsigned long session_id, char *buf, int len) int TSSend. String (unsigned long session_id, char *buf) int TSClose. Session (unsigned long session_id) char *TSGet. Session. User. Name (unsigned long session_id)
Telnet Server Summary • Start with TSInit. Server • Perform TSOpen. Port for each port – TS_UCONFIG_TYPE structure provides parameters (including callback addresses) on port-by-port basis • Process client interaction via callbacks for connect, login, receive, disconnect and buffer acquisition • Use TSSend. Data or TSSend. String to transmit to client. • Close session with TSClose. Session • Close out port with TSClose. Port
- Slides: 7