1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #2831 from OlegHahm/transceiver_broadcast

Use transceiver specific broadcast
This commit is contained in:
Oleg Hahm 2015-04-20 10:16:08 +02:00
commit 09c07e918d
7 changed files with 23 additions and 4 deletions

View File

@ -19,6 +19,11 @@
extern "C" { extern "C" {
#endif #endif
/**
* @brief Broadcast address
*/
#define MC1322X_BROADCAST_ADDRESS (0xFFFF)
/*********************************************************/ /*********************************************************/
/* function definitions */ /* function definitions */
/*********************************************************/ /*********************************************************/

View File

@ -44,6 +44,11 @@
*/ */
#define NATIVENET_DEV_CB_MAX (128) #define NATIVENET_DEV_CB_MAX (128)
/**
* @brief Broadcast address
*/
#define NATIVE_BROADCAST_ADDRESS (0)
#ifndef NATIVE_MAX_DATA_LENGTH #ifndef NATIVE_MAX_DATA_LENGTH
#include "tap.h" #include "tap.h"

View File

@ -201,7 +201,7 @@ void _nativenet_handle_packet(radio_packet_t *packet)
if (dst_addr == _nativenet_default_dev_more._radio_addr) { if (dst_addr == _nativenet_default_dev_more._radio_addr) {
DEBUG("_nativenet_handle_packet: accept packet, addressed to us\n"); DEBUG("_nativenet_handle_packet: accept packet, addressed to us\n");
} }
else if (dst_addr == 0) { else if (dst_addr == NATIVE_BROADCAST_ADDRESS) {
DEBUG("_nativenet_handle_packet: accept packet, broadcast\n"); DEBUG("_nativenet_handle_packet: accept packet, broadcast\n");
} }
else { else {

View File

@ -109,36 +109,42 @@ extern "C" {
#if (CC1100_MAX_DATA_LENGTH > PAYLOAD_SIZE) #if (CC1100_MAX_DATA_LENGTH > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (CC1100_MAX_DATA_LENGTH) #define PAYLOAD_SIZE (CC1100_MAX_DATA_LENGTH)
#define TRANSCEIVER_BROADCAST CC1100_BROADCAST_ADDRESS
#endif #endif
#endif #endif
#if (defined(MODULE_CC110X) || defined(MODULE_CC110X_LEGACY)) #if (defined(MODULE_CC110X) || defined(MODULE_CC110X_LEGACY))
#if (CC1100_MAX_DATA_LENGTH > PAYLOAD_SIZE) #if (CC1100_MAX_DATA_LENGTH > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (CC1100_MAX_DATA_LENGTH) #define PAYLOAD_SIZE (CC1100_MAX_DATA_LENGTH)
#define TRANSCEIVER_BROADCAST CC1100_BROADCAST_ADDRESS
#endif #endif
#endif #endif
#ifdef MODULE_CC2420 #ifdef MODULE_CC2420
#if (CC2420_MAX_DATA_LENGTH > PAYLOAD_SIZE) #if (CC2420_MAX_DATA_LENGTH > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (CC2420_MAX_DATA_LENGTH) #define PAYLOAD_SIZE (CC2420_MAX_DATA_LENGTH)
#define TRANSCEIVER_BROADCAST CC2420_BROADCAST_ADDRESS
#endif #endif
#endif #endif
#ifdef MODULE_AT86RF231 #ifdef MODULE_AT86RF231
#if (AT86RF231_MAX_DATA_LENGTH > PAYLOAD_SIZE) #if (AT86RF231_MAX_DATA_LENGTH > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (AT86RF231_MAX_DATA_LENGTH) #define PAYLOAD_SIZE (AT86RF231_MAX_DATA_LENGTH)
#define TRANSCEIVER_BROADCAST AT86RF231_BROADCAST_ADDRESS
#endif #endif
#endif #endif
#ifdef MODULE_MC1322X #ifdef MODULE_MC1322X
#if (MACA_MAX_PAYLOAD_SIZE > PAYLOAD_SIZE) #if (MACA_MAX_PAYLOAD_SIZE > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (MACA_MAX_PAYLOAD_SIZE) #define PAYLOAD_SIZE (MACA_MAX_PAYLOAD_SIZE)
#define TRANSCEIVER_BROADCAST MC1322X_BROADCAST_ADDRESS
#endif #endif
#endif #endif
#ifdef MODULE_NATIVENET #ifdef MODULE_NATIVENET
#if (NATIVE_MAX_DATA_LENGTH > PAYLOAD_SIZE) #if (NATIVE_MAX_DATA_LENGTH > PAYLOAD_SIZE)
#undef PAYLOAD_SIZE #undef PAYLOAD_SIZE
#define PAYLOAD_SIZE (NATIVE_MAX_DATA_LENGTH) #define PAYLOAD_SIZE (NATIVE_MAX_DATA_LENGTH)
#define TRANSCEIVER_BROADCAST NATIVE_BROADCAST_ADDRESS
#endif #endif
#endif #endif
/** /**

View File

@ -24,7 +24,7 @@ extern "C" {
#define RIOT_CCN_EVENT_NUMBER_OFFSET (1 << 8) #define RIOT_CCN_EVENT_NUMBER_OFFSET (1 << 8)
#define RIOT_BROADCAST (UINT16_MAX) #define RIOT_BROADCAST TRANSCEIVER_BROADCAST
typedef struct riot_ccnl_msg { typedef struct riot_ccnl_msg {
void *payload; void *payload;

View File

@ -99,7 +99,7 @@ int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop)
/* see if dest should be routed to a different next hop */ /* see if dest should be routed to a different next hop */
if (ipv6_addr_is_multicast(&packet->destaddr)) { if (ipv6_addr_is_multicast(&packet->destaddr)) {
/* if_id will be ignored */ /* if_id will be ignored */
uint16_t addr = 0xffff; uint16_t addr = TRANSCEIVER_BROADCAST;
return sixlowpan_lowpan_sendto(0, &addr, 2, (uint8_t *) packet, return sixlowpan_lowpan_sendto(0, &addr, 2, (uint8_t *) packet,
length); length);
} }
@ -124,7 +124,7 @@ int ipv6_send_packet(ipv6_hdr_t *packet, ipv6_addr_t *next_hop)
nce->lladdr_len, (uint8_t *) packet, length) < 0) { nce->lladdr_len, (uint8_t *) packet, length) < 0) {
/* XXX: this is wrong, but until ND does work correctly, /* XXX: this is wrong, but until ND does work correctly,
* this is the only way (aka the old way)*/ * this is the only way (aka the old way)*/
uint16_t raddr = 0xffff; /* Broadcast message */ uint16_t raddr = TRANSCEIVER_BROADCAST; /* Broadcast message */
sixlowpan_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet, sixlowpan_lowpan_sendto(0, &raddr, 2, (uint8_t *) packet,
length); length);
/* return -1; */ /* return -1; */

View File

@ -339,6 +339,9 @@ void rpl_send_DAO(rpl_dodag_t *my_dodag, ipv6_addr_t *destination, uint8_t lifet
if (destination) { if (destination) {
DEBUGF("Send DAO to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination)); DEBUGF("Send DAO to %s\n", ipv6_addr_to_str(addr_str, IPV6_MAX_ADDR_STR_LEN, destination));
} }
else {
DEBUGF("Send DAO to default destination\n");
}
#endif #endif