![]() |
|
|||
File indexing completed on 2025-05-11 08:24:13
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @brief File Transfer Protocol file system (FTP client). 0007 */ 0008 0009 /* 0010 * Copyright (c) 2009 embedded brains GmbH & Co. KG 0011 * 0012 * Copyright (c) 2002 IMD Ingenieurbuero fuer Microcomputertechnik 0013 * All rights reserved. 0014 * Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>. 0015 * 0016 * This code has been created after closly inspecting "tftpdriver.c" from Eric 0017 * Norum. 0018 * 0019 * Redistribution and use in source and binary forms, with or without 0020 * modification, are permitted provided that the following conditions 0021 * are met: 0022 * 1. Redistributions of source code must retain the above copyright 0023 * notice, this list of conditions and the following disclaimer. 0024 * 2. Redistributions in binary form must reproduce the above copyright 0025 * notice, this list of conditions and the following disclaimer in the 0026 * documentation and/or other materials provided with the distribution. 0027 * 0028 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0029 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0030 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0031 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0032 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0033 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0034 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0035 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0036 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0037 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0038 * POSSIBILITY OF SUCH DAMAGE. 0039 */ 0040 0041 #ifndef _RTEMS_FTPFS_H 0042 #define _RTEMS_FTPFS_H 0043 0044 #include <sys/time.h> 0045 #include <sys/ioctl.h> 0046 0047 #include <rtems/libio.h> 0048 0049 #ifdef __cplusplus 0050 extern "C" { 0051 #endif 0052 0053 /** 0054 * @defgroup rtems_ftpfs File Transfer Protocol File System 0055 * 0056 * @ingroup FileSystemTypesAndMount 0057 * 0058 * @brief The FTP file system (FTP client) can be used to transfer files from 0059 * or to remote hosts. 0060 * 0061 * You can mount the FTP file system with a call to mount() or 0062 * mount_and_make_target_path() with the @ref RTEMS_FILESYSTEM_TYPE_FTPFS file 0063 * system type. 0064 * 0065 * You have to add @ref CONFIGURE_FILESYSTEM_FTPFS to your application 0066 * configuration. 0067 * 0068 * You can open files either read-only or write-only. A seek is not allowed. 0069 * A close terminates the control and data connections. 0070 * 0071 * To open a file @c file.txt in the directory @c dir (relative to home 0072 * directory of the server) on a server named @c host using the user name 0073 * @c user and the password @c pw you must specify the following path: 0074 * <tt>/FTP/user:pw@@host/dir/file.txt</tt>. 0075 * 0076 * If the server is the default server specified in BOOTP, it can be ommitted: 0077 * <tt>/FTP/user:pw/dir/file.txt</tt>. 0078 * 0079 * The user name will be used for the password if it is ommitted: 0080 * <tt>/FTP/user@@host/dir/file.txt</tt>. 0081 * 0082 * For the data transfer passive (= default) and active (= fallback) mode are 0083 * supported. 0084 */ 0085 /**@{**/ 0086 0087 /** 0088 * @brief Well-known port number for FTP control connection. 0089 */ 0090 #define RTEMS_FTPFS_CTRL_PORT 21 0091 0092 /** 0093 * @brief Default mount point for FTP file system. 0094 */ 0095 #define RTEMS_FTPFS_MOUNT_POINT_DEFAULT "/FTP" 0096 0097 /** 0098 * @brief FTP file system IO control requests. 0099 */ 0100 typedef enum { 0101 RTEMS_FTPFS_IOCTL_GET_VERBOSE = _IOR( 'd', 1, bool *), 0102 RTEMS_FTPFS_IOCTL_SET_VERBOSE = _IOW( 'd', 1, bool *), 0103 RTEMS_FTPFS_IOCTL_GET_TIMEOUT = _IOR( 'd', 2, struct timeval *), 0104 RTEMS_FTPFS_IOCTL_SET_TIMEOUT = _IOW( 'd', 2, struct timeval *) 0105 } rtems_ftpfs_ioctl_numbers; 0106 0107 /** 0108 * @brief Returns in @a verbose if the verbose mode is enabled or disabled for 0109 * the file system at @a mount_point. 0110 * 0111 * If @a mount_point is @c NULL the default mount point 0112 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. 0113 */ 0114 rtems_status_code rtems_ftpfs_get_verbose( const char *mount_point, bool *verbose); 0115 0116 /** 0117 * @brief Enables or disables the verbose mode if @a verbose is @c true or 0118 * @c false respectively for the file system at @a mount_point. 0119 * 0120 * In the enabled verbose mode the commands and replies of the FTP control 0121 * connections will be printed to standard error. 0122 * 0123 * If @a mount_point is @c NULL the default mount point 0124 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. 0125 */ 0126 rtems_status_code rtems_ftpfs_set_verbose( const char *mount_point, bool verbose); 0127 0128 /** 0129 * @brief Returns the current timeout value in @a timeout for the file system 0130 * at @a mount_point. 0131 * 0132 * If @a mount_point is @c NULL the default mount point 0133 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. 0134 */ 0135 rtems_status_code rtems_ftpfs_get_timeout( 0136 const char *mount_point, 0137 struct timeval *timeout 0138 ); 0139 0140 /** 0141 * @brief Sets the timeout value to @a timeout for the file system at 0142 * @a mount_point. 0143 * 0144 * The timeout value will be used during connection establishment of active 0145 * data connections. It will be also used for send and receive operations on 0146 * data and control connections. 0147 * 0148 * If @a mount_point is @c NULL the default mount point 0149 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used. 0150 */ 0151 rtems_status_code rtems_ftpfs_set_timeout( 0152 const char *mount_point, 0153 const struct timeval *timeout 0154 ); 0155 0156 /** @} */ 0157 0158 /** 0159 * @brief Do not call directly, use mount(). 0160 */ 0161 int rtems_ftpfs_initialize( 0162 rtems_filesystem_mount_table_entry_t *mt_entry, 0163 const void *data 0164 ); 0165 0166 #ifdef __cplusplus 0167 } 0168 #endif 0169 0170 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |