mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 08:38:38 +08:00
FTPD daemon and example now build without errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4371 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
b7f677b8e1
commit
2f6adf5714
9 changed files with 180 additions and 47 deletions
|
@ -2446,4 +2446,4 @@
|
|||
* lib/stdio/lib_avsprintf.c: Add avsprintf().
|
||||
* lib/net/lib_inetntop.c: Add inet_ntop().
|
||||
* lib/net/lib_inetpton.c: Add inet_pton().
|
||||
|
||||
* include/pthread.h: Correct PTHREAD_MUTEX_INITIALIZER.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<h1><big><font color="#3c34ec">
|
||||
<i>NuttX RTOS Porting Guide</i>
|
||||
</font></big></h1>
|
||||
<p>Last Updated: January 25, 2011</p>
|
||||
<p>Last Updated: February 5, 2011</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -4866,6 +4866,36 @@ build
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>FTP Server</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<code>CONFIG_FTPD_VENDORID</code>: The vendor name to use in FTP communications. Default: "NuttX"
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_FTPD_SERVERID</code>: The server name to use in FTP communications. Default: "NuttX FTP Server"
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_FTPD_CMDBUFFERSIZE</code>: The maximum size of one command. Default: 512 bytes.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_FTPD_DATABUFFERSIZE</code>: The size of the I/O buffer for data transfers. Default: 2048 bytes.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_FTPD_WORKERSTACKSIZE</code>: The stacksize to allocate for each FTP daemon worker thread. Default: 2048 bytes.
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
Other required FTPD configuration settings: Of course TCP networking support is required. But here are a couple that are less obvious:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<code>CONFIG_DISABLE_PTHREAD=n</code>: pthread support is required
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_DISABLE_POLL=n</code>: poll() support is required
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2>USB Device-Side Support</h2>
|
||||
<h3>USB Device Controller Driver</h3>
|
||||
<ul>
|
||||
|
|
|
@ -916,6 +916,25 @@ defconfig -- This is a configuration file similar to the Linux
|
|||
CONFIG_THTTPD_URLPATTERN - If defined, then it will be used to match
|
||||
and verify referrers.
|
||||
|
||||
FTP Server
|
||||
|
||||
CONFIG_FTPD_VENDORID - The vendor name to use in FTP communications.
|
||||
Default: "NuttX"
|
||||
CONFIG_FTPD_SERVERID - The server name to use in FTP communications.
|
||||
Default: "NuttX FTP Server"
|
||||
CONFIG_FTPD_CMDBUFFERSIZE - The maximum size of one command. Default:
|
||||
512 bytes.
|
||||
CONFIG_FTPD_DATABUFFERSIZE - The size of the I/O buffer for data
|
||||
transfers. Default: 2048 bytes.
|
||||
CONFIG_FTPD_WORKERSTACKSIZE - The stacksize to allocate for each
|
||||
FTP daemon worker thread. Default: 2048 bytes.
|
||||
|
||||
Other required configuration settings: Of course TCP networking support
|
||||
is required. But here are a couple that are less obvious:
|
||||
|
||||
CONFIG_DISABLE_PTHREAD - pthread support is required
|
||||
CONFIG_DISABLE_POLL - poll() support is required
|
||||
|
||||
USB device controller driver
|
||||
|
||||
CONFIG_USBDEV - Enables USB device support
|
||||
|
|
|
@ -661,7 +661,25 @@ Where <subdir> is one of the following:
|
|||
CONFIG_DEBUG_CAN
|
||||
CONFIG_CAN_REGDEBUG
|
||||
|
||||
5. This configuration requires that jumper JP22 be set to enable RS-232 operation.
|
||||
5. This example can support an FTP client. In order to build in FTP client
|
||||
support simply uncomment the following lines in the appconfig file (before
|
||||
configuring) or in the apps/.config file (after configuring):
|
||||
|
||||
#CONFIGURED_APPS += netutils/ftpc
|
||||
#CONFIGURED_APPS += examples/ftpc
|
||||
|
||||
6. This example can support an FTP server. In order to build in FTP server
|
||||
support simply uncomment the following lines in the appconfig file (before
|
||||
configuring) or in the apps/.config file (after configuring):
|
||||
|
||||
#CONFIGURED_APPS += netutils/ftpd
|
||||
#CONFIGURED_APPS += examples/ftpd
|
||||
|
||||
And enable poll() support in the NuttX configuration file:
|
||||
|
||||
CONFIG_DISABLE_POLL=n
|
||||
|
||||
7. This configuration requires that jumper JP22 be set to enable RS-232 operation.
|
||||
|
||||
nsh2:
|
||||
-----
|
||||
|
|
|
@ -43,8 +43,8 @@ CONFIGURED_APPS += system/readline
|
|||
CONFIGURED_APPS += nshlib
|
||||
|
||||
# Networking libraries.
|
||||
# Uncomment netutils/ftpc to include an FTP client
|
||||
# Uncomment netutils/ftpd to include an FTP server
|
||||
# Uncomment netutils/ftpc to include an FTP client library
|
||||
# Uncomment netutils/ftpd to include an FTP server library
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CONFIGURED_APPS += netutils/uiplib
|
||||
|
|
|
@ -51,8 +51,36 @@
|
|||
|
||||
/* Values for protocol argument to socket() */
|
||||
|
||||
#define IPPROTO_TCP 1
|
||||
#define IPPROTO_UDP 2
|
||||
#define IPPROTO_IP 0 /* Dummy protocol for TCP */
|
||||
#define IPPROTO_HOPOPTS 0 /* IPv6 Hop-by-Hop options. */
|
||||
#define IPPROTO_ICMP 1 /* Internet Control Message Protocol */
|
||||
#define IPPROTO_IGMP 2 /* Internet Group Management Protocol */
|
||||
#define IPPROTO_IPIP 4 /* IPIP tunnels (older KA9Q tunnels use 94) */
|
||||
#define IPPROTO_TCP 6 /* Transmission Control Protocol */
|
||||
#define IPPROTO_EGP 8 /* Exterior Gateway Protocol */
|
||||
#define IPPROTO_PUP 12 /* PUP protocol */
|
||||
#define IPPROTO_UDP 17 /* User Datagram Protocol */
|
||||
#define IPPROTO_IDP 22 /* XNS IDP protocol */
|
||||
#define IPPROTO_TP 29 /* SO Transport Protocol Class 4. */
|
||||
#define IPPROTO_DCCP 33 /* Datagram Congestion Control Protocol */
|
||||
#define IPPROTO_IPV6 41 /* IPv6-in-IPv4 tunnelling */
|
||||
#define IPPROTO_ROUTING 43 /* IPv6 routing header. */
|
||||
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header. */
|
||||
#define IPPROTO_RSVP 46 /* Reservation Protocol. */
|
||||
#define IPPROTO_GRE 47 /* General Routing Encapsulation. */
|
||||
#define IPPROTO_ESP 50 /* Encapsulation Security Payload protocol */
|
||||
#define IPPROTO_AH 51 /* Authentication Header protocol */
|
||||
#define IPPROTO_ICMPV6 58 /* ICMPv6 */
|
||||
#define IPPROTO_NONE 59 /* IPv6 no next header. */
|
||||
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options. */
|
||||
#define IPPROTO_MTP 92 /* Multicast Transport Protocol. */
|
||||
#define IPPROTO_ENCAP 98 /* Encapsulation Header. */
|
||||
#define IPPROTO_BEETPH 94 /* IP option pseudo header for BEET */
|
||||
#define IPPROTO_PIM 103 /* Protocol Independent Multicast */
|
||||
#define IPPROTO_COMP 108 /* Compression Header protocol */
|
||||
#define IPPROTO_SCTP 132 /* Stream Control Transport Protocol */
|
||||
#define IPPROTO_UDPLITE 136 /* UDP-Lite (RFC 3828) */
|
||||
#define IPPROTO_RAW 255 /* Raw IP packets */
|
||||
|
||||
/* Values used with SIOCSIFMCFILTER and SIOCGIFMCFILTER ioctl's */
|
||||
|
||||
|
@ -88,16 +116,17 @@
|
|||
/* IPv4 Internet address */
|
||||
|
||||
typedef uint32_t in_addr_t;
|
||||
|
||||
struct in_addr
|
||||
{
|
||||
in_addr_t s_addr; /* Address (network byte order) */
|
||||
in_addr_t s_addr; /* Address (network byte order) */
|
||||
};
|
||||
|
||||
struct sockaddr_in
|
||||
{
|
||||
sa_family_t sin_family; /* Address family: AF_INET */
|
||||
uint16_t sin_port; /* Port in network byte order */
|
||||
struct in_addr sin_addr; /* Internet address */
|
||||
sa_family_t sin_family; /* Address family: AF_INET */
|
||||
uint16_t sin_port; /* Port in network byte order */
|
||||
struct in_addr sin_addr; /* Internet address */
|
||||
};
|
||||
|
||||
/* IPv6 Internet address */
|
||||
|
@ -106,17 +135,17 @@ struct in6_addr
|
|||
{
|
||||
union
|
||||
{
|
||||
uint8_t u6_addr8[16];
|
||||
uint16_t u6_addr16[8];
|
||||
uint32_t u6_addr32[4];
|
||||
uint8_t u6_addr8[16];
|
||||
uint16_t u6_addr16[8];
|
||||
uint32_t u6_addr32[4];
|
||||
} in6_u;
|
||||
};
|
||||
|
||||
struct sockaddr_in6
|
||||
{
|
||||
sa_family_t sin_family; /* Address family: AF_INET */
|
||||
uint16_t sin_port; /* Port in network byte order */
|
||||
struct in6_addr sin6_addr; /* IPv6 internet address */
|
||||
sa_family_t sin_family; /* Address family: AF_INET */
|
||||
uint16_t sin_port; /* Port in network byte order */
|
||||
struct in6_addr sin6_addr; /* IPv6 internet address */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -197,9 +197,9 @@ struct pthread_mutex_s
|
|||
typedef struct pthread_mutex_s pthread_mutex_t;
|
||||
|
||||
#ifdef CONFIG_MUTEX_TYPES
|
||||
# define PTHREAD_MUTEX_INITIALIZER {0, {1, 0xffff}, PTHREAD_MUTEX_DEFAULT, 0}
|
||||
# define PTHREAD_MUTEX_INITIALIZER {0, SEM_INITIALIZER(1), PTHREAD_MUTEX_DEFAULT, 0}
|
||||
#else
|
||||
# define PTHREAD_MUTEX_INITIALIZER {0, {1, 0xffff}}
|
||||
# define PTHREAD_MUTEX_INITIALIZER {0, SEM_INITIALIZER(1)}
|
||||
#endif
|
||||
|
||||
struct pthread_barrierattr_s
|
||||
|
|
|
@ -71,7 +71,13 @@ struct semholder_s
|
|||
void *holder; /* Holder TCB (actual type is _TCB) */
|
||||
int16_t counts; /* Number of counts owned by this holder */
|
||||
};
|
||||
|
||||
#if CONFIG_SEM_PREALLOCHOLDERS > 0
|
||||
# define SEMHOLDER_INITIALIZER {NULL, NULL, 0}
|
||||
#else
|
||||
# define SEMHOLDER_INITIALIZER {NULL, 0}
|
||||
#endif
|
||||
#endif /* CONFIG_PRIORITY_INHERITANCE */
|
||||
|
||||
/* This is the generic semaphore structure. */
|
||||
|
||||
|
@ -85,6 +91,12 @@ struct sem_s
|
|||
};
|
||||
typedef struct sem_s sem_t;
|
||||
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER}
|
||||
#else
|
||||
# define SEM_INITIALIZER(c) {(c)}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
|
|
@ -52,35 +52,35 @@
|
|||
|
||||
/* Protocol families */
|
||||
|
||||
#define PF_UNSPEC 0 /* Protocol family unspecified */
|
||||
#define PF_UNIX 1 /* Local communication */
|
||||
#define PF_LOCAL 1 /* Local communication */
|
||||
#define PF_INET 2 /* IPv4 Internet protocols */
|
||||
#define PF_INET6 3 /* IPv6 Internet protocols */
|
||||
#define PF_IPX 4 /* IPX - Novell protocols */
|
||||
#define PF_NETLINK 5 /* Kernel user interface device */
|
||||
#define PF_X25 6 /* ITU-T X.25 / ISO-8208 protocol */
|
||||
#define PF_AX25 7 /* Amateur radio AX.25 protocol */
|
||||
#define PF_ATMPVC 8 /* Access to raw ATM PVCs */
|
||||
#define PF_APPLETALK 9 /* Appletalk */
|
||||
#define PF_PACKET 10 /* Low level packet interface */
|
||||
#define PF_UNSPEC 0 /* Protocol family unspecified */
|
||||
#define PF_UNIX 1 /* Local communication */
|
||||
#define PF_LOCAL 1 /* Local communication */
|
||||
#define PF_INET 2 /* IPv4 Internet protocols */
|
||||
#define PF_INET6 3 /* IPv6 Internet protocols */
|
||||
#define PF_IPX 4 /* IPX - Novell protocols */
|
||||
#define PF_NETLINK 5 /* Kernel user interface device */
|
||||
#define PF_X25 6 /* ITU-T X.25 / ISO-8208 protocol */
|
||||
#define PF_AX25 7 /* Amateur radio AX.25 protocol */
|
||||
#define PF_ATMPVC 8 /* Access to raw ATM PVCs */
|
||||
#define PF_APPLETALK 9 /* Appletalk */
|
||||
#define PF_PACKET 10 /* Low level packet interface */
|
||||
|
||||
/* Address families */
|
||||
|
||||
#define AF_UNSPEC PF_UNSPEC
|
||||
#define AF_UNIX PF_UNIX
|
||||
#define AF_LOCAL PF_LOCAL
|
||||
#define AF_INET PF_INET
|
||||
#define AF_INET6 PF_INET6
|
||||
#define AF_IPX PF_IPX
|
||||
#define AF_NETLINK PF_NETLINK
|
||||
#define AF_X25 PF_X25
|
||||
#define AF_AX25 PF_AX25
|
||||
#define AF_ATMPVC PF_ATMPVC
|
||||
#define AF_APPLETALK PF_APPLETALK
|
||||
#define AF_PACKET PF_PACKET
|
||||
#define AF_UNSPEC PF_UNSPEC
|
||||
#define AF_UNIX PF_UNIX
|
||||
#define AF_LOCAL PF_LOCAL
|
||||
#define AF_INET PF_INET
|
||||
#define AF_INET6 PF_INET6
|
||||
#define AF_IPX PF_IPX
|
||||
#define AF_NETLINK PF_NETLINK
|
||||
#define AF_X25 PF_X25
|
||||
#define AF_AX25 PF_AX25
|
||||
#define AF_ATMPVC PF_ATMPVC
|
||||
#define AF_APPLETALK PF_APPLETALK
|
||||
#define AF_PACKET PF_PACKET
|
||||
|
||||
/*The socket created by socket() has the indicated type, which specifies
|
||||
/* The socket created by socket() has the indicated type, which specifies
|
||||
* the communication semantics.
|
||||
*/
|
||||
|
||||
|
@ -95,7 +95,6 @@
|
|||
#define SOCK_RDM 4 /* Provides a reliable datagram layer that does not guarantee ordering. */
|
||||
#define SOCK_PACKET 5 /* Obsolete and should not be used in new programs */
|
||||
|
||||
|
||||
/* Bits in the FLAGS argument to `send', `recv', et al. These are the bits
|
||||
* recognized by Linus, not all are supported by NuttX.
|
||||
*/
|
||||
|
@ -160,10 +159,36 @@
|
|||
* Type Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* sockaddr_storage structure. This structure must be (1) large enough to
|
||||
* accommodate all supported protocol-specific address structures, and (2)
|
||||
* aligned at an appropriate boundary so that pointers to it can be cast
|
||||
* as pointers to protocol-specific address structures and used to access
|
||||
* the fields of those structures without alignment problems
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
struct sockaddr_storage
|
||||
{
|
||||
sa_family_t ss_family; /* Address family */
|
||||
char ss_data[18]; /* 18-bytes of address data */
|
||||
};
|
||||
#else
|
||||
struct sockaddr_storage
|
||||
{
|
||||
sa_family_t ss_family; /* Address family */
|
||||
char ss_data[14]; /* 14-bytes of address data */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* The sockaddr structure is used to define a socket address which is used
|
||||
* in the bind(), connect(), getpeername(), getsockname(), recvfrom(), and
|
||||
* sendto() functions.
|
||||
*/
|
||||
|
||||
struct sockaddr
|
||||
{
|
||||
sa_family_t sa_family;
|
||||
char sa_data[14];
|
||||
sa_family_t sa_family; /* Address family: See AF_* definitions */
|
||||
char sa_data[14]; /* 14-bytes of address data */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
Loading…
Reference in a new issue