int shell_main(int argc, char *argv[])
#endif
{
  struct telnetd_config_s config;
  int ret;

  /* Configure the network */

  printf("shell_main: Initializing the network\n");
  shell_netinit();

  /* Configure the telnet daemon */

  config.d_port      = HTONS(23);
  config.d_priority  = CONFIG_EXAMPLES_TELNETD_DAEMONPRIO;
  config.d_stacksize = CONFIG_EXAMPLES_TELNETD_DAEMONSTACKSIZE;
  config.t_priority  = CONFIG_EXAMPLES_TELNETD_CLIENTPRIO;
  config.t_stacksize = CONFIG_EXAMPLES_TELNETD_CLIENTSTACKSIZE;
  config.t_entry     = nsh_consolemain;

  /* Start the telnet daemon */

  printf("shell_main: Starting the Telnet daemon\n");
  ret = telnetd_start(&config);
  if (ret < 0)
    {
      printf("Failed to tart the Telnet daemon\n");
    }

  printf("shell_main: Exiting\n");
  return 0;
}
Example #2
0
int nsh_telnetstart(void)
{
  struct telnetd_config_s config;
  int ret;

  /* Initialize any USB tracing options that were requested.  If standard
   * console is also defined, then we will defer this step to the standard
   * console.
   */

#if defined(CONFIG_NSH_USBDEV_TRACE) && !defined(CONFIG_NSH_CONSOLE)
  usbtrace_enable(TRACE_BITSET);
#endif

  /* Configure the telnet daemon */

  config.d_port      = HTONS(CONFIG_NSH_TELNETD_PORT);
  config.d_priority  = CONFIG_NSH_TELNETD_DAEMONPRIO;
  config.d_stacksize = CONFIG_NSH_TELNETD_DAEMONSTACKSIZE;
  config.t_priority  = CONFIG_NSH_TELNETD_CLIENTPRIO;
  config.t_stacksize = CONFIG_NSH_TELNETD_CLIENTSTACKSIZE;
  config.t_entry     = nsh_telnetmain;

  /* Start the telnet daemon */

  _info("Starting the Telnet daemon\n");
  ret = telnetd_start(&config);
  if (ret < 0)
    {
      _err("ERROR: Failed to tart the Telnet daemon: %d\n", ret);
    }

  return ret;
}