2017-03-30 02:07:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* net/sixlowpan/sixlowpan_internal.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
|
|
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
|
|
|
*
|
2017-03-30 23:38:56 +02:00
|
|
|
* Parts of this file derive from Contiki:
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008, Swedish Institute of Computer Science
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Additional fixes for AVR contributed by:
|
|
|
|
* Colin O'Flynn coflynn@newae.com
|
|
|
|
* Eric Gnoske egnoske@gmail.com
|
|
|
|
* Blake Leverett bleverett@gmail.com
|
|
|
|
* Mike Vidales mavida404@gmail.com
|
|
|
|
* Kevin Brown kbrown3@uccs.edu
|
|
|
|
* Nate Bohlmann nate@elfwerks.com
|
|
|
|
*
|
|
|
|
* Additional fixes for MSP430 contributed by:
|
|
|
|
* Joakim Eriksson
|
|
|
|
* Niclas Finne
|
|
|
|
* Nicolas Tsiftes
|
|
|
|
*
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
2017-03-30 02:07:52 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
2020-04-12 19:18:02 +02:00
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* 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.
|
2017-03-30 23:38:56 +02:00
|
|
|
* 3. Neither the name of the copyright holders nor the names of
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
2020-04-12 19:18:02 +02:00
|
|
|
* 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.
|
|
|
|
*
|
2017-03-30 02:07:52 +02:00
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#ifndef __NET_SIXLOWPAN_SIXLOWPAN_INTERNAL_H
|
|
|
|
#define __NET_SIXLOWPAN_SIXLOWPAN_INTERNAL_H
|
2017-03-30 02:07:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
2017-06-25 05:12:46 +02:00
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
#include <sys/types.h>
|
2017-06-25 05:12:46 +02:00
|
|
|
#include <stdbool.h>
|
2017-03-30 02:07:52 +02:00
|
|
|
|
|
|
|
#include <nuttx/net/tcp.h>
|
|
|
|
#include <nuttx/net/udp.h>
|
|
|
|
#include <nuttx/net/icmpv6.h>
|
2017-03-31 18:04:29 +02:00
|
|
|
#include <nuttx/net/sixlowpan.h>
|
2017-07-31 03:10:51 +02:00
|
|
|
#include <nuttx/wireless/pktradio.h>
|
2017-03-30 02:07:52 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
/* Copy a generic address */
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-05-04 19:33:22 +02:00
|
|
|
#define sixlowpan_anyaddrcopy(dest,src,len) \
|
|
|
|
memcpy(dest, src, len)
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
2019-03-11 19:48:17 +01:00
|
|
|
/* IEEE 802.15.4 address macros
|
|
|
|
*
|
|
|
|
* Copy a an IEEE 802.15.4 address.
|
|
|
|
*/
|
2017-07-31 03:10:51 +02:00
|
|
|
|
2017-05-04 19:33:22 +02:00
|
|
|
#define sixlowpan_saddrcopy(dest,src) \
|
|
|
|
sixlowpan_anyaddrcopy(dest,src,NET_6LOWPAN_SADDRSIZE)
|
|
|
|
|
2017-05-04 21:19:11 +02:00
|
|
|
#define sixlowpan_eaddrcopy(dest,src) \
|
2017-05-04 19:33:22 +02:00
|
|
|
sixlowpan_anyaddrcopy(dest,src,NET_6LOWPAN_EADDRSIZE)
|
|
|
|
|
2017-05-04 17:05:41 +02:00
|
|
|
#define sixlowpan_addrcopy(dest,src) \
|
2017-05-04 19:33:22 +02:00
|
|
|
sixlowpan_anyaddrcopy(dest,src,NET_6LOWPAN_ADDRSIZE)
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
#endif
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-03-31 23:09:07 +02:00
|
|
|
/* General helper macros ****************************************************/
|
|
|
|
|
2017-06-22 17:28:25 +02:00
|
|
|
/* GET 16-bit data: source in network order */
|
2017-05-05 03:17:38 +02:00
|
|
|
|
2017-06-22 17:28:25 +02:00
|
|
|
#define GETUINT16(ptr,index) \
|
2017-04-01 23:05:38 +02:00
|
|
|
((((uint16_t)((ptr)[index])) << 8) | ((uint16_t)(((ptr)[(index) + 1]))))
|
2017-05-05 03:17:38 +02:00
|
|
|
|
2018-12-18 14:34:41 +01:00
|
|
|
/* PUT 16-bit data: source in host order, result in network order */
|
2017-05-05 03:17:38 +02:00
|
|
|
|
|
|
|
#define PUTHOST16(ptr,index,value) \
|
2017-03-31 23:09:07 +02:00
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
(ptr)[index] = ((uint16_t)(value) >> 8) & 0xff; \
|
|
|
|
(ptr)[index + 1] = (uint16_t)(value) & 0xff; \
|
|
|
|
} \
|
2018-10-30 01:00:30 +01:00
|
|
|
while (0)
|
2017-03-31 23:09:07 +02:00
|
|
|
|
2017-06-26 00:09:09 +02:00
|
|
|
/* Return values ************************************************************/
|
|
|
|
|
2018-09-14 14:55:45 +02:00
|
|
|
/* Successful return values from header compression logic */
|
2017-06-26 00:09:09 +02:00
|
|
|
|
2017-08-26 18:00:47 +02:00
|
|
|
#define COMPRESS_HDR_INLINE 0 /* L2 header not compressed */
|
|
|
|
#define COMPRESS_HDR_ELIDED 1 /* L2 header compressed */
|
|
|
|
|
|
|
|
/* Memory Pools *************************************************************/
|
|
|
|
|
|
|
|
#define REASS_POOL_PREALLOCATED 0
|
|
|
|
#define REASS_POOL_DYNAMIC 1
|
2017-11-01 21:15:21 +01:00
|
|
|
#define REASS_POOL_RADIO 2
|
2017-06-26 00:09:09 +02:00
|
|
|
|
2017-04-04 20:31:22 +02:00
|
|
|
/* Debug ********************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_DUMPBUFFER
|
|
|
|
# define sixlowpan_dumpbuffer(m,b,s) ninfodumpbuffer(m,b,s)
|
|
|
|
#else
|
|
|
|
# define sixlowpan_dumpbuffer(m,b,s)
|
|
|
|
#endif
|
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-05-05 18:00:18 +02:00
|
|
|
/* IPv6 TCP/UDP/ICMPv6 Definitions ******************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_TCP
|
2017-03-30 23:38:56 +02:00
|
|
|
/* IPv6 + TCP header. Cast compatible based on IPv6 protocol field. */
|
2017-03-30 02:07:52 +02:00
|
|
|
|
|
|
|
struct ipv6tcp_hdr_s
|
|
|
|
{
|
|
|
|
struct ipv6_hdr_s ipv6;
|
|
|
|
struct tcp_hdr_s tcp;
|
|
|
|
};
|
2017-05-05 18:00:18 +02:00
|
|
|
#endif
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-05-05 18:00:18 +02:00
|
|
|
#ifdef CONFIG_NET_UDP
|
2017-03-30 02:07:52 +02:00
|
|
|
/* IPv6 + UDP header */
|
|
|
|
|
|
|
|
struct ipv6udp_hdr_s
|
|
|
|
{
|
|
|
|
struct ipv6_hdr_s ipv6;
|
|
|
|
struct udp_hdr_s udp;
|
|
|
|
};
|
2017-05-05 18:00:18 +02:00
|
|
|
#endif
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-05-05 18:00:18 +02:00
|
|
|
#ifdef CONFIG_NET_ICMPv6
|
2017-03-30 02:07:52 +02:00
|
|
|
/* IPv6 + ICMPv6 header */
|
|
|
|
|
|
|
|
struct ipv6icmp_hdr_s
|
|
|
|
{
|
|
|
|
struct ipv6_hdr_s ipv6;
|
|
|
|
struct icmpv6_iphdr_s icmp;
|
|
|
|
};
|
2017-05-05 18:00:18 +02:00
|
|
|
#endif
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
2017-05-04 19:33:22 +02:00
|
|
|
/* In order to provide a customizable IEEE 802.15.4 MAC header, a structure
|
|
|
|
* of meta data is passed to the MAC network driver, struct
|
|
|
|
* ieee802154_frame_meta_s. Many of the settings in this meta data are
|
2017-07-31 03:10:51 +02:00
|
|
|
* fixed, determined by the 6LoWPAN configuration. Other settings depend
|
2017-05-04 19:33:22 +02:00
|
|
|
* on the protocol used in the current packet or on chacteristics of the
|
|
|
|
* destination node.
|
|
|
|
*
|
|
|
|
* The following structure is used to summarize those per-packet
|
2020-02-23 09:50:23 +01:00
|
|
|
* customizations and, along, with the fixed configuration settings,
|
2017-05-04 19:33:22 +02:00
|
|
|
* determines the full form of that meta data.
|
|
|
|
*/
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
struct ieee802_txmetadata_s
|
2017-05-04 19:33:22 +02:00
|
|
|
{
|
2017-07-31 03:10:51 +02:00
|
|
|
uint8_t sextended : 1; /* Extended source address */
|
|
|
|
uint8_t dextended : 1; /* Extended destination address */
|
|
|
|
uint8_t xmits; /* Max MAC transmisstion */
|
|
|
|
uint8_t dpanid[IEEE802154_PANIDSIZE]; /* Destination PAN ID */
|
|
|
|
struct netdev_maxaddr_s source; /* Source IEEE 802.15.4 address */
|
|
|
|
struct netdev_maxaddr_s dest; /* Destination IEEE 802.15.4 address */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2020-04-12 19:18:02 +02:00
|
|
|
/* This structure holds the packet metadata as a union when multiple
|
|
|
|
* different radio types are supported.
|
2017-07-31 03:10:51 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
union sixlowpan_metadata_u
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
|
|
|
struct ieee802154_frame_meta_s ieee802154;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_WIRELESS_PKTRADIO
|
|
|
|
struct pktradio_metadata_s pktradio;
|
|
|
|
#endif
|
2017-05-04 19:33:22 +02:00
|
|
|
};
|
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Data
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-03-31 18:04:29 +02:00
|
|
|
/* The following data values are used to hold intermediate settings while
|
|
|
|
* processing IEEE802.15.4 frames. These globals are shared with incoming
|
2019-09-05 16:10:42 +02:00
|
|
|
* and outgoing frame processing and possibly with multiple IEEE802.15.4 MAC
|
2017-03-31 18:04:29 +02:00
|
|
|
* devices. The network lock provides exclusive use of these globals
|
2019-09-05 16:10:42 +02:00
|
|
|
* during that processing.
|
2017-03-31 18:04:29 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* g_uncomp_hdrlen is the length of the headers before compression (if HC2
|
|
|
|
* is used this includes the UDP header in addition to the IP header).
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern uint8_t g_uncomp_hdrlen;
|
|
|
|
|
2017-04-04 15:22:59 +02:00
|
|
|
/* g_frame_hdrlen is the total length of (the processed) 6lowpan headers
|
2017-03-31 18:04:29 +02:00
|
|
|
* (fragment headers, IPV6 or HC1, HC2, and HC1 and HC2 non compressed
|
|
|
|
* fields).
|
|
|
|
*/
|
|
|
|
|
2017-04-04 15:22:59 +02:00
|
|
|
extern uint8_t g_frame_hdrlen;
|
2017-03-31 18:04:29 +02:00
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
struct net_driver_s; /* Forward reference */
|
2017-08-20 15:10:48 +02:00
|
|
|
struct radio_driver_s; /* Forward reference */
|
2017-07-31 03:10:51 +02:00
|
|
|
struct devif_callback_s; /* Forward reference */
|
|
|
|
struct ipv6_hdr_s; /* Forward reference */
|
|
|
|
struct netdev_varaddr_s; /* Forward reference */
|
|
|
|
struct iob_s; /* Forward reference */
|
2017-03-30 02:07:52 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_send
|
|
|
|
*
|
|
|
|
* Description:
|
2020-04-12 19:18:02 +02:00
|
|
|
* Process an outgoing UDP or ICMPv6 packet. Takes an IP packet and
|
|
|
|
* formats it to be sent on an 802.15.4 network using 6lowpan. Called
|
|
|
|
* from common UDP/ICMPv6 send logic.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
2017-04-02 21:27:53 +02:00
|
|
|
* The payload data is in the caller 'buf' and is of length 'buflen'.
|
2017-03-31 15:54:58 +02:00
|
|
|
* Compressed headers will be added and if necessary the packet is
|
2017-05-03 17:40:42 +02:00
|
|
|
* fragmented. The resulting packet/fragments are submitted to the MAC
|
2017-07-29 21:42:26 +02:00
|
|
|
* via the network driver r_req_data method.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-03-31 23:09:07 +02:00
|
|
|
* dev - The IEEE802.15.4 MAC network driver interface.
|
2018-06-23 23:03:01 +02:00
|
|
|
* list - Head of callback list for send event handler
|
2017-06-25 00:00:41 +02:00
|
|
|
* ipv6hdr - IPv6 header followed by UDP or ICMPv6 header.
|
2017-03-31 23:09:07 +02:00
|
|
|
* buf - Data to send
|
2017-05-05 03:17:38 +02:00
|
|
|
* len - Length of data to send
|
2017-06-25 00:00:41 +02:00
|
|
|
* destmac - The IEEE802.15.4 MAC address of the destination
|
2020-01-04 11:37:46 +01:00
|
|
|
* timeout - Send timeout in milliseconds
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-02-23 09:50:23 +01:00
|
|
|
* Ok is returned on success; Otherwise a negated errno value is returned.
|
2017-03-30 02:07:52 +02:00
|
|
|
* This function is expected to fail if the driver is not an IEEE802.15.4
|
2017-06-25 00:00:41 +02:00
|
|
|
* MAC network driver. In that case, the logic will fall back to normal
|
2017-03-30 02:07:52 +02:00
|
|
|
* IPv4/IPv6 formatting.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int sixlowpan_send(FAR struct net_driver_s *dev,
|
2017-04-06 19:57:43 +02:00
|
|
|
FAR struct devif_callback_s **list,
|
net/devif/devif_callback.c: corrected the connection event list to work as FIFO instead of LIFO.
In case of enabled packet forwarding mode, packets were forwarded in a reverse order
because of LIFO behavior of the connection event list.
The issue exposed only during high network traffic. Thus the event list started to grow
that resulted in changing the order of packets inside of groups of several packets
like the following: 3, 2, 1, 6, 5, 4, 8, 7 etc.
Remarks concerning the connection event list implementation:
* Now the queue (list) is FIFO as it should be.
* The list is singly linked.
* The list has a head pointer (inside of outer net_driver_s structure),
and a tail pointer is added into outer net_driver_s structure.
* The list item is devif_callback_s structure.
It still has two pointers to two different list chains (*nxtconn and *nxtdev).
* As before the first argument (*dev) of the list functions can be NULL,
while the other argument (*list) is effective (not NULL).
* An extra (*tail) argument is added to devif_callback_alloc()
and devif_conn_callback_free() functions.
* devif_callback_alloc() time complexity is O(1) (i.e. O(n) to fill the whole list).
* devif_callback_free() time complexity is O(n) (i.e. O(n^2) to empty the whole list).
* devif_conn_event() time complexity is O(n).
2021-08-29 22:57:26 +02:00
|
|
|
FAR struct devif_callback_s **list_tail,
|
2017-04-06 19:57:43 +02:00
|
|
|
FAR const struct ipv6_hdr_s *ipv6hdr, FAR const void *buf,
|
2017-07-31 03:10:51 +02:00
|
|
|
size_t len, FAR const struct netdev_varaddr_s *destmac,
|
2020-04-12 18:46:40 +02:00
|
|
|
unsigned int timeout);
|
2017-03-30 02:07:52 +02:00
|
|
|
|
2017-03-30 23:38:56 +02:00
|
|
|
/****************************************************************************
|
2017-05-03 17:40:42 +02:00
|
|
|
* Name: sixlowpan_meta_data
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Based on the collected attributes and addresses, construct the MAC meta
|
|
|
|
* data structure that we need to interface with the IEEE802.15.4 MAC.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-05-08 18:56:35 +02:00
|
|
|
* pktmeta - Meta-data specific to the current outgoing frame
|
2017-07-31 03:10:51 +02:00
|
|
|
* meta - Location to return the corresponding meta data reference
|
|
|
|
* (obfuscated).
|
2017-05-03 17:40:42 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-02-23 09:50:23 +01:00
|
|
|
* Ok is returned on success; Otherwise a negated errno value is returned.
|
2017-05-03 17:40:42 +02:00
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_meta_data(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const struct ieee802_txmetadata_s *pktmeta,
|
2017-08-19 20:32:56 +02:00
|
|
|
FAR struct ieee802154_frame_meta_s *meta);
|
2017-07-31 03:10:51 +02:00
|
|
|
#endif
|
2017-05-03 17:40:42 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_frame_hdrlen
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function is before the first frame has been sent in order to
|
|
|
|
* determine what the size of the IEEE802.15.4 header will be. No frame
|
|
|
|
* buffer is required to make this determination.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-07-31 03:10:51 +02:00
|
|
|
* meta - obfuscated meta data that describes the MAC header
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-02-22 19:31:14 +01:00
|
|
|
* The frame header length is returned on success; otherwise, a negated
|
2017-03-30 23:38:56 +02:00
|
|
|
* errno value is return on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_frame_hdrlen(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *meta);
|
2017-03-30 23:38:56 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
2017-05-03 17:40:42 +02:00
|
|
|
* Name: sixlowpan_frame_submit
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2017-05-03 17:40:42 +02:00
|
|
|
* This function is called after eiether (1) the IEEE802.15.4 MAC driver
|
|
|
|
* polls for TX data or (2) after the IEEE802.15.4 MAC driver provides a
|
|
|
|
* new incoming frame and the network responds with an outgoing packet. It
|
|
|
|
* submits any new outgoing frame to the MAC.
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-07-31 03:10:51 +02:00
|
|
|
* meta - Obfuscated metadata that describes the MAC header
|
2017-05-03 17:40:42 +02:00
|
|
|
* frame - The IOB containing the frame to be submitted.
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2017-05-03 17:40:42 +02:00
|
|
|
* Zero (OK) is returned on success; otherwise, a negated errno value is
|
|
|
|
* return on any failure.
|
2017-03-30 23:38:56 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_frame_submit(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *meta, FAR struct iob_s *frame);
|
2017-03-30 23:38:56 +02:00
|
|
|
|
2017-04-01 17:07:16 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_queue_frames
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Process an outgoing UDP or TCP packet. This function is called from
|
2020-02-23 09:50:23 +01:00
|
|
|
* the send event handler when a TX poll is received. It formats the
|
2017-04-01 17:07:16 +02:00
|
|
|
* list of frames to be sent by the IEEE802.15.4 MAC driver.
|
|
|
|
*
|
2017-04-04 17:08:48 +02:00
|
|
|
* The payload data is in the caller 'buf' and is of length 'buflen'.
|
2017-04-01 17:07:16 +02:00
|
|
|
* Compressed headers will be added and if necessary the packet is
|
2017-05-03 17:40:42 +02:00
|
|
|
* fragmented. The resulting packet/fragments are submitted to the MAC
|
2017-07-29 21:42:26 +02:00
|
|
|
* via the network driver r_req_data method.
|
2017-04-01 17:07:16 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-07-09 19:35:26 +02:00
|
|
|
* ipv6 - IPv6 header followed by TCP or UDP header.
|
2017-04-04 17:08:48 +02:00
|
|
|
* buf - Beginning of the packet packet to send (with IPv6 + protocol
|
|
|
|
* headers)
|
2017-09-08 20:55:16 +02:00
|
|
|
* buflen - Length of data to send (includes IPv6 and protocol headers)
|
2017-04-01 17:07:16 +02:00
|
|
|
* destmac - The IEEE802.15.4 MAC address of the destination
|
|
|
|
*
|
|
|
|
* Returned Value:
|
2020-02-23 09:50:23 +01:00
|
|
|
* Ok is returned on success; Otherwise a negated errno value is returned.
|
2017-04-01 17:07:16 +02:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* Called with the network locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
|
2017-07-09 19:35:26 +02:00
|
|
|
FAR const struct ipv6_hdr_s *ipv6,
|
2017-04-02 21:27:53 +02:00
|
|
|
FAR const void *buf, size_t buflen,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const struct netdev_varaddr_s *destmac);
|
2017-04-01 17:07:16 +02:00
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_hc06_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
2020-04-12 19:18:02 +02:00
|
|
|
* sixlowpan_hc06_initialize() is called during OS initialization at
|
|
|
|
* power-up reset. It is called from the common sixlowpan_initialize()
|
|
|
|
* function. sixlowpan_hc06_initialize() configures HC06 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.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
|
|
|
|
void sixlowpan_hc06_initialize(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-02 18:06:31 +02:00
|
|
|
* Name: sixlowpan_compresshdr_hc06
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Compress IP/UDP header
|
|
|
|
*
|
|
|
|
* This function is called by the 6lowpan code to create a compressed
|
|
|
|
* 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the
|
|
|
|
* uip_buf buffer.
|
|
|
|
*
|
2017-09-08 23:04:51 +02:00
|
|
|
* HC-06:
|
|
|
|
*
|
|
|
|
* Originally draft-ietf-6lowpan-hc, version 6:
|
|
|
|
* http://tools.ietf.org/html/draft-ietf-6lowpan-hc-06,
|
|
|
|
*
|
|
|
|
* Updated to:
|
|
|
|
*
|
|
|
|
* RFC 6282:
|
|
|
|
* https://tools.ietf.org/html/rfc6282
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* NOTE: sixlowpan_compresshdr_hc06() does not support ISA100_UDP header
|
|
|
|
* compression
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
* ipv6 - The IPv6 header to be compressed
|
|
|
|
* destmac - L2 destination address, needed to compress the IP
|
|
|
|
* destination field
|
|
|
|
* fptr - Pointer to frame to be compressed.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2017-06-26 00:09:09 +02:00
|
|
|
* On success the indications of the defines COMPRESS_HDR_* are returned.
|
|
|
|
* A negated errno value is returned on failure.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_compresshdr_hc06(FAR struct radio_driver_s *radio,
|
2017-06-26 00:09:09 +02:00
|
|
|
FAR const struct ipv6_hdr_s *ipv6,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const struct netdev_varaddr_s *destmac,
|
2017-06-26 00:09:09 +02:00
|
|
|
FAR uint8_t *fptr);
|
2017-03-30 02:07:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-04-02 18:06:31 +02:00
|
|
|
* Name: sixlowpan_uncompresshdr_hc06
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Uncompress HC06 (i.e., IPHC and LOWPAN_UDP) headers and put them in
|
|
|
|
* sixlowpan_buf
|
|
|
|
*
|
|
|
|
* This function is called by the input function when the dispatch is HC06.
|
2017-05-04 17:05:41 +02:00
|
|
|
* We process the frame in the IOB buffer, uncompress the header fields,
|
|
|
|
* and copy the result into the driver packet buffer. At the end of the
|
2017-04-04 15:22:59 +02:00
|
|
|
* decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the
|
2017-03-30 02:07:52 +02:00
|
|
|
* appropriate values
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-31 03:10:51 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
* metadata - Obfuscated MAC metadata including node addressing
|
|
|
|
* information.
|
|
|
|
* 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 first fragment.
|
|
|
|
* iob - Pointer to the IOB containing the received frame.
|
|
|
|
* fptr - Pointer to frame to be compressed.
|
|
|
|
* bptr - Output goes here. Normally this is a known offset into
|
|
|
|
* d_buf, may be redirected to a "bitbucket" on the case of
|
|
|
|
* FRAGN frames.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
|
2017-08-19 16:48:52 +02:00
|
|
|
void sixlowpan_uncompresshdr_hc06(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *metadata,
|
2017-06-22 21:55:08 +02:00
|
|
|
uint16_t iplen, FAR struct iob_s *iob,
|
2017-04-16 20:18:42 +02:00
|
|
|
FAR uint8_t *fptr, FAR uint8_t *bptr);
|
2017-03-30 02:07:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_compresshdr_hc1
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Compress IP/UDP header using HC1 and HC_UDP
|
|
|
|
*
|
|
|
|
* This function is called by the 6lowpan code to create a compressed
|
|
|
|
* 6lowpan packet in the packetbuf buffer from a full IPv6 packet in the
|
|
|
|
* uip_buf buffer.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-04-02 18:06:31 +02:00
|
|
|
* ipv6 - The IPv6 header to be compressed
|
2017-04-02 02:24:21 +02:00
|
|
|
* destmac - L2 destination address, needed to compress the IP
|
2017-04-02 18:06:31 +02:00
|
|
|
* destination field
|
2017-04-16 20:18:42 +02:00
|
|
|
* fptr - Pointer to frame to be compressed.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2017-06-26 00:09:09 +02:00
|
|
|
* On success the indications of the defines COMPRESS_HDR_* are returned.
|
|
|
|
* A negated errno value is returned on failure.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_compresshdr_hc1(FAR struct radio_driver_s *radio,
|
2017-06-26 00:09:09 +02:00
|
|
|
FAR const struct ipv6_hdr_s *ipv6,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const struct netdev_varaddr_s *destmac,
|
2017-06-26 00:09:09 +02:00
|
|
|
FAR uint8_t *fptr);
|
2017-03-30 02:07:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_uncompresshdr_hc1
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Uncompress HC1 (and HC_UDP) headers and put them in sixlowpan_buf
|
|
|
|
*
|
|
|
|
* This function is called by the input function when the dispatch is
|
2017-05-04 17:05:41 +02:00
|
|
|
* HC1. It processes the frame in the IOB buffer, uncompresses the
|
|
|
|
* header fields, and copies the result in the packet buffer. At the
|
2017-04-04 15:22:59 +02:00
|
|
|
* end of the decompression, g_frame_hdrlen and uncompressed_hdr_len
|
2017-03-30 02:07:52 +02:00
|
|
|
* are set to the appropriate values
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-07-31 03:10:51 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
* metadata - Obfuscated MAC metadata including node addressing
|
|
|
|
* information.
|
|
|
|
* 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 fragment.
|
|
|
|
* iob - Pointer to the IOB containing the received frame.
|
|
|
|
* fptr - Pointer to frame to be uncompressed.
|
|
|
|
* bptr - Output goes here. Normally this is a known offset into
|
|
|
|
* d_buf, may be redirected to a "bitbucket" on the case of
|
|
|
|
* FRAGN frames.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
2018-09-14 14:55:45 +02:00
|
|
|
* Zero (OK) is returned on success, on failure a negated errno value is
|
2017-04-16 20:18:42 +02:00
|
|
|
* returned.
|
2017-03-30 02:07:52 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_uncompresshdr_hc1(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *metadata, uint16_t iplen,
|
|
|
|
FAR struct iob_s *iob, FAR uint8_t *fptr,
|
|
|
|
FAR uint8_t *bptr);
|
2017-03-30 02:07:52 +02:00
|
|
|
#endif
|
|
|
|
|
2017-11-22 19:10:39 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_nexthopaddr
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* sixlowpan_nexthopaddr(): If the destination is on-link, extract the
|
2020-04-12 19:18:02 +02:00
|
|
|
* IEEE 802.15.14 destination address from the destination IP address. If
|
|
|
|
* the destination is not reachable directly, use the routing table (if
|
|
|
|
* available) or fall back to the default router IP address and use the
|
|
|
|
* router IP address to derive the IEEE 802.15.4 MAC address.
|
2017-11-22 19:10:39 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int sixlowpan_nexthopaddr(FAR struct radio_driver_s *radio,
|
|
|
|
FAR const net_ipv6addr_t ipaddr,
|
|
|
|
FAR struct netdev_varaddr_s *destaddr);
|
|
|
|
|
2017-04-01 21:42:00 +02:00
|
|
|
/****************************************************************************
|
2017-06-30 17:32:17 +02:00
|
|
|
* Name: sixlowpan_islinklocal, sixlowpan_destaddrfromip, and
|
2017-05-06 22:24:06 +02:00
|
|
|
* sixlowpan_ismacbased
|
2017-04-01 21:42:00 +02:00
|
|
|
*
|
|
|
|
* Description:
|
2017-06-30 17:32:17 +02:00
|
|
|
* sixlowpan_destaddrfromip(): Extract the IEEE 802.15.14 destination
|
|
|
|
* address from a MAC-based destination IPv6 address. This function
|
|
|
|
* handles a tagged address union which may either a short or and
|
|
|
|
* extended destination address.
|
|
|
|
*
|
|
|
|
* In the case there the IEEE 802.15.4 node functions as an endpoint in a
|
|
|
|
* start topology, the destination address will, instead, be the address
|
2019-09-20 02:19:18 +02:00
|
|
|
* of the star hub (which is assumed to be the address of the coordinator).
|
2017-06-23 17:44:36 +02:00
|
|
|
*
|
|
|
|
* sixlowpan_ipfrom[s|e]addr(): Create a link-local, MAC-based IPv6
|
|
|
|
* address from an IEEE802.15.4 short address (saddr) or extended address
|
|
|
|
* (eaddr).
|
2017-05-06 22:24:06 +02:00
|
|
|
*
|
|
|
|
* sixlowpan_islinklocal() and sixlowpan_ismacbased() will return true for
|
2020-04-12 19:18:02 +02:00
|
|
|
* address created in this fashion. sixlowpan_destaddrfromip() is
|
|
|
|
* intended to handle a tagged address or any size. Local addresses are
|
|
|
|
* of a fixed but configurable size and sixlowpan_isaddrbased() is for use
|
|
|
|
* with such local addresses.
|
2017-04-01 21:42:00 +02:00
|
|
|
*
|
|
|
|
* 128 112 96 80 64 48 32 16
|
|
|
|
* ---- ---- ---- ---- ---- ---- ---- ----
|
2020-04-12 19:18:02 +02:00
|
|
|
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte short address IEEE
|
|
|
|
* 48-bit MAC
|
|
|
|
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE
|
|
|
|
* EUI-64
|
2017-04-01 21:42:00 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-04-04 01:04:56 +02:00
|
|
|
#define sixlowpan_islinklocal(ipaddr) ((ipaddr)[0] == NTOHS(0xfe80))
|
2017-04-01 23:05:38 +02:00
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_destaddrfromip(FAR struct radio_driver_s *radio,
|
2017-06-30 17:32:17 +02:00
|
|
|
const net_ipv6addr_t ipaddr,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR struct netdev_varaddr_s *addr);
|
2017-06-23 17:44:36 +02:00
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
void sixlowpan_ipfromaddr(FAR const struct netdev_varaddr_s *addr,
|
|
|
|
FAR net_ipv6addr_t ipaddr);
|
2017-05-06 22:24:06 +02:00
|
|
|
|
2017-04-01 23:05:38 +02:00
|
|
|
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const struct netdev_varaddr_s *addr);
|
2017-04-01 21:42:00 +02:00
|
|
|
|
2017-09-10 18:13:33 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_radio_framelen
|
|
|
|
*
|
|
|
|
* Description:
|
2020-02-23 09:50:23 +01:00
|
|
|
* Get the maximum frame length supported by radio network driver.
|
2017-09-10 18:13:33 +02:00
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-09-10 18:13:33 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* A non-negative, maximum frame lengthis returned on success; A negated
|
|
|
|
* errno valueis returned on any failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int sixlowpan_radio_framelen(FAR struct radio_driver_s *radio);
|
|
|
|
|
2017-04-22 00:23:40 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_src_panid
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Get the source PAN ID from the IEEE802.15.4 radio.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-29 21:42:26 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
2017-04-22 00:23:40 +02:00
|
|
|
* panid - The location in which to return the PAN ID. 0xfff may be
|
|
|
|
* returned if the device is not associated.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-07-31 03:10:51 +02:00
|
|
|
#ifdef CONFIG_WIRELESS_IEEE802154
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_src_panid(FAR struct radio_driver_s *radio,
|
2017-06-19 11:55:28 +02:00
|
|
|
FAR uint8_t *panid);
|
2017-07-31 03:10:51 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_extract_srcaddr
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Extract the source MAC address from the radio-specific RX metadata, and
|
|
|
|
* return the source address in a radio-agnostic form.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-31 03:10:51 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
* metadata - Opaque reference to the radio-specific RX metadata.
|
|
|
|
* srcaddr - The location in which to return the source MAC address.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_extract_srcaddr(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *metadata,
|
|
|
|
FAR struct netdev_varaddr_s *srcaddr);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_extract_destaddr
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Extract the destination MAC address from the radio-specific RX metadata,
|
|
|
|
* and return the destination address in a radio-agnostic form.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-07-31 03:10:51 +02:00
|
|
|
* radio - Reference to a radio network driver state instance.
|
|
|
|
* metadata - Opaque reference to the radio-specific RX metadata.
|
|
|
|
* destaddr - The location in which to return the destination MAC address.
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-08-19 16:48:52 +02:00
|
|
|
int sixlowpan_extract_destaddr(FAR struct radio_driver_s *radio,
|
2017-07-31 03:10:51 +02:00
|
|
|
FAR const void *metadata,
|
|
|
|
FAR struct netdev_varaddr_s *destaddr);
|
2017-07-29 21:42:26 +02:00
|
|
|
|
2017-08-26 18:00:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_reass_initialize
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function initializes the reassembly buffer allocator. This
|
|
|
|
* function must be called early in the initialization sequence before
|
|
|
|
* any radios begin operation.
|
|
|
|
*
|
|
|
|
* Called only once during network initialization.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-26 18:00:47 +02:00
|
|
|
* None
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-26 18:00:47 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void sixlowpan_reass_initialize(void);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_reass_allocate
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* The sixlowpan_reass_allocate function will get a free reassembly buffer
|
|
|
|
* structure for use by 6LoWPAN.
|
|
|
|
*
|
|
|
|
* This function will first attempt to allocate from the g_free_reass
|
|
|
|
* list. If that the list is empty, then the reassembly buffer structure
|
|
|
|
* will be allocated from the dynamic memory pool.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-26 18:00:47 +02:00
|
|
|
* reasstag - The reassembly tag for subsequent lookup.
|
|
|
|
* fragsrc - The source address of the fragment.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-26 18:00:47 +02:00
|
|
|
* A reference to the allocated reass structure. All fields used by the
|
|
|
|
* reasembly logic have been zeroed. On a failure to allocate, NULL is
|
|
|
|
* returned.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The network is locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct sixlowpan_reassbuf_s *
|
|
|
|
sixlowpan_reass_allocate(uint16_t reasstag,
|
|
|
|
FAR const struct netdev_varaddr_s *fragsrc);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_reass_find
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Find a previously allocated, active reassembly buffer with the specified
|
|
|
|
* reassembly tag.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-26 18:00:47 +02:00
|
|
|
* reasstag - The reassembly tag to match.
|
|
|
|
* fragsrc - The source address of the fragment.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-26 18:00:47 +02:00
|
|
|
* A reference to the matching reass structure.
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The network is locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
FAR struct sixlowpan_reassbuf_s *
|
|
|
|
sixlowpan_reass_find(uint16_t reasstag,
|
|
|
|
FAR const struct netdev_varaddr_s *fragsrc);
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: sixlowpan_reass_free
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* The sixlowpan_reass_free function will return a reass structure
|
|
|
|
* to the free list of messages if it was a pre-allocated reass
|
|
|
|
* structure. If the reass structure was allocated dynamically it will
|
|
|
|
* be deallocated.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2017-08-26 18:00:47 +02:00
|
|
|
* reass - reass structure to free
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2017-08-26 18:00:47 +02:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Assumptions:
|
|
|
|
* The network is locked.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void sixlowpan_reass_free(FAR struct sixlowpan_reassbuf_s *reass);
|
|
|
|
|
2017-03-30 02:07:52 +02:00
|
|
|
#endif /* CONFIG_NET_6LOWPAN */
|
2022-01-15 03:44:35 +01:00
|
|
|
#endif /* __NET_SIXLOWPAN_SIXLOWPAN_INTERNAL_H */
|