diff --git a/net/net_initialize.c b/net/net_initialize.c index df3a72226d..988faf6b54 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -1,7 +1,7 @@ /**************************************************************************** - * net/net_sockets.c + * net/net_initialize.c * - * Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2015, 2017 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,6 +49,7 @@ #include "devif/devif.h" #include "netdev/netdev.h" #include "arp/arp.h" +#include "sixlowpan/sixlowpan.h" #include "neighbor/neighbor.h" #include "tcp/tcp.h" #include "udp/udp.h" @@ -58,26 +59,6 @@ #include "route/route.h" #include "utils/utils.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -119,7 +100,13 @@ void net_setup(void) /* Initialize the Neighbor Table data structures */ neighbor_initialize(); + +#ifdef CONFIG_NET_6LOWPAN + /* Initialize 6loWPAN data structures */ + + sixlowpan_initialize(); #endif +#endif /* CONFIG_NET_IPv6 */ #ifdef CONFIG_NET_IOB /* Initialize I/O buffering */ diff --git a/net/sixlowpan/Make.defs b/net/sixlowpan/Make.defs index 150cb6ec88..ffe1351f94 100644 --- a/net/sixlowpan/Make.defs +++ b/net/sixlowpan/Make.defs @@ -39,6 +39,7 @@ ifeq ($(CONFIG_NET_6LOWPAN),y) # Include IEEE 802.15.4 file in the build +NET_CSRCS += sixlowpan_initialize.c sixlowpan_globals.c NET_CSRCS += sixlowpan_compressor.c sixlowpan_sniffer.c # Include the sixlowpan directory in the build diff --git a/net/sixlowpan/sixlowpan.h b/net/sixlowpan/sixlowpan.h index e85135e0cf..37d8bb597c 100644 --- a/net/sixlowpan/sixlowpan.h +++ b/net/sixlowpan/sixlowpan.h @@ -41,6 +41,7 @@ ****************************************************************************/ #include +#include #ifdef CONFIG_NET_6LOWPAN @@ -55,7 +56,8 @@ extern FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor; /* Rime Sniffer support for one single listener to enable trace of IP */ -extern struct sixlowpan_rime_sniffer_s *g_sixlopan_sniffer; +struct sixlowpan_rime_sniffer_s; /* Foward reference */ +extern FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer; /**************************************************************************** * Public Types @@ -65,5 +67,26 @@ extern struct sixlowpan_rime_sniffer_s *g_sixlopan_sniffer; * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: sixlowpan_initialize + * + * Description: + * sixlowpan_initialize() is called during OS initialization at power-up + * reset. It is called from the common net_setup() function. + * sixlowpan_initialize() configures 6loWPAN networking data structures. + * It is called prior to platform-specific driver initialization so that + * the 6loWPAN networking subsystem is prepared to deal with network + * driver initialization actions. + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_initialize(void); + #endif /* CONFIG_NET_6LOWPAN */ #endif /* _NET_SIXLOWPAN_SIXLOWPAN_H */ diff --git a/net/sixlowpan/sixlowpan_compressor.c b/net/sixlowpan/sixlowpan_compressor.c index ffaa64ae2e..3457530b79 100644 --- a/net/sixlowpan/sixlowpan_compressor.c +++ b/net/sixlowpan/sixlowpan_compressor.c @@ -46,14 +46,6 @@ #ifdef CONFIG_NET_6LOWPAN -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* A pointer to the optional, architecture-specific compressor */ - -FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor; - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/net/sixlowpan/sixlowpan_globals.c b/net/sixlowpan/sixlowpan_globals.c new file mode 100644 index 0000000000..e289d88c0c --- /dev/null +++ b/net/sixlowpan/sixlowpan_globals.c @@ -0,0 +1,60 @@ +/**************************************************************************** + * net/sixlowpan/sixlowpan_sniffer.c + * + * Copyright (C) 2017 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "nuttx/net/sixlowpan.h" + +#include "sixlowpan/sixlowpan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* A pointer to the optional, architecture-specific compressor */ + +FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor; + +/* A pointer to the optional, architecture-specific sniffer */ + +FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer; + +#endif /* CONFIG_NET_6LOWPAN */ diff --git a/net/sixlowpan/sixlowpan_initialize.c b/net/sixlowpan/sixlowpan_initialize.c new file mode 100644 index 0000000000..53180f0a90 --- /dev/null +++ b/net/sixlowpan/sixlowpan_initialize.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * net/net_sockets.c + * + * Copyright (C) 2017 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "sixlowpan/sixlowpan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sixlowpan_initialize + * + * Description: + * sixlowpan_initialize() is called during OS initialization at power-up + * reset. It is called from the common net_setup() function. + * sixlowpan_initialize() configures 6loWPAN networking data structures. + * It is called prior to platform-specific driver initialization so that + * the 6loWPAN networking subsystem is prepared to deal with network + * driver initialization actions. + * + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ + +void sixlowpan_initialize(void) +{ + /* REVIST: To be provided */ +} + +#endif /* CONFIG_NET_6LOWPAN */ diff --git a/net/sixlowpan/sixlowpan_sniffer.c b/net/sixlowpan/sixlowpan_sniffer.c index d9ffadc973..baf3acc09c 100644 --- a/net/sixlowpan/sixlowpan_sniffer.c +++ b/net/sixlowpan/sixlowpan_sniffer.c @@ -46,14 +46,6 @@ #ifdef CONFIG_NET_6LOWPAN -/**************************************************************************** - * Public Data - ****************************************************************************/ - -/* A pointer to the optional, architecture-specific sniffer */ - -FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer; - /**************************************************************************** * Public Functions ****************************************************************************/