source: rtems/cpukit/libnetworking/rtems/ftpfs.h @ c69b6fe

4.115
Last change on this file since c69b6fe was c69b6fe, checked in by Sebastian Huber <sebastian.huber@…>, on 06/09/10 at 11:36:09

2010-06-09 Sebastian Huber <sebastian.huber@…>

  • libnetworking/rtems/ftpfs.h, libnetworking/lib/ftpfs.c: Added rtems_ftpfs_mount() again. Documentation.
  • Property mode set to 100644
File size: 4.5 KB
Line 
1/**
2 * @file
3 *
4 * @brief File Transfer Protocol file system (FTP client).
5 */
6
7/*
8 * Copyright (c) 2009
9 * embedded brains GmbH
10 * Obere Lagerstr. 30
11 * D-82178 Puchheim
12 * Germany
13 * <rtems@embedded-brains.de>
14 *
15 * (c) Copyright 2002
16 * Thomas Doerfler
17 * IMD Ingenieurbuero fuer Microcomputertechnik
18 * Herbststr. 8
19 * 82178 Puchheim, Germany
20 * <Thomas.Doerfler@imd-systems.de>
21 *
22 * Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>.
23 *
24 * This code has been created after closly inspecting "tftpdriver.c" from Eric
25 * Norum.
26 *
27 * The license and distribution terms for this file may be
28 * found in the file LICENSE in this distribution or at
29 * http://www.rtems.com/license/LICENSE.
30 *
31 * $Id$
32 */
33
34#ifndef _RTEMS_FTPFS_H
35#define _RTEMS_FTPFS_H
36
37#include <sys/time.h>
38#include <sys/ioctl.h>
39
40#include <rtems/libio.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/**
47 * @defgroup rtems_ftpfs File Transfer Protocol File System
48 *
49 * @brief The FTP file system (FTP client) can be used to transfer files from
50 * or to remote hosts.
51 *
52 * You can mount the FTP file system with a call to rtems_ftpfs_mount().
53 * Alternatively you can use mount() directly.
54 *
55 * You can open files either read-only or write-only.  A seek is not allowed.
56 * A close terminates the control and data connections.
57 *
58 * To open a file @c file.txt in the directory @c dir (relative to home
59 * directory of the server) on a server named @c host using the user name
60 * @c user and the password @c pw you must specify the following path:
61 * <tt>/FTP/user:pw@@host/dir/file.txt</tt>.
62 *
63 * If the server is the default server specified in BOOTP, it can be ommitted:
64 * <tt>/FTP/user:pw/dir/file.txt</tt>.
65 *
66 * The user name will be used for the password if it is ommitted:
67 * <tt>/FTP/user@@host/dir/file.txt</tt>.
68 *
69 * For the data transfer passive (= default) and active (= fallback) mode are
70 * supported.
71 *
72 * @{
73 */
74
75/**
76 * @brief Well-known port number for FTP control connection.
77 */
78#define RTEMS_FTPFS_CTRL_PORT 21
79
80/**
81 * @brief Default mount point for FTP file system.
82 */
83#define RTEMS_FTPFS_MOUNT_POINT_DEFAULT "/FTP"
84
85/**
86 * @brief FTP file system IO control requests.
87 */
88typedef enum {
89  RTEMS_FTPFS_IOCTL_GET_VERBOSE = _IOR( 'd', 1, bool *),
90  RTEMS_FTPFS_IOCTL_SET_VERBOSE = _IOW( 'd', 1, bool *),
91  RTEMS_FTPFS_IOCTL_GET_TIMEOUT = _IOR( 'd', 2, struct timeval *),
92  RTEMS_FTPFS_IOCTL_SET_TIMEOUT = _IOW( 'd', 2, struct timeval *)
93} rtems_ftpfs_ioctl_numbers;
94
95/**
96 * @brief Creates the mount point @a mount_point and mounts the FTP file
97 * system.
98 *       
99 * If @a mount_point is @c NULL the default mount point         
100 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.   
101 *       
102 * It is mounted with read and write access.     
103 */     
104rtems_status_code rtems_ftpfs_mount( const char *mount_point);
105
106/**
107 * @brief Returns in @a verbose if the verbose mode is enabled or disabled for
108 * the file system at @a mount_point.
109 *
110 * If @a mount_point is @c NULL the default mount point
111 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
112 */
113rtems_status_code rtems_ftpfs_get_verbose( const char *mount_point, bool *verbose);
114
115/**
116 * @brief Enables or disables the verbose mode if @a verbose is @c true or
117 * @c false respectively for the file system at @a mount_point.
118 *
119 * In the enabled verbose mode the commands and replies of the FTP control
120 * connections will be printed to standard error.
121 *
122 * If @a mount_point is @c NULL the default mount point
123 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
124 */
125rtems_status_code rtems_ftpfs_set_verbose( const char *mount_point, bool verbose);
126
127/**
128 * @brief Returns the current timeout value in @a timeout for the file system
129 * at @a mount_point.
130 *
131 * If @a mount_point is @c NULL the default mount point
132 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
133 */
134rtems_status_code rtems_ftpfs_get_timeout(
135  const char *mount_point,
136  struct timeval *timeout
137);
138
139/**
140 * @brief Sets the timeout value to @a timeout for the file system at
141 * @a mount_point.
142 *
143 * The timeout value will be used during connection establishment of active
144 * data connections.  It will be also used for send and receive operations on
145 * data and control connections.
146 *
147 * If @a mount_point is @c NULL the default mount point
148 * @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
149 */
150rtems_status_code rtems_ftpfs_set_timeout(
151  const char *mount_point,
152  const struct timeval *timeout
153);
154
155/** @} */
156
157/**
158 * Do not call directly, use rtems_ftpfs_mount() or mount().
159 */
160int rtems_ftpfs_initialize(
161  rtems_filesystem_mount_table_entry_t *mt_entry,
162  const void *data
163);
164
165#ifdef __cplusplus
166}
167#endif
168
169#endif
Note: See TracBrowser for help on using the repository browser.