#include <net_config.h>
U16 tnet_cbfunc (
U8 code, /* Type of message requested by the telnet server. */
U8* buf, /* Location where to write the requested message. */
U16 buflen ); /* Number of bytes in the output buffer. */
Description
The tnet_cbfunc function provides the connection and login
messages to the telnet server running on TCPnet, when requested. The
telnet server sends these messages to the telnet client.
The argument code specifies the type of message that the
telnet server requires. This is shown in the table.
Code
Message
Description
0
Initial header
To inform the user that the user's telnet client has
connected to the telnet server running on TCPnet.
1
Prompt string
To inform the user that the telnet server is ready and
waiting for a command.
2
Login header
Displayed only when user authentication is enabled.
3
Login username
To inform the user to enter the username.
4
Login password
To inform the user to enter the password.
5
Incorrect login
To inform the user that the login is incorrect.
6
Timeout login
To inform the user that the login has timed out.
7
Unsolicited message
To write unsolicited messages from the high-layer user
application (for example a basic interpreter).
The argument buf points to the output buffer where the
tnet_cbfunc must write the message. The argument buflen
specifies the length of the output buffer in bytes.
The tnet_cbfunc function is part of RL-TCPnet. The
prototype is defined in net_config.h. You must customize the function
in telnet_uif.c.
note
The length of the output buffer, buflen, might vary because
buffer length is determined by the TCP socket Maximum Segment Size
(MSS) negotiation. The buffer length is normally around 1400 bytes
for local LAN. But this can be reduced to 500 bytes or even
less.
If the tnet_cbfunc function writes more bytes than
buflen into the output buffer, then a system crash resulting from
corruption of memory link pointers is highly likely.
The telnet server does not automatically expand the carriage
return (CR) character. The tnet_cbfunc function must write
the carriage return and line feed (LF) characters into the the
buffer to indicate the end of each message.
Return Value
The tnet_cbfunc function returns the number of bytes
written to the output buffer.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.