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,132 +82,132 @@
* bytes for all subsequent headers. * bytes for all subsequent headers.
*/ */
#define RIME_FRAG_DISPATCH_SIZE 0 /* 16 bit */ #define SIXLOWPAN_FRAG_DISPATCH_SIZE 0 /* 16 bit */
#define RIME_FRAG_TAG 2 /* 16 bit */ #define SIXLOWPAN_FRAG_TAG 2 /* 16 bit */
#define RIME_FRAG_OFFSET 4 /* 8 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 SIXLOWPAN_HC1_DISPATCH 0 /* 8 bit */
#define RIME_HC1_ENCODING 1 /* 8 bit */ #define SIXLOWPAN_HC1_ENCODING 1 /* 8 bit */
#define RIME_HC1_TTL 2 /* 8 bit */ #define SIXLOWPAN_HC1_TTL 2 /* 8 bit */
#define RIME_HC1_HC_UDP_DISPATCH 0 /* 8 bit */ #define SIXLOWPAN_HC1_HC_UDP_DISPATCH 0 /* 8 bit */
#define RIME_HC1_HC_UDP_HC1_ENCODING 1 /* 8 bit */ #define SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING 1 /* 8 bit */
#define RIME_HC1_HC_UDP_UDP_ENCODING 2 /* 8 bit */ #define SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING 2 /* 8 bit */
#define RIME_HC1_HC_UDP_TTL 3 /* 8 bit */ #define SIXLOWPAN_HC1_HC_UDP_TTL 3 /* 8 bit */
#define RIME_HC1_HC_UDP_PORTS 4 /* 8 bit */ #define SIXLOWPAN_HC1_HC_UDP_PORTS 4 /* 8 bit */
#define RIME_HC1_HC_UDP_CHKSUM 5 /* 16 bit */ #define SIXLOWPAN_HC1_HC_UDP_CHKSUM 5 /* 16 bit */
/* Min and Max compressible UDP ports - HC06 */ /* Min and Max compressible UDP ports - HC06 */
#define SIXLOWPAN_UDP_4_BIT_PORT_MIN 0xf0b0 #define SIXLOWPAN_UDP_4_BIT_PORT_MIN 0xf0b0
#define SIXLOWPAN_UDP_4_BIT_PORT_MAX 0xf0bf /* f0b0 + 15 */ #define SIXLOWPAN_UDP_4_BIT_PORT_MAX 0xf0bf /* f0b0 + 15 */
#define SIXLOWPAN_UDP_8_BIT_PORT_MIN 0xf000 #define SIXLOWPAN_UDP_8_BIT_PORT_MIN 0xf000
#define SIXLOWPAN_UDP_8_BIT_PORT_MAX 0xf0ff /* f000 + 255 */ #define SIXLOWPAN_UDP_8_BIT_PORT_MAX 0xf0ff /* f000 + 255 */
/* 6lowpan dispatches */ /* 6lowpan dispatches */
#define SIXLOWPAN_DISPATCH_NALP 0x00 /* 00xxxxxx Not a LoWPAN packet */ #define SIXLOWPAN_DISPATCH_NALP 0x00 /* 00xxxxxx Not a LoWPAN packet */
#define SIXLOWPAN_DISPATCH_NALP_MASK 0xc0 /* 11000000 */ #define SIXLOWPAN_DISPATCH_NALP_MASK 0xc0 /* 11000000 */
#define SIXLOWPAN_DISPATCH_IPV6 0x41 /* 01000001 Uncompressed IPv6 addresses */ #define SIXLOWPAN_DISPATCH_IPV6 0x41 /* 01000001 Uncompressed IPv6 addresses */
#define SIXLOWPAN_DISPATCH_HC1 0x42 /* 01000010 HC1 Compressed IPv6 header */ #define SIXLOWPAN_DISPATCH_HC1 0x42 /* 01000010 HC1 Compressed IPv6 header */
#define SIXLOWPAN_DISPATCH_BC0 0x50 /* 01010000 BC0 Broadcast header */ #define SIXLOWPAN_DISPATCH_BC0 0x50 /* 01010000 BC0 Broadcast header */
#define SIXLOWPAN_DISPATCH_ESC 0x7f /* 01111111 Additional Dispatch octet follows */ #define SIXLOWPAN_DISPATCH_ESC 0x7f /* 01111111 Additional Dispatch octet follows */
#define SIXLOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx IP Header Compression (IPHC)*/ #define SIXLOWPAN_DISPATCH_IPHC 0x60 /* 011xxxxx IP Header Compression (IPHC)*/
#define SIXLOWPAN_DISPATCH_IPHC_MASK 0xe0 /* 11100000 */ #define SIXLOWPAN_DISPATCH_IPHC_MASK 0xe0 /* 11100000 */
#define SIXLOWPAN_DISPATCH_MESH 0x80 /* 10xxxxxx Mesh routing header */ #define SIXLOWPAN_DISPATCH_MESH 0x80 /* 10xxxxxx Mesh routing header */
#define SIXLOWPAN_DISPATCH_MESH_MASK 0xc0 /* 11000000 */ #define SIXLOWPAN_DISPATCH_MESH_MASK 0xc0 /* 11000000 */
#define SIXLOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx Fragmentation header (first) */ #define SIXLOWPAN_DISPATCH_FRAG1 0xc0 /* 11000xxx Fragmentation header (first) */
#define SIXLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx Fragmentation header (subsequent) */ #define SIXLOWPAN_DISPATCH_FRAGN 0xe0 /* 11100xxx Fragmentation header (subsequent) */
#define SIXLOWPAN_DISPATCH_FRAG_MASK 0xf8 /* 11111000 */ #define SIXLOWPAN_DISPATCH_FRAG_MASK 0xf8 /* 11111000 */
/* HC1 encoding */ /* HC1 encoding */
#define SIXLOWPAN_HC1_NH_UDP 0x02 #define SIXLOWPAN_HC1_NH_UDP 0x02
#define SIXLOWPAN_HC1_NH_TCP 0x06 #define SIXLOWPAN_HC1_NH_TCP 0x06
#define SIXLOWPAN_HC1_NH_ICMP6 0x04 #define SIXLOWPAN_HC1_NH_ICMP6 0x04
/* HC_UDP encoding (works together with HC1) */ /* HC_UDP encoding (works together with HC1) */
#define SIXLOWPAN_HC_UDP_ALL_C 0xe0 #define SIXLOWPAN_HC_UDP_ALL_C 0xe0
/* IPHC encoding /* IPHC encoding
* *
* Values of fields within the IPHC encoding first byte * Values of fields within the IPHC encoding first byte
* (Using MS-to-LS bit numbering of the draft RFC) * (Using MS-to-LS bit numbering of the draft RFC)
*/ */
/* Bits 0-2: 011 */ /* Bits 0-2: 011 */
#define SIXLOWPAN_IPHC_TC_MASK 0x18 /* Bits 3-4: Traffic Class, Flow Label */ #define SIXLOWPAN_IPHC_TC_MASK 0x18 /* Bits 3-4: Traffic Class, Flow Label */
# define SIXLOWPAN_IPHC_TC_00 0x00 /* ECN+DSCP+4-bit Pad+Flow Label (4 bytes) */ # define SIXLOWPAN_IPHC_TC_00 0x00 /* ECN+DSCP+4-bit Pad+Flow Label (4 bytes) */
# define SIXLOWPAN_IPHC_TC_01 0x08 /* ECN+2-bit Pad+ Flow Label (3 bytes), DSCP is elided. */ # define SIXLOWPAN_IPHC_TC_01 0x08 /* ECN+2-bit Pad+ Flow Label (3 bytes), DSCP is elided. */
# define SIXLOWPAN_IPHC_TC_10 0x10 /* ECN+DSCP (1 byte), Flow Label is elided */ # define SIXLOWPAN_IPHC_TC_10 0x10 /* ECN+DSCP (1 byte), Flow Label is elided */
# define SIXLOWPAN_IPHC_TC_11 0x11 /* Traffic Class and Flow Label are elided */ # define SIXLOWPAN_IPHC_TC_11 0x11 /* Traffic Class and Flow Label are elided */
#define SIXLOWPAN_IPHC_NH 0x04 /* Bit 5: Next Header Compressed */ #define SIXLOWPAN_IPHC_NH 0x04 /* Bit 5: Next Header Compressed */
#define SIXLOWPAN_IPHC_HLIM_MASK 0x03 /* Bits 6-7: Hop Limit */ #define SIXLOWPAN_IPHC_HLIM_MASK 0x03 /* Bits 6-7: Hop Limit */
# define SIXLOWPAN_IPHC_HLIM_INLINE 0x00 /* Carried in-line */ # define SIXLOWPAN_IPHC_HLIM_INLINE 0x00 /* Carried in-line */
# define SIXLOWPAN_IPHC_HLIM_1 0x01 /* Compressed hop limit of 1 */ # define SIXLOWPAN_IPHC_HLIM_1 0x01 /* Compressed hop limit of 1 */
# define SIXLOWPAN_IPHC_HLIM_64 0x02 /* Compressed hop limit of 64 */ # define SIXLOWPAN_IPHC_HLIM_64 0x02 /* Compressed hop limit of 64 */
# define SIXLOWPAN_IPHC_HLIM_255 0x03 /* Compressed hop limit of 255 */ # define SIXLOWPAN_IPHC_HLIM_255 0x03 /* Compressed hop limit of 255 */
/* Values of fields within the IPHC encoding second byte */ /* Values of fields within the IPHC encoding second byte */
#define SIXLOWPAN_IPHC_CID 0x80 /* Bit 8: Context identifier extension */ #define SIXLOWPAN_IPHC_CID 0x80 /* Bit 8: Context identifier extension */
#define SIXLOWPAN_IPHC_SAC 0x40 /* Bit 9: Source address compression */ #define SIXLOWPAN_IPHC_SAC 0x40 /* Bit 9: Source address compression */
#define SIXLOWPAN_IPHC_SAM_MASK 0x30 /* Bits 10-11: Source address mode */ #define SIXLOWPAN_IPHC_SAM_MASK 0x30 /* Bits 10-11: Source address mode */
# define SIXLOWPAN_IPHC_SAM_128 0x00 /* 128-bits */ # define SIXLOWPAN_IPHC_SAM_128 0x00 /* 128-bits */
# define SIXLOWPAN_IPHC_SAM_64 0x10 /* 64-bits */ # define SIXLOWPAN_IPHC_SAM_64 0x10 /* 64-bits */
# define SIXLOWPAN_IPHC_SAM_16 0x20 /* 16-bits */ # define SIXLOWPAN_IPHC_SAM_16 0x20 /* 16-bits */
# define SIXLOWPAN_IPHC_SAM_0 0x30 /* 0-bits */ # define SIXLOWPAN_IPHC_SAM_0 0x30 /* 0-bits */
#define SIXLOWPAN_IPHC_M 0x08 /* Bit 12: Multicast compression */ #define SIXLOWPAN_IPHC_M 0x08 /* Bit 12: Multicast compression */
#define SIXLOWPAN_IPHC_DAC 0x04 /* Bit 13: Destination address compression */ #define SIXLOWPAN_IPHC_DAC 0x04 /* Bit 13: Destination address compression */
#define SIXLOWPAN_IPHC_DAM_MASK 0x03 /* Bits 14-15: Destination address mode */ #define SIXLOWPAN_IPHC_DAM_MASK 0x03 /* Bits 14-15: Destination address mode */
# define SIXLOWPAN_IPHC_DAM_128 0x00 /* 128-bits */ # define SIXLOWPAN_IPHC_DAM_128 0x00 /* 128-bits */
# define SIXLOWPAN_IPHC_DAM_64 0x01 /* 64-bits */ # define SIXLOWPAN_IPHC_DAM_64 0x01 /* 64-bits */
# define SIXLOWPAN_IPHC_DAM_16 0x02 /* 16-bits */ # define SIXLOWPAN_IPHC_DAM_16 0x02 /* 16-bits */
# define SIXLOWPAN_IPHC_DAM_0 0x03 /* 0-bits */ # define SIXLOWPAN_IPHC_DAM_0 0x03 /* 0-bits */
#define SIXLOWPAN_IPHC_SAM_BIT 4 #define SIXLOWPAN_IPHC_SAM_BIT 4
#define SIXLOWPAN_IPHC_DAM_BIT 0 #define SIXLOWPAN_IPHC_DAM_BIT 0
/* Link local context number */ /* Link local context number */
#define SIXLOWPAN_IPHC_ADDR_CONTEXT_LL 0 #define SIXLOWPAN_IPHC_ADDR_CONTEXT_LL 0
/* 16-bit multicast addresses compression */ /* 16-bit multicast addresses compression */
#define SIXLOWPAN_IPHC_MCAST_RANGE 0xa0 #define SIXLOWPAN_IPHC_MCAST_RANGE 0xa0
/* NHC_EXT_HDR */ /* NHC_EXT_HDR */
#define SIXLOWPAN_NHC_MASK 0xf0 #define SIXLOWPAN_NHC_MASK 0xf0
#define SIXLOWPAN_NHC_EXT_HDR 0xe0 #define SIXLOWPAN_NHC_EXT_HDR 0xe0
/* LOWPAN_UDP encoding (works together with IPHC) */ /* LOWPAN_UDP encoding (works together with IPHC) */
#define SIXLOWPAN_NHC_UDP_MASK 0xf8 #define SIXLOWPAN_NHC_UDP_MASK 0xf8
#define SIXLOWPAN_NHC_UDP_ID 0xf0 #define SIXLOWPAN_NHC_UDP_ID 0xf0
#define SIXLOWPAN_NHC_UDP_CHECKSUMC 0x04 #define SIXLOWPAN_NHC_UDP_CHECKSUMC 0x04
#define SIXLOWPAN_NHC_UDP_CHECKSUMI 0x00 #define SIXLOWPAN_NHC_UDP_CHECKSUMI 0x00
/* Values for port compression, _with checksum_ ie bit 5 set to 0 */ /* Values for port compression, _with checksum_ ie bit 5 set to 0 */
#define SIXLOWPAN_NHC_UDP_CS_P_00 0xf0 /* All inline */ #define SIXLOWPAN_NHC_UDP_CS_P_00 0xf0 /* All inline */
#define SIXLOWPAN_NHC_UDP_CS_P_01 0xf1 /* Source 16bit inline, dest = 0xf0 + 8 bit inline */ #define SIXLOWPAN_NHC_UDP_CS_P_01 0xf1 /* Source 16bit inline, dest = 0xf0 + 8 bit inline */
#define SIXLOWPAN_NHC_UDP_CS_P_10 0xf2 /* Source = 0xf0 + 8bit inline, dest = 16 bit inline */ #define SIXLOWPAN_NHC_UDP_CS_P_10 0xf2 /* Source = 0xf0 + 8bit inline, dest = 16 bit inline */
#define SIXLOWPAN_NHC_UDP_CS_P_11 0xf3 /* Source & dest = 0xf0b + 4bit inline */ #define SIXLOWPAN_NHC_UDP_CS_P_11 0xf3 /* Source & dest = 0xf0b + 4bit inline */
/* The 6lowpan "headers" length */ /* The 6lowpan "headers" length */
#define SIXLOWPAN_IPV6_HDR_LEN 1 /* One byte */ #define SIXLOWPAN_IPV6_HDR_LEN 1 /* One byte */
#define SIXLOWPAN_HC1_HDR_LEN 3 #define SIXLOWPAN_HC1_HDR_LEN 3
#define SIXLOWPAN_HC1_HC_UDP_HDR_LEN 7 #define SIXLOWPAN_HC1_HC_UDP_HDR_LEN 7
#define SIXLOWPAN_FRAG1_HDR_LEN 4 #define SIXLOWPAN_FRAG1_HDR_LEN 4
#define SIXLOWPAN_FRAGN_HDR_LEN 5 #define SIXLOWPAN_FRAGN_HDR_LEN 5
/* Address compressibility test macros **************************************/ /* Address compressibility test macros **************************************/

View File

@ -134,12 +134,12 @@ endif # NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_0
endif # NET_6LOWPAN_COMPRESSION_HC06 endif # NET_6LOWPAN_COMPRESSION_HC06
config NET_6LOWPAN_EXTENDEDADDR config NET_6LOWPAN_EXTENDEDADDR
bool "Extended Rime address" bool "Extended IEEE 802.15.4 address"
default n default n
---help--- ---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 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 config NET_6LOWPAN_MAXAGE
int "Packet reassembly timeout" int "Packet reassembly timeout"

View File

@ -10,12 +10,12 @@ Optimal 6loWPAN Configuration
128 112 96 80 64 48 32 16 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 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 Rime address IEEE EUI-64 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 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 For link-local address, AAAA is 0xfe80
@ -23,8 +23,8 @@ Optimal 6loWPAN Configuration
128 112 96 80 64 48 32 16 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 0000 00ff fe00 MMMM 2-byte short address IEEE 48-bit MAC
fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte Rime address IEEE EUI-64 fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte extended address IEEE EUI-64
4. Compressable port numbers in the rangs 0xf0b0-0xf0bf 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 41 88 2a cefa 3412 cdab ### 9-byte MAC header
c50e 000b ### 4-byte FRAG1 header c50e 000b ### 4-byte FRAG1 header
42 ### SIXLOWPAN_DISPATCH_HC1 42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
e0 ### RIME_HC1_HC_UDP_UDP_ENCODING e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
00 ### RIME_HC1_HC_UDP_TTL 00 ### SIXLOWPAN_HC1_HC_UDP_TTL
10 ### RIME_HC1_HC_UDP_PORTS 10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM 0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
104 byte Payload follows: 104 byte Payload follows:
4f4e452064617920 48656e6e792d7065 6e6e792077617320 7069636b696e6720 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 41 88 2b cefa 3412 cdab ### 9-byte MAC header
e50e 000b 0d ### 5 byte FRAGN header e50e 000b 0d ### 5 byte FRAGN header
42 ### SIXLOWPAN_DISPATCH_HC1 42 ### SIXLOWPAN_DISPATCH_HC1
fb ### RIME_HC1_HC_UDP_HC1_ENCODING fb ### SIXLOWPAN_HC1_HC_UDP_HC1_ENCODING
e0 ### RIME_HC1_HC_UDP_UDP_ENCODING e0 ### SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING
00 ### RIME_HC1_HC_UDP_TTL 00 ### SIXLOWPAN_HC1_HC_UDP_TTL
10 ### RIME_HC1_HC_UDP_PORTS 10 ### SIXLOWPAN_HC1_HC_UDP_PORTS
0000 ### RIME_HC1_HC_UDP_CHKSUM 0000 ### SIXLOWPAN_HC1_HC_UDP_CHKSUM
104 byte Payload follows: 104 byte Payload follows:
476f6f646e657373 2067726163696f75 73206d6521272073 6169642048656e6e 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_uncomp_hdrlen = 0;
g_frame_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_pktattrs, 0, PACKETBUF_NUM_ATTRS * sizeof(uint16_t));
memset(g_pktaddrs, 0, PACKETBUF_NUM_ADDRS * sizeof(struct sixlowpan_addr_s)); 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 */ /* 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); &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. /* Get the destination PAN ID.
* *
@ -400,9 +400,9 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
*/ */
pktlen = buflen + g_uncomp_hdrlen; pktlen = buflen + g_uncomp_hdrlen;
PUTINT16(fragptr, RIME_FRAG_DISPATCH_SIZE, PUTINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE,
((SIXLOWPAN_DISPATCH_FRAG1 << 8) | pktlen)); ((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; 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. */ /* 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)); ((SIXLOWPAN_DISPATCH_FRAGN << 8) | pktlen));
PUTINT16(fragptr, RIME_FRAG_TAG, ieee->i_dgramtag); PUTINT16(fragptr, SIXLOWPAN_FRAG_TAG, ieee->i_dgramtag);
fragptr[RIME_FRAG_OFFSET] = outlen >> 3; fragptr[SIXLOWPAN_FRAG_OFFSET] = outlen >> 3;
fragn_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN; fragn_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;

View File

@ -70,8 +70,8 @@
* Name: sixlowpan_addrnull * Name: sixlowpan_addrnull
* *
* Description: * Description:
* If the output address is NULL in the Rime buf, then it is broadcast * If the output address is NULL in the MAC header buf, then it is
* on the 802.15.4 network. * broadcast on the 802.15.4 network.
* *
* Input parameters: * Input parameters:
* addrmode - The address mode * 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_type = FRAME802154_DATAFRAME;
meta->fcf.frame_pending = g_pktattrs[PACKETBUF_ATTR_PENDING]; meta->fcf.frame_pending = g_pktattrs[PACKETBUF_ATTR_PENDING];
/* If the output address is NULL in the Rime buf, then it is broadcast /* If the output address is NULL in the MAC header buf, then it is
* on the 802.15.4 network. * broadcast on the 802.15.4 network.
*/ */
rcvrnull = sixlowpan_addrnull(g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8); 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->src_pid = src_panid;
meta->dest_pid = dest_panid; meta->dest_pid = dest_panid;
/* If the output address is NULL in the Rime buf, then it is broadcast /* If the output address is NULL in the MAC header buf, then it is
* on the 802.15.4 network. * broadcast on the 802.15.4 network.
*/ */
if (rcvrnull) if (rcvrnull)
@ -179,7 +179,7 @@ int sixlowpan_meta_data(uint16_t dest_panid,
{ {
/* Copy the destination address */ /* 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); g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8);
/* Use short destination address mode if so configured */ /* 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 */ /* 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); &ieee->i_dev.d_mac.ieee802154);
/* Use short soruce address mode if so configured */ /* 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 */ /* 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", 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 * sixlowpan_buf
* *
* This function is called by the input function when the dispatch is HC06. * 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, * We process the frame in the IOB buffer, uncompress the header fields,
* and copy the result in the sixlowpan buffer. At the end of the * 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 * decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the
* appropriate values * appropriate values
* *

View File

@ -137,12 +137,12 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
{ {
/* IPV6 DISPATCH /* IPV6 DISPATCH
* Something cannot be compressed, use IPV6 DISPATCH, compress * 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) */ /* 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; g_frame_hdrlen += SIXLOWPAN_IPV6_HDR_LEN;
memcpy(fptr + g_frame_hdrlen, ipv6, IPv6_HDRLEN); 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 * 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; g_uncomp_hdrlen += IPv6_HDRLEN;
switch (ipv6->proto) switch (ipv6->proto)
{ {
case IP_PROTO_ICMP6: case IP_PROTO_ICMP6:
/* HC1 encoding and ttl */ /* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfc; hc1[SIXLOWPAN_HC1_ENCODING] = 0xfc;
hc1[RIME_HC1_TTL] = ipv6->ttl; hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN; g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break; break;
@ -172,8 +172,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
case IP_PROTO_TCP: case IP_PROTO_TCP:
/* HC1 encoding and ttl */ /* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfe; hc1[SIXLOWPAN_HC1_ENCODING] = 0xfe;
hc1[RIME_HC1_TTL] = ipv6->ttl; hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN; g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break; break;
#endif /* CONFIG_NET_TCP */ #endif /* CONFIG_NET_TCP */
@ -201,17 +201,17 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
/* HC1 encoding */ /* 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 */ /* HC_UDP encoding, ttl, src and dest ports, checksum */
hcudp[RIME_HC1_HC_UDP_UDP_ENCODING] = 0xe0; hcudp[SIXLOWPAN_HC1_HC_UDP_UDP_ENCODING] = 0xe0;
hcudp[RIME_HC1_HC_UDP_TTL] = ipv6->ttl; hcudp[SIXLOWPAN_HC1_HC_UDP_TTL] = ipv6->ttl;
hcudp[RIME_HC1_HC_UDP_PORTS] = hcudp[SIXLOWPAN_HC1_HC_UDP_PORTS] =
(uint8_t)((ntohs(udp->srcport) - CONFIG_NET_6LOWPAN_MINPORT) << 4) + (uint8_t)((ntohs(udp->srcport) - CONFIG_NET_6LOWPAN_MINPORT) << 4) +
(uint8_t)((ntohs(udp->destport) - CONFIG_NET_6LOWPAN_MINPORT)); (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_frame_hdrlen += SIXLOWPAN_HC1_HC_UDP_HDR_LEN;
g_uncomp_hdrlen += UDP_HDRLEN; g_uncomp_hdrlen += UDP_HDRLEN;
@ -220,8 +220,8 @@ void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
{ {
/* HC1 encoding and ttl */ /* HC1 encoding and ttl */
hc1[RIME_HC1_ENCODING] = 0xfa; hc1[SIXLOWPAN_HC1_ENCODING] = 0xfa;
hc1[RIME_HC1_TTL] = ipv6->ttl; hc1[SIXLOWPAN_HC1_TTL] = ipv6->ttl;
g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN; 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 * Uncompress HC1 (and HC_UDP) headers and put them in sixlowpan_buf
* *
* This function is called by the input function when the dispatch is * This function is called by the input function when the dispatch is
* HC1. It processes the packet in the rime buffer, uncompresses the * HC1. It processes the frame in the IOB buffer, uncompresses the
* header fields, and copies the result in the sixlowpan buffer. At the * header fields, and copies the result in the packet buffer. At the
* end of the decompression, g_frame_hdrlen and uncompressed_hdr_len * end of the decompression, g_frame_hdrlen and uncompressed_hdr_len
* are set to the appropriate values * are set to the appropriate values
* *
@ -275,26 +275,26 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
* addresses. * addresses.
*/ */
sixlowpan_ipfromrime(&g_pktaddrs[PACKETBUF_ADDR_SENDER], sixlowpan_ipfromaddr(&g_pktaddrs[PACKETBUF_ADDR_SENDER],
ipv6->srcipaddr); ipv6->srcipaddr);
sixlowpan_ipfromrime(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER], sixlowpan_ipfromaddr(&g_pktaddrs[PACKETBUF_ADDR_RECEIVER],
ipv6->destipaddr); ipv6->destipaddr);
g_uncomp_hdrlen += IPv6_HDRLEN; g_uncomp_hdrlen += IPv6_HDRLEN;
/* len[], proto, and ttl depend on the encoding */ /* 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: case SIXLOWPAN_HC1_NH_ICMP6:
ipv6->proto = IP_PROTO_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; g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break; break;
#if CONFIG_NET_TCP #if CONFIG_NET_TCP
case SIXLOWPAN_HC1_NH_TCP: case SIXLOWPAN_HC1_NH_TCP:
ipv6->proto = IP_PROTO_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; g_frame_hdrlen += SIXLOWPAN_HC1_HDR_LEN;
break; break;
#endif /* CONFIG_NET_TCP */ #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; FAR uint8_t *hcudp = fptr + g_frame_hdrlen;
ipv6->proto = IP_PROTO_UDP; 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 */ /* 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) SIXLOWPAN_HC_UDP_ALL_C)
{ {
nwarn("WARNING: sixlowpan (uncompress_hdr), packet not supported"); 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 */ /* IP TTL */
ipv6->ttl = hcudp[RIME_HC1_HC_UDP_TTL]; ipv6->ttl = hcudp[SIXLOWPAN_HC1_HC_UDP_TTL];
/* UDP ports, len, checksum */ /* UDP ports, len, checksum */
udp->srcport = 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 = 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_uncomp_hdrlen += UDP_HDRLEN;
g_frame_hdrlen += SIXLOWPAN_HC1_HC_UDP_HDR_LEN; 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; 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 */ /* 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 */ /* Set up for the reassembly */
fragsize = GETINT16(fragptr, RIME_FRAG_DISPATCH_SIZE) & 0x07ff; fragsize = GETINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE) & 0x07ff;
fragtag = GETINT16(fragptr, RIME_FRAG_TAG); fragtag = GETINT16(fragptr, SIXLOWPAN_FRAG_TAG);
g_frame_hdrlen += SIXLOWPAN_FRAG1_HDR_LEN; g_frame_hdrlen += SIXLOWPAN_FRAG1_HDR_LEN;
ninfo("FRAG1: fragsize=%d fragtag=%d fragoffset=%d\n", 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. */ /* Set offset, tag, size. Offset is in units of 8 bytes. */
fragoffset = fragptr[RIME_FRAG_OFFSET]; fragoffset = fragptr[SIXLOWPAN_FRAG_OFFSET];
fragtag = GETINT16(fragptr, RIME_FRAG_TAG); fragtag = GETINT16(fragptr, SIXLOWPAN_FRAG_TAG);
fragsize = GETINT16(fragptr, RIME_FRAG_DISPATCH_SIZE) & 0x07ff; fragsize = GETINT16(fragptr, SIXLOWPAN_FRAG_DISPATCH_SIZE) & 0x07ff;
g_frame_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN; g_frame_hdrlen += SIXLOWPAN_FRAGN_HDR_LEN;
ninfo("FRAGN: fragsize=%d fragtag=%d fragoffset=%d\n", 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 */ /* Verify that this fragment is part of that reassembly sequence */
else if (fragsize != ieee->i_pktlen || ieee->i_reasstag != fragtag || 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 /* The packet is a fragment that does not belong to the packet
* being reassembled or the packet is not a fragment. * 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", ninfo("Starting reassembly: i_pktlen %u, i_reasstag %d\n",
ieee->i_pktlen, ieee->i_reasstag); 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 */ #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; hc1 = fptr + g_frame_hdrlen;
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06 #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"); ninfo("IPHC Dispatch\n");
sixlowpan_uncompresshdr_hc06(fragsize, iob, fptr, bptr); 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 */ #endif /* CONFIG_NET_6LOWPAN_COMPRESSION_HC06 */
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1 #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"); ninfo("HC1 Dispatch\n");
sixlowpan_uncompresshdr_hc1(fragsize, iob, fptr, bptr); sixlowpan_uncompresshdr_hc1(fragsize, iob, fptr, bptr);
@ -480,7 +480,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
else else
#endif /* CONFIG_NET_6LOWPAN_COMPRESSION_HC1 */ #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"); ninfo("IPv6 Dispatch\n");
sixlowpan_uncompress_ipv6hdr(fptr, bptr); sixlowpan_uncompress_ipv6hdr(fptr, bptr);
@ -489,7 +489,7 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
{ {
/* Unknown or unsupported header */ /* 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; return OK;
} }
@ -519,10 +519,10 @@ static int sixlowpan_frame_process(FAR struct ieee802154_driver_s *ieee,
#endif /* CONFIG_NET_6LOWPAN_FRAG */ #endif /* CONFIG_NET_6LOWPAN_FRAG */
/* Copy "payload" from the rime buffer to the IEEE802.15.4 MAC driver's /* Copy "payload" from the frame 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 buffer, d_buf. If this frame is a first fragment or not part of
* packet, we have already copied the compressed headers, g_uncomp_hdrlen * a fragmented packet, we have already copied the compressed headers,
* and g_frame_hdrlen are non-zerio, fragoffset is. * g_uncomp_hdrlen and g_frame_hdrlen are non-zerio, fragoffset is.
*/ */
paysize = iob->io_len - g_frame_hdrlen; 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); ipv6hdr = IPv6BUF(&ieee->i_dev);
/* Get the Rime MAC address of the destination. This /* Get the IEEE 802.15.4 MAC address of the destination.
* assumes an encoding of the MAC address in the IPv6 * This assumes an encoding of the MAC address in the IPv6
* address. * address.
*/ */
sixlowpan_rimefromip(ipv6hdr->destipaddr, &destmac); sixlowpan_addrfromip(ipv6hdr->destipaddr, &destmac);
/* The data payload should follow the IPv6 header plus /* The data payload should follow the IPv6 header plus
* the protocol header. * the protocol header.

View File

@ -71,19 +71,17 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Rime addres macros */ /* IEEE 802.15.4 addres macros */
/* Copy a Rime address */ /* Copy a an IEEE 802.15.4 address */
#define rimeaddr_copy(dest,src) \ #define sixlowpan_addrcopy(dest,src) \
memcpy(dest, src, NET_6LOWPAN_ADDRSIZE) 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) (memcmp(addr1, addr2, NET_6LOWPAN_ADDRSIZE) == 0)
/* Pointers in the Rime buffer */
/* Packet buffer Definitions */ /* Packet buffer Definitions */
#define PACKETBUF_ATTR_PACKET_TYPE_DATA 0 #define PACKETBUF_ATTR_PACKET_TYPE_DATA 0
@ -198,14 +196,6 @@ struct ipv6icmp_hdr_s
* during that processing * 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 /* 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). * 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 * sixlowpan_buf
* *
* This function is called by the input function when the dispatch is HC06. * 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, * We process the frame in the IOB buffer, uncompress the header fields,
* and copy the result in the sixlowpan buffer. At the end of the * 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 * decompression, g_frame_hdrlen and g_uncompressed_hdrlen are set to the
* appropriate values * 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 * Uncompress HC1 (and HC_UDP) headers and put them in sixlowpan_buf
* *
* This function is called by the input function when the dispatch is * This function is called by the input function when the dispatch is
* HC1. It processes the packet in the rime buffer, uncompresses the * HC1. It processes the frame in the IOB buffer, uncompresses the
* header fields, and copies the result in the sixlowpan buffer. At the * header fields, and copies the result in the packet buffer. At the
* end of the decompression, g_frame_hdrlen and uncompressed_hdr_len * end of the decompression, g_frame_hdrlen and uncompressed_hdr_len
* are set to the appropriate values * are set to the appropriate values
* *
@ -535,34 +525,34 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
#endif #endif
/**************************************************************************** /****************************************************************************
* Name: sixlowpan_islinklocal, sixlowpan_ipfromrime, sixlowpan_rimefromip, * Name: sixlowpan_islinklocal, sixlowpan_ipfromaddr, sixlowpan_addrfromip,
* and sixlowpan_ismacbased * and sixlowpan_ismacbased
* *
* Description: * Description:
* sixlowpan_ipfromrime: Create a link local IPv6 address from a rime * sixlowpan_ipfromaddr: Create a link local IPv6 address from an IEEE
* address. * 802.15.4 address.
* *
* sixlowpan_rimefromip: Extract the rime address from a link local IPv6 * sixlowpan_addrfromip: Extract the IEEE 802.15.14 address from a link
* address. * local IPv6 address.
* *
* sixlowpan_islinklocal and sixlowpan_ismacbased will return true for * sixlowpan_islinklocal and sixlowpan_ismacbased will return true for
* address created in this fashion. * address created in this fashion.
* *
* 128 112 96 80 64 48 32 16 * 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 0000 0000 0000 2-byte short address (VALID?)
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address * fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address
* *
****************************************************************************/ ****************************************************************************/
#define sixlowpan_islinklocal(ipaddr) ((ipaddr)[0] == NTOHS(0xfe80)) #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); net_ipv6addr_t ipaddr);
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr, void sixlowpan_addrfromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *rime); FAR struct sixlowpan_addr_s *addr);
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr, 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 * 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); psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND);
/* Get the Rime MAC address of the destination This assumes an encoding /* Get the IEEE 802.15.4 MAC address of the destination. This assumes
* of the MAC address in the IPv6 address. * 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 /* If routable, then call sixlowpan_send() to format and send the 6loWPAN
* packet. * packet.
@ -414,11 +414,11 @@ void sixlowpan_tcp_send(FAR struct net_driver_s *dev)
uint16_t hdrlen; uint16_t hdrlen;
uint16_t buflen; uint16_t buflen;
/* Get the Rime MAC address of the destination. This assumes an /* Get the IEEE 802.15.4 MAC address of the destination. This
* encoding of the MAC address in the IPv6 address. * 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 /* 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 * 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); psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_SEND);
/* Get the Rime MAC address of the destination This assumes an encoding /* Get the IEEE 802.15.4 MAC address of the destination This assumes an
* of the MAC address in the IPv6 address. * 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 /* If routable, then call sixlowpan_send() to format and send the 6loWPAN
* packet. * packet.

View File

@ -68,19 +68,19 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: sixlowpan_ipfromrime * Name: sixlowpan_ipfromaddr
* *
* Description: * 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 * 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 0000 00ff fe00 xxxx 2-byte address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64 * 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) net_ipv6addr_t ipaddr)
{ {
/* We consider only links with IEEE EUI-64 identifier or IEEE 48-bit MAC /* 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); ipaddr[0] = HTONS(0xfe80);
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR #ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
memcpy(&ipaddr[4], rime, NET_6LOWPAN_ADDRSIZE); memcpy(&ipaddr[4], addr, NET_6LOWPAN_ADDRSIZE);
ipaddr[4] ^= HTONS(0x0200); ipaddr[4] ^= HTONS(0x0200);
#else #else
ipaddr[5] = HTONS(0x00ff); ipaddr[5] = HTONS(0x00ff);
ipaddr[6] = HTONS(0xfe00); ipaddr[6] = HTONS(0xfe00);
memcpy(&ipaddr[7], rime, NET_6LOWPAN_ADDRSIZE); memcpy(&ipaddr[7], addr, NET_6LOWPAN_ADDRSIZE);
ipaddr[7] ^= HTONS(0x0200); ipaddr[7] ^= HTONS(0x0200);
#endif #endif
} }
/**************************************************************************** /****************************************************************************
* Name: sixlowpan_rimefromip * Name: sixlowpan_addrfromip
* *
* Description: * 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 * 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 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64 * fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
* *
****************************************************************************/ ****************************************************************************/
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr, void sixlowpan_addrfromip(const net_ipv6addr_t ipaddr,
FAR struct sixlowpan_addr_s *rime) 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)); DEBUGASSERT(ipaddr[0] == HTONS(0xfe80));
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR #ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
memcpy(rime, &ipaddr[4], NET_6LOWPAN_ADDRSIZE); memcpy(addr, &ipaddr[4], NET_6LOWPAN_ADDRSIZE);
#else #else
memcpy(rime, &ipaddr[7], NET_6LOWPAN_ADDRSIZE); memcpy(addr, &ipaddr[7], NET_6LOWPAN_ADDRSIZE);
#endif #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 * 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 0000 00ff fe00 xxxx 2-byte short address IEEE 48-bit MAC
* fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte Rime address IEEE EUI-64 * fe80 0000 0000 0000 xxxx xxxx xxxx xxxx 8-byte extended address IEEE EUI-64
* *
****************************************************************************/ ****************************************************************************/
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr, 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 #ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
return (ipaddr[4] == htons((GETINT16(rimeptr, 0) ^ 0x0200)) && return (ipaddr[4] == htons((GETINT16(byteptr, 0) ^ 0x0200)) &&
ipaddr[5] == GETINT16(rimeptr, 2) && ipaddr[5] == GETINT16(byteptr, 2) &&
ipaddr[6] == GETINT16(rimeptr, 4) && ipaddr[6] == GETINT16(byteptr, 4) &&
ipaddr[7] == GETINT16(rimeptr, 6)); ipaddr[7] == GETINT16(byteptr, 6));
#else #else
return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) && return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) &&
ipaddr[7] == htons((GETINT16(rimeptr, 0) ^ 0x0200))); ipaddr[7] == htons((GETINT16(byteptr, 0) ^ 0x0200)));
#endif #endif
} }