diff --git a/net/Kconfig b/net/Kconfig index f2814ab04df..5b627ab048a 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -54,35 +54,6 @@ config NET_IPv6 ---help--- Build in support for IPv6. Not fully implemented. -config NSOCKET_DESCRIPTORS - int "Number of socket descriptor" - default 8 - ---help--- - Maximum number of socket descriptors per task/thread. - -config NET_NACTIVESOCKETS - int "Max socket operations" - default 16 - ---help--- - Maximum number of concurrent socket operations (recv, send, etc.). - Default: 16 - -config NET_SOCKOPTS - bool "Socket options" - default n - ---help--- - Enable or disable support for socket options - -if NET_SOCKOPTS - -config NET_SOLINGER - bool "SO_LINGER socket option" - default n - ---help--- - Enable or disable support for the SO_LINGER socket option. - -endif # NET_SOCKOPTS - config NET_BUFSIZE int "Network packet buffer size (MTU)" default 1294 if !NET_SLIP && NET_IPv6 @@ -124,6 +95,7 @@ config NET_GUARDSIZE packet size will be chopped down to the size indicated in the TCP header. +source "net/socket/Kconfig" source "net/netdev/Kconfig" source "net/pkt/Kconfig" source "net/tcp/Kconfig" diff --git a/net/Makefile b/net/Makefile index 22ccc94f761..42a6359da57 100644 --- a/net/Makefile +++ b/net/Makefile @@ -45,45 +45,17 @@ NET_CSRCS = net_initialize.c # Socket support SOCK_ASRCS = -SOCK_CSRCS = bind.c connect.c getsockname.c recv.c recvfrom.c socket.c -SOCK_CSRCS += sendto.c net_sockets.c net_close.c net_dup.c net_dup2.c -SOCK_CSRCS += net_clone.c net_vfcntl.c - -VPATH = -DEPPATH = --dep-path . - -# TCP/IP support - -ifeq ($(CONFIG_NET_TCP),y) -SOCK_CSRCS += send.c listen.c accept.c net_monitor.c -endif - -# Socket options - -ifeq ($(CONFIG_NET_SOCKOPTS),y) -SOCK_CSRCS += setsockopt.c getsockopt.c -ifneq ($(CONFIG_DISABLE_CLOCK),y) -SOCK_CSRCS += net_timeo.c net_timeval2dsec.c -endif -endif - -# Support for network access using streams - -ifneq ($(CONFIG_NFILE_STREAMS),0) -SOCK_CSRCS += net_checksd.c -endif - -# Support for sendfile() - -ifeq ($(CONFIG_NET_SENDFILE),y) -SOCK_CSRCS += net_sendfile.c -endif +SOCK_CSRCS = # Support for operations on network devices NETDEV_ASRCS = NETDEV_CSRCS = +VPATH = +DEPPATH = --dep-path . + +include socket/Make.defs include netdev/Make.defs include iob/Make.defs include arp/Make.defs diff --git a/net/arp/Make.defs b/net/arp/Make.defs index 28a21236191..42b8fc5758a 100644 --- a/net/arp/Make.defs +++ b/net/arp/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # ARP supported is not provided for SLIP (Ethernet only) ifneq ($(CONFIG_NET_SLIP),y) @@ -46,4 +44,3 @@ DEPPATH += --dep-path arp VPATH += :arp endif -endif diff --git a/net/icmp/Make.defs b/net/icmp/Make.defs index 9e77e257f85..4e186908853 100644 --- a/net/icmp/Make.defs +++ b/net/icmp/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # ICMP source files ifeq ($(CONFIG_NET_ICMP),y) @@ -54,5 +52,3 @@ endif DEPPATH += --dep-path icmp VPATH += :icmp - -endif diff --git a/net/igmp/Make.defs b/net/igmp/Make.defs index 5b7fd9ea669..2f9b9507a4e 100644 --- a/net/igmp/Make.defs +++ b/net/igmp/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # IGMP source files ifeq ($(CONFIG_NET_IGMP),y) @@ -48,4 +46,3 @@ DEPPATH += --dep-path igmp VPATH += :igmp endif -endif diff --git a/net/iob/Make.defs b/net/iob/Make.defs index 6366220e7c7..dc7eb5fec0a 100644 --- a/net/iob/Make.defs +++ b/net/iob/Make.defs @@ -35,7 +35,7 @@ ifeq ($(CONFIG_NET_IOB),y) -# Include IOB src files +# Include IOB source files NET_CSRCS += iob_add_queue.c iob_alloc.c iob_alloc_qentry.c iob_clone.c NET_CSRCS += iob_concat.c iob_copyin.c iob_copyout.c iob_contig.c iob_free.c diff --git a/net/netdev/Make.defs b/net/netdev/Make.defs index 47ec02b9ba1..b6ec45062d9 100644 --- a/net/netdev/Make.defs +++ b/net/netdev/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # Support for operations on network devices NETDEV_CSRCS += netdev_register.c netdev_ioctl.c net_poll.c netdev_txnotify.c @@ -50,5 +48,3 @@ endif DEPPATH += --dep-path netdev VPATH += :netdev - -endif # CONFIG_NET diff --git a/net/pkt/Make.defs b/net/pkt/Make.defs index 1f983d7f757..e9e60f9cc9b 100644 --- a/net/pkt/Make.defs +++ b/net/pkt/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # Packet socket support ifeq ($(CONFIG_NET_PKT),y) @@ -56,4 +54,3 @@ DEPPATH += --dep-path pkt VPATH += :pkt endif # CONFIG_NET_PKT -endif # CONFIG_NET diff --git a/net/route/Make.defs b/net/route/Make.defs index 1f6eef3a059..5cbdc8bf75f 100644 --- a/net/route/Make.defs +++ b/net/route/Make.defs @@ -33,7 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) ifeq ($(CONFIG_NET_ROUTE),y) # Routing table support @@ -47,4 +46,3 @@ DEPPATH += --dep-path route VPATH += :route endif -endif diff --git a/net/socket/Kconfig b/net/socket/Kconfig new file mode 100644 index 00000000000..fe6b0289290 --- /dev/null +++ b/net/socket/Kconfig @@ -0,0 +1,36 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +menu "Socket Support" + +config NSOCKET_DESCRIPTORS + int "Number of socket descriptor" + default 8 + ---help--- + Maximum number of socket descriptors per task/thread. + +config NET_NACTIVESOCKETS + int "Max socket operations" + default 16 + ---help--- + Maximum number of concurrent socket operations (recv, send, etc.). + Default: 16 + +config NET_SOCKOPTS + bool "Socket options" + default n + ---help--- + Enable or disable support for socket options + +if NET_SOCKOPTS + +config NET_SOLINGER + bool "SO_LINGER socket option" + default n + ---help--- + Enable or disable support for the SO_LINGER socket option. + +endif # NET_SOCKOPTS +endmenu # Socket Support diff --git a/net/socket/Make.defs b/net/socket/Make.defs new file mode 100644 index 00000000000..1b310ca7d05 --- /dev/null +++ b/net/socket/Make.defs @@ -0,0 +1,72 @@ +############################################################################ +# net/socket/Make.defs +# +# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +# Include socket source files + +SOCK_CSRCS += bind.c connect.c getsockname.c recv.c recvfrom.c socket.c +SOCK_CSRCS += sendto.c net_sockets.c net_close.c net_dup.c net_dup2.c +SOCK_CSRCS += net_clone.c net_vfcntl.c + +# TCP/IP support + +ifeq ($(CONFIG_NET_TCP),y) +SOCK_CSRCS += send.c listen.c accept.c net_monitor.c +endif + +# Socket options + +ifeq ($(CONFIG_NET_SOCKOPTS),y) +SOCK_CSRCS += setsockopt.c getsockopt.c +ifneq ($(CONFIG_DISABLE_CLOCK),y) +SOCK_CSRCS += net_timeo.c net_timeval2dsec.c +endif +endif + +# Support for network access using streams + +ifneq ($(CONFIG_NFILE_STREAMS),0) +SOCK_CSRCS += net_checksd.c +endif + +# Support for sendfile() + +ifeq ($(CONFIG_NET_SENDFILE),y) +SOCK_CSRCS += net_sendfile.c +endif + +# Include socket build support + +DEPPATH += --dep-path socket +VPATH += :socket diff --git a/net/tcp/Make.defs b/net/tcp/Make.defs index 8660af45f34..6870539f337 100644 --- a/net/tcp/Make.defs +++ b/net/tcp/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # TCP/IP source files ifeq ($(CONFIG_NET_TCP),y) @@ -68,4 +66,3 @@ DEPPATH += --dep-path tcp VPATH += :tcp endif # CONFIG_NET_TCP -endif # CONFIG_NET diff --git a/net/udp/Make.defs b/net/udp/Make.defs index 08a1f3bf125..f93eeca806b 100644 --- a/net/udp/Make.defs +++ b/net/udp/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # UDP source files ifeq ($(CONFIG_NET_UDP),y) @@ -47,4 +45,3 @@ DEPPATH += --dep-path udp VPATH += :udp endif # CONFIG_NET_UDP -endif # CONFIG_NET diff --git a/net/uip/Make.defs b/net/uip/Make.defs index 3d58aacc49c..cb65bc94b21 100644 --- a/net/uip/Make.defs +++ b/net/uip/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - # Common IP source files NET_CSRCS += uip_initialize.c uip_setipid.c uip_input.c uip_send.c @@ -62,5 +60,3 @@ endif DEPPATH += --dep-path uip VPATH += :uip - -endif diff --git a/net/utils/Make.defs b/net/utils/Make.defs index 6685a3b7c74..376398bf4d0 100644 --- a/net/utils/Make.defs +++ b/net/utils/Make.defs @@ -33,8 +33,6 @@ # ############################################################################ -ifeq ($(CONFIG_NET),y) - NET_CSRCS += net_dsec2timeval.c net_chksum.c # Non-interrupt level support required? @@ -47,5 +45,3 @@ endif DEPPATH += --dep-path utils VPATH += :utils - -endif