OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rtems-20020807/] [doc/] [networking/] [servers.t] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
@c
2
@c  Text Written by Jake Janovetz
3
@c
4
@c  COPYRIGHT (c) 1988-2002.
5
@c  On-Line Applications Research Corporation (OAR).
6
@c  All rights reserved.
7
@c
8
@c  servers.t,v 1.4 2002/01/17 21:47:45 joel Exp
9
@c
10
 
11
 
12
@chapter Network Servers
13
 
14
@section RTEMS FTP Daemon
15
 
16
The RTEMS FTPD is a complete file transfer protocol (FTP) daemon
17
which can store, retrieve, and manipulate files on the local
18
filesystem.  In addition, the RTEMS FTPD provides ``hooks''
19
which are actions performed on received data.  Hooks are useful
20
in situations where a destination file is not necessarily
21
appropriate or in cases when a formal device driver has not yet
22
been implemented.
23
 
24
This server was implemented and documented by Jake Janovetz
25
(janovetz@@tempest.ece.uiuc.edu).
26
 
27
@subsection Configuration Parameters
28
 
29
The configuration structure for FTPD is as follows:
30
 
31
@example
32
struct 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
 
42
The FTPD task priority is specified with @code{priority}.  Because
43
hooks are not saved as files, the received data is placed in an
44
allocated buffer.  @code{max_hook_filesize} specifies the maximum
45
size of this buffer.  Finally, @code{hooks} is a pointer to the
46
configured hooks structure.
47
 
48
@subsection Initializing FTPD (Starting the daemon)
49
 
50
Starting FTPD is done with a call to @code{rtems_initialize_ftpd()}.
51
The configuration structure must be provided in the application
52
source code.  Example hooks structure and configuration structure
53
folllow.
54
 
55
@example
56
struct rtems_ftpd_hook ftp_hooks[] =
57
   @{
58
      @{"untar", Untar_FromMemory@},
59
      @{NULL, NULL@}
60
   @};
61
 
62
struct 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
 
71
Specifying 0 for the well-known port causes FTPD to use the
72
UNIX standard FTPD port (21).
73
 
74
@subsection Using Hooks
75
 
76
In the example above, one hook was installed.  The hook causes
77
FTPD to call the function @code{Untar_FromMemory} when the
78
user sends data to the file @code{untar}.  The prototype for
79
the @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
 
85
An example FTP transcript which exercises this hook is:
86
 
87
@example
88
220 RTEMS FTP server (Version 1.0-JWJ) ready.
89
Name (dcomm0:janovetz): John Galt
90
230 User logged in.
91
Remote system type is RTEMS.
92
ftp> bin
93
200 Type set to I.
94
ftp> dir
95
200 PORT command successful.
96
150 ASCII data connection for LIST.
97
drwxrwx--x      0     0         268  dev
98
drwxrwx--x      0     0           0  TFTP
99
226 Transfer complete.
100
ftp> put html.tar untar
101
local: html.tar remote: untar
102
200 PORT command successful.
103
150 BINARY data connection.
104
210 File transferred successfully.
105
471040 bytes sent in 0.48 secs (9.6e+02 Kbytes/sec)
106
ftp> dir
107
200 PORT command successful.
108
150 ASCII data connection for LIST.
109
drwxrwx--x      0     0         268  dev
110
drwxrwx--x      0     0           0  TFTP
111
drwxrwx--x      0     0        3484  public_html
112
226 Transfer complete.
113
ftp> quit
114
221 Goodbye.
115
@end example
116
 
117
 
118
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.