source: rtems/doc/networking/servers.t @ 65beca61

4.104.114.84.95
Last change on this file since 65beca61 was 5345873, checked in by Joel Sherrill <joel.sherrill@…>, on 04/01/99 at 21:43:50

New file. Text from Jake Janovetz.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1@c
2@c  Text Written by Jake Janovetz
3@c
4@c  COPYRIGHT (c) 1988-1998.
5@c  On-Line Applications Research Corporation (OAR).
6@c  All rights reserved.
7@c
8@c  $Id$
9@c
10
11
12@chapter Network Servers
13
14@section RTEMS FTP Daemon
15
16The RTEMS FTPD is a complete file transfer protocol (FTP) daemon
17which can store, retrieve, and manipulate files on the local
18filesystem.  In addition, the RTEMS FTPD provides ``hooks''
19which are actions performed on received data.  Hooks are useful
20in situations where a destination file is not necessarily
21appropriate or in cases when a formal device driver has not yet
22been implemented.
23
24@subsection Configuration Parameters
25
26The configuration structure for FTPD is as follows:
27
28@example
29struct rtems_ftpd_configuration
30@{
31   rtems_task_priority     priority;           /* FTPD task priority  */
32   unsigned long           max_hook_filesize;  /* Maximum buffersize  */
33                                               /*    for hooks        */
34   int                     port;               /* Well-known port     */
35   struct rtems_ftpd_hook  *hooks;             /* List of hooks       */
36@};
37@end example
38
39The FTPD task priority is specified with @code{priority}.  Because
40hooks are not saved as files, the received data is placed in an
41allocated buffer.  @code{max_hook_filesize} specifies the maximum
42size of this buffer.  Finally, @code{hooks} is a pointer to the
43configured hooks structure.
44
45@subsection Initializing FTPD (Starting the daemon)
46
47Starting FTPD is done with a call to @code{rtems_initialize_ftpd()}.
48The configuration structure must be provided in the application
49source code.  Example hooks structure and configuration structure
50folllow.
51
52@example
53struct rtems_ftpd_hook ftp_hooks[] =
54   @{
55      @{"untar", Untar_FromMemory@},
56      @{NULL, NULL@}
57   @};
58
59struct rtems_ftpd_configuration rtems_ftpd_configuration =
60   @{
61      40,                     /* FTPD task priority */
62      512*1024,               /* Maximum hook 'file' size */
63      0,                      /* Use default port */
64      ftp_hooks               /* Local ftp hooks */
65   @};
66@end example
67
68Specifying 0 for the well-known port causes FTPD to use the
69UNIX standard FTPD port (21).
70
71@subsection Using Hooks
72
73In the example above, one hook was installed.  The hook causes
74FTPD to call the function @code{Untar_FromMemory} when the
75user sends data to the file @code{untar}.  The prototype for
76the @code{untar} hook (and hooks, in general) is:
77
78@example
79   int Untar_FromMemory(unsigned char *tar_buf, unsigned long size);
80@end example
81
82An example FTP transcript which exercises this hook is:
83
84@example
85220 RTEMS FTP server (Version 1.0-JWJ) ready.
86Name (dcomm0:janovetz): John Galt
87230 User logged in.
88Remote system type is RTEMS.
89ftp> bin
90200 Type set to I.
91ftp> dir
92200 PORT command successful.
93150 ASCII data connection for LIST.
94drwxrwx--x      0     0         268  dev
95drwxrwx--x      0     0           0  TFTP
96226 Transfer complete.
97ftp> put html.tar untar
98local: html.tar remote: untar
99200 PORT command successful.
100150 BINARY data connection.
101210 File transferred successfully.
102471040 bytes sent in 0.48 secs (9.6e+02 Kbytes/sec)
103ftp> dir
104200 PORT command successful.
105150 ASCII data connection for LIST.
106drwxrwx--x      0     0         268  dev
107drwxrwx--x      0     0           0  TFTP
108drwxrwx--x      0     0        3484  public_html
109226 Transfer complete.
110ftp> quit     
111221 Goodbye.
112@end example
113
114
115
Note: See TracBrowser for help on using the repository browser.