2011-05-10 00:21:10 +02:00
|
|
|
/****************************************************************************
|
2021-06-11 11:07:52 +02:00
|
|
|
* apps/include/netutils/telnetd.h
|
2011-05-10 00:21:10 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* 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
|
2011-05-10 00:21:10 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-05-10 00:21:10 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* 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.
|
2012-01-30 22:29:59 +01:00
|
|
|
*
|
2011-05-10 00:21:10 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2012-01-30 22:29:59 +01:00
|
|
|
#ifndef __APPS_INCLUDE_NETUTILS_TELNETD_H
|
|
|
|
#define __APPS_INCLUDE_NETUTILS_TELNETD_H
|
2011-05-10 00:21:10 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-01-30 22:29:59 +01:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2011-05-10 00:21:10 +02:00
|
|
|
/****************************************************************************
|
2012-01-30 22:29:59 +01:00
|
|
|
* Pre-processor Definitions
|
2011-05-10 00:21:10 +02:00
|
|
|
****************************************************************************/
|
2021-06-11 11:07:52 +02:00
|
|
|
|
2015-06-13 02:07:47 +02:00
|
|
|
/* CONFIG_TELNETD_CONSOLE - Use the first Telnet session as the default
|
2012-01-30 22:29:59 +01:00
|
|
|
* console.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-06-11 11:07:52 +02:00
|
|
|
/* An instance of the struct telnetd_config_s structure must be passed to
|
2015-06-13 02:07:47 +02:00
|
|
|
* telnetd_start in order to configure the new Telnet daemon.
|
2012-01-30 22:29:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
struct telnetd_config_s
|
|
|
|
{
|
|
|
|
/* These fields describe the telnet daemon */
|
|
|
|
|
2017-06-27 17:14:13 +02:00
|
|
|
uint8_t d_priority; /* The execution priority of the Telnet daemon task */
|
|
|
|
size_t d_stacksize; /* The stack size needed by the Telnet daemon task */
|
|
|
|
|
|
|
|
/* These fields describe the network connection */
|
|
|
|
|
|
|
|
uint16_t d_port; /* The port to listen on (in network byte order) */
|
|
|
|
sa_family_t d_family; /* Address family */
|
2012-01-30 22:29:59 +01:00
|
|
|
|
2015-06-13 02:07:47 +02:00
|
|
|
/* These fields describe the priority of each thread created by the Telnet
|
2012-01-30 22:29:59 +01:00
|
|
|
* daemon.
|
|
|
|
*/
|
|
|
|
|
2017-06-27 17:14:13 +02:00
|
|
|
uint8_t t_priority; /* The execution priority of the spawned task, */
|
|
|
|
size_t t_stacksize; /* The stack size needed by the spawned task */
|
|
|
|
main_t t_entry; /* The entrypoint of the task to spawn when a new
|
|
|
|
* connection is accepted. */
|
2012-01-30 22:29:59 +01:00
|
|
|
};
|
2011-05-10 00:21:10 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define EXTERN extern "C"
|
2015-06-13 02:07:47 +02:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-05-10 00:21:10 +02:00
|
|
|
#else
|
|
|
|
#define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
2012-01-30 22:29:59 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: telnetd_start
|
|
|
|
*
|
|
|
|
* Description:
|
2015-06-13 02:07:47 +02:00
|
|
|
* Start the Telnet daemon.
|
2012-01-30 22:29:59 +01:00
|
|
|
*
|
|
|
|
* Parameters:
|
|
|
|
* config A pointer to a configuration structure that characterizes the
|
2015-06-13 02:07:47 +02:00
|
|
|
* Telnet daemon. This configuration structure may be defined
|
2012-01-30 22:29:59 +01:00
|
|
|
* on the caller's stack because it is not retained by the
|
|
|
|
* daemon.
|
|
|
|
*
|
|
|
|
* Return:
|
2015-06-13 02:07:47 +02:00
|
|
|
* The process ID (pid) of the new Telnet daemon is returned on
|
2012-01-30 22:29:59 +01:00
|
|
|
* success; A negated errno is returned if the daemon was not successfully
|
|
|
|
* started.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2011-05-10 00:21:10 +02:00
|
|
|
|
2015-06-13 02:07:47 +02:00
|
|
|
int telnetd_start(FAR struct telnetd_config_s *config);
|
2011-05-10 00:21:10 +02:00
|
|
|
|
|
|
|
#undef EXTERN
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2012-01-30 22:29:59 +01:00
|
|
|
#endif /* __APPS_INCLUDE_NETUTILS_TELNETD_H */
|