system: telnetd: Add telnetd app
Summary: - This commit adds telnetd app Impact: - None Testing: - Tested with sabre-6quad:netknsh (will be updated later) Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
This commit is contained in:
parent
3f70a78dd3
commit
a86315050d
39
system/telnetd/Kconfig
Normal file
39
system/telnetd/Kconfig
Normal file
@ -0,0 +1,39 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config SYSTEM_TELNETD
|
||||
tristate "Telnet daemon application"
|
||||
default n
|
||||
depends on NETUTILS_TELNETD
|
||||
---help---
|
||||
Enable the Telnet daemon application
|
||||
|
||||
config SYSTEM_TELNETD_PROGNAME
|
||||
string "Telnetd program name"
|
||||
default "telnetd"
|
||||
depends on SYSTEM_TELNETD
|
||||
---help---
|
||||
This is the name of the program that will be used when the NSH ELF
|
||||
program is installed.
|
||||
|
||||
config SYSTEM_TELNETD_PRIORITY
|
||||
int "Telnetd task priority"
|
||||
default 100
|
||||
depends on SYSTEM_TELNETD
|
||||
|
||||
config SYSTEM_TELNETD_STACKSIZE
|
||||
int "Telnetd task stack size"
|
||||
default DEFAULT_TASK_STACKSIZE
|
||||
depends on SYSTEM_TELNETD
|
||||
|
||||
config SYSTEM_TELNETD_SESSION_PRIORITY
|
||||
int "Telnetd session task priority"
|
||||
default 100
|
||||
depends on SYSTEM_TELNETD
|
||||
|
||||
config SYSTEM_TELNETD_SESSION_STACKSIZE
|
||||
int "Telnetd session task stack size"
|
||||
default 3072
|
||||
depends on SYSTEM_TELNETD
|
23
system/telnetd/Make.defs
Normal file
23
system/telnetd/Make.defs
Normal file
@ -0,0 +1,23 @@
|
||||
############################################################################
|
||||
# apps/system/telnetd/Make.defs
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_SYSTEM_TELNETD),)
|
||||
CONFIGURED_APPS += $(APPDIR)/system/telnetd
|
||||
endif
|
34
system/telnetd/Makefile
Normal file
34
system/telnetd/Makefile
Normal file
@ -0,0 +1,34 @@
|
||||
############################################################################
|
||||
# apps/system/telnetd/Makefile
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# telnetd
|
||||
|
||||
PROGNAME := $(CONFIG_SYSTEM_TELNETD_PROGNAME)
|
||||
PRIORITY := $(CONFIG_SYSTEM_TELNETD_PRIORITY)
|
||||
STACKSIZE := $(CONFIG_SYSTEM_TELNETD_STACKSIZE)
|
||||
MODULE := $(CONFIG_SYSTEM_TELNETD)
|
||||
|
||||
# Files
|
||||
|
||||
MAINSRC := telnetd.c
|
||||
|
||||
include $(APPDIR)/Application.mk
|
61
system/telnetd/telnetd.c
Normal file
61
system/telnetd/telnetd.c
Normal file
@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
* apps/system/telnetd/telnetd.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "netutils/telnetd.h"
|
||||
#include "netutils/netlib.h"
|
||||
#include "nshlib/nshlib.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
FAR char *argv1[3];
|
||||
char arg0[sizeof("0x1234567812345678")];
|
||||
struct telnetd_s daemon;
|
||||
|
||||
/* Initialize the daemon structure */
|
||||
|
||||
daemon.port = HTONS(23);
|
||||
daemon.family = AF_INET;
|
||||
daemon.entry = nsh_telnetmain;
|
||||
|
||||
/* NOTE: Settings for telnet session task */
|
||||
|
||||
daemon.priority = CONFIG_SYSTEM_TELNETD_SESSION_PRIORITY;
|
||||
daemon.stacksize = CONFIG_SYSTEM_TELNETD_SESSION_STACKSIZE;
|
||||
|
||||
snprintf(arg0, sizeof(arg0), "0x%" PRIxPTR, (uintptr_t)&daemon);
|
||||
argv1[0] = "telnetd";
|
||||
argv1[1] = arg0;
|
||||
argv1[2] = NULL;
|
||||
|
||||
telnetd_daemon(2, argv1);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user