source: rtems-docs/networking/network_servers.rst @ 9b5801a

4.115am
Last change on this file since 9b5801a was d389819, checked in by Amar Takhar <amar@…>, on 01/18/16 at 05:37:40

Convert all Unicode to ASCII(128)

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