1 | /* |
---|
2 | * Copyright (c) 2013 embedded brains GmbH. All rights reserved. |
---|
3 | * |
---|
4 | * embedded brains GmbH |
---|
5 | * Dornierstr. 4 |
---|
6 | * 82178 Puchheim |
---|
7 | * Germany |
---|
8 | * <rtems@embedded-brains.de> |
---|
9 | * |
---|
10 | * Redistribution and use in source and binary forms, with or without |
---|
11 | * modification, are permitted provided that the following conditions |
---|
12 | * are met: |
---|
13 | * 1. Redistributions of source code must retain the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer. |
---|
15 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer in the |
---|
17 | * documentation and/or other materials provided with the distribution. |
---|
18 | * |
---|
19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
29 | * SUCH DAMAGE. |
---|
30 | */ |
---|
31 | |
---|
32 | #include <assert.h> |
---|
33 | |
---|
34 | #include <rtems.h> |
---|
35 | #include <rtems/ftpd.h> |
---|
36 | #include <rtems/shell.h> |
---|
37 | #include <rtems/console.h> |
---|
38 | |
---|
39 | #define TEST_NAME "LIBBSD FTPD 1" |
---|
40 | |
---|
41 | struct rtems_ftpd_configuration rtems_ftpd_configuration = { |
---|
42 | /* FTPD task priority */ |
---|
43 | .priority = 100, |
---|
44 | |
---|
45 | /* Maximum buffersize for hooks */ |
---|
46 | .max_hook_filesize = 0, |
---|
47 | |
---|
48 | /* Well-known port */ |
---|
49 | .port = 21, |
---|
50 | |
---|
51 | /* List of hooks */ |
---|
52 | .hooks = NULL, |
---|
53 | |
---|
54 | /* Root for FTPD or NULL for "/" */ |
---|
55 | .root = NULL, |
---|
56 | |
---|
57 | /* Max. connections */ |
---|
58 | .tasks_count = 4, |
---|
59 | |
---|
60 | /* Idle timeout in seconds or 0 for no (infinite) timeout */ |
---|
61 | .idle = 5 * 60, |
---|
62 | |
---|
63 | /* Access: 0 - r/w, 1 - read-only, 2 - write-only, 3 - browse-only */ |
---|
64 | .access = 0 |
---|
65 | }; |
---|
66 | |
---|
67 | static void |
---|
68 | test_main(void) |
---|
69 | { |
---|
70 | rtems_status_code sc; |
---|
71 | int rv; |
---|
72 | |
---|
73 | rv = rtems_initialize_ftpd(); |
---|
74 | assert(rv == 0); |
---|
75 | |
---|
76 | sc = rtems_shell_init( |
---|
77 | "SHLL", |
---|
78 | 32 * 1024, |
---|
79 | 1, |
---|
80 | CONSOLE_DEVICE_NAME, |
---|
81 | false, |
---|
82 | true, |
---|
83 | NULL |
---|
84 | ); |
---|
85 | assert(sc == RTEMS_SUCCESSFUL); |
---|
86 | } |
---|
87 | |
---|
88 | #define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER |
---|
89 | #define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER |
---|
90 | |
---|
91 | #include <rtems/bsd/test/default-network-init.h> |
---|
92 | |
---|
93 | #define CONFIGURE_SHELL_COMMANDS_INIT |
---|
94 | |
---|
95 | #include <bsp/irq-info.h> |
---|
96 | #include <rtems/netcmds-config.h> |
---|
97 | |
---|
98 | #define CONFIGURE_SHELL_USER_COMMANDS \ |
---|
99 | &bsp_interrupt_shell_command, \ |
---|
100 | &rtems_shell_PING_Command, \ |
---|
101 | &rtems_shell_ROUTE_Command, \ |
---|
102 | &rtems_shell_NETSTAT_Command, \ |
---|
103 | &rtems_shell_IFCONFIG_Command |
---|
104 | |
---|
105 | #define CONFIGURE_SHELL_COMMAND_CPUUSE |
---|
106 | #define CONFIGURE_SHELL_COMMAND_PERIODUSE |
---|
107 | #define CONFIGURE_SHELL_COMMAND_STACKUSE |
---|
108 | |
---|
109 | #define CONFIGURE_SHELL_COMMAND_CP |
---|
110 | #define CONFIGURE_SHELL_COMMAND_PWD |
---|
111 | #define CONFIGURE_SHELL_COMMAND_LS |
---|
112 | #define CONFIGURE_SHELL_COMMAND_LN |
---|
113 | #define CONFIGURE_SHELL_COMMAND_LSOF |
---|
114 | #define CONFIGURE_SHELL_COMMAND_CHDIR |
---|
115 | #define CONFIGURE_SHELL_COMMAND_CD |
---|
116 | #define CONFIGURE_SHELL_COMMAND_MKDIR |
---|
117 | #define CONFIGURE_SHELL_COMMAND_RMDIR |
---|
118 | #define CONFIGURE_SHELL_COMMAND_CAT |
---|
119 | #define CONFIGURE_SHELL_COMMAND_MV |
---|
120 | #define CONFIGURE_SHELL_COMMAND_RM |
---|
121 | #define CONFIGURE_SHELL_COMMAND_MALLOC_INFO |
---|
122 | |
---|
123 | #include <rtems/shellconfig.h> |
---|