1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 10:12:45 +01:00

ieee802154: remove ng_ prefix

This commit is contained in:
Martine Lenders 2015-08-07 14:36:04 +02:00
parent 73a42314a5
commit 9cf5e5fb6a
10 changed files with 128 additions and 128 deletions

View File

@ -12,26 +12,26 @@ endif
ifneq (,$(filter ng_at86rf2%,$(USEMODULE)))
USEMODULE += ng_at86rf2xx
USEMODULE += ng_ieee802154
USEMODULE += ieee802154
endif
ifneq (,$(filter kw2xrf,$(USEMODULE)))
USEMODULE += ng_ieee802154
USEMODULE += ieee802154
endif
ifneq (,$(filter xbee,$(USEMODULE)))
USEMODULE += ng_ieee802154
USEMODULE += ieee802154
endif
ifneq (,$(filter ng_zep,$(USEMODULE)))
USEMODULE += hashes
USEMODULE += ng_ieee802154
USEMODULE += ieee802154
USEMODULE += ng_udp
USEMODULE += random
USEMODULE += vtimer
endif
ifneq (,$(filter ng_ieee802154,$(USEMODULE)))
ifneq (,$(filter ieee802154,$(USEMODULE)))
ifneq (,$(filter ng_ipv6, $(USEMODULE)))
USEMODULE += ng_sixlowpan
endif

View File

@ -1,5 +1,5 @@
PSEUDOMODULES += ng_netif_default
PSEUDOMODULES += ng_ieee802154
PSEUDOMODULES += ieee802154
PSEUDOMODULES += ng_ipv6_default
PSEUDOMODULES += ng_ipv6_router
PSEUDOMODULES += ng_ipv6_router_default

View File

@ -30,7 +30,7 @@
#include "periph/uart.h"
#include "periph/gpio.h"
#include "net/ng_netbase.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#ifdef __cplusplus
extern "C" {

View File

@ -25,7 +25,7 @@
#include "periph/gpio.h"
#include "periph/cpuid.h"
#include "net/ng_netbase.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#define ENABLE_DEBUG (0)
#include "debug.h"
@ -807,7 +807,7 @@ int kw2xrf_set(ng_netdev_t *netdev, netopt_t opt, void *value, size_t value_len)
}
}
/* TODO: generalize and move to ng_ieee802154 */
/* TODO: generalize and move to ieee802154 */
/* TODO: include security header implications */
static size_t _get_frame_hdr_len(uint8_t *mhr)
{
@ -815,32 +815,32 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
size_t len = 3;
/* figure out address sizes */
tmp = (mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK);
tmp = (mhr[1] & IEEE802154_FCF_DST_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
len += 4;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
len += 10;
}
else if (tmp != NG_IEEE802154_FCF_DST_ADDR_VOID) {
else if (tmp != IEEE802154_FCF_DST_ADDR_VOID) {
return 0;
}
tmp = (mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK);
tmp = (mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_VOID) {
if (tmp == IEEE802154_FCF_SRC_ADDR_VOID) {
return len;
}
else {
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
len += 2;
}
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
return (len + 2);
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
return (len + 8);
}
}
@ -848,7 +848,7 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
return 0;
}
/* TODO: generalize and move to ng_ieee802154 */
/* TODO: generalize and move to (gnrc_)ieee802154 */
static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
{
uint8_t tmp;
@ -858,12 +858,12 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
ng_netif_hdr_t *hdr;
/* figure out address sizes */
tmp = mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK;
tmp = mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
src_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
src_len = 8;
}
else if (tmp == 0) {
@ -873,12 +873,12 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
return NULL;
}
tmp = mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK;
tmp = mhr[1] & IEEE802154_FCF_DST_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
dst_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
dst_len = 8;
}
else if (tmp == 0) {
@ -912,7 +912,7 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
tmp = 3;
}
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
tmp += 2;
}

View File

@ -26,7 +26,7 @@
#include "hwtimer.h"
#include "periph/cpuid.h"
#include "byteorder.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#include "net/ng_netbase.h"
#include "ng_at86rf2xx_registers.h"
#include "ng_at86rf2xx_internal.h"
@ -221,7 +221,7 @@ void ng_at86rf2xx_tx_prepare(ng_at86rf2xx_t *dev)
dev->idle_state = state;
}
ng_at86rf2xx_set_state(dev, NG_AT86RF2XX_STATE_TX_ARET_ON);
dev->frame_len = NG_IEEE802154_FCS_LEN;
dev->frame_len = IEEE802154_FCS_LEN;
}
size_t ng_at86rf2xx_tx_load(ng_at86rf2xx_t *dev, uint8_t *data,

View File

@ -20,7 +20,7 @@
*/
#include "net/eui64.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#include "net/ng_netbase.h"
#include "ng_at86rf2xx.h"
#include "ng_at86rf2xx_netdev.h"
@ -32,21 +32,21 @@
#define _MAX_MHR_OVERHEAD (25)
/* TODO: generalize and move to ng_ieee802154 */
/* TODO: generalize and move to (gnrc_)ieee802154 */
static size_t _make_data_frame_hdr(ng_at86rf2xx_t *dev, uint8_t *buf,
ng_netif_hdr_t *hdr)
{
int pos = 0;
/* we are building a data frame here */
buf[0] = NG_IEEE802154_FCF_TYPE_DATA;
buf[1] = NG_IEEE802154_FCF_VERS_V1;
buf[0] = IEEE802154_FCF_TYPE_DATA;
buf[1] = IEEE802154_FCF_VERS_V1;
/* if AUTOACK is enabled, then we also expect ACKs for this packet */
if (!(hdr->flags & NG_NETIF_HDR_FLAGS_BROADCAST) &&
!(hdr->flags & NG_NETIF_HDR_FLAGS_MULTICAST) &&
(dev->options & NG_AT86RF2XX_OPT_AUTOACK)) {
buf[0] |= NG_IEEE802154_FCF_ACK_REQ;
buf[0] |= IEEE802154_FCF_ACK_REQ;
}
/* fill in destination PAN ID */
@ -57,18 +57,18 @@ static size_t _make_data_frame_hdr(ng_at86rf2xx_t *dev, uint8_t *buf,
/* fill in destination address */
if (hdr->flags &
(NG_NETIF_HDR_FLAGS_BROADCAST | NG_NETIF_HDR_FLAGS_MULTICAST)) {
buf[1] |= NG_IEEE802154_FCF_DST_ADDR_SHORT;
buf[1] |= IEEE802154_FCF_DST_ADDR_SHORT;
buf[pos++] = 0xff;
buf[pos++] = 0xff;
}
else if (hdr->dst_l2addr_len == 2) {
uint8_t *dst_addr = ng_netif_hdr_get_dst_addr(hdr);
buf[1] |= NG_IEEE802154_FCF_DST_ADDR_SHORT;
buf[1] |= IEEE802154_FCF_DST_ADDR_SHORT;
buf[pos++] = dst_addr[1];
buf[pos++] = dst_addr[0];
}
else if (hdr->dst_l2addr_len == 8) {
buf[1] |= NG_IEEE802154_FCF_DST_ADDR_LONG;
buf[1] |= IEEE802154_FCF_DST_ADDR_LONG;
uint8_t *dst_addr = ng_netif_hdr_get_dst_addr(hdr);
for (int i = 7; i >= 0; i--) {
buf[pos++] = dst_addr[i];
@ -84,17 +84,17 @@ static size_t _make_data_frame_hdr(ng_at86rf2xx_t *dev, uint8_t *buf,
buf[pos++] = (uint8_t)((dev->pan) & 0xff);
buf[pos++] = (uint8_t)((dev->pan) >> 8);
} else {
buf[0] |= NG_IEEE802154_FCF_PAN_COMP;
buf[0] |= IEEE802154_FCF_PAN_COMP;
}
/* fill in source address */
if (dev->options & NG_AT86RF2XX_OPT_SRC_ADDR_LONG) {
buf[1] |= NG_IEEE802154_FCF_SRC_ADDR_LONG;
buf[1] |= IEEE802154_FCF_SRC_ADDR_LONG;
memcpy(&(buf[pos]), dev->addr_long, 8);
pos += 8;
}
else {
buf[1] |= NG_IEEE802154_FCF_SRC_ADDR_SHORT;
buf[1] |= IEEE802154_FCF_SRC_ADDR_SHORT;
buf[pos++] = dev->addr_short[0];
buf[pos++] = dev->addr_short[1];
}
@ -105,7 +105,7 @@ static size_t _make_data_frame_hdr(ng_at86rf2xx_t *dev, uint8_t *buf,
return pos;
}
/* TODO: generalize and move to ng_ieee802154 */
/* TODO: generalize and move to ieee802154 */
/* TODO: include security header implications */
static size_t _get_frame_hdr_len(uint8_t *mhr)
{
@ -113,35 +113,35 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
size_t len = 3;
/* figure out address sizes */
tmp = (mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
tmp = (mhr[1] & IEEE802154_FCF_DST_ADDR_MASK);
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
len += 4;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
len += 10;
}
else if (tmp != NG_IEEE802154_FCF_DST_ADDR_VOID) {
else if (tmp != IEEE802154_FCF_DST_ADDR_VOID) {
return 0;
}
tmp = (mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_VOID) {
tmp = (mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK);
if (tmp == IEEE802154_FCF_SRC_ADDR_VOID) {
return len;
}
else {
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
len += 2;
}
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
return (len + 2);
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
return (len + 8);
}
}
return 0;
}
/* TODO: generalize and move to ng_ieee802154 */
/* TODO: generalize and move to (gnrc_)ieee802154 */
static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
{
uint8_t tmp;
@ -151,27 +151,27 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
ng_netif_hdr_t *hdr;
/* figure out address sizes */
tmp = mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
tmp = mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK;
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
src_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
src_len = 8;
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_VOID) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_VOID) {
src_len = 0;
}
else {
return NULL;
}
tmp = mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
tmp = mhr[1] & IEEE802154_FCF_DST_ADDR_MASK;
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
dst_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
dst_len = 8;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_VOID) {
else if (tmp == IEEE802154_FCF_DST_ADDR_VOID) {
dst_len = 0;
}
else {
@ -196,7 +196,7 @@ static ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
else {
tmp = 3;
}
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
tmp += 2;
}
if (src_len > 0) {
@ -213,7 +213,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
{
ng_at86rf2xx_t *dev = (ng_at86rf2xx_t *)netdev;
ng_pktsnip_t *snip;
uint8_t mhr[NG_IEEE802154_MAX_HDR_LEN];
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
size_t len;
if (pkt == NULL) {
@ -260,7 +260,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
static void _receive_data(ng_at86rf2xx_t *dev)
{
uint8_t mhr[NG_IEEE802154_MAX_HDR_LEN];
uint8_t mhr[IEEE802154_MAX_HDR_LEN];
size_t pkt_len, hdr_len;
ng_pktsnip_t *hdr, *payload = NULL;
ng_netif_hdr_t *netif;
@ -412,11 +412,11 @@ static int _get(ng_netdev_t *device, netopt_t opt, void *val, size_t max_len)
}
if (dev->options & NG_AT86RF2XX_OPT_SRC_ADDR_LONG) {
uint64_t addr = ng_at86rf2xx_get_addr_long(dev);
ng_ieee802154_get_iid(val, (uint8_t *)&addr, 8);
ieee802154_get_iid(val, (uint8_t *)&addr, 8);
}
else {
uint16_t addr = ng_at86rf2xx_get_addr_short(dev);
ng_ieee802154_get_iid(val, (uint8_t *)&addr, 2);
ieee802154_get_iid(val, (uint8_t *)&addr, 2);
}
return sizeof(eui64_t);

View File

@ -26,7 +26,7 @@
#include "hwtimer.h"
#include "msg.h"
#include "net/eui64.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#include "periph/cpuid.h"
#define ENABLE_DEBUG (0)
@ -626,10 +626,10 @@ static int _get(ng_netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
return -EOVERFLOW;
}
if (dev->addr_flags & XBEE_ADDR_FLAGS_LONG) {
ng_ieee802154_get_iid(value, (uint8_t *)&dev->addr_long, 8);
ieee802154_get_iid(value, (uint8_t *)&dev->addr_long, 8);
}
else {
ng_ieee802154_get_iid(value, (uint8_t *)&dev->addr_short, 2);
ieee802154_get_iid(value, (uint8_t *)&dev->addr_short, 2);
}
return sizeof(eui64_t);

View File

@ -7,7 +7,7 @@
*/
/**
* @defgroup net_ng_ieee802154 IEEE802.15.4
* @defgroup net_ieee802154 IEEE802.15.4
* @ingroup net
* @brief IEEE802.15.4 header definitions and utility functions
* @{
@ -18,8 +18,8 @@
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef NG_IEEE802154_H_
#define NG_IEEE802154_H_
#ifndef IEEE802154_H_
#define IEEE802154_H_
#include <stdlib.h>
@ -33,33 +33,33 @@ extern "C" {
* @brief IEEE802.15.4 FCF field definitions
* @{
*/
#define NG_IEEE802154_MAX_HDR_LEN (23U)
#define NG_IEEE802154_FCF_LEN (2U)
#define NG_IEEE802154_FCS_LEN (2U)
#define IEEE802154_MAX_HDR_LEN (23U)
#define IEEE802154_FCF_LEN (2U)
#define IEEE802154_FCS_LEN (2U)
#define NG_IEEE802154_FCF_TYPE_MASK (0x07)
#define NG_IEEE802154_FCF_TYPE_BEACON (0x00)
#define NG_IEEE802154_FCF_TYPE_DATA (0x01)
#define NG_IEEE802154_FCF_TYPE_ACK (0x02)
#define NG_IEEE802154_FCF_TYPE_MACCMD (0x03)
#define IEEE802154_FCF_TYPE_MASK (0x07)
#define IEEE802154_FCF_TYPE_BEACON (0x00)
#define IEEE802154_FCF_TYPE_DATA (0x01)
#define IEEE802154_FCF_TYPE_ACK (0x02)
#define IEEE802154_FCF_TYPE_MACCMD (0x03)
#define NG_IEEE802154_FCF_SECURITY_EN (0x08)
#define NG_IEEE802154_FCF_FRAME_PEND (0x10)
#define NG_IEEE802154_FCF_ACK_REQ (0x20)
#define NG_IEEE802154_FCF_PAN_COMP (0x40)
#define IEEE802154_FCF_SECURITY_EN (0x08)
#define IEEE802154_FCF_FRAME_PEND (0x10)
#define IEEE802154_FCF_ACK_REQ (0x20)
#define IEEE802154_FCF_PAN_COMP (0x40)
#define NG_IEEE802154_FCF_DST_ADDR_MASK (0x0c)
#define NG_IEEE802154_FCF_DST_ADDR_VOID (0x00)
#define NG_IEEE802154_FCF_DST_ADDR_SHORT (0x08)
#define NG_IEEE802154_FCF_DST_ADDR_LONG (0x0c)
#define IEEE802154_FCF_DST_ADDR_MASK (0x0c)
#define IEEE802154_FCF_DST_ADDR_VOID (0x00)
#define IEEE802154_FCF_DST_ADDR_SHORT (0x08)
#define IEEE802154_FCF_DST_ADDR_LONG (0x0c)
#define NG_IEEE802154_FCF_VERS_V0 (0x00)
#define NG_IEEE802154_FCF_VERS_V1 (0x10)
#define IEEE802154_FCF_VERS_V0 (0x00)
#define IEEE802154_FCF_VERS_V1 (0x10)
#define NG_IEEE802154_FCF_SRC_ADDR_MASK (0xc0)
#define NG_IEEE802154_FCF_SRC_ADDR_VOID (0x00)
#define NG_IEEE802154_FCF_SRC_ADDR_SHORT (0x80)
#define NG_IEEE802154_FCF_SRC_ADDR_LONG (0xc0)
#define IEEE802154_FCF_SRC_ADDR_MASK (0xc0)
#define IEEE802154_FCF_SRC_ADDR_VOID (0x00)
#define IEEE802154_FCF_SRC_ADDR_SHORT (0x80)
#define IEEE802154_FCF_SRC_ADDR_LONG (0xc0)
/** @} */
/**
@ -80,7 +80,7 @@ extern "C" {
* @return Copy of @p eui64 on success.
* @return NULL, if @p addr_len was of illegal length.
*/
static inline eui64_t *ng_ieee802154_get_iid(eui64_t *eui64, uint8_t *addr,
static inline eui64_t *ieee802154_get_iid(eui64_t *eui64, uint8_t *addr,
size_t addr_len)
{
int i = 0;
@ -124,5 +124,5 @@ static inline eui64_t *ng_ieee802154_get_iid(eui64_t *eui64, uint8_t *addr,
}
#endif
#endif /* NG_IEEE802154_H_ */
#endif /* IEEE802154_H_ */
/** @} */

View File

@ -23,7 +23,7 @@
#include "hashes.h"
#include "kernel.h"
#include "msg.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#include "net/ng_ipv6/addr.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ng_netbase.h"
@ -82,7 +82,7 @@ static size_t _zep_hdr_fill(ng_zep_t *dev, ng_zep_hdr_t *hdr,
/* Event handlers for ISR events */
static void _rx_started_event(ng_zep_t *dev);
/* IEEE 802.15.4 helper functions: TODO: generalize add to ng_ieee802154 */
/* IEEE 802.15.4 helper functions: TODO: generalize add to (gnrc_)ieee802154 */
static size_t _make_data_frame_hdr(ng_zep_t *dev, uint8_t *buf,
ng_netif_hdr_t *hdr);
static size_t _get_frame_hdr_len(uint8_t *mhr);
@ -209,7 +209,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
ng_pktsnip_t *ptr, *new_pkt, *hdr;
ng_zep_hdr_t *zep;
size_t payload_len = ng_pkt_len(pkt->next), hdr_len, mhr_offset;
uint8_t mhr[NG_IEEE802154_MAX_HDR_LEN], *data;
uint8_t mhr[IEEE802154_MAX_HDR_LEN], *data;
uint16_t fcs = 0;
if ((netdev == NULL) || (netdev->driver != &_zep_driver)) {
@ -227,7 +227,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
return -ENOMSG;
}
new_pkt = _zep_hdr_build(dev, hdr_len + payload_len + NG_IEEE802154_FCS_LEN, false);
new_pkt = _zep_hdr_build(dev, hdr_len + payload_len + IEEE802154_FCS_LEN, false);
if (new_pkt == NULL) {
DEBUG("zep: could not allocate ZEP header in pktbuf\n");
@ -261,7 +261,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
new_pkt = hdr;
mhr_offset = _zep_hdr_fill(dev, zep, payload_len + hdr_len + NG_IEEE802154_FCS_LEN);
mhr_offset = _zep_hdr_fill(dev, zep, payload_len + hdr_len + IEEE802154_FCS_LEN);
if (mhr_offset == 0) {
DEBUG("zep: error filling ZEP header\n");
@ -294,7 +294,7 @@ static int _send(ng_netdev_t *netdev, ng_pktsnip_t *pkt)
return -ENOENT;
}
return payload_len + hdr_len + NG_IEEE802154_FCS_LEN;
return payload_len + hdr_len + IEEE802154_FCS_LEN;
}
static int _add_cb(ng_netdev_t *dev, ng_netdev_event_cb_t cb)
@ -410,11 +410,11 @@ static int _get(ng_netdev_t *netdev, netopt_t opt, void *value, size_t max_len)
}
if (dev->flags & NG_ZEP_FLAGS_SRC_ADDR_LONG) {
uint64_t addr = byteorder_ltobll(dev->eui64).u64;
ng_ieee802154_get_iid(value, (uint8_t *)&addr, 8);
ieee802154_get_iid(value, (uint8_t *)&addr, 8);
}
else {
uint16_t addr = byteorder_ltobs(dev->addr).u16;
ng_ieee802154_get_iid(value, (uint8_t *)&addr, 2);
ieee802154_get_iid(value, (uint8_t *)&addr, 2);
}
return sizeof(eui64_t);
@ -872,19 +872,19 @@ static void _rx_started_event(ng_zep_t *dev)
}
}
/* TODO: Generalize and move all below to ng_ieee802154 */
/* TODO: Generalize and move all below to ieee802154 */
static size_t _make_data_frame_hdr(ng_zep_t *dev, uint8_t *buf,
ng_netif_hdr_t *hdr)
{
int pos = 0;
/* we are building a data frame here */
buf[0] = NG_IEEE802154_FCF_TYPE_DATA;
buf[0] = IEEE802154_FCF_TYPE_DATA;
buf[1] = 0x88; /* use short src and dst addresses as starting point */
/* if AUTOACK is enabled, then we also expect ACKs for this packet */
if (dev->flags & NG_ZEP_FLAGS_AUTOACK) {
buf[0] |= NG_IEEE802154_FCF_ACK_REQ;
buf[0] |= IEEE802154_FCF_ACK_REQ;
}
/* fill in destination PAN ID */
@ -922,7 +922,7 @@ static size_t _make_data_frame_hdr(ng_zep_t *dev, uint8_t *buf,
buf[pos++] = dev->pan.u8[1];
}
else {
buf[0] |= NG_IEEE802154_FCF_PAN_COMP;
buf[0] |= IEEE802154_FCF_PAN_COMP;
}
/* fill in source address */
@ -948,32 +948,32 @@ static size_t _get_frame_hdr_len(uint8_t *mhr)
size_t len = 3;
/* figure out address sizes */
tmp = (mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK);
tmp = (mhr[1] & IEEE802154_FCF_DST_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
len += 4;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
len += 10;
}
else if (tmp != NG_IEEE802154_FCF_DST_ADDR_VOID) {
else if (tmp != IEEE802154_FCF_DST_ADDR_VOID) {
return 0;
}
tmp = (mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK);
tmp = (mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK);
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_VOID) {
if (tmp == IEEE802154_FCF_SRC_ADDR_VOID) {
return len;
}
else {
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
len += 2;
}
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
return (len + 2);
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
return (len + 8);
}
}
@ -990,12 +990,12 @@ ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
ng_netif_hdr_t *hdr;
/* figure out address sizes */
tmp = mhr[1] & NG_IEEE802154_FCF_SRC_ADDR_MASK;
tmp = mhr[1] & IEEE802154_FCF_SRC_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_SRC_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_SRC_ADDR_SHORT) {
src_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_SRC_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_SRC_ADDR_LONG) {
src_len = 8;
}
else if (tmp == 0) {
@ -1005,12 +1005,12 @@ ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
return NULL;
}
tmp = mhr[1] & NG_IEEE802154_FCF_DST_ADDR_MASK;
tmp = mhr[1] & IEEE802154_FCF_DST_ADDR_MASK;
if (tmp == NG_IEEE802154_FCF_DST_ADDR_SHORT) {
if (tmp == IEEE802154_FCF_DST_ADDR_SHORT) {
dst_len = 2;
}
else if (tmp == NG_IEEE802154_FCF_DST_ADDR_LONG) {
else if (tmp == IEEE802154_FCF_DST_ADDR_LONG) {
dst_len = 8;
}
else if (tmp == 0) {
@ -1044,7 +1044,7 @@ ng_pktsnip_t *_make_netif_hdr(uint8_t *mhr)
tmp = 3;
}
if (!(mhr[0] & NG_IEEE802154_FCF_PAN_COMP)) {
if (!(mhr[0] & IEEE802154_FCF_PAN_COMP)) {
tmp += 2;
}

View File

@ -15,7 +15,7 @@
#include <stdbool.h>
#include "byteorder.h"
#include "net/ng_ieee802154.h"
#include "net/ieee802154.h"
#include "net/ng_ipv6/hdr.h"
#include "net/ng_netbase.h"
#include "net/ng_sixlowpan/ctx.h"
@ -201,7 +201,7 @@ bool ng_sixlowpan_iphc_decode(ng_pktsnip_t *pkt)
break;
case IPHC_SAC_SAM_L2:
ng_ieee802154_get_iid((eui64_t *)(&ipv6_hdr->src.u64[1]),
ieee802154_get_iid((eui64_t *)(&ipv6_hdr->src.u64[1]),
ng_netif_hdr_get_src_addr(netif_hdr),
netif_hdr->src_l2addr_len);
ng_ipv6_addr_set_link_local_prefix(&ipv6_hdr->src);
@ -228,7 +228,7 @@ bool ng_sixlowpan_iphc_decode(ng_pktsnip_t *pkt)
break;
case IPHC_SAC_SAM_CTX_L2:
ng_ieee802154_get_iid((eui64_t *)(&ipv6_hdr->src.u64[1]),
ieee802154_get_iid((eui64_t *)(&ipv6_hdr->src.u64[1]),
ng_netif_hdr_get_src_addr(netif_hdr),
netif_hdr->src_l2addr_len);
ng_ipv6_addr_init_prefix(&ipv6_hdr->src, &ctx->prefix,
@ -276,7 +276,7 @@ bool ng_sixlowpan_iphc_decode(ng_pktsnip_t *pkt)
break;
case IPHC_M_DAC_DAM_U_L2:
ng_ieee802154_get_iid((eui64_t *)(&ipv6_hdr->dst.u64[1]),
ieee802154_get_iid((eui64_t *)(&ipv6_hdr->dst.u64[1]),
ng_netif_hdr_get_dst_addr(netif_hdr),
netif_hdr->dst_l2addr_len);
ng_ipv6_addr_set_link_local_prefix(&ipv6_hdr->dst);
@ -299,7 +299,7 @@ bool ng_sixlowpan_iphc_decode(ng_pktsnip_t *pkt)
break;
case IPHC_M_DAC_DAM_U_CTX_L2:
ng_ieee802154_get_iid((eui64_t *)(&ipv6_hdr->dst.u64[1]),
ieee802154_get_iid((eui64_t *)(&ipv6_hdr->dst.u64[1]),
ng_netif_hdr_get_dst_addr(netif_hdr),
netif_hdr->dst_l2addr_len);
ng_ipv6_addr_init_prefix(&ipv6_hdr->dst, &ctx->prefix,
@ -510,7 +510,7 @@ bool ng_sixlowpan_iphc_encode(ng_pktsnip_t *pkt)
(netif_hdr->src_l2addr_len == 4) ||
(netif_hdr->src_l2addr_len == 8)) {
/* prefer to create IID from netif header if available */
ng_ieee802154_get_iid(&iid, ng_netif_hdr_get_src_addr(netif_hdr),
ieee802154_get_iid(&iid, ng_netif_hdr_get_src_addr(netif_hdr),
netif_hdr->src_l2addr_len);
}
else {
@ -619,7 +619,7 @@ bool ng_sixlowpan_iphc_encode(ng_pktsnip_t *pkt)
ng_ipv6_addr_is_link_local(&ipv6_hdr->dst)) && (netif_hdr->dst_l2addr_len > 0)) {
eui64_t iid;
ng_ieee802154_get_iid(&iid, ng_netif_hdr_get_dst_addr(netif_hdr),
ieee802154_get_iid(&iid, ng_netif_hdr_get_dst_addr(netif_hdr),
netif_hdr->dst_l2addr_len);
if ((ipv6_hdr->dst.u64[1].u64 == iid.uint64.u64) ||