6loWPAN: Remove final references to Rime from code.

This commit is contained in:
Gregory Nutt 2017-05-04 09:05:41 -06:00
parent 969c1ab614
commit 6f6e61769a
12 changed files with 218 additions and 228 deletions

View File

@ -82,22 +82,22 @@
* bytes for all subsequent headers.
*/
#define RIME_FRAG_DISPATCH_SIZE 0 /* 16 bit */
#define RIME_FRAG_TAG 2 /* 16 bit */
#define RIME_FRAG_OFFSET 4 /* 8 bit */
#define SIXLOWPAN_FRAG_DISPATCH_SIZE 0 /* 16 bit */
#define SIXLOWPAN_FRAG_TAG 2 /* 16 bit */
#define SIXLOWPAN_FRAG_OFFSET 4 /* 8 bit */
/* Define the Rime buffer as a byte array */
/* Define the frame buffer as a byte array */
#define RIME_HC1_DISPATCH 0 /* 8 bit */
#define RIME_HC1_ENCODING 1 /* 8 bit */
#define RIME_HC1_TTL 2 /* 8 bit */
#define SIXLOWPAN_HC1_DISPATCH 0 /* 8 bit */
#define SIXLOWPAN_HC1_ENCODING 1 /* 8 bit */
#define SIXLOWPAN_HC1_TTL 2 /* 8 bit */
#define RIME_HC1_HC_UDP_DISPATCH 0 /* 8 bit */
#define RIME_HC1_HC_UDP_HC1_ENCODING 1 /* 8 bit */
#define RIME_HC1_HC_UDP_UDP_ENCODING 2 /* 8 bit */
#define RIME_HC1_HC_UDP_TTL 3 /* 8 bit */
#define RIME_HC1_HC_UDP_PORTS 4 /* 8 bit */
#define RIME_HC1_HC_UDP_CHKSUM 5 /* 16 bit */
#define SIXLOWPAN_HC1_HC_UDP_DISPATCH 0 /* 8 bit */
#define SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING 1 /* 8 bit */
#define SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING 2 /* 8 bit */
#define SIXLOWPAN_HC1_HC_UDP_TTL 3 /* 8 bit */
#define SIXLOWPAN_HC1_HC_UDP_PORTS 4 /* 8 bit */
#define SIXLOWPAN_HC1_HC_UDP_CHKSUM 5 /* 16 bit */
/* Min and Max compressible UDP ports - HC06 */

View File

@ -134,12 +134,12 @@ endif # NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_0
endif # NET_6LOWPAN_COMPRESSION_HC06
config NET_6LOWPAN_EXTENDEDADDR
bool "Extended Rime address"
bool "Extended IEEE 802.15.4 address"
default n
---help---
By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC
By default, a 2-byte short address is used for the IEEE802.15.4 MAC
device's link layer address. If this option is selected, then an
8-byte Rime address will be used.
8-byte extended address will be used.
config NET_6LOWPAN_MAXAGE
int "Packet reassembly timeout"

View File

@ -10,12 +10,12 @@ Optimal 6loWPAN Configuration
128 112 96 80 64 48 32 16
---- ---- ---- ---- ---- ---- ---- ----
AAAA xxxx xxxx xxxx xxxx 00ff fe00 MMMM 2-byte Rime address IEEE 48-bit MAC
AAAA 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte Rime address IEEE EUI-64
AAAA xxxx xxxx xxxx xxxx 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC
AAAA 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64
Where MMM is the 2-byte rime address XORed 0x0200. For example, the MAC
Where MMM is the 2-byte short address XORed 0x0200. For example, the MAC
address of 0xabcd would be 0xa9cd. And NNNN NNNN NNNN NNNN is the 8-byte
rime address address XOR 02000 0000 0000 0000.
extended address address XOR 02000 0000 0000 0000.
For link-local address, AAAA is 0xfe80
@ -23,8 +23,8 @@ Optimal 6loWPAN Configuration
128 112 96 80 64 48 32 16
---- ---- ---- ---- ---- ---- ---- ----
fe80 0000 0000 0000 0000 00ff fe00 MMMM 2-byte Rime address IEEE 48-bit MAC
fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte Rime address IEEE EUI-64
fe80 0000 0000 0000 0000 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC
fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64
4. Compressable port numbers in the rangs 0xf0b0-0xf0bf
@ -52,11 +52,11 @@ this is a HC1 compressed first frame of a packet
41 88 2a cefa 3412 cdab ### 9-byte MAC header
c50e 000b ### 4-byte FRAG1 header
42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING
e0 ### RIME_HC1_HC_UDP_UDP_ENCODING
00 ### RIME_HC1_HC_UDP_TTL
10 ### RIME_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM
fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
00 ### SIXLOWPAN_HC1_HC_UDP_TTL
10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
104 byte Payload follows:
4f4e452064617920 48656e6e792d7065 6e6e792077617320 7069636b696e6720
@ -69,11 +69,11 @@ This is the second frame of the same transfer:
41 88 2b cefa 3412 cdab ### 9-byte MAC header
e50e 000b 0d ### 5 byte FRAGN header
42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING
e0 ### RIME_HC1_HC_UDP_UDP_ENCODING
00 ### RIME_HC1_HC_UDP_TTL
10 ### RIME_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM
fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
00 ### SIXLOWPAN_HC1_HC_UDP_TTL
10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
104 byte Payload follows:
476f6f646e657373 2067726163696f75 73206d6521272073 6169642048656e6e

View File

@ -231,7 +231,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
g_uncomp_hdrlen = 0;
g_frame_hdrlen = 0;
/* Reset rime buffer, packet buffer metatadata */
/* Reset address buffer and packet buffer metatadata */
memset(g_pktattrs, 0, PACKETBUF_NUM_ATTRS * sizeof(uint16_t));
memset(g_pktaddrs, 0, PACKETBUF_NUM_ADDRS * sizeof(struct sixlowpan_addr_s));
@ -286,9 +286,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
/* Set the source and destination address */
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
sixlowpan_addrcopy(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
&ieee->i_dev.d_mac.ieee802154);
rimeaddr_copy(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], destmac);
sixlowpan_addrcopy(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], destmac);
/* Get the destination PAN ID.
*
@ -400,9 +400,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
*/
pktlen = buflen + g_uncomp_hdrlen;
PUTINT16(fragptr, RIME_FRAG_DISPATCH_SIZE,
PUTINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE,
((SIXLOWPAN_DISPATCH_FRAG1 << 8) | pktlen));
PUTINT16(fragptr, RIME_FRAG_TAG, ieee->i_dgramtag);
PUTINT16(fragptr, SIXLOWPAN_FRAG_TAG, ieee->i_dgramtag);
g_frame_hdrlen += SIXLOWPAN_FRAG1_HDR_LEN;
@ -469,10 +469,10 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
/* Setup up the FRAGN header after the frame header. */
PUTINT16(fragptr, RIME_FRAG_DISPATCH_SIZE,
PUTINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE,
((SIXLOWPAN_DISPATCH_FRAGN << 8) | pktlen));
PUTINT16(fragptr, RIME_FRAG_TAG, ieee->i_dgramtag);
fragptr[RIME_FRAG_OFFSET] = outlen >> 3;
PUTINT16(fragptr, SIXLOWPAN_FRAG_TAG, ieee->i_dgramtag);
fragptr[SIXLOWPAN_FRAG_OFFSET] = outlen >> 3;
fragn_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;

View File

@ -70,8 +70,8 @@
* Name: sixlowpan_addrnull
*
* Description:
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
* If the output address is NULL in the MAC header buf, then it is
* broadcast on the 802.15.4 network.
*
* Input parameters:
* addrmode - The address mode
@ -138,8 +138,8 @@ int sixlowpan_meta_data(uint16_t dest_panid,
meta->fcf.frame_type = FRAME802154_DATAFRAME;
meta->fcf.frame_pending = g_pktattrs[PACKETBUF_ATTR_PENDING];
/* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
/* If the output address is NULL in the MAC header buf, then it is
* broadcast on the 802.15.4 network.
*/
rcvrnull = sixlowpan_addrnull(g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8);
@ -163,8 +163,8 @@ int sixlowpan_meta_data(uint16_t dest_panid,
meta->src_pid = src_panid;
meta->dest_pid = dest_panid;
/* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
/* If the output address is NULL in the MAC header buf, then it is
* broadcast on the 802.15.4 network.
*/
if (rcvrnull)
@ -179,7 +179,7 @@ int sixlowpan_meta_data(uint16_t dest_panid,
{
/* Copy the destination address */
rimeaddr_copy((struct sixlowpan_addr_s *)&meta->dest_addr,
sixlowpan_addrcopy((struct sixlowpan_addr_s *)&meta->dest_addr,
g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8);
/* Use short destination address mode if so configured */
@ -193,7 +193,7 @@ int sixlowpan_meta_data(uint16_t dest_panid,
/* Set the source address to the node address assigned to the device */
rimeaddr_copy((struct sixlowpan_addr_s *)&meta->src_addr,
sixlowpan_addrcopy((struct sixlowpan_addr_s *)&meta->src_addr,
&ieee->i_dev.d_mac.ieee802154);
/* Use short soruce address mode if so configured */

View File

@ -316,7 +316,7 @@ static void uncompress_addr(FAR net_ipv6addr_t ipaddr, uint8_t const prefix[],
{
/* No IID based configuration if no prefix and no data => unspec */
sixlowpan_ipfromrime(macaddr, ipaddr);
sixlowpan_ipfromaddr(macaddr, ipaddr);
}
ninfo("Uncompressing %d + %d => %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
@ -828,8 +828,8 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
* sixlowpan_buf
*
* This function is called by the input function when the dispatch is HC06.
* We process the packet in the rime buffer, uncompress the header fields,
* and copy the result in the sixlowpan buffer. At the end of the
* 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
* decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the
* appropriate values
*

View File

@ -137,12 +137,12 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
{
/* IPV6 DISPATCH
* Something cannot be compressed, use IPV6 DISPATCH, compress
* nothing, copy IPv6 header in rime buffer
* nothing, copy IPv6 header into the frame buffer
*/
/* IPv6 dispatch header (1 byte) */
hc1[RIME_HC1_DISPATCH] = SIXLOWPAN_DISPATCH_IPV6;
hc1[SIXLOWPAN_HC1_DISPATCH] = SIXLOWPAN_DISPATCH_IPV6;
g_frame_hdrlen += SIXLOWPAN_IPV6_HDR_LEN;
memcpy(fptr + g_frame_hdrlen, ipv6, IPv6_HDRLEN);
@ -156,15 +156,15 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
* header is UDP, we compress UDP header using HC2
*/
hc1[RIME_HC1_DISPATCH] = SIXLOWPAN_DISPATCH_HC1;
hc1[SIXLOWPAN_HC1_DISPATCH] = SIXLOWPAN_DISPATCH_HC1;
g_uncomp_hdrlen += IPv6_HDRLEN;
switch (ipv6->proto)
{
case IP_PROTO_ICMP6:
/* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfc;
hc1[RIME_HC1_TTL] = ipv6->ttl;
hc1[SIXLOWPAN_HC1_ENCODING] = 0xfc;
hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break;
@ -172,8 +172,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
case IP_PROTO_TCP:
/* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfe;
hc1[RIME_HC1_TTL] = ipv6->ttl;
hc1[SIXLOWPAN_HC1_ENCODING] = 0xfe;
hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break;
#endif /* CONFIG_NET_TCP */
@ -201,17 +201,17 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
/* HC1 encoding */
hcudp[RIME_HC1_HC_UDP_HC1_ENCODING] = 0xfb;
hcudp[SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING] = 0xfb;
/* HC_UDP encoding, ttl, src and dest ports, checksum */
hcudp[RIME_HC1_HC_UDP_UDP_ENCODING] = 0xe0;
hcudp[RIME_HC1_HC_UDP_TTL] = ipv6->ttl;
hcudp[RIME_HC1_HC_UDP_PORTS] =
hcudp[SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING] = 0xe0;
hcudp[SIXLOWPAN_HC1_HC_UDP_TTL] = ipv6->ttl;
hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] =
(uint8_t)((ntohs(udp->srcport) - CONFIG_NET_6LOWPAN_MINPORT) << 4) +
(uint8_t)((ntohs(udp->destport) - CONFIG_NET_6LOWPAN_MINPORT));
memcpy(&hcudp[RIME_HC1_HC_UDP_CHKSUM], &udp->udpchksum, 2);
memcpy(&hcudp[SIXLOWPAN_HC1_HC_UDP_CHKSUM], &udp->udpchksum, 2);
g_frame_hdrlen += SIXLOWPAN_HC1_HC_UDP_HDR_LEN;
g_uncomp_hdrlen += UDP_HDRLEN;
@ -220,8 +220,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
{
/* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfa;
hc1[RIME_HC1_TTL] = ipv6->ttl;
hc1[SIXLOWPAN_HC1_ENCODING] = 0xfa;
hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
}
}
@ -238,8 +238,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
* Uncompress HC1 (and HC_UDP) headers and put them in sixlowpan_buf
*
* This function is called by the input function when the dispatch is
* HC1. It processes the packet in the rime buffer, uncompresses the
* header fields, and copies the result in the sixlowpan buffer. At the
* HC1. It processes the frame in the IOB buffer, uncompresses the
* header fields, and copies the result in the packet buffer. At the
* end of the decompression, g_frame_hdrlen and uncompressed_hdr_len
* are set to the appropriate values
*
@ -275,26 +275,26 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
* addresses.
*/
sixlowpan_ipfromrime(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
sixlowpan_ipfromaddr(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
ipv6->srcipaddr);
sixlowpan_ipfromrime(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER],
sixlowpan_ipfromaddr(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER],
ipv6->destipaddr);
g_uncomp_hdrlen += IPv6_HDRLEN;
/* len[], proto, and ttl depend on the encoding */
switch (hc1[RIME_HC1_ENCODING] & 0x06)
switch (hc1[SIXLOWPAN_HC1_ENCODING] & 0x06)
{
case SIXLOWPAN_HC1_NH_ICMP6:
ipv6->proto = IP_PROTO_ICMP6;
ipv6->ttl = hc1[RIME_HC1_TTL];
ipv6->ttl = hc1[SIXLOWPAN_HC1_TTL];
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break;
#if CONFIG_NET_TCP
case SIXLOWPAN_HC1_NH_TCP:
ipv6->proto = IP_PROTO_TCP;
ipv6->ttl = hc1[RIME_HC1_TTL];
ipv6->ttl = hc1[SIXLOWPAN_HC1_TTL];
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break;
#endif /* CONFIG_NET_TCP */
@ -306,11 +306,11 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
FAR uint8_t *hcudp = fptr + g_frame_hdrlen;
ipv6->proto = IP_PROTO_UDP;
if ((hcudp[RIME_HC1_HC_UDP_HC1_ENCODING] & 0x01) != 0)
if ((hcudp[SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING] & 0x01) != 0)
{
/* UDP header is compressed with HC_UDP */
if (hcudp[RIME_HC1_HC_UDP_UDP_ENCODING] !=
if (hcudp[SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING] !=
SIXLOWPAN_HC_UDP_ALL_C)
{
nwarn("WARNING: sixlowpan (uncompress_hdr), packet not supported");
@ -319,16 +319,16 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
/* IP TTL */
ipv6->ttl = hcudp[RIME_HC1_HC_UDP_TTL];
ipv6->ttl = hcudp[SIXLOWPAN_HC1_HC_UDP_TTL];
/* UDP ports, len, checksum */
udp->srcport =
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[RIME_HC1_HC_UDP_PORTS] >> 4));
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] >> 4));
udp->destport =
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[RIME_HC1_HC_UDP_PORTS] & 0x0F));
htons(CONFIG_NET_6LOWPAN_MINPORT + (hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] & 0x0F));
memcpy(&udp->udpchksum, &hcudp[RIME_HC1_HC_UDP_CHKSUM], 2);
memcpy(&udp->udpchksum, &hcudp[SIXLOWPAN_HC1_HC_UDP_CHKSUM], 2);
g_uncomp_hdrlen += UDP_HDRLEN;
g_frame_hdrlen += SIXLOWPAN_HC1_HC_UDP_HDR_LEN;

View File

@ -291,7 +291,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
*/
fragptr = fptr + hdrsize;
switch ((GETINT16(fragptr, RIME_FRAG_DISPATCH_SIZE) & 0xf800) >> 8)
switch ((GETINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE) & 0xf800) >> 8)
{
/* First fragment of new reassembly */
@ -299,8 +299,8 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
{
/* Set up for the reassembly */
fragsize = GETINT16(fragptr, RIME_FRAG_DISPATCH_SIZE) & 0x07ff;
fragtag = GETINT16(fragptr, RIME_FRAG_TAG);
fragsize = GETINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE) & 0x07ff;
fragtag = GETINT16(fragptr, SIXLOWPAN_FRAG_TAG);
g_frame_hdrlen += SIXLOWPAN_FRAG1_HDR_LEN;
ninfo("FRAG1: fragsize=%d fragtag=%d fragoffset=%d\n",
@ -317,9 +317,9 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
{
/* Set offset, tag, size. Offset is in units of 8 bytes. */
fragoffset = fragptr[RIME_FRAG_OFFSET];
fragtag = GETINT16(fragptr, RIME_FRAG_TAG);
fragsize = GETINT16(fragptr, RIME_FRAG_DISPATCH_SIZE) & 0x07ff;
fragoffset = fragptr[SIXLOWPAN_FRAG_OFFSET];
fragtag = GETINT16(fragptr, SIXLOWPAN_FRAG_TAG);
fragsize = GETINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE) & 0x07ff;
g_frame_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;
ninfo("FRAGN: fragsize=%d fragtag=%d fragoffset=%d\n",
@ -402,7 +402,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
/* Verify that this fragment is part of that reassembly sequence */
else if (fragsize != ieee->i_pktlen || ieee->i_reasstag != fragtag ||
!rimeaddr_cmp(&ieee->i_fragsrc, &g_pktaddrs[PACKETBUF_ADDR_SENDER]))
!sixlowpan_addrcmp(&ieee->i_fragsrc, &g_pktaddrs[PACKETBUF_ADDR_SENDER]))
{
/* The packet is a fragment that does not belong to the packet
* being reassembled or the packet is not a fragment.
@ -454,7 +454,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
ninfo("Starting reassembly: i_pktlen %u, i_reasstag %d\n",
ieee->i_pktlen, ieee->i_reasstag);
rimeaddr_copy(&ieee->i_fragsrc, &g_pktaddrs[PACKETBUF_ADDR_SENDER]);
sixlowpan_addrcopy(&ieee->i_fragsrc, &g_pktaddrs[PACKETBUF_ADDR_SENDER]);
}
#endif /* CONFIG_NET_6LOWPAN_FRAG */
@ -463,7 +463,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
hc1 = fptr + g_frame_hdrlen;
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
if ((hc1[RIME_HC1_DISPATCH] & SIXLOWPAN_DISPATCH_IPHC_MASK) == SIXLOWPAN_DISPATCH_IPHC)
if ((hc1[SIXLOWPAN_HC1_DISPATCH] & SIXLOWPAN_DISPATCH_IPHC_MASK) == SIXLOWPAN_DISPATCH_IPHC)
{
ninfo("IPHC Dispatch\n");
sixlowpan_uncompresshdr_hc06(fragsize, iob, fptr, bptr);
@ -472,7 +472,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
#endif /* CONFIG_NET_6LOWPAN_COMPRESSION_HC06 */
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1
if (hc1[RIME_HC1_DISPATCH] == SIXLOWPAN_DISPATCH_HC1)
if (hc1[SIXLOWPAN_HC1_DISPATCH] == SIXLOWPAN_DISPATCH_HC1)
{
ninfo("HC1 Dispatch\n");
sixlowpan_uncompresshdr_hc1(fragsize, iob, fptr, bptr);
@ -480,7 +480,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
else
#endif /* CONFIG_NET_6LOWPAN_COMPRESSION_HC1 */
if (hc1[RIME_HC1_DISPATCH] == SIXLOWPAN_DISPATCH_IPV6)
if (hc1[SIXLOWPAN_HC1_DISPATCH] == SIXLOWPAN_DISPATCH_IPV6)
{
ninfo("IPv6 Dispatch\n");
sixlowpan_uncompress_ipv6hdr(fptr, bptr);
@ -489,7 +489,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
{
/* Unknown or unsupported header */
nwarn("WARNING: Unknown dispatch: %u\n", hc1[RIME_HC1_DISPATCH]);
nwarn("WARNING: Unknown dispatch: %u\n", hc1[SIXLOWPAN_HC1_DISPATCH]);
return OK;
}
@ -519,10 +519,10 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
#endif /* CONFIG_NET_6LOWPAN_FRAG */
/* Copy "payload" from the rime buffer to the IEEE802.15.4 MAC driver's
* d_buf. If this frame is a first fragment or not part of a fragmented
* packet, we have already copied the compressed headers, g_uncomp_hdrlen
* and g_frame_hdrlen are non-zerio, fragoffset is.
/* Copy "payload" from the frame buffer to the IEEE802.15.4 MAC driver's
* packet buffer, d_buf. If this frame is a first fragment or not part of
* a fragmented packet, we have already copied the compressed headers,
* g_uncomp_hdrlen and g_frame_hdrlen are non-zerio, fragoffset is.
*/
paysize = iob->io_len - g_frame_hdrlen;
@ -751,12 +751,12 @@ int sixlowpan_input(FAR struct ieee802154_driver_s *ieee,
ipv6hdr = IPv6BUF(&ieee->i_dev);
/* Get the Rime MAC address of the destination. This
* assumes an encoding of the MAC address in the IPv6
/* Get the IEEE 802.15.4 MAC address of the destination.
* This assumes an encoding of the MAC address in the IPv6
* address.
*/
sixlowpan_rimefromip(ipv6hdr->destipaddr, &destmac);
sixlowpan_addrfromip(ipv6hdr->destipaddr, &destmac);
/* The data payload should follow the IPv6 header plus
* the protocol header.

View File

@ -71,19 +71,17 @@
* Pre-processor Definitions
****************************************************************************/
/* Rime addres macros */
/* Copy a Rime address */
/* IEEE 802.15.4 addres macros */
/* Copy a an IEEE 802.15.4 address */
#define rimeaddr_copy(dest,src) \
#define sixlowpan_addrcopy(dest,src) \
memcpy(dest, src, NET_6LOWPAN_ADDRSIZE)
/* Compare two Rime addresses */
/* Compare two IEEE 802.15.4 addresses */
#define rimeaddr_cmp(addr1,addr2) \
#define sixlowpan_addrcmp(addr1,addr2) \
(memcmp(addr1, addr2, NET_6LOWPAN_ADDRSIZE) == 0)
/* Pointers in the Rime buffer */
/* Packet buffer Definitions */
#define PACKETBUF_ATTR_PACKET_TYPE_DATA 0
@ -198,14 +196,6 @@ struct ipv6icmp_hdr_s
* during that processing
*/
/* A pointer to the rime buffer.
*
* We initialize it to the beginning of the rime buffer, then access
* different fields by updating the offset ieee->g_frame_hdrlen.
*/
extern FAR uint8_t *g_rimeptr;
/* 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).
*/
@ -449,8 +439,8 @@ void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
* sixlowpan_buf
*
* This function is called by the input function when the dispatch is HC06.
* We process the packet in the rime buffer, uncompress the header fields,
* and copy the result in the sixlowpan buffer. At the end of the
* 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
* decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the
* appropriate values
*
@ -509,8 +499,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
* Uncompress HC1 (and HC_UDP) headers and put them in sixlowpan_buf
*
* This function is called by the input function when the dispatch is
* HC1. It processes the packet in the rime buffer, uncompresses the
* header fields, and copies the result in the sixlowpan buffer. At the
* HC1. It processes the frame in the IOB buffer, uncompresses the
* header fields, and copies the result in the packet buffer. At the
* end of the decompression, g_frame_hdrlen and uncompressed_hdr_len
* are set to the appropriate values
*
@ -535,34 +525,34 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
#endif
/****************************************************************************
* Name: sixlowpan_islinklocal, sixlowpan_ipfromrime, sixlowpan_rimefromip,
* Name: sixlowpan_islinklocal, sixlowpan_ipfromaddr, sixlowpan_addrfromip,
* and sixlowpan_ismacbased
*
* Description:
* sixlowpan_ipfromrime: Create a link local IPv6 address from a rime
* address.
* sixlowpan_ipfromaddr: Create a link local IPv6 address from an IEEE
* 802.15.4 address.
*
* sixlowpan_rimefromip: Extract the rime address from a link local IPv6
* address.
* sixlowpan_addrfromip: Extract the IEEE 802.15.14 address from a link
* local IPv6 address.
*
* sixlowpan_islinklocal and sixlowpan_ismacbased will return true for
* address created in this fashion.
*
* 128 112 96 80 64 48 32 16
* ---- ---- ---- ---- ---- ---- ---- ----
* fe80 0000 0000 0000 xxxx 0000 0000 0000 2-byte Rime address (VALID?)
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address
* fe80 0000 0000 0000 xxxx 0000 0000 0000 2-byte short address (VALID?)
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address
*
****************************************************************************/
#define sixlowpan_islinklocal(ipaddr) ((ipaddr)[0] == NTOHS(0xfe80))
void sixlowpan_ipfromrime(FAR const struct sixlowpan_addr_s *rime,
void sixlowpan_ipfromaddr(FAR const struct sixlowpan_addr_s *addr,
net_ipv6addr_t ipaddr);
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *rime);
void sixlowpan_addrfromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *addr);
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
FAR const struct sixlowpan_addr_s *rime);
FAR const struct sixlowpan_addr_s *addr);
/****************************************************************************
* Name: sixlowpan_src_panid

View File

@ -317,11 +317,11 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf,
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND);
/* Get the Rime MAC address of the destination This assumes an encoding
* of the MAC address in the IPv6 address.
/* Get the IEEE 802.15.4 MAC address of the destination. This assumes
* an encoding of the MAC address in the IPv6 address.
*/
sixlowpan_rimefromip(conn->u.ipv6.raddr, &destmac);
sixlowpan_addrfromip(conn->u.ipv6.raddr, &destmac);
/* If routable, then call sixlowpan_send() to format and send the 6loWPAN
* packet.
@ -414,11 +414,11 @@ void sixlowpan_tcp_send(FAR struct net_driver_s *dev)
uint16_t hdrlen;
uint16_t buflen;
/* Get the Rime MAC address of the destination. This assumes an
* encoding of the MAC address in the IPv6 address.
/* Get the IEEE 802.15.4 MAC address of the destination. This
* assumes an encoding of the MAC address in the IPv6 address.
*/
sixlowpan_rimefromip(ipv6hdr->ipv6.destipaddr, &destmac);
sixlowpan_addrfromip(ipv6hdr->ipv6.destipaddr, &destmac);
/* Get the IPv6 + TCP combined header length. The size of the TCP
* header is encoded in the top 4 bits of the tcpoffset field (in

View File

@ -292,11 +292,11 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock,
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND);
/* Get the Rime MAC address of the destination This assumes an encoding
* of the MAC address in the IPv6 address.
/* Get the IEEE 802.15.4 MAC address of the destination This assumes an
* encoding of the MAC address in the IPv6 address.
*/
sixlowpan_rimefromip(to6->sin6_addr.in6_u.u6_addr16, &destmac);
sixlowpan_addrfromip(to6->sin6_addr.in6_u.u6_addr16, &destmac);
/* If routable, then call sixlowpan_send() to format and send the 6loWPAN
* packet.

View File

@ -68,19 +68,19 @@
****************************************************************************/
/****************************************************************************
* Name: sixlowpan_ipfromrime
* Name: sixlowpan_ipfromaddr
*
* Description:
* Create a link local IPv6 address from a rime address:
* Create a link local IPv6 address from an IEEE 802.15.4 address:
*
* 128 112 96 80 64 48 32 16
* ---- ---- ---- ---- ---- ---- ---- ----
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte Rime address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte address IEEE EUI-64
*
****************************************************************************/
void sixlowpan_ipfromrime(FAR const struct sixlowpan_addr_s *rime,
void sixlowpan_ipfromaddr(FAR const struct sixlowpan_addr_s *addr,
net_ipv6addr_t ipaddr)
{
/* We consider only links with IEEE EUI-64 identifier or IEEE 48-bit MAC
@ -91,42 +91,42 @@ void sixlowpan_ipfromrime(FAR const struct sixlowpan_addr_s *rime,
ipaddr[0] = HTONS(0xfe80);
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
memcpy(&ipaddr[4], rime, NET_6LOWPAN_ADDRSIZE);
memcpy(&ipaddr[4], addr, NET_6LOWPAN_ADDRSIZE);
ipaddr[4] ^= HTONS(0x0200);
#else
ipaddr[5] = HTONS(0x00ff);
ipaddr[6] = HTONS(0xfe00);
memcpy(&ipaddr[7], rime, NET_6LOWPAN_ADDRSIZE);
memcpy(&ipaddr[7], addr, NET_6LOWPAN_ADDRSIZE);
ipaddr[7] ^= HTONS(0x0200);
#endif
}
/****************************************************************************
* Name: sixlowpan_rimefromip
* Name: sixlowpan_addrfromip
*
* Description:
* Extract the rime address from a link local IPv6 address:
* Extract the IEEE 802.15.4 address from a link local IPv6 address:
*
* 128 112 96 80 64 48 32 16
* ---- ---- ---- ---- ---- ---- ---- ----
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte Rime address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64
* 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
*
****************************************************************************/
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *rime)
void sixlowpan_addrfromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *addr)
{
/* REVISIT: See notes about 2 byte addresses in sixlowpan_ipfromrime() */
/* REVISIT: See notes about 2 byte addresses in sixlowpan_ipfromaddr() */
DEBUGASSERT(ipaddr[0] == HTONS(0xfe80));
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
memcpy(rime, &ipaddr[4], NET_6LOWPAN_ADDRSIZE);
memcpy(addr, &ipaddr[4], NET_6LOWPAN_ADDRSIZE);
#else
memcpy(rime, &ipaddr[7], NET_6LOWPAN_ADDRSIZE);
memcpy(addr, &ipaddr[7], NET_6LOWPAN_ADDRSIZE);
#endif
rime->u8[0] ^= 0x02;
addr->u8[0] ^= 0x02;
}
/****************************************************************************
@ -137,24 +137,24 @@ void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
*
* 128 112 96 80 64 48 32 16
* ---- ---- ---- ---- ---- ---- ---- ----
* fe80 0000 0000 0000 0000 00ff fe00 xxxx 2-byte Rime address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64
* 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
*
****************************************************************************/
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
FAR const struct sixlowpan_addr_s *rime)
FAR const struct sixlowpan_addr_s *addr)
{
FAR const uint8_t *rimeptr = rime->u8;
FAR const uint8_t *byteptr = addr->u8;
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
return (ipaddr[4] == htons((GETINT16(rimeptr, 0) ^ 0x0200)) &&
ipaddr[5] == GETINT16(rimeptr, 2) &&
ipaddr[6] == GETINT16(rimeptr, 4) &&
ipaddr[7] == GETINT16(rimeptr, 6));
return (ipaddr[4] == htons((GETINT16(byteptr, 0) ^ 0x0200)) &&
ipaddr[5] == GETINT16(byteptr, 2) &&
ipaddr[6] == GETINT16(byteptr, 4) &&
ipaddr[7] == GETINT16(byteptr, 6));
#else
return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) &&
ipaddr[7] == htons((GETINT16(rimeptr, 0) ^ 0x0200)));
ipaddr[7] == htons((GETINT16(byteptr, 0) ^ 0x0200)));
#endif
}