mirror of
https://github.com/apache/nuttx.git
synced 2026-05-13 02:18:38 +08:00
Added support for socket descriptors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@318 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1295,68 +1295,71 @@ The system can be re-made subsequently by just typing <code>make</code>.
|
||||
</ul>
|
||||
|
||||
<h2>Network Support</h2>
|
||||
<h3>TCP/IP support via uIP</h2>
|
||||
<h3>TCP/IP and UDP support via uIP</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<code>CONFIG_NET_UIP</code>: Enable or disable all uIP features
|
||||
<code>CONFIG_NET</code>: Enable or disable all network features
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_UIP_IPv6</code>: Build in support for IPv6
|
||||
<code>CONFIG_NET_IPv6</code>: Build in support for IPv6
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_MAX_CONNECTIONS</code>: Maximum number of TCP connections
|
||||
<code>CONFIG_NSOCKET_DESCRIPTORS</code>: Maximum number of socket descriptors per task/thread.
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_MAX_LISTENPORTS</code>: Maximum number of listening TCP ports
|
||||
<code>CONFIG_NET_MAX_CONNECTIONS</code>: Maximum number of TCP connections
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_BUFFER_SIZE</code>: uIP buffer size
|
||||
<code>CONFIG_NET_MAX_LISTENPORTS</code>: Maximum number of listening TCP ports
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_LOGGING</code>: Logging on or off
|
||||
<code>CONFIG_NET_BUFFER_SIZE</code>: uIP buffer size
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_UDP</code>: UDP support on or off
|
||||
<code>CONFIG_NET_LOGGING</code>: Logging on or off
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_UDP_CHECKSUMS</code>: UDP checksums on or off
|
||||
<code>CONFIG_NET_UDP</code>: UDP support on or off
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_UDP_CONNS</code>: The maximum amount of concurrent UDP connections
|
||||
<code>CONFIG_NET_UDP_CHECKSUMS</code>: UDP checksums on or off
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_STATISTICS</code>: uIP statistics on or off
|
||||
<code>CONFIG_NET_UDP_CONNS</code>: The maximum amount of concurrent UDP connections
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_PINGADDRCONF</code>: Use "ping" packet for setting IP address
|
||||
<code>CONFIG_NET_STATISTICS</code>: uIP statistics on or off
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_RECEIVE_WINDOW</code>: The size of the advertised receiver's window
|
||||
<code>CONFIG_NET_PINGADDRCONF</code>: Use "ping" packet for setting IP address
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_ARPTAB_SIZE</code>: The size of the ARP table
|
||||
<code>CONFIG_NET_RECEIVE_WINDOW</code>: The size of the advertised receiver's window
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_BROADCAST</code>: Broadcast support
|
||||
<code>CONFIG_NET_ARPTAB_SIZE</code>: The size of the ARP table
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_LLH_LEN</code>: The link level header length
|
||||
<code>CONFIG_NET_BROADCAST</code>: Broadcast support
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_EXTERNAL_BUFFER</code>: Incoming packet buffer (uip_buf) is defined externally
|
||||
<code>CONFIG_NET_LLH_LEN</code>: The link level header length
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_FWCACHE_SIZE</code>: number of packets to remember when looking for duplicates
|
||||
<code>CONFIG_NET_EXTERNAL_BUFFER</code>: Incoming packet buffer (uip_buf) is defined externally
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_NET_FWCACHE_SIZE</code>: number of packets to remember when looking for duplicates
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>UIP Network Utilities</h3>
|
||||
<ul>
|
||||
<li>
|
||||
<code>CONFIG_UIP_DHCP_LIGHT</code>: Reduces size of DHCP
|
||||
<code>CONFIG_NET_DHCP_LIGHT</code>: Reduces size of DHCP
|
||||
</li>
|
||||
<li>
|
||||
<code>CONFIG_UIP_RESOLV_ENTRIES</code>: Number of resolver entries
|
||||
<code>CONFIG_NET_RESOLV_ENTRIES</code>: Number of resolver entries
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ BOARD_DIR = configs/$(CONFIG_ARCH_BOARD)
|
||||
NONFSDIRS = sched lib $(ARCH_SRC) mm examples/$(CONFIG_EXAMPLE)
|
||||
FSDIRS = fs drivers
|
||||
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
NONFSDIRS += net netutils
|
||||
endif
|
||||
|
||||
@@ -79,7 +79,7 @@ ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
|
||||
LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
LINKLIBS += net/libnet$(LIBEXT) netutils/libnetutils$(LIBEXT)
|
||||
endif
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ CSRCS = up_initialize.c up_idle.c up_interruptcontext.c \
|
||||
ifeq ($(CONFIG_FS_FAT),y)
|
||||
CSRCS += up_blockdevice.c up_deviceimage.c
|
||||
endif
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += up_uipdriver.c
|
||||
SPECSRCS += up_tapdev.c
|
||||
endif
|
||||
|
||||
@@ -83,7 +83,7 @@ void up_idle(void)
|
||||
|
||||
/* Run the network if enabled */
|
||||
|
||||
#ifdef CONFIG_NET_UIP
|
||||
#ifdef CONFIG_NET
|
||||
uipdriver_loop();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ void up_initialize(void)
|
||||
devnull_register(); /* Standard /dev/null */
|
||||
up_devconsole(); /* Our private /dev/console */
|
||||
up_registerblockdevice(); /* Our simulated block device /dev/blkdev */
|
||||
#ifdef CONFIG_NET_UIP
|
||||
#ifdef CONFIG_NET
|
||||
uipdriver_init(); /* Our "real" netwok driver */
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ extern char *up_deviceimage(void);
|
||||
|
||||
/* up_tapdev.c ************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UIP
|
||||
#ifdef CONFIG_NET
|
||||
extern unsigned long up_getwalltime( void );
|
||||
extern void tapdev_init(void);
|
||||
extern unsigned int tapdev_read(char *buf, unsigned int buflen);
|
||||
@@ -118,7 +118,7 @@ extern void tapdev_send(char *buf, unsigned int buflen);
|
||||
|
||||
/* up_uipdriver.c *********************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_UIP
|
||||
#ifdef CONFIG_NET
|
||||
extern int uipdriver_init(void);
|
||||
extern void uipdriver_loop(void);
|
||||
#endif
|
||||
|
||||
@@ -106,7 +106,7 @@ void uipdriver_loop(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
uip_len = tapdev_read(uip_buf, UIP_BUFSIZE);
|
||||
uip_len = tapdev_read((char*)uip_buf, UIP_BUFSIZE);
|
||||
if (uip_len > 0)
|
||||
{
|
||||
if (BUF->type == htons(UIP_ETHTYPE_IP))
|
||||
@@ -122,7 +122,7 @@ void uipdriver_loop(void)
|
||||
if (uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
tapdev_send(uip_buf, uip_len);
|
||||
tapdev_send((char*)uip_buf, uip_len);
|
||||
}
|
||||
}
|
||||
else if (BUF->type == htons(UIP_ETHTYPE_ARP))
|
||||
@@ -136,7 +136,7 @@ void uipdriver_loop(void)
|
||||
|
||||
if (uip_len > 0)
|
||||
{
|
||||
tapdev_send(uip_buf, uip_len);
|
||||
tapdev_send((char*)uip_buf, uip_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ void uipdriver_loop(void)
|
||||
if (uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
tapdev_send(uip_buf, uip_len);
|
||||
tapdev_send((char*)uip_buf, uip_len);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void uipdriver_loop(void)
|
||||
if (uip_len > 0)
|
||||
{
|
||||
uip_arp_out();
|
||||
tapdev_send(uip_buf, uip_len);
|
||||
tapdev_send((char*)uip_buf, uip_len);
|
||||
}
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
||||
+21
-20
@@ -208,32 +208,33 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
structures. The system manages a pool of preallocated
|
||||
watchdog structures to minimize dynamic allocations
|
||||
|
||||
TCP/IP support via uIP
|
||||
CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
CONFIG_UIP_LOGGING - Logging on or off
|
||||
CONFIG_UIP_UDP - UDP support on or off
|
||||
CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP
|
||||
TCP/IP and UDP support via uIP
|
||||
CONFIG_NET - Enable or disable all network features
|
||||
CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
CONFIG_NET_LOGGING - Logging on or off
|
||||
CONFIG_NET_UDP - UDP support on or off
|
||||
CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP
|
||||
connections
|
||||
CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's
|
||||
CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's
|
||||
window
|
||||
CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
CONFIG_UIP_BROADCAST - Broadcast support
|
||||
CONFIG_UIP_LLH_LEN - The link level header length
|
||||
CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf)
|
||||
CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
CONFIG_NET_BROADCAST - Broadcast support
|
||||
CONFIG_NET_LLH_LEN - The link level header length
|
||||
CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf)
|
||||
is defined externally
|
||||
CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when
|
||||
CONFIG_NET_FWCACHE_SIZE - number of packets to remember when
|
||||
looking for duplicates
|
||||
|
||||
UIP Network Utilities
|
||||
CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
|
||||
Stack and heap information
|
||||
|
||||
|
||||
+41
-39
@@ -250,48 +250,50 @@ CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=n
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
+41
-39
@@ -239,48 +239,50 @@ CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=n
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
@@ -263,48 +263,50 @@ CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=n
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
@@ -248,48 +248,50 @@ CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=y
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
+41
-39
@@ -236,48 +236,50 @@ CONFIG_PREALLOC_WDOGS=4
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=y
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
+41
-39
@@ -210,48 +210,50 @@ CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_FS_FAT=y
|
||||
|
||||
#
|
||||
# TCP/IP support via uIP
|
||||
# CONFIG_NET_UIP - Enable or disable all uIP features
|
||||
# CONFIG_NET_UIP_IPv6 - Build in support for IPv6
|
||||
# CONFIG_UIP_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_UIP_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_UIP_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_UIP_LOGGING - Logging on or off
|
||||
# CONFIG_UIP_UDP - UDP support on or off
|
||||
# CONFIG_UIP_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_UIP_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_UIP_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_UIP_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_UIP_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_UIP_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_UIP_BROADCAST - Broadcast support
|
||||
# CONFIG_UIP_LLH_LEN - The link level header length
|
||||
# CONFIG_UIP_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_UIP_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET_UIP=n
|
||||
CONFIG_NET_UIP_IPv6=n
|
||||
CONFIG_UIP_MAX_CONNECTIONS=40
|
||||
CONFIG_UIP_MAX_LISTENPORTS=40
|
||||
CONFIG_UIP_BUFFER_SIZE=420
|
||||
CONFIG_UIP_LOGGING=y
|
||||
CONFIG_UIP_UDP=n
|
||||
CONFIG_UIP_UDP_CHECKSUMS=y
|
||||
#CONFIG_UIP_UDP_CONNS=10
|
||||
CONFIG_UIP_STATISTICS=y
|
||||
#CONFIG_UIP_PINGADDRCONF=0
|
||||
#CONFIG_UIP_RECEIVE_WINDOW=
|
||||
#CONFIG_UIP_ARPTAB_SIZE=8
|
||||
CONFIG_UIP_BROADCAST=n
|
||||
#CONFIG_UIP_LLH_LEN=14
|
||||
CONFIG_UIP_EXTERNAL_BUFFER=n
|
||||
#CONFIG_UIP_FWCACHE_SIZE=2
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_MAX_CONNECTIONS - Maximum number of TCP connections
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports
|
||||
# CONFIG_NET_BUFFER_SIZE - uIP buffer size
|
||||
# CONFIG_NET_LOGGING - Logging on or off
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_EXTERNAL_BUFFER - Incoming packet buffer (uip_buf) is defined externally
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=n
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=8
|
||||
CONFIG_NET_MAX_CONNECTIONS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_BUFFER_SIZE=420
|
||||
CONFIG_NET_LOGGING=y
|
||||
CONFIG_NET_UDP=n
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
#CONFIG_NET_RECEIVE_WINDOW=
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
CONFIG_NET_EXTERNAL_BUFFER=n
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_UIP_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_UIP_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_UIP_DHCP_LIGHT=n
|
||||
CONFIG_UIP_RESOLV_ENTRIES=4
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
|
||||
+15
-15
@@ -31,11 +31,12 @@
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: main.c,v 1.2 2007-08-30 23:57:58 patacongo Exp $
|
||||
* $Id: main.c,v 1.3 2007-09-01 18:06:12 patacongo Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <net/uip/uip.h>
|
||||
@@ -63,12 +64,11 @@
|
||||
|
||||
int user_start(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
uip_ipaddr_t ipaddr;
|
||||
#if defined(CONFIG_EXAMPLE_UIP_DHCPC)
|
||||
uint16 mac[6] = {1, 2, 3, 4, 5, 6};
|
||||
#endif
|
||||
#ifdef CONFIG_EXAMPLE_UIP_SMTP
|
||||
#if defined(CONFIG_EXAMPLE_UIP_DHCPC) || defined(CONFIG_EXAMPLE_UIP_SMTP)
|
||||
void *handle;
|
||||
#endif
|
||||
|
||||
@@ -84,10 +84,20 @@ int user_start(int argc, char *argv[])
|
||||
#elif defined(CONFIG_EXAMPLE_UIP_TELNETD)
|
||||
telnetd_init();
|
||||
#elif defined(CONFIG_EXAMPLE_UIP_DHCPC)
|
||||
dhcpc_init(&mac, 6);
|
||||
handle = dhcpc_open(&mac, 6);
|
||||
if (handle)
|
||||
{
|
||||
struct dhcpc_state ds;
|
||||
(void)dhcpc_request(handle, &ds);
|
||||
uip_sethostaddr(ds.ipaddr);
|
||||
uip_setnetmask(ds.netmask);
|
||||
uip_setdraddr(ds.default_router);
|
||||
resolv_conf(ds.dnsaddr);
|
||||
dhcpc_close(handle);
|
||||
}
|
||||
#elif defined(CONFIG_EXAMPLE_UIP_SMTP)
|
||||
uip_ipaddr(ipaddr, 127, 0, 0, 1);
|
||||
handle = smtp_init();
|
||||
handle = smtp_open();
|
||||
if (handle)
|
||||
{
|
||||
smtp_configure("localhost", ipaddr);
|
||||
@@ -131,16 +141,6 @@ void resolv_found(char *name, uint16 *ipaddr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __DHCPC_H__
|
||||
void dhcpc_configured(const struct dhcpc_state *s)
|
||||
{
|
||||
uip_sethostaddr(s->ipaddr);
|
||||
uip_setnetmask(s->netmask);
|
||||
uip_setdraddr(s->default_router);
|
||||
resolv_conf(s->dnsaddr);
|
||||
}
|
||||
#endif /* __DHCPC_H__ */
|
||||
|
||||
void webclient_closed(void)
|
||||
{
|
||||
printf("Webclient: connection closed\n");
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
/****************************************************************************
|
||||
* dhcpc.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* This logic was leveraged from uIP which also has a BSD-style license:
|
||||
*
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -25,34 +32,41 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* @(#)$Id: dhcpc.h,v 1.1.1.1 2007-08-26 23:07:02 patacongo Exp $
|
||||
*/
|
||||
#ifndef __DHCPC_H__
|
||||
#define __DHCPC_H__
|
||||
|
||||
#ifndef NET_UIP_DHCP_H__
|
||||
#define NET_UIP_DHCP_H__
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
struct dhcpc_state {
|
||||
char state;
|
||||
struct uip_udp_conn *conn;
|
||||
uint16 ticks;
|
||||
const void *mac_addr;
|
||||
int mac_len;
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
uint8 serverid[4];
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct dhcpc_state
|
||||
{
|
||||
uint16 lease_time[2];
|
||||
uint8 serverid[4];
|
||||
uint16 ipaddr[2];
|
||||
uint16 netmask[2];
|
||||
uint16 dnsaddr[2];
|
||||
uint16 default_router[2];
|
||||
};
|
||||
|
||||
void dhcpc_init(const void *mac_addr, int mac_len);
|
||||
void dhcpc_request(void);
|
||||
void dhcpc_configured(const struct dhcpc_state *s);
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __DHCPC_H__ */
|
||||
void *dhcpc_open(const void *mac_addr, int mac_len);
|
||||
int dhcpc_request(void *handle, struct dhcpc_state *ds);
|
||||
void dhcpc_close(void *handle);
|
||||
|
||||
#endif /* NET_UIP_DHCP_H__ */
|
||||
+30
-10
@@ -1,9 +1,15 @@
|
||||
/* psock.h
|
||||
/****************************************************************************
|
||||
* psock.h
|
||||
* Protosocket library header file
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* This logic was leveraged from uIP which also has a BSD-style license:
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2004, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -28,7 +34,10 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __NET_UIP_PSOCK_H
|
||||
#define __NET_UIP_PSOCK_H
|
||||
|
||||
/* psock Protosockets library
|
||||
*
|
||||
@@ -65,12 +74,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PSOCK_H__
|
||||
#define __PSOCK_H__
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <net/uip/uipopt.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* The structure that holds the state of a buffer.
|
||||
*
|
||||
* This structure holds the state of a uIP buffer. The structure has
|
||||
@@ -103,6 +120,10 @@ struct psock
|
||||
unsigned char state; /* The state of the protosocket. */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public FunctionPrototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Initialize a protosocket.
|
||||
*
|
||||
* Initializes a protosocket and must be called before the
|
||||
@@ -232,6 +253,5 @@ extern boolean psock_checknewdata(struct psock *s);
|
||||
|
||||
extern void psock_waitnewdata(struct psock *s);
|
||||
|
||||
#endif /* __PSOCK_H__ */
|
||||
|
||||
/** @} */
|
||||
#endif /* CONFIG_NET */
|
||||
#endif /* __NET_UIP_PSOCK_H */
|
||||
|
||||
+36
-38
@@ -1,14 +1,19 @@
|
||||
/**
|
||||
/****************************************************************************
|
||||
* uip.h
|
||||
* Header file for the uIP TCP/IP stack.
|
||||
* author Adam Dunkels <adam@dunkels.com>
|
||||
*
|
||||
* The uIP TCP/IP stack header file contains definitions for a number
|
||||
* of C macros that are used by uIP programs as well as internal uIP
|
||||
* structures, TCP/IP header structures and function declarations.
|
||||
*
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* This logic was leveraged from uIP which also has a BSD-style license:
|
||||
*
|
||||
* Author Adam Dunkels <adam@dunkels.com>
|
||||
* Copyright (c) 2001-2003, Adam Dunkels.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -34,14 +39,10 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack.
|
||||
*
|
||||
* $Id: uip.h,v 1.1.1.1 2007-08-26 23:12:16 patacongo Exp $
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __UIP_H__
|
||||
#define __UIP_H__
|
||||
#ifndef __NET_UIP_UIP_H
|
||||
#define __NET_UIP_UIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -117,11 +118,11 @@
|
||||
#define UIP_PROTO_ICMP6 58
|
||||
|
||||
/* Header sizes. */
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
# define UIP_IPH_LEN 40
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
# define UIP_IPH_LEN 20 /* Size of IP header */
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
#define UIP_UDPH_LEN 8 /* Size of UDP header */
|
||||
#define UIP_TCPH_LEN 20 /* Size of TCP header */
|
||||
#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN) /* Size of IP + UDP header */
|
||||
@@ -137,11 +138,11 @@
|
||||
typedef uint16 uip_ip4addr_t[2];
|
||||
typedef uint16 uip_ip6addr_t[8];
|
||||
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
typedef uip_ip6addr_t uip_ipaddr_t;
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
typedef uip_ip4addr_t uip_ipaddr_t;
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* Representation of a uIP TCP connection.
|
||||
*
|
||||
@@ -259,7 +260,7 @@ struct uip_stats {
|
||||
/* The TCP and IP headers. */
|
||||
|
||||
struct uip_tcpip_hdr {
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* IPv6 header. */
|
||||
|
||||
uint8 vtc,
|
||||
@@ -268,7 +269,7 @@ struct uip_tcpip_hdr {
|
||||
uint8 len[2];
|
||||
uint8 proto, ttl;
|
||||
uip_ip6addr_t srcipaddr, destipaddr;
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
/* IPv4 header. */
|
||||
|
||||
uint8 vhl,
|
||||
@@ -281,7 +282,7 @@ struct uip_tcpip_hdr {
|
||||
uint16 ipchksum;
|
||||
uint16 srcipaddr[2],
|
||||
destipaddr[2];
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* TCP header. */
|
||||
|
||||
@@ -300,7 +301,7 @@ struct uip_tcpip_hdr {
|
||||
/* The ICMP and IP headers. */
|
||||
|
||||
struct uip_icmpip_hdr {
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* IPv6 header. */
|
||||
|
||||
uint8 vtc,
|
||||
@@ -309,7 +310,7 @@ struct uip_icmpip_hdr {
|
||||
uint8 len[2];
|
||||
uint8 proto, ttl;
|
||||
uip_ip6addr_t srcipaddr, destipaddr;
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
/* IPv4 header. */
|
||||
|
||||
uint8 vhl,
|
||||
@@ -322,24 +323,24 @@ struct uip_icmpip_hdr {
|
||||
uint16 ipchksum;
|
||||
uint16 srcipaddr[2],
|
||||
destipaddr[2];
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* ICMP (echo) header. */
|
||||
uint8 type, icode;
|
||||
uint16 icmpchksum;
|
||||
#ifndef CONFIG_NET_UIP_IPv6
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
uint16 id, seqno;
|
||||
#else /* !CONFIG_NET_UIP_IPv6 */
|
||||
#else /* !CONFIG_NET_IPv6 */
|
||||
uint8 flags, reserved1, reserved2, reserved3;
|
||||
uint8 icmp6data[16];
|
||||
uint8 options[1];
|
||||
#endif /* !CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* !CONFIG_NET_IPv6 */
|
||||
};
|
||||
|
||||
/* The UDP and IP headers. */
|
||||
|
||||
struct uip_udpip_hdr {
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* IPv6 header. */
|
||||
|
||||
uint8 vtc,
|
||||
@@ -348,7 +349,7 @@ struct uip_udpip_hdr {
|
||||
uint8 len[2];
|
||||
uint8 proto, ttl;
|
||||
uip_ip6addr_t srcipaddr, destipaddr;
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
/* IP header. */
|
||||
|
||||
uint8 vhl,
|
||||
@@ -361,7 +362,7 @@ struct uip_udpip_hdr {
|
||||
uint16 ipchksum;
|
||||
uint16 srcipaddr[2],
|
||||
destipaddr[2];
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* UDP header. */
|
||||
|
||||
@@ -634,9 +635,6 @@ void uip_unlisten(uint16 port);
|
||||
* which usually is done within 0.5 seconds after the call to
|
||||
* uip_connect().
|
||||
*
|
||||
* Note: This function is avaliable only if support for active open
|
||||
* has been configured by defining UIP_ACTIVE_OPEN to 1 in uipopt.h.
|
||||
*
|
||||
* Note: Since this function requires the port number to be in network
|
||||
* byte order, a conversion using HTONS() or htons() is necessary.
|
||||
*
|
||||
@@ -972,14 +970,14 @@ struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, uint16 rport);
|
||||
* src The source from where to copy.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_UIP_IPv6
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
#define uip_ipaddr_copy(dest, src) do { \
|
||||
((uint16 *)dest)[0] = ((uint16 *)src)[0]; \
|
||||
((uint16 *)dest)[1] = ((uint16 *)src)[1]; \
|
||||
} while(0)
|
||||
#else /* !CONFIG_NET_UIP_IPv6 */
|
||||
#else /* !CONFIG_NET_IPv6 */
|
||||
#define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t))
|
||||
#endif /* !CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* !CONFIG_NET_IPv6 */
|
||||
|
||||
/* Compare two IP addresses
|
||||
*
|
||||
@@ -996,12 +994,12 @@ struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, uint16 rport);
|
||||
* addr2 The second IP address.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_UIP_IPv6
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
#define uip_ipaddr_cmp(addr1, addr2) (((uint16 *)addr1)[0] == ((uint16 *)addr2)[0] && \
|
||||
((uint16 *)addr1)[1] == ((uint16 *)addr2)[1])
|
||||
#else /* !CONFIG_NET_UIP_IPv6 */
|
||||
#else /* !CONFIG_NET_IPv6 */
|
||||
#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
|
||||
#endif /* !CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* !CONFIG_NET_IPv6 */
|
||||
|
||||
/**
|
||||
* Compare two IP addresses with netmasks
|
||||
@@ -1169,4 +1167,4 @@ extern int uip_event_timedwait(uint16 waitflags, int timeout);
|
||||
|
||||
extern void uip_event_signal(void);
|
||||
|
||||
#endif /* __UIP_H__ */
|
||||
#endif /* __NET_UIP_UIP_H */
|
||||
|
||||
+149
-174
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
/****************************************************************************
|
||||
* net.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __NUTTX_NET_H
|
||||
#define __NUTTX_NET_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
#include <net/uip/psock.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the internal representation of a socket reference by a file
|
||||
* descriptor.
|
||||
*/
|
||||
|
||||
struct socket
|
||||
{
|
||||
/* Proto-socket */
|
||||
|
||||
struct psock psock;
|
||||
};
|
||||
|
||||
/* This defines a list of sockets indexed by the socket descriptor */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
struct socketlist
|
||||
{
|
||||
sem_t sl_sem; /* Manage access to the socket list */
|
||||
sint16 sl_crefs; /* Reference count */
|
||||
struct socket sl_sockets[CONFIG_NSOCKET_DESCRIPTORS];
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* net_sockets.c *************************************************************/
|
||||
|
||||
EXTERN FAR struct socketlist *net_alloclist(void);
|
||||
EXTERN int net_addreflist(FAR struct socketlist *list);
|
||||
EXTERN int net_releaselist(FAR struct socketlist *list);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
#endif /* __NUTTX_NET_H */
|
||||
+12
-1
@@ -48,6 +48,7 @@
|
||||
#include <mqueue.h>
|
||||
#include <time.h>
|
||||
#include <nuttx/irq.h>
|
||||
#include <nuttx/net.h>
|
||||
|
||||
/********************************************************************************
|
||||
* Definitions
|
||||
@@ -166,7 +167,7 @@ struct _TCB
|
||||
{
|
||||
/* Fields used to support list management *************************************/
|
||||
|
||||
FAR struct _TCB *flink; /* link in DQ of TCBs */
|
||||
FAR struct _TCB *flink; /* link in DQ of TCBs */
|
||||
FAR struct _TCB *blink;
|
||||
|
||||
/* Task Management Fields *****************************************************/
|
||||
@@ -247,6 +248,12 @@ struct _TCB
|
||||
FAR struct streamlist *streams; /* Holds C buffered I/O info */
|
||||
#endif
|
||||
|
||||
/* Network socket *************************************************************/
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
FAR struct socketlist *sockets; /* Maps file descriptor to file */
|
||||
#endif
|
||||
|
||||
/* State save areas ***********************************************************/
|
||||
/* The form and content of these fields are processor-specific. */
|
||||
|
||||
@@ -287,6 +294,10 @@ EXTERN FAR struct streamlist *sched_getstreams(void);
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
EXTERN FAR struct socketlist *sched_getsockets(void);
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
/* sched_foreach will enumerate over each task and provide the
|
||||
* TCB of each task to a user callback functions. Interrupts
|
||||
* will be disabled throughout this enumeration!
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ char *dirname(char *path)
|
||||
/* Check for trailing slash characters */
|
||||
|
||||
len = strlen(path);
|
||||
while (path[len-1] = '/')
|
||||
while (path[len-1] == '/')
|
||||
{
|
||||
/* Remove trailing '/' UNLESS this would make a zero length string */
|
||||
if (len > 1)
|
||||
|
||||
+3
-3
@@ -37,9 +37,9 @@
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
STD_ASRCS =
|
||||
STD_CSRCS = socket.c bind.c
|
||||
STD_CSRCS = socket.c bind.c net_sockets.c
|
||||
include uip/Make.defs
|
||||
endif
|
||||
|
||||
@@ -71,7 +71,7 @@ $(BIN): $(OBJS)
|
||||
done ; )
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
$(MKDEP) --dep-path . --dep-path uip $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
endif
|
||||
touch $@
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/****************************************************************************
|
||||
* net_internal.h
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __NET_INTERNAL_H
|
||||
#define __NET_INTERNAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
#include <nuttx/net.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pulblic Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/* net_sockets.c *************************************************************/
|
||||
|
||||
EXTERN void weak_function net_initialize(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
#endif /* __NET_INTERNAL_H */
|
||||
@@ -0,0 +1,171 @@
|
||||
/****************************************************************************
|
||||
* net_sockets.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <string.h>
|
||||
#include <semaphore.h>
|
||||
#include <assert.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <nuttx/net.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include "net_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static void _net_semtake(FAR struct socketlist *list)
|
||||
{
|
||||
/* Take the semaphore (perhaps waiting) */
|
||||
|
||||
while (sem_wait(&list->sl_sem) != 0)
|
||||
{
|
||||
/* The only case that an error should occr here is if
|
||||
* the wait was awakened by a signal.
|
||||
*/
|
||||
|
||||
ASSERT(*get_errno_ptr() == EINTR);
|
||||
}
|
||||
}
|
||||
|
||||
#define _net_semgive(list) sem_post(&list->sl_sem)
|
||||
|
||||
/****************************************************************************
|
||||
* Pulblic Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* This is called from the initialization logic to configure the socket layer */
|
||||
|
||||
void net_initialize(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Allocate a list of files for a new task */
|
||||
|
||||
FAR struct socketlist *net_alloclist(void)
|
||||
{
|
||||
FAR struct socketlist *list;
|
||||
list = (FAR struct socketlist*)kzmalloc(sizeof(struct socketlist));
|
||||
if (list)
|
||||
{
|
||||
/* Start with a reference count of one */
|
||||
|
||||
list->sl_crefs = 1;
|
||||
|
||||
/* Initialize the list access mutex */
|
||||
|
||||
(void)sem_init(&list->sl_sem, 0, 1);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/* Increase the reference count on a file list */
|
||||
|
||||
int net_addreflist(FAR struct socketlist *list)
|
||||
{
|
||||
if (list)
|
||||
{
|
||||
/* Increment the reference count on the list.
|
||||
* NOTE: that we disable interrupts to do this
|
||||
* (vs. taking the list semaphore). We do this
|
||||
* because file cleanup operations often must be
|
||||
* done from the IDLE task which cannot wait
|
||||
* on semaphores.
|
||||
*/
|
||||
|
||||
register irqstate_t flags = irqsave();
|
||||
list->sl_crefs++;
|
||||
irqrestore(flags);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* Release a reference to the file list */
|
||||
|
||||
int net_releaselist(FAR struct socketlist *list)
|
||||
{
|
||||
int crefs;
|
||||
if (list)
|
||||
{
|
||||
/* Decrement the reference count on the list.
|
||||
* NOTE: that we disable interrupts to do this
|
||||
* (vs. taking the list semaphore). We do this
|
||||
* because file cleanup operations often must be
|
||||
* done from the IDLE task which cannot wait
|
||||
* on semaphores.
|
||||
*/
|
||||
|
||||
irqstate_t flags = irqsave();
|
||||
crefs = --(list->sl_crefs);
|
||||
irqrestore(flags);
|
||||
|
||||
/* If the count decrements to zero, then there is no reference
|
||||
* to the structure and it should be deallocated. Since there
|
||||
* are references, it would be an error if any task still held
|
||||
* a reference to the list's semaphore.
|
||||
*/
|
||||
|
||||
if (crefs <= 0)
|
||||
{
|
||||
/* Destroy the semaphore and release the filelist */
|
||||
|
||||
(void)sem_destroy(&list->sl_sem);
|
||||
sched_free(list);
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
+2
-1
@@ -30,7 +30,7 @@
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: psock.c,v 1.1.1.1 2007-08-26 23:04:11 patacongo Exp $
|
||||
* $Id: psock.c,v 1.2 2007-09-01 18:06:13 patacongo Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -375,3 +375,4 @@ void psock_init(register struct psock *psock, char *buffer, unsigned int buffers
|
||||
psock->bufsize = buffersize;
|
||||
buf_setup(&psock->buf, (uint8*)buffer, buffersize);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -136,8 +136,8 @@ struct fwcache_entry {
|
||||
/*
|
||||
* The number of packets to remember when looking for duplicates.
|
||||
*/
|
||||
#ifdef CONFIG_UIP_FWCACHE_SIZE
|
||||
# define FWCACHE_SIZE CONFIG_UIP_FWCACHE_SIZE
|
||||
#ifdef CONFIG_NET_FWCACHE_SIZE
|
||||
# define FWCACHE_SIZE CONFIG_NET_FWCACHE_SIZE
|
||||
#else
|
||||
# define FWCACHE_SIZE 2
|
||||
#endif
|
||||
|
||||
+76
-75
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
* uip-neighbor.c
|
||||
* Database of link-local neighbors, used by IPv6 code and to be used by
|
||||
* a future ARP code rewrite.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
* Copyright (c) 2006, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -25,23 +30,12 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the uIP TCP/IP stack
|
||||
*
|
||||
* $Id: uip-neighbor.c,v 1.1.1.1 2007-08-26 23:04:08 patacongo Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Database of link-local neighbors, used by IPv6 code and
|
||||
* to be used by a future ARP code rewrite.
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#include "uip-neighbor.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
|
||||
#define MAX_TIME 128
|
||||
|
||||
@@ -51,108 +45,115 @@
|
||||
#define ENTRIES 8
|
||||
#endif /* UIP_NEIGHBOR_CONF_ENTRIES */
|
||||
|
||||
struct neighbor_entry {
|
||||
struct neighbor_entry
|
||||
{
|
||||
uip_ipaddr_t ipaddr;
|
||||
struct uip_neighbor_addr addr;
|
||||
uint8 time;
|
||||
};
|
||||
static struct neighbor_entry entries[ENTRIES];
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_neighbor_init(void)
|
||||
void uip_neighbor_init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < ENTRIES; ++i) {
|
||||
entries[i].time = MAX_TIME;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_neighbor_periodic(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < ENTRIES; ++i) {
|
||||
if(entries[i].time < MAX_TIME) {
|
||||
entries[i].time++;
|
||||
for(i = 0; i < ENTRIES; ++i)
|
||||
{
|
||||
entries[i].time = MAX_TIME;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr)
|
||||
|
||||
void uip_neighbor_periodic(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < ENTRIES; ++i)
|
||||
{
|
||||
if (entries[i].time < MAX_TIME)
|
||||
{
|
||||
entries[i].time++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr)
|
||||
{
|
||||
int i, oldest;
|
||||
uint8 oldest_time;
|
||||
|
||||
printf("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3],
|
||||
addr->addr.addr[4], addr->addr.addr[5]);
|
||||
|
||||
dbg("Adding neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
addr->addr.addr[0], addr->addr.addr[1], addr->addr.addr[2], addr->addr.addr[3],
|
||||
addr->addr.addr[4], addr->addr.addr[5]);
|
||||
|
||||
/* Find the first unused entry or the oldest used entry. */
|
||||
|
||||
oldest_time = 0;
|
||||
oldest = 0;
|
||||
for(i = 0; i < ENTRIES; ++i) {
|
||||
if(entries[i].time == MAX_TIME) {
|
||||
oldest = i;
|
||||
break;
|
||||
for (i = 0; i < ENTRIES; ++i)
|
||||
{
|
||||
if (entries[i].time == MAX_TIME)
|
||||
{
|
||||
oldest = i;
|
||||
break;
|
||||
}
|
||||
if (uip_ipaddr_cmp(entries[i].ipaddr, addr))
|
||||
{
|
||||
oldest = i;
|
||||
break;
|
||||
}
|
||||
if (entries[i].time > oldest_time)
|
||||
{
|
||||
oldest = i;
|
||||
oldest_time = entries[i].time;
|
||||
}
|
||||
}
|
||||
if(uip_ipaddr_cmp(entries[i].ipaddr, addr)) {
|
||||
oldest = i;
|
||||
break;
|
||||
}
|
||||
if(entries[i].time > oldest_time) {
|
||||
oldest = i;
|
||||
oldest_time = entries[i].time;
|
||||
}
|
||||
}
|
||||
|
||||
/* Use the oldest or first free entry (either pointed to by the
|
||||
"oldest" variable). */
|
||||
* "oldest" variable).
|
||||
*/
|
||||
|
||||
entries[oldest].time = 0;
|
||||
uip_ipaddr_copy(entries[oldest].ipaddr, ipaddr);
|
||||
memcpy(&entries[oldest].addr, addr, sizeof(struct uip_neighbor_addr));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static struct neighbor_entry *
|
||||
find_entry(uip_ipaddr_t ipaddr)
|
||||
|
||||
static struct neighbor_entry *find_entry(uip_ipaddr_t ipaddr)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < ENTRIES; ++i) {
|
||||
if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) {
|
||||
return &entries[i];
|
||||
|
||||
for(i = 0; i < ENTRIES; ++i)
|
||||
{
|
||||
if (uip_ipaddr_cmp(entries[i].ipaddr, ipaddr))
|
||||
{
|
||||
return &entries[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uip_neighbor_update(uip_ipaddr_t ipaddr)
|
||||
|
||||
void uip_neighbor_update(uip_ipaddr_t ipaddr)
|
||||
{
|
||||
struct neighbor_entry *e;
|
||||
|
||||
e = find_entry(ipaddr);
|
||||
if(e != NULL) {
|
||||
e->time = 0;
|
||||
}
|
||||
if (e != NULL)
|
||||
{
|
||||
e->time = 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
struct uip_neighbor_addr *
|
||||
uip_neighbor_lookup(uip_ipaddr_t ipaddr)
|
||||
|
||||
struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr)
|
||||
{
|
||||
struct neighbor_entry *e;
|
||||
|
||||
e = find_entry(ipaddr);
|
||||
if(e != NULL) {
|
||||
/* printf("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3],
|
||||
e->addr.addr.addr[4], e->addr.addr.addr[5]);*/
|
||||
if (e != NULL)
|
||||
{
|
||||
dbg("Lookup neighbor with link address %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
e->addr.addr.addr[0], e->addr.addr.addr[1], e->addr.addr.addr[2], e->addr.addr.addr[3],
|
||||
e->addr.addr.addr[4], e->addr.addr.addr[5]);
|
||||
|
||||
return &e->addr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
+10
-10
@@ -61,25 +61,25 @@ uip_split_output(void)
|
||||
/* Create the first packet. This is done by altering the length
|
||||
field of the IP header and updating the checksums. */
|
||||
uip_len = len1 + UIP_TCPIP_HLEN;
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* For IPv6, the IP length field does not include the IPv6 IP header
|
||||
length. */
|
||||
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
|
||||
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
BUF->len[0] = uip_len >> 8;
|
||||
BUF->len[1] = uip_len & 0xff;
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* Recalculate the TCP checksum. */
|
||||
BUF->tcpchksum = 0;
|
||||
BUF->tcpchksum = ~(uip_tcpchksum());
|
||||
|
||||
#ifndef CONFIG_NET_UIP_IPv6
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
/* Recalculate the IP checksum. */
|
||||
BUF->ipchksum = 0;
|
||||
BUF->ipchksum = ~(uip_ipchksum());
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* Transmit the first packet. */
|
||||
/* uip_fw_output();*/
|
||||
@@ -91,15 +91,15 @@ uip_split_output(void)
|
||||
memory. This place is detemined by the length of the first
|
||||
packet (len1). */
|
||||
uip_len = len2 + UIP_TCPIP_HLEN;
|
||||
#ifdef CONFIG_NET_UIP_IPv6
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
/* For IPv6, the IP length field does not include the IPv6 IP header
|
||||
length. */
|
||||
BUF->len[0] = ((uip_len - UIP_IPH_LEN) >> 8);
|
||||
BUF->len[1] = ((uip_len - UIP_IPH_LEN) & 0xff);
|
||||
#else /* CONFIG_NET_UIP_IPv6 */
|
||||
#else /* CONFIG_NET_IPv6 */
|
||||
BUF->len[0] = uip_len >> 8;
|
||||
BUF->len[1] = uip_len & 0xff;
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* uip_appdata += len1;*/
|
||||
memcpy(uip_appdata, (uint8 *)uip_appdata + len1, len2);
|
||||
@@ -114,11 +114,11 @@ uip_split_output(void)
|
||||
BUF->tcpchksum = 0;
|
||||
BUF->tcpchksum = ~(uip_tcpchksum());
|
||||
|
||||
#ifndef CONFIG_NET_UIP_IPv6
|
||||
#ifndef CONFIG_NET_IPv6
|
||||
/* Recalculate the IP checksum. */
|
||||
BUF->ipchksum = 0;
|
||||
BUF->ipchksum = ~(uip_ipchksum());
|
||||
#endif /* CONFIG_NET_UIP_IPv6 */
|
||||
#endif /* CONFIG_NET_IPv6 */
|
||||
|
||||
/* Transmit the second packet. */
|
||||
/* uip_fw_output();*/
|
||||
|
||||
+262
-178
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -37,7 +37,7 @@
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
include uiplib/Make.defs
|
||||
include dhcpc/Make.defs
|
||||
include resolv/Make.defs
|
||||
@@ -77,7 +77,7 @@ $(BIN): $(OBJS)
|
||||
done ; )
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
ifeq ($(CONFIG_NET_UIP),y)
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
$(MKDEP) --dep-path uiplib --dep-path dhcpc --dep-path smtp --dep-path webclient \
|
||||
--dep-path resolv --dep-path telnetd --dep-path webserver \
|
||||
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_UIP_UDP),y)
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
DHCPC_ASRCS =
|
||||
DHCPC_CSRCS = dhcpc.c
|
||||
endif
|
||||
+143
-105
@@ -1,4 +1,4 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* dhcpc.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
@@ -9,55 +9,56 @@
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <net/uip/uip.h>
|
||||
#include <net/uip/dhcpc.h>
|
||||
|
||||
#include "dhcpc.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/* CLK_TCK is the frequency of the system clock (typically 100Hz) */
|
||||
|
||||
#define CLOCK_SECOND CLK_TCK
|
||||
|
||||
#define STATE_INITIAL 0
|
||||
@@ -94,9 +95,20 @@
|
||||
#define DHCP_OPTION_REQ_LIST 55
|
||||
#define DHCP_OPTION_END 255
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
struct dhcpc_state_internal
|
||||
{
|
||||
char state;
|
||||
sem_t sem;
|
||||
struct uip_udp_conn *conn;
|
||||
uint16 ticks;
|
||||
const void *mac_addr;
|
||||
int mac_len;
|
||||
struct dhcpc_state *result;
|
||||
};
|
||||
|
||||
struct dhcp_msg
|
||||
{
|
||||
@@ -108,25 +120,24 @@ struct dhcp_msg
|
||||
uint8 siaddr[4];
|
||||
uint8 giaddr[4];
|
||||
uint8 chaddr[16];
|
||||
#ifndef CONFIG_UIP_DHCP_LIGHT
|
||||
#ifndef CONFIG_NET_DHCP_LIGHT
|
||||
uint8 sname[64];
|
||||
uint8 file[128];
|
||||
#endif
|
||||
uint8 options[312];
|
||||
};
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
************************************************************/
|
||||
|
||||
static struct dhcpc_state s;
|
||||
****************************************************************************/
|
||||
|
||||
static const uint8 xid[4] = {0xad, 0xde, 0x12, 0x23};
|
||||
static const uint8 magic_cookie[4] = {99, 130, 83, 99};
|
||||
static volatile struct dhcpc_state_internal *gpdhcpc;
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
static uint8 *add_msg_type(uint8 *optptr, uint8 type)
|
||||
{
|
||||
@@ -136,19 +147,19 @@ static uint8 *add_msg_type(uint8 *optptr, uint8 type)
|
||||
return optptr;
|
||||
}
|
||||
|
||||
static uint8 *add_server_id(uint8 *optptr)
|
||||
static uint8 *add_server_id(struct dhcpc_state *presult, uint8 *optptr)
|
||||
{
|
||||
*optptr++ = DHCP_OPTION_SERVER_ID;
|
||||
*optptr++ = 4;
|
||||
memcpy(optptr, s.serverid, 4);
|
||||
memcpy(optptr, presult->serverid, 4);
|
||||
return optptr + 4;
|
||||
}
|
||||
|
||||
static uint8 *add_req_ipaddr(uint8 *optptr)
|
||||
static uint8 *add_req_ipaddr(struct dhcpc_state *presult, uint8 *optptr)
|
||||
{
|
||||
*optptr++ = DHCP_OPTION_REQ_IPADDR;
|
||||
*optptr++ = 4;
|
||||
memcpy(optptr, s.ipaddr, 4);
|
||||
memcpy(optptr, presult->ipaddr, 4);
|
||||
return optptr + 4;
|
||||
}
|
||||
|
||||
@@ -168,11 +179,11 @@ static uint8 *add_end(uint8 *optptr)
|
||||
return optptr;
|
||||
}
|
||||
|
||||
static void create_msg(register struct dhcp_msg *m)
|
||||
static void create_msg(struct dhcpc_state_internal *pdhcpc, struct dhcp_msg *m)
|
||||
{
|
||||
m->op = DHCP_REQUEST;
|
||||
m->htype = DHCP_HTYPE_ETHERNET;
|
||||
m->hlen = s.mac_len;
|
||||
m->hlen = pdhcpc->mac_len;
|
||||
m->hops = 0;
|
||||
memcpy(m->xid, xid, sizeof(m->xid));
|
||||
m->secs = 0;
|
||||
@@ -182,9 +193,9 @@ static void create_msg(register struct dhcp_msg *m)
|
||||
memset(m->yiaddr, 0, sizeof(m->yiaddr));
|
||||
memset(m->siaddr, 0, sizeof(m->siaddr));
|
||||
memset(m->giaddr, 0, sizeof(m->giaddr));
|
||||
memcpy(m->chaddr, s.mac_addr, s.mac_len);
|
||||
memset(&m->chaddr[s.mac_len], 0, sizeof(m->chaddr) - s.mac_len);
|
||||
#ifndef CONFIG_UIP_DHCP_LIGHT
|
||||
memcpy(m->chaddr, pdhcpc->mac_addr, pdhcpc->mac_len);
|
||||
memset(&m->chaddr[pdhcpc->mac_len], 0, sizeof(m->chaddr) - pdhcpc->mac_len);
|
||||
#ifndef CONFIG_NET_DHCP_LIGHT
|
||||
memset(m->sname, 0, sizeof(m->sname));
|
||||
memset(m->file, 0, sizeof(m->file));
|
||||
#endif
|
||||
@@ -192,12 +203,12 @@ static void create_msg(register struct dhcp_msg *m)
|
||||
memcpy(m->options, magic_cookie, sizeof(magic_cookie));
|
||||
}
|
||||
|
||||
static void send_discover(void)
|
||||
static void send_discover(struct dhcpc_state_internal *pdhcpc)
|
||||
{
|
||||
uint8 *end;
|
||||
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
|
||||
|
||||
create_msg(m);
|
||||
create_msg(pdhcpc, m);
|
||||
|
||||
end = add_msg_type(&m->options[4], DHCPDISCOVER);
|
||||
end = add_req_options(end);
|
||||
@@ -206,22 +217,22 @@ static void send_discover(void)
|
||||
uip_send(uip_appdata, end - (uint8 *)uip_appdata);
|
||||
}
|
||||
|
||||
static void send_request(void)
|
||||
static void send_request(struct dhcpc_state_internal *pdhcpc)
|
||||
{
|
||||
uint8 *end;
|
||||
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
|
||||
|
||||
create_msg(m);
|
||||
create_msg(pdhcpc, m);
|
||||
|
||||
end = add_msg_type(&m->options[4], DHCPREQUEST);
|
||||
end = add_server_id(end);
|
||||
end = add_req_ipaddr(end);
|
||||
end = add_server_id(pdhcpc->result, end);
|
||||
end = add_req_ipaddr(pdhcpc->result, end);
|
||||
end = add_end(end);
|
||||
|
||||
uip_send(uip_appdata, end - (uint8 *)uip_appdata);
|
||||
}
|
||||
|
||||
static uint8 parse_options(uint8 *optptr, int len)
|
||||
static uint8 parse_options(struct dhcpc_state *presult, uint8 *optptr, int len)
|
||||
{
|
||||
uint8 *end = optptr + len;
|
||||
uint8 type = 0;
|
||||
@@ -231,22 +242,22 @@ static uint8 parse_options(uint8 *optptr, int len)
|
||||
switch(*optptr)
|
||||
{
|
||||
case DHCP_OPTION_SUBNET_MASK:
|
||||
memcpy(s.netmask, optptr + 2, 4);
|
||||
memcpy(presult->netmask, optptr + 2, 4);
|
||||
break;
|
||||
case DHCP_OPTION_ROUTER:
|
||||
memcpy(s.default_router, optptr + 2, 4);
|
||||
memcpy(presult->default_router, optptr + 2, 4);
|
||||
break;
|
||||
case DHCP_OPTION_DNS_SERVER:
|
||||
memcpy(s.dnsaddr, optptr + 2, 4);
|
||||
memcpy(presult->dnsaddr, optptr + 2, 4);
|
||||
break;
|
||||
case DHCP_OPTION_MSG_TYPE:
|
||||
type = *(optptr + 2);
|
||||
break;
|
||||
case DHCP_OPTION_SERVER_ID:
|
||||
memcpy(s.serverid, optptr + 2, 4);
|
||||
memcpy(presult->serverid, optptr + 2, 4);
|
||||
break;
|
||||
case DHCP_OPTION_LEASE_TIME:
|
||||
memcpy(s.lease_time, optptr + 2, 4);
|
||||
memcpy(presult->lease_time, optptr + 2, 4);
|
||||
break;
|
||||
case DHCP_OPTION_END:
|
||||
return type;
|
||||
@@ -257,115 +268,131 @@ static uint8 parse_options(uint8 *optptr, int len)
|
||||
return type;
|
||||
}
|
||||
|
||||
static uint8 parse_msg(void)
|
||||
static uint8 parse_msg(struct dhcpc_state_internal *pdhcpc)
|
||||
{
|
||||
struct dhcpc_state *presult = pdhcpc->result;
|
||||
struct dhcp_msg *m = (struct dhcp_msg *)uip_appdata;
|
||||
|
||||
if (m->op == DHCP_REPLY &&
|
||||
memcmp(m->xid, xid, sizeof(xid)) == 0 &&
|
||||
memcmp(m->chaddr, s.mac_addr, s.mac_len) == 0)
|
||||
memcmp(m->xid, xid, sizeof(xid)) == 0 &&
|
||||
memcmp(m->chaddr, pdhcpc->mac_addr, pdhcpc->mac_len) == 0)
|
||||
{
|
||||
memcpy(s.ipaddr, m->yiaddr, 4);
|
||||
return parse_options(&m->options[4], uip_datalen());
|
||||
memcpy(presult->ipaddr, m->yiaddr, 4);
|
||||
return parse_options(presult, &m->options[4], uip_datalen());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handle_dhcp(void)
|
||||
static void handle_dhcp(struct dhcpc_state_internal *pdhcpc)
|
||||
{
|
||||
struct dhcpc_state *presult = pdhcpc->result;
|
||||
|
||||
restart:
|
||||
s.state = STATE_SENDING;
|
||||
s.ticks = CLOCK_SECOND;
|
||||
pdhcpc->state = STATE_SENDING;
|
||||
pdhcpc->ticks = CLOCK_SECOND;
|
||||
|
||||
do
|
||||
{
|
||||
/* Send the command */
|
||||
|
||||
send_discover();
|
||||
send_discover(pdhcpc);
|
||||
|
||||
/* Wait for the response */
|
||||
|
||||
uip_event_timedwait(UIP_NEWDATA, CLOCK_SECOND);
|
||||
|
||||
if (uip_newdata() && parse_msg() == DHCPOFFER)
|
||||
if (uip_newdata() && parse_msg(pdhcpc) == DHCPOFFER)
|
||||
{
|
||||
s.state = STATE_OFFER_RECEIVED;
|
||||
pdhcpc->state = STATE_OFFER_RECEIVED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s.ticks < CLOCK_SECOND * 60)
|
||||
if (pdhcpc->ticks < CLOCK_SECOND * 60)
|
||||
{
|
||||
s.ticks *= 2;
|
||||
pdhcpc->ticks *= 2;
|
||||
}
|
||||
}
|
||||
while(s.state != STATE_OFFER_RECEIVED);
|
||||
while(pdhcpc->state != STATE_OFFER_RECEIVED);
|
||||
|
||||
s.ticks = CLOCK_SECOND;
|
||||
pdhcpc->ticks = CLOCK_SECOND;
|
||||
|
||||
do
|
||||
{
|
||||
/* Send the request */
|
||||
|
||||
send_request();
|
||||
send_request(pdhcpc);
|
||||
|
||||
/* Then wait to received the response */
|
||||
|
||||
uip_event_timedwait(UIP_NEWDATA, CLOCK_SECOND);
|
||||
|
||||
if (uip_newdata() && parse_msg() == DHCPACK)
|
||||
if (uip_newdata() && parse_msg(pdhcpc) == DHCPACK)
|
||||
{
|
||||
s.state = STATE_CONFIG_RECEIVED;
|
||||
pdhcpc->state = STATE_CONFIG_RECEIVED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (s.ticks <= CLOCK_SECOND * 10)
|
||||
if (pdhcpc->ticks <= CLOCK_SECOND * 10)
|
||||
{
|
||||
s.ticks += CLOCK_SECOND;
|
||||
pdhcpc->ticks += CLOCK_SECOND;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
while(s.state != STATE_CONFIG_RECEIVED);
|
||||
while(pdhcpc->state != STATE_CONFIG_RECEIVED);
|
||||
|
||||
dbg("Got IP address %d.%d.%d.%d\n",
|
||||
uip_ipaddr1(s.ipaddr), uip_ipaddr2(s.ipaddr),
|
||||
uip_ipaddr3(s.ipaddr), uip_ipaddr4(s.ipaddr));
|
||||
uip_ipaddr1(presult->ipaddr), uip_ipaddr2(presult->ipaddr),
|
||||
uip_ipaddr3(presult->ipaddr), uip_ipaddr4(presult->ipaddr));
|
||||
dbg("Got netmask %d.%d.%d.%d\n",
|
||||
uip_ipaddr1(s.netmask), uip_ipaddr2(s.netmask),
|
||||
uip_ipaddr3(s.netmask), uip_ipaddr4(s.netmask));
|
||||
uip_ipaddr1(presult->netmask), uip_ipaddr2(presult->netmask),
|
||||
uip_ipaddr3(presult->netmask), uip_ipaddr4(presult->netmask));
|
||||
dbg("Got DNS server %d.%d.%d.%d\n",
|
||||
uip_ipaddr1(s.dnsaddr), uip_ipaddr2(s.dnsaddr),
|
||||
uip_ipaddr3(s.dnsaddr), uip_ipaddr4(s.dnsaddr));
|
||||
uip_ipaddr1(presult->dnsaddr), uip_ipaddr2(presult->dnsaddr),
|
||||
uip_ipaddr3(presult->dnsaddr), uip_ipaddr4(presult->dnsaddr));
|
||||
dbg("Got default router %d.%d.%d.%d\n",
|
||||
uip_ipaddr1(s.default_router), uip_ipaddr2(s.default_router),
|
||||
uip_ipaddr3(s.default_router), uip_ipaddr4(s.default_router));
|
||||
uip_ipaddr1(presult->default_router), uip_ipaddr2(presult->default_router),
|
||||
uip_ipaddr3(presult->default_router), uip_ipaddr4(presult->default_router));
|
||||
dbg("Lease expires in %ld seconds\n",
|
||||
ntohs(s.lease_time[0])*65536ul + ntohs(s.lease_time[1]));
|
||||
|
||||
dhcpc_configured(&s);
|
||||
|
||||
pthread_exit(NULL);
|
||||
ntohs(presult->lease_time[0])*65536ul + ntohs(presult->lease_time[1]));
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
void dhcpc_init(const void *mac_addr, int mac_len)
|
||||
void *dhcpc_open(const void *mac_addr, int mac_len)
|
||||
{
|
||||
uip_ipaddr_t addr;
|
||||
struct dhcpc_state_internal *pdhcpc;
|
||||
|
||||
s.mac_addr = mac_addr;
|
||||
s.mac_len = mac_len;
|
||||
|
||||
s.state = STATE_INITIAL;
|
||||
uip_ipaddr(addr, 255,255,255,255);
|
||||
s.conn = uip_udp_new(&addr, HTONS(DHCPC_SERVER_PORT));
|
||||
if (s.conn != NULL)
|
||||
pdhcpc = (struct dhcpc_state_internal *)malloc(sizeof(struct dhcpc_state_internal));
|
||||
if (pdhcpc)
|
||||
{
|
||||
uip_udp_bind(s.conn, HTONS(DHCPC_CLIENT_PORT));
|
||||
memset(pdhcpc, 0, sizeof(struct dhcpc_state_internal));
|
||||
pdhcpc->mac_addr = mac_addr;
|
||||
pdhcpc->mac_len = mac_len;
|
||||
pdhcpc->state = STATE_INITIAL;
|
||||
sem_init(&pdhcpc->sem, 0, 0);
|
||||
|
||||
uip_ipaddr(addr, 255,255,255,255);
|
||||
pdhcpc->conn = uip_udp_new(&addr, HTONS(DHCPC_SERVER_PORT));
|
||||
if (pdhcpc->conn != NULL)
|
||||
{
|
||||
uip_udp_bind(pdhcpc->conn, HTONS(DHCPC_CLIENT_PORT));
|
||||
}
|
||||
}
|
||||
return (void*)pdhcpc;
|
||||
}
|
||||
|
||||
void dhcpc_close(void *handle)
|
||||
{
|
||||
struct dchcpc_state_internal *pdhcpc = (struct dchcpc_state_internal *)handle;
|
||||
if (pdhcpc)
|
||||
{
|
||||
free(pdhcpc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,16 +402,27 @@ void dhcpc_init(const void *mac_addr, int mac_len)
|
||||
|
||||
void uip_interrupt_udp_event(void)
|
||||
{
|
||||
handle_dhcp();
|
||||
if (gpdhcpc)
|
||||
{
|
||||
sem_post(&gpdhcpc->sem);
|
||||
}
|
||||
}
|
||||
|
||||
void dhcpc_request(void)
|
||||
int dhcpc_request(void *handle, struct dhcpc_state *ds)
|
||||
{
|
||||
struct dhcpc_state_internal *pdhcpc = (struct dhcpc_state_internal *)handle;
|
||||
uint16 ipaddr[2];
|
||||
|
||||
if (s.state == STATE_INITIAL)
|
||||
if (pdhcpc->state == STATE_INITIAL)
|
||||
{
|
||||
uip_ipaddr(ipaddr, 0,0,0,0);
|
||||
uip_sethostaddr(ipaddr);
|
||||
}
|
||||
|
||||
pdhcpc->result = ds;
|
||||
gpdhcpc = pdhcpc;
|
||||
sem_wait(&pdhcpc->sem);
|
||||
gpdhcpc = NULL;
|
||||
handle_dhcp(pdhcpc);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_UIP_UDP),y)
|
||||
ifeq ($(CONFIG_NET_UDP),y)
|
||||
RESOLV_ASRCS =
|
||||
RESOLV_CSRCS = resolv.c
|
||||
endif
|
||||
|
||||
+294
-257
File diff suppressed because it is too large
Load Diff
@@ -262,6 +262,10 @@ int smtp_send(void *handle, char *to, char *cc, char *from, char *subject, char
|
||||
struct smtp_state *psmtp = (struct smtp_state *)handle;
|
||||
struct uip_conn *conn;
|
||||
|
||||
/* This is the moral equivalent of socket() + bind(). It returns the
|
||||
* initialized connection structure
|
||||
*/
|
||||
|
||||
conn = uip_connect(&psmtp->smtpserver, HTONS(25));
|
||||
if (conn == NULL)
|
||||
{
|
||||
@@ -277,14 +281,21 @@ int smtp_send(void *handle, char *to, char *cc, char *from, char *subject, char
|
||||
psmtp->msglen = msglen;
|
||||
psmtp->result = OK;
|
||||
|
||||
/* Make this instance globally visible */
|
||||
|
||||
gpsmtp = psmtp;
|
||||
|
||||
/* Initialized the psock structure inside the smtp state structure */
|
||||
|
||||
psock_init(&psmtp->psock, psmtp->buffer, SMTP_INPUT_BUFFER_SIZE);
|
||||
|
||||
/* And wait for the the socket to be connected */
|
||||
|
||||
sem_wait(&psmtp->sem);
|
||||
gpsmtp = 0;
|
||||
|
||||
/* Was an error reported by interrupt handler? */
|
||||
|
||||
if (psmtp->result == OK )
|
||||
{
|
||||
/* No... Send the message */
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
############################################################
|
||||
############################################################################
|
||||
# Makefile
|
||||
#
|
||||
# Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
@@ -41,7 +41,7 @@ ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
MISC_SRCS = os_start.c get_errno_ptr.c \
|
||||
sched_setupstreams.c sched_getfiles.c sched_getstreams.c \
|
||||
sched_setupstreams.c sched_getfiles.c sched_getsockets.c sched_getstreams.c \
|
||||
sched_setupidlefiles.c sched_setuptaskfiles.c sched_setuppthreadfiles.c \
|
||||
sched_releasefiles.c
|
||||
TSK_SRCS = task_create.c task_init.c task_setup.c task_activate.c \
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ enum os_crash_codes_e
|
||||
|
||||
/* Stubs used when there are no file descriptors */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS <= 0
|
||||
#if CONFIG_NFILE_DESCRIPTORS <= 0 && CONFIG_NSOCKET_DESCRIPTORS <= 0
|
||||
# define sched_setupidlefiles(t) (OK)
|
||||
# define sched_setuptaskfiles(t) (OK)
|
||||
# define sched_setuppthreadfiles(t) (OK)
|
||||
@@ -254,11 +254,11 @@ extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state);
|
||||
extern void sched_removeblocked(FAR _TCB *btcb);
|
||||
extern FAR _TCB *sched_gettcb(pid_t pid);
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
extern int sched_setupidlefiles(FAR _TCB *tcb);
|
||||
extern int sched_setuptaskfiles(FAR _TCB *tcb);
|
||||
extern int sched_setuppthreadfiles(FAR _TCB *tcb);
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
|
||||
extern int sched_setupstreams(FAR _TCB *tcb);
|
||||
extern int sched_flushfiles(FAR _TCB *tcb);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/************************************************************
|
||||
* sched_getsockets.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
#include <sched.h>
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Function: sched_getsockets
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the socket list for this thread
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
*
|
||||
* Return Value:
|
||||
* A pointer to the errno.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
FAR struct socketlist *sched_getsockets(void)
|
||||
{
|
||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||
return rtcb->sockets;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
@@ -38,8 +38,11 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
#include <sched.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/net.h>
|
||||
#include <nuttx/lib.h>
|
||||
|
||||
/************************************************************
|
||||
@@ -66,12 +69,11 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
int sched_releasefiles(_TCB *tcb)
|
||||
{
|
||||
if (tcb)
|
||||
{
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
/* Free the file descriptor list */
|
||||
|
||||
files_releaselist(tcb->filelist);
|
||||
@@ -83,7 +85,17 @@ int sched_releasefiles(_TCB *tcb)
|
||||
lib_releaselist(tcb->streams);
|
||||
tcb->streams = NULL;
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
/* Free the file descriptor list */
|
||||
|
||||
net_releaselist(tcb->sockets);
|
||||
tcb->sockets = NULL;
|
||||
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS || CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
@@ -38,11 +38,17 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/net.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************
|
||||
@@ -69,12 +75,11 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
int sched_setupidlefiles(FAR _TCB *tcb)
|
||||
{
|
||||
int fd;
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
/* Allocate file descriptors for the TCB */
|
||||
|
||||
tcb->filelist = files_alloclist();
|
||||
@@ -83,8 +88,20 @@ int sched_setupidlefiles(FAR _TCB *tcb)
|
||||
*get_errno_ptr() = ENOMEM;
|
||||
return ERROR;
|
||||
}
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#ifdef CONFIG_DEV_CONSOLE
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
/* Allocate socket descriptors for the TCB */
|
||||
|
||||
tcb->sockets = net_alloclist();
|
||||
if (!tcb->sockets)
|
||||
{
|
||||
*get_errno_ptr() = ENOMEM;
|
||||
return ERROR;
|
||||
}
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
|
||||
/* Open stdin, dup to get stdout and stderr. */
|
||||
|
||||
fd = open("/dev/console", O_RDWR);
|
||||
@@ -107,7 +124,7 @@ int sched_setupidlefiles(FAR _TCB *tcb)
|
||||
#else
|
||||
return OK;
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_DEV_CONSOLE */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS && CONFIG_DEV_CONSOLE */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS || CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
@@ -38,9 +38,14 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
#include <sched.h>
|
||||
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/net.h>
|
||||
#include <nuttx/lib.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************
|
||||
@@ -68,12 +73,11 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
int sched_setuppthreadfiles(FAR _TCB *tcb)
|
||||
{
|
||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
/* The child thread inherits the parent file descriptors */
|
||||
|
||||
tcb->filelist = rtcb->filelist;
|
||||
@@ -86,8 +90,17 @@ int sched_setuppthreadfiles(FAR _TCB *tcb)
|
||||
lib_addreflist(tcb->streams);
|
||||
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
/* The child thread inherits the parent file descriptors */
|
||||
|
||||
tcb->sockets = rtcb->sockets;
|
||||
net_addreflist(tcb->sockets);
|
||||
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS || CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
@@ -38,8 +38,11 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
|
||||
|
||||
#include <sched.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/net.h>
|
||||
#include <nuttx/lib.h>
|
||||
|
||||
/************************************************************
|
||||
@@ -50,8 +53,6 @@
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
|
||||
|
||||
int sched_setupstreams(FAR _TCB *tcb)
|
||||
{
|
||||
/* Allocate file strems for the TCB */
|
||||
|
||||
@@ -38,9 +38,14 @@
|
||||
************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/net.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************
|
||||
@@ -68,16 +73,15 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
|
||||
int sched_setuptaskfiles(FAR _TCB *tcb)
|
||||
{
|
||||
#ifdef CONFIG_DEV_CONSOLE
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
|
||||
FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head;
|
||||
int i;
|
||||
#endif /* CONFIG_DEV_CONSOLE */
|
||||
int ret = OK;
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||
/* Allocate file descriptors for the TCB */
|
||||
|
||||
tcb->filelist = files_alloclist();
|
||||
@@ -86,8 +90,20 @@ int sched_setuptaskfiles(FAR _TCB *tcb)
|
||||
*get_errno_ptr() = ENOMEM;
|
||||
return ERROR;
|
||||
}
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
|
||||
#ifdef CONFIG_DEV_CONSOLE
|
||||
#if CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
/* Allocate socket descriptors for the TCB */
|
||||
|
||||
tcb->sockets = net_alloclist();
|
||||
if (!tcb->sockets)
|
||||
{
|
||||
*get_errno_ptr() = ENOMEM;
|
||||
return ERROR;
|
||||
}
|
||||
#endif /* CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_DEV_CONSOLE)
|
||||
/* Duplicate the first three file descriptors */
|
||||
|
||||
if (rtcb->filelist)
|
||||
@@ -104,8 +120,8 @@ int sched_setuptaskfiles(FAR _TCB *tcb)
|
||||
|
||||
ret = sched_setupstreams(tcb);
|
||||
#endif /* CONFIG_NFILE_STREAMS */
|
||||
#endif /* CONFIG_DEV_CONSOLE */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS && CONFIG_DEV_CONSOLE */
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS */
|
||||
#endif /* CONFIG_NFILE_DESCRIPTORS || CONFIG_NSOCKET_DESCRIPTORS */
|
||||
|
||||
Reference in New Issue
Block a user