mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #626 from LudwigOrtmann/issue_621
add EUI-64 support for nativenet
This commit is contained in:
commit
114aaa65e5
@ -84,6 +84,23 @@ radio_address_t nativenet_set_address(radio_address_t address);
|
||||
*/
|
||||
radio_address_t nativenet_get_address();
|
||||
|
||||
/**
|
||||
* @brief Sets the IEEE long address of the nativenet transceiver.
|
||||
*
|
||||
* @param[in] addr The desired address.
|
||||
*
|
||||
* @return The set address after calling.
|
||||
*/
|
||||
uint64_t nativenet_set_address_long(uint64_t addr);
|
||||
|
||||
/**
|
||||
* @brief Gets the current IEEE long address of the nativenet
|
||||
* transceiver.
|
||||
*
|
||||
* @return The current IEEE long address.
|
||||
*/
|
||||
uint64_t nativenet_get_address_long(void);
|
||||
|
||||
/**
|
||||
* Set transceiver channel
|
||||
*
|
||||
|
@ -38,6 +38,7 @@ struct rx_buffer_s {
|
||||
};
|
||||
|
||||
extern struct rx_buffer_s _nativenet_rx_buffer[RX_BUF_SIZE];
|
||||
extern uint64_t _native_net_addr_long;
|
||||
|
||||
void _nativenet_handle_packet(radio_packet_t *packet);
|
||||
int8_t send_buf(radio_packet_t *packet);
|
||||
|
@ -47,6 +47,7 @@ uint16_t _native_net_pan;
|
||||
uint8_t _native_net_monitor;
|
||||
static int _native_net_tpid;
|
||||
radio_address_t _native_net_addr;
|
||||
uint64_t _native_net_addr_long;
|
||||
|
||||
/************************************************************************/
|
||||
/* nativenet.h **********************************************************/
|
||||
@ -108,6 +109,20 @@ radio_address_t nativenet_get_address()
|
||||
return _native_net_addr;
|
||||
}
|
||||
|
||||
uint64_t nativenet_get_address_long(void)
|
||||
{
|
||||
DEBUG("nativenet_get_address_long -> address = %"PRIx64"\n", _native_net_addr_long);
|
||||
return _native_net_addr_long;
|
||||
}
|
||||
|
||||
uint64_t nativenet_set_address_long(uint64_t address)
|
||||
{
|
||||
DEBUG("nativenet_set_address_long(address=%"PRIx64")\n", address);
|
||||
warnx("nativenet_set_address_long: this does not actually change the interfaces address");
|
||||
_native_net_addr_long = address;
|
||||
return _native_net_addr_long;
|
||||
}
|
||||
|
||||
int8_t nativenet_send(radio_packet_t *packet)
|
||||
{
|
||||
packet->src = _native_net_addr;
|
||||
|
@ -284,6 +284,17 @@ int tap_init(char *name)
|
||||
}
|
||||
memcpy(_native_tap_mac, ifr.ifr_hwaddr.sa_data, ETHER_ADDR_LEN);
|
||||
#endif
|
||||
DEBUG("_native_tap_mac: %02x:%02x:%02x:%02x:%02x:%02x\n", _native_tap_mac[0], _native_tap_mac[1], _native_tap_mac[2], _native_tap_mac[3], _native_tap_mac[4], _native_tap_mac[5]);
|
||||
|
||||
unsigned char *eui_64 = (unsigned char*)&_native_net_addr_long;
|
||||
eui_64[0] = _native_tap_mac[0];
|
||||
eui_64[1] = _native_tap_mac[1];
|
||||
eui_64[2] = _native_tap_mac[2];
|
||||
eui_64[3] = 0xff;
|
||||
eui_64[4] = 0xfe;
|
||||
eui_64[5] = _native_tap_mac[3];
|
||||
eui_64[6] = _native_tap_mac[4];
|
||||
eui_64[7] = _native_tap_mac[5];
|
||||
|
||||
/* configure signal handler for fds */
|
||||
register_interrupt(SIGIO, _native_handle_tap_input);
|
||||
|
Loading…
Reference in New Issue
Block a user