NET: Move routing table functions to net/route

This commit is contained in:
Gregory Nutt 2014-06-26 13:02:08 -06:00
parent 787ba2f1d1
commit d120befd39
16 changed files with 98 additions and 42 deletions

View File

@ -138,18 +138,7 @@ config NET_STATISTICS
---help---
uIP statistics on or off
config NET_ROUTE
bool "Routing table suport"
default n
---help---
Build in support for a routing table. See include/net/route.h
config NET_MAXROUTES
int "Routing table size"
default 4
depends on NET_ROUTE
---help---
The size of the routing table (in entries).
source "net/route/Kconfig"
config NET_MULTICAST
bool "Multi-cast Tx support"

View File

@ -62,13 +62,6 @@ SOCK_CSRCS += net_timeo.c net_dsec2timeval.c net_timeval2dsec.c
endif
endif
# Routing table support
ifeq ($(CONFIG_NET_ROUTE),y)
SOCK_CSRCS += net_addroute.c net_allocroute.c net_delroute.c
SOCK_CSRCS += net_foreachroute.c net_router.c netdev_router.c
endif
# Support for network access using streams
ifneq ($(CONFIG_NFILE_STREAMS),0)
@ -101,6 +94,7 @@ include tcp/Make.defs
include udp/Make.defs
include pkt/Make.defs
include uip/Make.defs
include route/Make.defs
endif
ASRCS = $(SOCK_ASRCS) $(NETDEV_ASRCS) $(NET_ASRCS)

View File

@ -67,7 +67,7 @@
#include <nuttx/net/netdev.h>
#include <nuttx/net/arp.h>
#include "net_route.h"
#include "route/route.h"
#ifdef CONFIG_NET_ARP

View File

@ -53,8 +53,8 @@
#include <nuttx/net/net.h>
#include <nuttx/kmalloc.h>
#include "net_route.h"
#include "net.h"
#include "route/route.h"
/****************************************************************************
* Pre-processor Definitions

View File

@ -47,8 +47,8 @@
#include <nuttx/net/netdev.h>
#include "net_route.h"
#include "net.h"
#include "route/route.h"
/****************************************************************************
* Pre-processor Definitions

View File

@ -64,7 +64,7 @@
#endif
#include "net.h"
#include "net_route.h"
#include "route/route.h"
/****************************************************************************
* Pre-processor Definitions

23
net/route/Kconfig Normal file
View File

@ -0,0 +1,23 @@
#
# For a description of the syntax of this configuration file,
# see misc/tools/kconfig-language.txt.
#
menu "Routing Table Configuration"
config NET_ROUTE
bool "Routing table support"
default n
---help---
Build in support for a routing table. See include/net/route.h
if NET_ROUTE
config NET_MAXROUTES
int "Routing table size"
default 4
---help---
The size of the routing table (in entries).
endif # NET_ROUTE
endmenu # ARP Configuration

50
net/route/Make.defs Normal file
View File

@ -0,0 +1,50 @@
############################################################################
# net/route/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.
#
############################################################################
ifeq ($(CONFIG_NET),y)
ifeq ($(CONFIG_NET_ROUTE),y)
# Routing table support
SOCK_CSRCS += net_addroute.c net_allocroute.c net_delroute.c
SOCK_CSRCS += net_foreachroute.c net_router.c netdev_router.c
# Include routing table build support
DEPPATH += --dep-path route
VPATH += :route
endif
endif

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/net_addroute.c
* net/route/net_addroute.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -47,7 +47,7 @@
#include <arch/irq.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/net_allocroute.c
* net/route/net_allocroute.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -46,7 +46,7 @@
#include <arch/irq.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/net_delroute.c
* net/route/net_delroute.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -44,7 +44,7 @@
#include <errno.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/net_foreachroute.c
* net/route/net_foreachroute.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -45,7 +45,7 @@
#include <arch/irq.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/net_router.c
* net/route/net_router.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -44,7 +44,7 @@
#include <errno.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/netdev_router.c
* net/route/netdev_router.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -46,7 +46,7 @@
#include <nuttx/net/netdev.h>
#include "net.h"
#include "net_route.h"
#include "route/route.h"
#if defined(CONFIG_NET) && defined(CONFIG_NET_ROUTE)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* net/net_route.h
* net/route/route.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __NET_NET_ROUTE_H
#define __NET_NET_ROUTE_H
#ifndef __NET_ROUTE_ROUTE_H
#define __NET_ROUTE_ROUTE_H
/****************************************************************************
* Included Files
@ -260,4 +260,4 @@ int net_foreachroute(route_handler_t handler, FAR void *arg);
#endif
#endif /* CONFIG_NET_ROUTE */
#endif /* __NET_NET_ROUTE_H */
#endif /* __NET_ROUTE_ROUTE_H */

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net//tcp_send.c
* net/tcp/tcp_send.c
*
* Copyright (C) 2007-2010, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>