diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-05 17:36:13 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-02-05 17:36:13 +0000 |
commit | d8a039ee18825d1f29e0c020ae6569453fb7bb4f (patch) | |
tree | f5b452486749985de7826e7deb82d4752deabe58 /nuttx | |
parent | efb4bf7dca5d637268c6d70eec2880352047e34c (diff) | |
download | px4-nuttx-d8a039ee18825d1f29e0c020ae6569453fb7bb4f.tar.gz px4-nuttx-d8a039ee18825d1f29e0c020ae6569453fb7bb4f.tar.bz2 px4-nuttx-d8a039ee18825d1f29e0c020ae6569453fb7bb4f.zip |
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
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/ChangeLog | 2 | ||||
-rw-r--r-- | nuttx/Documentation/NuttxPortingGuide.html | 32 | ||||
-rw-r--r-- | nuttx/configs/README.txt | 19 | ||||
-rwxr-xr-x | nuttx/configs/stm3240g-eval/README.txt | 20 | ||||
-rw-r--r-- | nuttx/configs/stm3240g-eval/nsh/appconfig | 4 | ||||
-rw-r--r-- | nuttx/include/netinet/in.h | 53 | ||||
-rw-r--r-- | nuttx/include/pthread.h | 4 | ||||
-rw-r--r-- | nuttx/include/semaphore.h | 12 | ||||
-rw-r--r-- | nuttx/include/sys/socket.h | 83 |
9 files changed, 181 insertions, 48 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index bc10b9b26..f60b7b9b6 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -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. diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 9b0c60ce7..2fd18b1d8 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -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> diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 8154c22c2..fc1743ced 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -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 diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt index 9013cdffc..727b46d08 100755 --- a/nuttx/configs/stm3240g-eval/README.txt +++ b/nuttx/configs/stm3240g-eval/README.txt @@ -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: ----- diff --git a/nuttx/configs/stm3240g-eval/nsh/appconfig b/nuttx/configs/stm3240g-eval/nsh/appconfig index 9567dd792..77bf3e938 100644 --- a/nuttx/configs/stm3240g-eval/nsh/appconfig +++ b/nuttx/configs/stm3240g-eval/nsh/appconfig @@ -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 diff --git a/nuttx/include/netinet/in.h b/nuttx/include/netinet/in.h index 2b92bba7f..066266ab9 100644 --- a/nuttx/include/netinet/in.h +++ b/nuttx/include/netinet/in.h @@ -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 */ }; /**************************************************************************** diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h index 974bd1f36..b0942b85c 100644 --- a/nuttx/include/pthread.h +++ b/nuttx/include/pthread.h @@ -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 diff --git a/nuttx/include/semaphore.h b/nuttx/include/semaphore.h index 7eea3a41b..dd1754d69 100644 --- a/nuttx/include/semaphore.h +++ b/nuttx/include/semaphore.h @@ -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 ****************************************************************************/ diff --git a/nuttx/include/sys/socket.h b/nuttx/include/sys/socket.h index 7613d00cd..83699bfbd 100644 --- a/nuttx/include/sys/socket.h +++ b/nuttx/include/sys/socket.h @@ -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 - -/*The socket created by socket() has the indicated type, which specifies +#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 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 */ }; /**************************************************************************** |