source: rtems/doc/networking/servers.t @ 02b7a13

4.104.114.84.95
Last change on this file since 02b7a13 was 02b7a13, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 2, 1999 at 5:58:57 PM

Added Network Servers Chapter including Jake Janovetz's ftpd server.

  • Property mode set to 100644
File size: 3.4 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
24This server was implemented and documented by Jake Janovetz
25(janovetz@@tempest.ece.uiuc.edu).
26
27@subsection Configuration Parameters
28
29The configuration structure for FTPD is as follows:
30
31@example
32struct rtems_ftpd_configuration
33@{
34   rtems_task_priority     priority;           /* FTPD task priority  */
35   unsigned long           max_hook_filesize;  /* Maximum buffersize  */
36                                               /*    for hooks        */
37   int                     port;               /* Well-known port     */
38   struct rtems_ftpd_hook  *hooks;             /* List of hooks       */
39@};
40@end example
41
42The FTPD task priority is specified with @code{priority}.  Because
43hooks are not saved as files, the received data is placed in an
44allocated buffer.  @code{max_hook_filesize} specifies the maximum
45size of this buffer.  Finally, @code{hooks} is a pointer to the
46configured hooks structure.
47
48@subsection Initializing FTPD (Starting the daemon)
49
50Starting FTPD is done with a call to @code{rtems_initialize_ftpd()}.
51The configuration structure must be provided in the application
52source code.  Example hooks structure and configuration structure
53folllow.
54
55@example
56struct rtems_ftpd_hook ftp_hooks[] =
57   @{
58      @{"untar", Untar_FromMemory@},
59      @{NULL, NULL@}
60   @};
61
62struct rtems_ftpd_configuration rtems_ftpd_configuration =
63   @{
64      40,                     /* FTPD task priority */
65      512*1024,               /* Maximum hook 'file' size */
66      0,                      /* Use default port */
67      ftp_hooks               /* Local ftp hooks */
68   @};
69@end example
70
71Specifying 0 for the well-known port causes FTPD to use the
72UNIX standard FTPD port (21).
73
74@subsection Using Hooks
75
76In the example above, one hook was installed.  The hook causes
77FTPD to call the function @code{Untar_FromMemory} when the
78user sends data to the file @code{untar}.  The prototype for
79the @code{untar} hook (and hooks, in general) is:
80
81@example
82   int Untar_FromMemory(unsigned char *tar_buf, unsigned long size);
83@end example
84
85An example FTP transcript which exercises this hook is:
86
87@example
88220 RTEMS FTP server (Version 1.0-JWJ) ready.
89Name (dcomm0:janovetz): John Galt
90230 User logged in.
91Remote system type is RTEMS.
92ftp> bin
93200 Type set to I.
94ftp> dir
95200 PORT command successful.
96150 ASCII data connection for LIST.
97drwxrwx--x      0     0         268  dev
98drwxrwx--x      0     0           0  TFTP
99226 Transfer complete.
100ftp> put html.tar untar
101local: html.tar remote: untar
102200 PORT command successful.
103150 BINARY data connection.
104210 File transferred successfully.
105471040 bytes sent in 0.48 secs (9.6e+02 Kbytes/sec)
106ftp> dir
107200 PORT command successful.
108150 ASCII data connection for LIST.
109drwxrwx--x      0     0         268  dev
110drwxrwx--x      0     0           0  TFTP
111drwxrwx--x      0     0        3484  public_html
112226 Transfer complete.
113ftp> quit     
114221 Goodbye.
115@end example
116
117
118
Note: See TracBrowser for help on using the repository browser.