6loWPAN: Add HC06 decompression logic; Remove outboard compressor hooks.

This commit is contained in:
Gregory Nutt
2017-04-02 08:08:35 -06:00
parent 5a56d3cce7
commit d16fc98c74
7 changed files with 554 additions and 139 deletions
+11
View File
@@ -526,6 +526,17 @@ bool net_ipv6addr_maskcmp(const net_ipv6addr_t addr1,
const net_ipv6addr_t mask);
#endif
/****************************************************************************
* Function: net_ipv6addr_prefixcmp
*
* Description:
* Compare two IPv6 address prefixes.
*
****************************************************************************/
#define net_ipv6addr_prefixcmp(addr1, addr2, length) \
(memcmp(addr1, addr2, length >> 3) == 0)
/****************************************************************************
* Function: net_ipaddr_mask
*
-41
View File
@@ -477,30 +477,6 @@ struct ieee802154_driver_s
#endif /* CONFIG_NET_6LOWPAN_FRAG */
};
/* The structure of a next header compressor. This compressor is provided
* by architecture-specific logic outside of the network stack.
*
* TODO: needs more parameters when compressing extension headers, etc.
*/
struct sixlowpan_nhcompressor_s
{
CODE int (*is_compressable)(uint8_t next_header);
/* Compress next header (TCP/UDP, etc) - ptr points to next header to
* compress.
*/
CODE int (*compress)(FAR uint8_t *compressed, FAR uint8_t *uncompressed_len);
/* Uncompress next header (TCP/UDP, etc) - ptr points to next header to
* uncompress.
*/
CODE int (*uncompress)(FAR uint8_t *compressed, FAR uint8_t *lowpanbuf,
FAR uint8_t *uncompressed_len);
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -560,21 +536,4 @@ struct sixlowpan_nhcompressor_s
int sixlowpan_input(FAR struct ieee802154_driver_s *ieee);
/****************************************************************************
* Function: sixlowpan_set_compressor
*
* Description:
* Configure to use the architecture-specific compressor.
*
* Input parameters:
* compressor - A reference to the new compressor to be used. This may
* be a NULL value to disable the compressor.
*
* Returned Value:
* None
*
****************************************************************************/
void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor);
#endif /* __INCLUDE_NUTTX_NET_SIXLOWOAN_H */
+1 -1
View File
@@ -41,7 +41,7 @@ ifeq ($(CONFIG_NET_6LOWPAN),y)
NET_CSRCS += sixlowpan_initialize.c sixlowpan_globals.c sixlowpan_utils.c
NET_CSRCS += sixlowpan_input.c sixlowpan_send.c sixlowpan_framer.c
NET_CSRCS += sixlowpan_framelist.c sixlowpan_compressor.c
NET_CSRCS += sixlowpan_framelist.c
ifeq ($(CONFIG_NET_TCP),y)
NET_CSRCS += sixlowpan_tcpsend.c
-79
View File
@@ -1,79 +0,0 @@
/****************************************************************************
* net/sixlowpan/sixlowpan_compressor.c
*
* Copyright (C) 2017 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "nuttx/net/net.h"
#include "sixlowpan/sixlowpan_internal.h"
#ifdef CONFIG_NET_6LOWPAN
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Function: sixlowpan_set_compressor
*
* Description:
* Configure to use the architecture-specific compressor.
*
* Input parameters:
* compressor - A reference to the new compressor to be used. This may
* be a NULL value to disable the compressor.
*
* Returned Value:
* None
*
****************************************************************************/
void sixlowpan_set_compressor(FAR struct sixlowpan_nhcompressor_s *compressor)
{
/* Make sure that the compressor is not in use */
net_lock();
/* Then instantiate the new compressor */
g_sixlowpan_compressor = compressor;
net_unlock();
}
#endif /* CONFIG_NET_6LOWPAN */
-4
View File
@@ -47,10 +47,6 @@
* Public Data
****************************************************************************/
/* A pointer to the optional, architecture-specific compressor */
FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor;
/* The following data values are used to hold intermediate settings while
* processing IEEE802.15.4 frames. These globals are shared with incoming
* and outgoing frame processing and possibly with mutliple IEEE802.15.4 MAC
File diff suppressed because it is too large Load Diff
+2 -7
View File
@@ -335,11 +335,6 @@ struct frame802154_s
* Public Data
****************************************************************************/
/* A pointer to the optional, architecture-specific compressor */
struct sixlowpan_nhcompressor_s; /* Foward reference */
extern FAR struct sixlowpan_nhcompressor_s *g_sixlowpan_compressor;
/* The following data values are used to hold intermediate settings while
* processing IEEE802.15.4 frames. These globals are shared with incoming
* and outgoing frame processing and possibly with mutliple IEEE802.15.4 MAC
@@ -593,7 +588,7 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
* Input Parmeters:
* ieee - A reference to the IEE802.15.4 network device state
* iplen - Equal to 0 if the packet is not a fragment (IP length is then
* inferred from the L2 length), non 0 if the packet is a 1st
* inferred from the L2 length), non 0 if the packet is a first
* fragment.
*
* Returned Value:
@@ -650,7 +645,7 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
* Input Parameters:
* ieee - A reference to the IEE802.15.4 network device state
* iplen - Equal to 0 if the packet is not a fragment (IP length is then
* inferred from the L2 length), non 0 if the packet is a 1st
* inferred from the L2 length), non 0 if the packet is a first
* fragment.
*
* Returned Value: