mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-17 17:38:37 +08:00
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* FTP Server Information
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_FTPD_H
|
||||
#define _RTEMS_FTPD_H
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FTPD_CONTROL_PORT 21
|
||||
|
||||
/* Various buffer sizes */
|
||||
enum {
|
||||
FTPD_BUFSIZE = 256, /* Size for temporary buffers */
|
||||
FTPD_DATASIZE = 4 * 1024, /* Size for file transfer buffers */
|
||||
FTPD_STACKSIZE = RTEMS_MINIMUM_STACK_SIZE + FTPD_DATASIZE /* Tasks stack size */
|
||||
};
|
||||
|
||||
/* FTPD access control flags */
|
||||
enum
|
||||
{
|
||||
FTPD_NO_WRITE = 0x1,
|
||||
FTPD_NO_READ = 0x2,
|
||||
FTPD_NO_RW = FTPD_NO_WRITE | FTPD_NO_READ
|
||||
};
|
||||
|
||||
typedef int (*rtems_ftpd_hookfunction)(char *, size_t);
|
||||
|
||||
#include <rtems/shell.h>
|
||||
|
||||
struct rtems_ftpd_hook
|
||||
{
|
||||
char *filename;
|
||||
rtems_ftpd_hookfunction hook_function;
|
||||
};
|
||||
|
||||
struct rtems_ftpd_configuration
|
||||
{
|
||||
rtems_task_priority priority; /* FTPD task priority */
|
||||
unsigned long max_hook_filesize; /* Maximum buffersize */
|
||||
/* for hooks */
|
||||
int port; /* Well-known port */
|
||||
struct rtems_ftpd_hook *hooks; /* List of hooks */
|
||||
char const *root; /* Root for FTPD or 0 for / */
|
||||
int tasks_count; /* Max. connections */
|
||||
int idle; /* Idle timeout in seoconds
|
||||
or 0 for no (inf) timeout */
|
||||
int access; /* 0 - r/w, 1 - read-only,
|
||||
2 - write-only,
|
||||
3 - browse-only */
|
||||
rtems_shell_login_check_t login; /* Login check or 0 to ignore
|
||||
user/passwd. */
|
||||
bool verbose; /* Say hello! */
|
||||
};
|
||||
|
||||
/*
|
||||
* Reply codes.
|
||||
*/
|
||||
#define PRELIM 1 /* positive preliminary */
|
||||
#define COMPLETE 2 /* positive completion */
|
||||
#define CONTINUE 3 /* positive intermediate */
|
||||
#define TRANSIENT 4 /* transient negative completion */
|
||||
#define ERROR 5 /* permanent negative completion */
|
||||
|
||||
/*
|
||||
* Initialise with the global table.
|
||||
*
|
||||
* Note, use rc.conf, this function will be removed at some point.
|
||||
*/
|
||||
int rtems_initialize_ftpd(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _RTEMS_FTPD_H */
|
@@ -1,159 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief File Transfer Protocol file system (FTP client).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* (c) Copyright 2002
|
||||
* Thomas Doerfler
|
||||
* IMD Ingenieurbuero fuer Microcomputertechnik
|
||||
* Herbststr. 8
|
||||
* 82178 Puchheim, Germany
|
||||
* <Thomas.Doerfler@imd-systems.de>
|
||||
*
|
||||
* Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>.
|
||||
*
|
||||
* This code has been created after closly inspecting "tftpdriver.c" from Eric
|
||||
* Norum.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_FTPFS_H
|
||||
#define _RTEMS_FTPFS_H
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup rtems_ftpfs File Transfer Protocol File System
|
||||
*
|
||||
* @brief The FTP file system (FTP client) can be used to transfer files from
|
||||
* or to remote hosts.
|
||||
*
|
||||
* You can mount the FTP file system with a call to mount() or
|
||||
* mount_and_make_target_path() with the @ref RTEMS_FILESYSTEM_TYPE_FTPFS file
|
||||
* system type.
|
||||
*
|
||||
* You have to add @ref CONFIGURE_FILESYSTEM_FTPFS to your application
|
||||
* configuration.
|
||||
*
|
||||
* You can open files either read-only or write-only. A seek is not allowed.
|
||||
* A close terminates the control and data connections.
|
||||
*
|
||||
* To open a file @c file.txt in the directory @c dir (relative to home
|
||||
* directory of the server) on a server named @c host using the user name
|
||||
* @c user and the password @c pw you must specify the following path:
|
||||
* <tt>/FTP/user:pw@@host/dir/file.txt</tt>.
|
||||
*
|
||||
* If the server is the default server specified in BOOTP, it can be ommitted:
|
||||
* <tt>/FTP/user:pw/dir/file.txt</tt>.
|
||||
*
|
||||
* The user name will be used for the password if it is ommitted:
|
||||
* <tt>/FTP/user@@host/dir/file.txt</tt>.
|
||||
*
|
||||
* For the data transfer passive (= default) and active (= fallback) mode are
|
||||
* supported.
|
||||
*/
|
||||
/**@{**/
|
||||
|
||||
/**
|
||||
* @brief Well-known port number for FTP control connection.
|
||||
*/
|
||||
#define RTEMS_FTPFS_CTRL_PORT 21
|
||||
|
||||
/**
|
||||
* @brief Default mount point for FTP file system.
|
||||
*/
|
||||
#define RTEMS_FTPFS_MOUNT_POINT_DEFAULT "/FTP"
|
||||
|
||||
/**
|
||||
* @brief FTP file system IO control requests.
|
||||
*/
|
||||
typedef enum {
|
||||
RTEMS_FTPFS_IOCTL_GET_VERBOSE = _IOR( 'd', 1, bool *),
|
||||
RTEMS_FTPFS_IOCTL_SET_VERBOSE = _IOW( 'd', 1, bool *),
|
||||
RTEMS_FTPFS_IOCTL_GET_TIMEOUT = _IOR( 'd', 2, struct timeval *),
|
||||
RTEMS_FTPFS_IOCTL_SET_TIMEOUT = _IOW( 'd', 2, struct timeval *)
|
||||
} rtems_ftpfs_ioctl_numbers;
|
||||
|
||||
/**
|
||||
* @brief Returns in @a verbose if the verbose mode is enabled or disabled for
|
||||
* the file system at @a mount_point.
|
||||
*
|
||||
* If @a mount_point is @c NULL the default mount point
|
||||
* @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
|
||||
*/
|
||||
rtems_status_code rtems_ftpfs_get_verbose( const char *mount_point, bool *verbose);
|
||||
|
||||
/**
|
||||
* @brief Enables or disables the verbose mode if @a verbose is @c true or
|
||||
* @c false respectively for the file system at @a mount_point.
|
||||
*
|
||||
* In the enabled verbose mode the commands and replies of the FTP control
|
||||
* connections will be printed to standard error.
|
||||
*
|
||||
* If @a mount_point is @c NULL the default mount point
|
||||
* @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
|
||||
*/
|
||||
rtems_status_code rtems_ftpfs_set_verbose( const char *mount_point, bool verbose);
|
||||
|
||||
/**
|
||||
* @brief Returns the current timeout value in @a timeout for the file system
|
||||
* at @a mount_point.
|
||||
*
|
||||
* If @a mount_point is @c NULL the default mount point
|
||||
* @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
|
||||
*/
|
||||
rtems_status_code rtems_ftpfs_get_timeout(
|
||||
const char *mount_point,
|
||||
struct timeval *timeout
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Sets the timeout value to @a timeout for the file system at
|
||||
* @a mount_point.
|
||||
*
|
||||
* The timeout value will be used during connection establishment of active
|
||||
* data connections. It will be also used for send and receive operations on
|
||||
* data and control connections.
|
||||
*
|
||||
* If @a mount_point is @c NULL the default mount point
|
||||
* @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
|
||||
*/
|
||||
rtems_status_code rtems_ftpfs_set_timeout(
|
||||
const char *mount_point,
|
||||
const struct timeval *timeout
|
||||
);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Do not call directly, use mount().
|
||||
*/
|
||||
int rtems_ftpfs_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Original Author: Fernando RUIZ CASAS (fernando.ruiz@ctv.es)
|
||||
* May 2001
|
||||
* Reworked by Till Straumann and .h overhauled by Joel Sherrill.
|
||||
*
|
||||
* Copyright (c) 2009 embedded brains GmbH and others.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_TELNETD_H
|
||||
#define _RTEMS_TELNETD_H
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool rtems_telnetd_login_check(
|
||||
const char *user,
|
||||
const char *passphrase
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Telnet command type.
|
||||
*/
|
||||
typedef void (*rtems_telnetd_command)(
|
||||
char * /* device name */,
|
||||
void * /* arg */
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Telnet configuration structure.
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* @brief Function invoked for each Telnet connection.
|
||||
*
|
||||
* The first parameter contains the device name. The second parameter
|
||||
* contains the argument pointer of this configuration table.
|
||||
*/
|
||||
rtems_telnetd_command command;
|
||||
|
||||
/**
|
||||
* @brief Argument for command function.
|
||||
*/
|
||||
void *arg;
|
||||
|
||||
/**
|
||||
* @brief Task priority.
|
||||
*
|
||||
* If this parameter is equal to zero, then the priority of network task is
|
||||
* used or 100 if this priority is less than two.
|
||||
*/
|
||||
rtems_task_priority priority;
|
||||
|
||||
/**
|
||||
* @brief Task stack size.
|
||||
*/
|
||||
size_t stack_size;
|
||||
|
||||
/**
|
||||
* @brief Login check function.
|
||||
*
|
||||
* Method used for login checks. Use @c NULL to disable a login check.
|
||||
*/
|
||||
rtems_shell_login_check_t login_check;
|
||||
|
||||
/**
|
||||
* @brief Keep standard IO of the caller.
|
||||
*
|
||||
* Telnet takes over the standard input, output and error associated with
|
||||
* task, if this parameter is set to @c true. In this case, it will @b not
|
||||
* listen on any sockets. When this parameter is @c false, Telnet will
|
||||
* create other tasks for the shell which listen on sockets.
|
||||
*/
|
||||
bool keep_stdio;
|
||||
} rtems_telnetd_config_table;
|
||||
|
||||
/**
|
||||
* @brief Start the Telnet subsystem with the provided configuration.
|
||||
*/
|
||||
rtems_status_code rtems_telnetd_start(const rtems_telnetd_config_table* config);
|
||||
|
||||
/**
|
||||
* @brief Telnet configuration.
|
||||
*
|
||||
* The application must provide this configuration table. It is used by
|
||||
* rtems_telnetd_initialize() to configure the Telnet subsystem. Do not modify
|
||||
* the entries after the intialization since it is used internally.
|
||||
*/
|
||||
extern rtems_telnetd_config_table rtems_telnetd_config;
|
||||
|
||||
/**
|
||||
* @brief Initializes the Telnet subsystem.
|
||||
*
|
||||
* Uses the application provided @ref rtems_telnetd_config configuration table.
|
||||
*/
|
||||
rtems_status_code rtems_telnetd_initialize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user