diff --git a/net/sixlowpan/Make.defs b/net/sixlowpan/Make.defs index 0ddebc0b20..ceda75dc6d 100644 --- a/net/sixlowpan/Make.defs +++ b/net/sixlowpan/Make.defs @@ -40,6 +40,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_input.c sixlowpan_output.c NET_CSRCS += sixlowpan_compressor.c sixlowpan_sniffer.c ifeq ($(CONFIG_NET_6LOWPAN_COMPRESSION_HC06),y) diff --git a/net/sixlowpan/sixlowpan.h b/net/sixlowpan/sixlowpan.h index 31a858205d..6fe0efe99f 100644 --- a/net/sixlowpan/sixlowpan.h +++ b/net/sixlowpan/sixlowpan.h @@ -76,7 +76,7 @@ extern FAR struct sixlowpan_rime_sniffer_s *g_sixlowpan_sniffer; * 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. + * driver initialization actions. * * Input Parameters: * None diff --git a/net/sixlowpan/sixlowpan_initialize.c b/net/sixlowpan/sixlowpan_initialize.c index ccf0cefed4..07e10b6a37 100644 --- a/net/sixlowpan/sixlowpan_initialize.c +++ b/net/sixlowpan/sixlowpan_initialize.c @@ -56,7 +56,7 @@ * 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. + * driver initialization actions. * * Input Parameters: * None diff --git a/net/sixlowpan/sixlowpan_input.c b/net/sixlowpan/sixlowpan_input.c new file mode 100644 index 0000000000..df02dbece9 --- /dev/null +++ b/net/sixlowpan/sixlowpan_input.c @@ -0,0 +1,83 @@ +/**************************************************************************** + * net/sixlowpan/sixlowpan_initialize.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 + +#include "nuttx/net/netdev.h" +#include "sixlowpan/sixlowpan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sixlowpan_input + * + * Description: + * Process an incoming IP packet. + * + * This function is called when the device driver has received a 6loWPAN + * packet from the network. The packet from the device driver must be + * present in the d_buf buffer, and the length of the packet should be + * placed in the d_len field. + * + * When the function returns, there may be an outbound packet placed + * in the d_buf packet buffer. If so, the d_len field is set to + * the length of the packet. If no packet is to be sent out, the + * d_len field is set to 0. + * + * Input Parameters: + * dev - The IEEE802.15.4 MAC network driver interface. + * + * Returned Value: + * Ok is returned on success; Othewise a negated errno value is returned. + * + ****************************************************************************/ + +int sixlowpan_input(FAR struct net_driver_s *dev) +{ + /* REVISIT: To be provided */ + return -ENOSYS; +} + +#endif /* CONFIG_NET_6LOWPAN */ diff --git a/net/sixlowpan/sixlowpan_output.c b/net/sixlowpan/sixlowpan_output.c new file mode 100644 index 0000000000..af4b7c9d63 --- /dev/null +++ b/net/sixlowpan/sixlowpan_output.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * net/sixlowpan/sixlowpan_output.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 + +#include "nuttx/net/netdev.h" +#include "sixlowpan/sixlowpan.h" + +#ifdef CONFIG_NET_6LOWPAN + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: sixlowpan_output + * + * Description: + * Process an outgoing UDP or TCP packet. Called from UDP/TCP logic to + * determine if the the packet should be formatted for 6loWPAN output. + * + * Input Parameters: + * dev - The IEEE802.15.4 MAC network driver interface. + * + * Returned Value: + * Ok is returned on success; Othewise a negated errno value is returned. + * This function is expected to fail if the driver is not an IEEE802.15.4 + * MAC network driver. In that case, the UDP/TCP will fall back to normal + * IPv4/IPv6 formatting. + * + ****************************************************************************/ + +int sixlowpan_output(FAR struct net_driver_s *dev) +{ + /* REVISIT: To be provided */ + return -ENOSYS; +} + +#endif /* CONFIG_NET_6LOWPAN */