missing Samples\tcpip\LOGINCONSOLE.C

Hi, I have installed dynamic C10.50 and was reading TCP/IP manual v2. In the manual, it said the sample program LOGINCONSOLE.C demonstrate how to use con_loginname(), con_loginpassword() and con_logout(). However, I cannot find that file from that directory. Can someone post me the source code or give a quick guide on how and where to call those functions.

Do i call it using the standard way:
const ConsoleCommand console_commands[] =
{
{ “HELLO WORLD”, hello_world, 0 },
{ “ECHO”, con_echo, help_echo_txt },
{ “HELP”, con_help, help_help_txt },
};

Thanks for pointing this out. The samples were available up until DC10.40, but the path was wrong. They were in the samples/zconsole/ directory. They were removed as they were written to use FS2, which is not supported on Rabbit 4000 and up core modules. It was intended that they be re-written and put back, but that obviously hasn’t happened yet. I have entered a bug report on this, and on changing the TCPIP manual to cover the 2000/3000/4000 differences.

The userblock_tcpipconsole.c sample in the samples/zconsole directory is the same tcpipconsole.c sample mentioned further along in section 13. I modified the loginconsole.c sample to work on 4000/5000 modules and have included it below. I tested this and it works, but it has not gone through our normal level of QA testing. This will be addressed and included in a future release of DC.


/********************************************************************
   loginconsole.c
   Digi International, Copyright � 2002-2009.  All rights reserved.

   This sample program is similar to the BASICCONSOLE.C sample
   program, but it adds the commands to handle setting up logins.
   Default serial port in this sample is port D. For BLxS2xx boards,
   change this to port E.

   After setting the "LOGIN NAME" and "LOGIN PASSWORD" type
   "logout" or restart the controller.  You will then be prompted
   for a name and password to gain access.

      version 1.0 :	Initial coding.
      version 1.1 :	Added  #class auto

********************************************************************/
#class auto

/*
 * Size of the buffers for serial port D.  If you want to use
 * another serial port, you should change the buffer macros below
 * appropriately (and change the console_io[] array below).
 */
#define DINBUFSIZE		1023
#define DOUTBUFSIZE		255

/*
 * Maximum number of entries in the TCP servers' object list (in
 * this case, the total number of variables and files that can
 * be created)
 */
#define SSPEC_MAXSPEC  5

/*
 * The number of console I/O streams that this program supports.
 * Since we are only supporting serial port C, then there is only
 * one I/O stream.
 */
#define NUM_CONSOLES 1

/*
 * Defines the message that is displayed on all I/O channels when
 * the console starts up.
 */
#define CON_INIT_MESSAGE "LoginConsole Version 1.1
"

/*
 * Indicate that we want to use the user block for our configuration
 * information.
 */
#define CON_BACKUP_USER_BLOCK

#memmap xmem

/*
 * Note that all libraries that zconsole.lib needs must be #use'd
 * before #use'ing zconsole.lib .
 */
#use "zconsole.lib"

/*
 * This function prototype is for a custom command, so it must be
 * declared before the console_command[] array.
 */
int hello_world(ConsoleState* state);

/*
 * This array defines which I/O streams for which the console will
 * be available.  The streams included below are defined through
 * macros.  Available macros are CONSOLE_IO_SERA, CONSOLE_IO_SERB,
 * CONSOLE_IO_SERC, CONSOLE_IO_SERD, CONSOLE_IO_TELNET, and
 * CONSOLE_IO_SP (for the slave port).  The parameter for the macro
 * represents the initial baud rate for serial ports, the port
 * number for telnet, or the channel number for the slave port.
 * It is possible for the user to define her own I/O handlers and
 * include them in a ConsoleIO structure in the console_io array.
 * Remember that if you change the number of I/O streams here, you
 * should also change the NUM_CONSOLES macro above.
 */
const ConsoleIO console_io[] =
{
   CONSOLE_IO_SERD(57600)
};

/*
 * This array defines the commands that are available in the console.
 * The first parameter for the ConsoleCommand structure is the
 * command specification--that is, the means by which the console
 * recognizes a command.  The second parameter is the function
 * to call when the command is recognized.  The third parameter is
 * the location of the #ximport'ed help file for the command.
 */
const ConsoleCommand console_commands[] =
{
   { "LOGIN NAME", con_loginname, 0 },
   { "LOGIN PASSWORD", con_loginpassword, 0 },
   { "LOGOUT", con_logout, 0 },
   { "HELLO WORLD", hello_world, 0 },
   { "ECHO", con_echo, 0 }                       // Turns echoing on and off.
};

/*
 * This array sets up the error messages that can be generated.
 * CON_STANDARD_ERRORS is a macro that expands to the standard
 * errors that the built-in commands in zconsole.lib uses.  Users
 * can define their own errors here, as well.
 */
const ConsoleError console_errors[] = {
   CON_STANDARD_ERRORS
};

/*
 * This array defines the information (such as configuration) that
 * will be saved to the filesystem.  Note that if, for example, the
 * HTTP or SMTP related commands are include in the console_commands
 * array above, then the backup information must be included in
 * this array.  The entries below are macros that expand to the
 * appropriate entry for each set of functionality.  Users can also
 * add their own information to be backed up here by adding more
 * ConsoleBackup structures.
 */
const ConsoleBackup console_backup[] =
{
   CONSOLE_BASIC_BACKUP,
   CONSOLE_LOGIN_BACKUP
};

/*
 * This is a custom command.  Custom commands always take a
 * ConsoleState* as an argument (a pointer to the state structure
 * for the given I/O stream), and return an int.  The return value
 * should be 0 when the command wishes to be called again on the
 * next console_tick(), 1 when the command has successfully
 * finished processing, or -1 when the command has finished due
 * to an error.
 */
int hello_world(ConsoleState* state)
{
   state->conio->puts("Hello, World!
");
   return 1;
}

void main(void)
{
#if (BL4S100_SERIES || BLXS200_SERIES)
   // Board init needed on SBC boards
   brdInit();
#endif

   /*
    * Initialize the console
    */
   if (console_init() != 0) {
      printf("Console did not initialize.
");

      /*
       * Save the backup information to the console.
       */
      con_backup();
   }

   while (1) {
      /*
       * console_tick() drives the console.
       */
      console_tick();
   }
}