A few more telnet updates

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4348 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-01-30 22:20:42 +00:00
parent 622ac27bfa
commit 1e4d04d53b
5 changed files with 25 additions and 15 deletions
+1 -1
View File
@@ -173,4 +173,4 @@
telnet infrastructure. The new telnet daemon creates sessions that are telnet infrastructure. The new telnet daemon creates sessions that are
"wrapped" as character devices and mapped to stdin, stdout, and stderr. "wrapped" as character devices and mapped to stdin, stdout, and stderr.
Now the telnet session can be inherited by spawned tasks. Now the telnet session can be inherited by spawned tasks.
* examples/telnetd: Add a test for the nte telnet daemon. * examples/telnetd: Add a test for the new telnet daemon.
+5 -5
View File
@@ -93,9 +93,9 @@ static struct ptentry_s g_parsetab[] =
static void shell_help(int argc, char **argv) static void shell_help(int argc, char **argv)
{ {
printf("Available commands:"); printf("Available commands:\n");
printf(" help, ? - show help"); printf(" help, ? - show help\n");
printf(" exit - exit shell"); printf(" exit - exit shell\n");
} }
/**************************************************************************** /****************************************************************************
@@ -157,8 +157,8 @@ int shell_session(int argc, char *argv[])
{ {
char line[128]; char line[128];
printf("uIP command shell -- NuttX style"); printf("uIP command shell -- NuttX style\n");
printf("Type '?' and return for help"); printf("Type '?' and return for help\n");
for(;;) for(;;)
{ {
+10 -2
View File
@@ -50,6 +50,10 @@
* CONFIG_TELNETD_NPOLLWAITERS - If the poll method is enabled, then this * CONFIG_TELNETD_NPOLLWAITERS - If the poll method is enabled, then this
* value will defined the maximum number of threads that can be waiting * value will defined the maximum number of threads that can be waiting
* for events. Default: 1 * for events. Default: 1
* CONFIG_TELNETD_RXBUFFER_SIZE - The size of the telnet receive buffer.
* Default: 256 bytes.
* CONFIG_TELNETD_TXBUFFER_SIZE - The size of the telnet transmit buffer.
* Default: 256 bytes.
* CONFIG_TELNETD_DUMPBUFFER - dumping of all input/output buffers. * CONFIG_TELNETD_DUMPBUFFER - dumping of all input/output buffers.
*/ */
@@ -59,8 +63,12 @@
/* Configurable settings */ /* Configurable settings */
#ifndef CONFIG_TELNETD_IOBUFFER_SIZE #ifndef CONFIG_TELNETD_RXBUFFER_SIZE
# define CONFIG_TELNETD_IOBUFFER_SIZE 512 # define CONFIG_TELNETD_RXBUFFER_SIZE 256
#endif
#ifndef CONFIG_TELNETD_TXBUFFER_SIZE
# define CONFIG_TELNETD_TXBUFFER_SIZE 256
#endif #endif
/**************************************************************************** /****************************************************************************
+7 -5
View File
@@ -107,8 +107,8 @@ struct telnetd_dev_s
uint8_t td_offset; /* Offset to the valid, pending bytes in the rxbuffer */ uint8_t td_offset; /* Offset to the valid, pending bytes in the rxbuffer */
uint8_t td_crefs; /* The number of open references to the session */ uint8_t td_crefs; /* The number of open references to the session */
FAR struct socket *td_psock; /* A reference to the internal socket structure */ FAR struct socket *td_psock; /* A reference to the internal socket structure */
char td_rxbuffer[CONFIG_TELNETD_IOBUFFER_SIZE]; char td_rxbuffer[CONFIG_TELNETD_RXBUFFER_SIZE];
char td_txbuffer[CONFIG_TELNETD_IOBUFFER_SIZE]; char td_txbuffer[CONFIG_TELNETD_TXBUFFER_SIZE];
}; };
/**************************************************************************** /****************************************************************************
@@ -518,7 +518,7 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len
else else
{ {
ret = psock_recv(priv->td_psock, priv->td_rxbuffer, ret = psock_recv(priv->td_psock, priv->td_rxbuffer,
CONFIG_TELNETD_IOBUFFER_SIZE, 0); CONFIG_TELNETD_RXBUFFER_SIZE, 0);
if (ret > 0) if (ret > 0)
{ {
/* Process the received telnet data */ /* Process the received telnet data */
@@ -558,9 +558,11 @@ static ssize_t telnetd_write(FAR struct file *filep, FAR const char *buffer, siz
eol = telnetd_putchar(priv, ch, &ncopied); eol = telnetd_putchar(priv, ch, &ncopied);
/* Was that the end of a line? */ /* Was that the end of a line? Or is the buffer too full to hold the
* next largest character sequence ("\r\n\0")?
*/
if (eol) if (eol || ncopied > CONFIG_TELNETD_TXBUFFER_SIZE-3)
{ {
/* Yes... send the data now */ /* Yes... send the data now */
+2 -2
View File
@@ -2408,5 +2408,5 @@
sub-directory: By making libboard.a a "phony" target, libboard.a should sub-directory: By making libboard.a a "phony" target, libboard.a should
always rebuilt (the end result is worth the small increase in build time) always rebuilt (the end result is worth the small increase in build time)
(submitted by Mike Smith). (submitted by Mike Smith).
* include/net/psock.h: A new low level socket interface that allows the OS * include/net/psock.h: Added a new low level socket interface that allows the
to use the socket interface without having a socket descriptor. OS to use the socket interface without having a socket descriptor.