NET: Create net/sockets directory and hook into the build/configuration system

This commit is contained in:
Gregory Nutt 2014-06-28 16:41:55 -06:00
parent 0443aa9947
commit 64c8dba8c4
15 changed files with 115 additions and 96 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

36
net/socket/Kconfig Normal file
View file

@ -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

72
net/socket/Make.defs Normal file
View file

@ -0,0 +1,72 @@
############################################################################
# net/socket/Make.defs
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# 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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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