6loWPAN: Replace some Rime address naming with more consistent short/exended address terminology
This commit is contained in:
parent
6a45afdd75
commit
969c1ab614
@ -548,7 +548,7 @@ CONFIG_NET_6LOWPAN_MAXADDRCONTEXT=1
|
||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_0=0xaa
|
||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_1=0xaa
|
||||
# CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_1 is not set
|
||||
# CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED is not set
|
||||
# CONFIG_NET_6LOWPAN_EXTENDEDADDR is not set
|
||||
CONFIG_NET_6LOWPAN_MAXAGE=20
|
||||
CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS=4
|
||||
CONFIG_NET_6LOWPAN_MTU=1294
|
||||
|
@ -58,15 +58,18 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC
|
||||
* device's link layer address. If CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
* is selected, then an 8-byte Rime address will be used.
|
||||
/* By default, a 2-byte short address is used for the IEEE802.15.4 MAC
|
||||
* device's link layer address. If CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
* is selected, then an 8-byte extended address will be used.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
# define NET_6LOWPAN_RIMEADDR_SIZE 8
|
||||
#define NET_6LOWPAN_SADDRSIZE 2
|
||||
#define NET_6LOWPAN_EADDRSIZE 8
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
# define NET_6LOWPAN_ADDRSIZE NET_6LOWPAN_EADDRSIZE
|
||||
#else
|
||||
# define NET_6LOWPAN_RIMEADDR_SIZE 2
|
||||
# define NET_6LOWPAN_ADDRSIZE NET_6LOWPAN_SADDRSIZE
|
||||
#endif
|
||||
|
||||
/* Frame format definitions *************************************************/
|
||||
@ -123,11 +126,29 @@
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* Rime address representation */
|
||||
/* IEEE 802.15.4 address representations */
|
||||
|
||||
struct rimeaddr_s
|
||||
struct sixlowpan_saddr_s
|
||||
{
|
||||
uint8_t u8[NET_6LOWPAN_RIMEADDR_SIZE];
|
||||
uint8_t u8[NET_6LOWPAN_SADDRSIZE];
|
||||
};
|
||||
|
||||
struct sixlowpan_eaddr_s
|
||||
{
|
||||
uint8_t u8[NET_6LOWPAN_EADDRSIZE];
|
||||
};
|
||||
|
||||
union sixlowpan_anyaddr_u
|
||||
{
|
||||
struct sixlowpan_saddr_s saddr;
|
||||
struct sixlowpan_eaddr_s eaddr;
|
||||
};
|
||||
|
||||
/* Represents the configured address size */
|
||||
|
||||
struct sixlowpan_addr_s
|
||||
{
|
||||
uint8_t u8[NET_6LOWPAN_ADDRSIZE];
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -224,7 +224,7 @@ struct net_driver_s
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* The address assigned to an IEEE 802.15.4 radio. */
|
||||
|
||||
struct rimeaddr_s ieee802154; /* IEEE 802.15.4 Radio address */
|
||||
struct sixlowpan_addr_s ieee802154; /* IEEE 802.15.4 Radio address */
|
||||
#endif
|
||||
} d_mac;
|
||||
#endif
|
||||
|
@ -420,7 +420,7 @@ struct ieee802154_driver_s
|
||||
|
||||
/* The source MAC address of the fragments being merged */
|
||||
|
||||
struct rimeaddr_s i_fragsrc;
|
||||
struct sixlowpan_addr_s i_fragsrc;
|
||||
|
||||
/* That time at which reassembly was started. If the elapsed time
|
||||
* exceeds CONFIG_NET_6LOWPAN_MAXAGE, then the reassembly will
|
||||
|
@ -790,7 +790,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
{
|
||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||
memcpy(req->ifr_hwaddr.sa_data,
|
||||
dev->d_mac.ieee802154.u8, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
dev->d_mac.ieee802154.u8, NET_6LOWPAN_ADDRSIZE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@ -828,7 +828,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
#endif
|
||||
{
|
||||
memcpy(dev->d_mac.ieee802154.u8,
|
||||
req->ifr_hwaddr.sa_data, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
req->ifr_hwaddr.sa_data, NET_6LOWPAN_ADDRSIZE);
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
@ -1023,7 +1023,7 @@ static int netdev_arp_ioctl(FAR struct socket *psock, int cmd,
|
||||
case SIOCSARP: /* Set an ARP mapping */
|
||||
{
|
||||
if (req != NULL &&
|
||||
req->arp_pa.sa_family == AF_INET &&
|
||||
req->arp_pa.sa_family == AF_INET &&
|
||||
req->arp_ha.sa_family == ARPHRD_ETHER)
|
||||
{
|
||||
FAR struct sockaddr_in *addr =
|
||||
|
@ -151,7 +151,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
case NET_LL_IEEE802154:
|
||||
{
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||
"%s\tLink encap:6loWPAN HWaddr "
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
@ -213,7 +213,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
||||
dev->d_ifname, ether_ntoa(&dev->d_mac.ether), status);
|
||||
|
||||
#elif defined(CONFIG_NET_6LOWPAN)
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||
"%s\tLink encap:6loWPAN HWaddr "
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x at %s\n",
|
||||
|
@ -133,7 +133,7 @@ config NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_2_1
|
||||
endif # NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_0
|
||||
endif # NET_6LOWPAN_COMPRESSION_HC06
|
||||
|
||||
config NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
config NET_6LOWPAN_EXTENDEDADDR
|
||||
bool "Extended Rime address"
|
||||
default n
|
||||
---help---
|
||||
|
@ -209,13 +209,13 @@ static void sixlowpan_compress_ipv6hdr(FAR const struct ipv6_hdr_s *ipv6hdr,
|
||||
int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *destip,
|
||||
FAR const void *buf, size_t buflen,
|
||||
FAR const struct rimeaddr_s *destmac)
|
||||
FAR const struct sixlowpan_addr_s *destmac)
|
||||
{
|
||||
struct ieee802154_frame_meta_s meta;
|
||||
FAR struct iob_s *iob;
|
||||
FAR uint8_t *fptr;
|
||||
int framer_hdrlen;
|
||||
struct rimeaddr_s bcastmac;
|
||||
struct sixlowpan_addr_s bcastmac;
|
||||
uint16_t pktlen;
|
||||
uint16_t paysize;
|
||||
uint16_t dest_panid;
|
||||
@ -234,7 +234,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
||||
/* Reset rime buffer, packet buffer metatadata */
|
||||
|
||||
memset(g_pktattrs, 0, PACKETBUF_NUM_ATTRS * sizeof(uint16_t));
|
||||
memset(g_pktaddrs, 0, PACKETBUF_NUM_ADDRS * sizeof(struct rimeaddr_s));
|
||||
memset(g_pktaddrs, 0, PACKETBUF_NUM_ADDRS * sizeof(struct sixlowpan_addr_s));
|
||||
|
||||
g_pktattrs[PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS] =
|
||||
CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS;
|
||||
@ -263,7 +263,7 @@ int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
||||
|
||||
if (destmac == NULL)
|
||||
{
|
||||
memset(&bcastmac, 0, sizeof(struct rimeaddr_s));
|
||||
memset(&bcastmac, 0, sizeof(struct sixlowpan_addr_s));
|
||||
destmac = &bcastmac;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@
|
||||
|
||||
static bool sixlowpan_addrnull(FAR uint8_t *addr)
|
||||
{
|
||||
int i = NET_6LOWPAN_RIMEADDR_SIZE;
|
||||
int i = NET_6LOWPAN_ADDRSIZE;
|
||||
|
||||
while (i-- > 0)
|
||||
{
|
||||
@ -179,12 +179,12 @@ int sixlowpan_meta_data(uint16_t dest_panid,
|
||||
{
|
||||
/* Copy the destination address */
|
||||
|
||||
rimeaddr_copy((struct rimeaddr_s *)&meta->dest_addr,
|
||||
rimeaddr_copy((struct sixlowpan_addr_s *)&meta->dest_addr,
|
||||
g_pktaddrs[PACKETBUF_ADDR_RECEIVER].u8);
|
||||
|
||||
/* Use short destination address mode if so configured */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
meta->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
|
||||
#else
|
||||
meta->fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||
@ -193,12 +193,12 @@ int sixlowpan_meta_data(uint16_t dest_panid,
|
||||
|
||||
/* Set the source address to the node address assigned to the device */
|
||||
|
||||
rimeaddr_copy((struct rimeaddr_s *)&meta->src_addr,
|
||||
rimeaddr_copy((struct sixlowpan_addr_s *)&meta->src_addr,
|
||||
&ieee->i_dev.d_mac.ieee802154);
|
||||
|
||||
/* Use short soruce address mode if so configured */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
meta->fcf.src_addr_mode = FRAME802154_LONGADDRMODE;
|
||||
#else
|
||||
meta->fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||
|
@ -70,6 +70,6 @@ uint8_t g_frame_hdrlen;
|
||||
/* Packet buffer metadata: Attributes and addresses */
|
||||
|
||||
uint16_t g_pktattrs[PACKETBUF_NUM_ATTRS];
|
||||
struct rimeaddr_s g_pktaddrs[PACKETBUF_NUM_ADDRS];
|
||||
struct sixlowpan_addr_s g_pktaddrs[PACKETBUF_NUM_ADDRS];
|
||||
|
||||
#endif /* CONFIG_NET_6LOWPAN */
|
||||
|
@ -233,7 +233,7 @@ static FAR struct sixlowpan_addrcontext_s *
|
||||
****************************************************************************/
|
||||
|
||||
static uint8_t compress_addr_64(FAR const net_ipv6addr_t ipaddr,
|
||||
FAR const struct rimeaddr_s *macaddr,
|
||||
FAR const struct sixlowpan_addr_s *macaddr,
|
||||
uint8_t bitpos)
|
||||
{
|
||||
ninfo("ipaddr=%p macaddr=%p bitpos=%u g_hc06ptr=%p\n",
|
||||
@ -275,7 +275,7 @@ static uint8_t compress_addr_64(FAR const net_ipv6addr_t ipaddr,
|
||||
****************************************************************************/
|
||||
|
||||
static void uncompress_addr(FAR net_ipv6addr_t ipaddr, uint8_t const prefix[],
|
||||
uint8_t prefpost, FAR struct rimeaddr_s *macaddr)
|
||||
uint8_t prefpost, FAR struct sixlowpan_addr_s *macaddr)
|
||||
{
|
||||
uint8_t prefcount = prefpost >> 4;
|
||||
uint8_t postcount = prefpost & 0x0f;
|
||||
@ -446,7 +446,7 @@ void sixlowpan_hc06_initialize(void)
|
||||
|
||||
void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *ipv6,
|
||||
FAR const struct rimeaddr_s *destmac,
|
||||
FAR const struct sixlowpan_addr_s *destmac,
|
||||
FAR uint8_t *fptr)
|
||||
{
|
||||
FAR uint8_t *iphc = fptr + g_frame_hdrlen;
|
||||
@ -987,14 +987,14 @@ void sixlowpan_uncompresshdr_hc06(uint16_t iplen, FAR struct iob_s *iob,
|
||||
|
||||
uncompress_addr(ipv6->srcipaddr,
|
||||
tmp != 0 ? addrcontext->prefix : NULL, g_unc_ctxconf[tmp],
|
||||
(FAR struct rimeaddr_s *)&g_pktaddrs[PACKETBUF_ADDR_SENDER]);
|
||||
(FAR struct sixlowpan_addr_s *)&g_pktaddrs[PACKETBUF_ADDR_SENDER]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No compression and link local */
|
||||
|
||||
uncompress_addr(ipv6->srcipaddr, g_llprefix, g_unc_llconf[tmp],
|
||||
(FAR struct rimeaddr_s *)&g_pktaddrs[PACKETBUF_ADDR_SENDER]);
|
||||
(FAR struct sixlowpan_addr_s *)&g_pktaddrs[PACKETBUF_ADDR_SENDER]);
|
||||
}
|
||||
|
||||
/* Destination address */
|
||||
@ -1053,14 +1053,14 @@ void sixlowpan_uncompresshdr_hc06(uint16_t iplen, FAR struct iob_s *iob,
|
||||
}
|
||||
|
||||
uncompress_addr(ipv6->destipaddr, addrcontext->prefix, g_unc_ctxconf[tmp],
|
||||
(FAR struct rimeaddr_s *)&g_pktaddrs[PACKETBUF_ADDR_RECEIVER]);
|
||||
(FAR struct sixlowpan_addr_s *)&g_pktaddrs[PACKETBUF_ADDR_RECEIVER]);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not address context based => link local M = 0, DAC = 0 - same as SAC */
|
||||
|
||||
uncompress_addr(ipv6->destipaddr, g_llprefix, g_unc_llconf[tmp],
|
||||
(FAR struct rimeaddr_s *)&g_pktaddrs[PACKETBUF_ADDR_RECEIVER]);
|
||||
(FAR struct sixlowpan_addr_s *)&g_pktaddrs[PACKETBUF_ADDR_RECEIVER]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@
|
||||
|
||||
void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *ipv6,
|
||||
FAR const struct rimeaddr_s *destmac,
|
||||
FAR const struct sixlowpan_addr_s *destmac,
|
||||
FAR uint8_t *fptr)
|
||||
{
|
||||
FAR uint8_t *hc1 = fptr + g_frame_hdrlen;
|
||||
|
@ -740,7 +740,7 @@ int sixlowpan_input(FAR struct ieee802154_driver_s *ieee,
|
||||
{
|
||||
FAR struct ipv6_hdr_s *ipv6hdr;
|
||||
FAR uint8_t *buffer;
|
||||
struct rimeaddr_s destmac;
|
||||
struct sixlowpan_addr_s destmac;
|
||||
size_t hdrlen;
|
||||
size_t buflen;
|
||||
|
||||
|
@ -75,12 +75,12 @@
|
||||
/* Copy a Rime address */
|
||||
|
||||
#define rimeaddr_copy(dest,src) \
|
||||
memcpy(dest, src, NET_6LOWPAN_RIMEADDR_SIZE)
|
||||
memcpy(dest, src, NET_6LOWPAN_ADDRSIZE)
|
||||
|
||||
/* Compare two Rime addresses */
|
||||
|
||||
#define rimeaddr_cmp(addr1,addr2) \
|
||||
(memcmp(addr1, addr2, NET_6LOWPAN_RIMEADDR_SIZE) == 0)
|
||||
(memcmp(addr1, addr2, NET_6LOWPAN_ADDRSIZE) == 0)
|
||||
|
||||
/* Pointers in the Rime buffer */
|
||||
|
||||
@ -222,7 +222,7 @@ extern uint8_t g_frame_hdrlen;
|
||||
/* Packet buffer metadata: Attributes and addresses */
|
||||
|
||||
extern uint16_t g_pktattrs[PACKETBUF_NUM_ATTRS];
|
||||
extern struct rimeaddr_s g_pktaddrs[PACKETBUF_NUM_ADDRS];
|
||||
extern struct sixlowpan_addr_s g_pktaddrs[PACKETBUF_NUM_ADDRS];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
@ -236,7 +236,7 @@ struct net_driver_s; /* Forward reference */
|
||||
struct ieee802154_driver_s; /* Forward reference */
|
||||
struct devif_callback_s; /* Forward reference */
|
||||
struct ipv6_hdr_s; /* Forward reference */
|
||||
struct rimeaddr_s; /* Forward reference */
|
||||
struct sixlowpan_addr_s; /* Forward reference */
|
||||
struct iob_s; /* Forward reference */
|
||||
|
||||
/****************************************************************************
|
||||
@ -275,7 +275,7 @@ struct iob_s; /* Forward reference */
|
||||
int sixlowpan_send(FAR struct net_driver_s *dev,
|
||||
FAR struct devif_callback_s **list,
|
||||
FAR const struct ipv6_hdr_s *ipv6hdr, FAR const void *buf,
|
||||
size_t buflen, FAR const struct rimeaddr_s *raddr,
|
||||
size_t buflen, FAR const struct sixlowpan_addr_s *raddr,
|
||||
uint16_t timeout);
|
||||
|
||||
/****************************************************************************
|
||||
@ -381,7 +381,7 @@ int sixlowpan_frame_submit(FAR struct ieee802154_driver_s *ieee,
|
||||
int sixlowpan_queue_frames(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *ipv6hdr,
|
||||
FAR const void *buf, size_t buflen,
|
||||
FAR const struct rimeaddr_s *destmac);
|
||||
FAR const struct sixlowpan_addr_s *destmac);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sixlowpan_hc06_initialize
|
||||
@ -437,7 +437,7 @@ void sixlowpan_hc06_initialize(void);
|
||||
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC06
|
||||
void sixlowpan_compresshdr_hc06(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *ipv6,
|
||||
FAR const struct rimeaddr_s *destmac,
|
||||
FAR const struct sixlowpan_addr_s *destmac,
|
||||
FAR uint8_t *fptr);
|
||||
#endif
|
||||
|
||||
@ -498,7 +498,7 @@ void sixlowpan_uncompresshdr_hc06(uint16_t iplen, FAR struct iob_s *iob,
|
||||
#ifdef CONFIG_NET_6LOWPAN_COMPRESSION_HC1
|
||||
void sixlowpan_compresshdr_hc1(FAR struct ieee802154_driver_s *ieee,
|
||||
FAR const struct ipv6_hdr_s *ipv6,
|
||||
FAR const struct rimeaddr_s *destmac,
|
||||
FAR const struct sixlowpan_addr_s *destmac,
|
||||
FAR uint8_t *fptr);
|
||||
#endif
|
||||
|
||||
@ -557,12 +557,12 @@ int sixlowpan_uncompresshdr_hc1(uint16_t iplen, FAR struct iob_s *iob,
|
||||
|
||||
#define sixlowpan_islinklocal(ipaddr) ((ipaddr)[0] == NTOHS(0xfe80))
|
||||
|
||||
void sixlowpan_ipfromrime(FAR const struct rimeaddr_s *rime,
|
||||
void sixlowpan_ipfromrime(FAR const struct sixlowpan_addr_s *rime,
|
||||
net_ipv6addr_t ipaddr);
|
||||
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
|
||||
FAR struct rimeaddr_s *rime);
|
||||
FAR struct sixlowpan_addr_s *rime);
|
||||
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
|
||||
FAR const struct rimeaddr_s *rime);
|
||||
FAR const struct sixlowpan_addr_s *rime);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sixlowpan_src_panid
|
||||
|
@ -83,7 +83,7 @@ struct sixlowpan_send_s
|
||||
uint16_t s_timeout; /* Send timeout in deciseconds */
|
||||
systime_t s_time; /* Last send time for determining timeout */
|
||||
FAR const struct ipv6_hdr_s *s_ipv6hdr; /* IPv6 header, followed by UDP or TCP header. */
|
||||
FAR const struct rimeaddr_s *s_destmac; /* Destination MAC address */
|
||||
FAR const struct sixlowpan_addr_s *s_destmac; /* Destination MAC address */
|
||||
FAR const void *s_buf; /* Data to send */
|
||||
size_t s_len; /* Length of data in buf */
|
||||
};
|
||||
@ -274,7 +274,7 @@ end_wait:
|
||||
int sixlowpan_send(FAR struct net_driver_s *dev,
|
||||
FAR struct devif_callback_s **list,
|
||||
FAR const struct ipv6_hdr_s *ipv6hdr, FAR const void *buf,
|
||||
size_t len, FAR const struct rimeaddr_s *destmac,
|
||||
size_t len, FAR const struct sixlowpan_addr_s *destmac,
|
||||
uint16_t timeout)
|
||||
{
|
||||
struct sixlowpan_send_s sinfo;
|
||||
|
@ -164,7 +164,7 @@ ssize_t psock_6lowpan_tcp_send(FAR struct socket *psock, FAR const void *buf,
|
||||
FAR struct tcp_conn_s *conn;
|
||||
FAR struct net_driver_s *dev;
|
||||
struct ipv6tcp_hdr_s ipv6tcp;
|
||||
struct rimeaddr_s destmac;
|
||||
struct sixlowpan_addr_s destmac;
|
||||
uint16_t timeout;
|
||||
uint16_t iplen;
|
||||
int ret;
|
||||
@ -409,7 +409,7 @@ void sixlowpan_tcp_send(FAR struct net_driver_s *dev)
|
||||
}
|
||||
else
|
||||
{
|
||||
struct rimeaddr_s destmac;
|
||||
struct sixlowpan_addr_s destmac;
|
||||
FAR uint8_t *buf;
|
||||
uint16_t hdrlen;
|
||||
uint16_t buflen;
|
||||
|
@ -162,7 +162,7 @@ ssize_t psock_6lowpan_udp_sendto(FAR struct socket *psock,
|
||||
FAR struct udp_conn_s *conn;
|
||||
FAR struct net_driver_s *dev;
|
||||
struct ipv6udp_hdr_s ipv6udp;
|
||||
struct rimeaddr_s destmac;
|
||||
struct sixlowpan_addr_s destmac;
|
||||
uint16_t iplen;
|
||||
uint16_t timeout;
|
||||
int ret;
|
||||
|
@ -80,7 +80,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_ipfromrime(FAR const struct rimeaddr_s *rime,
|
||||
void sixlowpan_ipfromrime(FAR const struct sixlowpan_addr_s *rime,
|
||||
net_ipv6addr_t ipaddr)
|
||||
{
|
||||
/* We consider only links with IEEE EUI-64 identifier or IEEE 48-bit MAC
|
||||
@ -90,13 +90,13 @@ void sixlowpan_ipfromrime(FAR const struct rimeaddr_s *rime,
|
||||
memset(ipaddr, 0, sizeof(net_ipv6addr_t));
|
||||
ipaddr[0] = HTONS(0xfe80);
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
memcpy(&ipaddr[4], rime, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
memcpy(&ipaddr[4], rime, NET_6LOWPAN_ADDRSIZE);
|
||||
ipaddr[4] ^= HTONS(0x0200);
|
||||
#else
|
||||
ipaddr[5] = HTONS(0x00ff);
|
||||
ipaddr[6] = HTONS(0xfe00);
|
||||
memcpy(&ipaddr[7], rime, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
memcpy(&ipaddr[7], rime, NET_6LOWPAN_ADDRSIZE);
|
||||
ipaddr[7] ^= HTONS(0x0200);
|
||||
#endif
|
||||
}
|
||||
@ -115,16 +115,16 @@ void sixlowpan_ipfromrime(FAR const struct rimeaddr_s *rime,
|
||||
****************************************************************************/
|
||||
|
||||
void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
|
||||
FAR struct rimeaddr_s *rime)
|
||||
FAR struct sixlowpan_addr_s *rime)
|
||||
{
|
||||
/* REVISIT: See notes about 2 byte addresses in sixlowpan_ipfromrime() */
|
||||
|
||||
DEBUGASSERT(ipaddr[0] == HTONS(0xfe80));
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
memcpy(rime, &ipaddr[4], NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
memcpy(rime, &ipaddr[4], NET_6LOWPAN_ADDRSIZE);
|
||||
#else
|
||||
memcpy(rime, &ipaddr[7], NET_6LOWPAN_RIMEADDR_SIZE);
|
||||
memcpy(rime, &ipaddr[7], NET_6LOWPAN_ADDRSIZE);
|
||||
#endif
|
||||
rime->u8[0] ^= 0x02;
|
||||
}
|
||||
@ -143,11 +143,11 @@ void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
|
||||
****************************************************************************/
|
||||
|
||||
bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
|
||||
FAR const struct rimeaddr_s *rime)
|
||||
FAR const struct sixlowpan_addr_s *rime)
|
||||
{
|
||||
FAR const uint8_t *rimeptr = rime->u8;
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
return (ipaddr[4] == htons((GETINT16(rimeptr, 0) ^ 0x0200)) &&
|
||||
ipaddr[5] == GETINT16(rimeptr, 2) &&
|
||||
ipaddr[6] == GETINT16(rimeptr, 4) &&
|
||||
|
@ -350,7 +350,7 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%04x\n",
|
||||
dev->d_mac.ieee802154.u8[0], dev->d_mac.ieee802154.u8[1],
|
||||
dev->d_mac.ieee802154.u8[2], dev->d_mac.ieee802154.u8[3],
|
||||
@ -507,7 +507,7 @@ static int lo_txavail(FAR struct net_driver_s *dev)
|
||||
#if defined(CONFIG_NET_IGMP) || defined(CONFIG_NET_ICMPv6)
|
||||
static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
||||
#else
|
||||
@ -542,7 +542,7 @@ static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||
#ifdef CONFIG_NET_6LOWPAN_EXTENDEDADDR
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user