Merge pull request #547 from adamdunkels/push/rimeaddr-linkaddr

Rename the rimeaddr module to linkaddr
This commit is contained in:
Nicolas Tsiftes 2014-01-29 12:57:44 -08:00
commit 4e6bed24f9
180 changed files with 930 additions and 930 deletions

View file

@ -48,7 +48,7 @@
/*---------------------------------------------------------------------------*/
void
collect_view_construct_message(struct collect_view_data_msg *msg,
const rimeaddr_t *parent,
const linkaddr_t *parent,
uint16_t parent_etx,
uint16_t current_rtmetric,
uint16_t num_neighbors,
@ -93,7 +93,7 @@ collect_view_construct_message(struct collect_view_data_msg *msg,
last_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
last_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
memcpy(&msg->parent, &parent->u8[RIMEADDR_SIZE - 2], 2);
memcpy(&msg->parent, &parent->u8[LINKADDR_SIZE - 2], 2);
msg->parent_etx = parent_etx;
msg->current_rtmetric = current_rtmetric;
msg->num_neighbors = num_neighbors;

View file

@ -2,7 +2,7 @@
#define COLLECT_VIEW_H
#include "contiki-conf.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/rime/collect.h"
struct collect_view_data_msg {
@ -23,7 +23,7 @@ struct collect_view_data_msg {
};
void collect_view_construct_message(struct collect_view_data_msg *msg,
const rimeaddr_t *parent,
const linkaddr_t *parent,
uint16_t etx_to_parent,
uint16_t current_rtmetric,
uint16_t num_neighbors,

View file

@ -91,8 +91,8 @@ static struct ctimer profile_timer;
static deluge_object_id_t next_object_id;
/* Rime callbacks. */
static void broadcast_recv(struct broadcast_conn *, const rimeaddr_t *);
static void unicast_recv(struct unicast_conn *, const rimeaddr_t *);
static void broadcast_recv(struct broadcast_conn *, const linkaddr_t *);
static void unicast_recv(struct unicast_conn *, const linkaddr_t *);
static const struct broadcast_callbacks broadcast_call = {broadcast_recv, NULL};
static const struct unicast_callbacks unicast_call = {unicast_recv, NULL};
@ -288,7 +288,7 @@ advertise_summary(struct deluge_object *obj)
}
static void
handle_summary(struct deluge_msg_summary *msg, const rimeaddr_t *sender)
handle_summary(struct deluge_msg_summary *msg, const linkaddr_t *sender)
{
int highest_available, i;
clock_time_t oldest_request, oldest_data, now;
@ -332,7 +332,7 @@ handle_summary(struct deluge_msg_summary *msg, const rimeaddr_t *sender)
return;
}
rimeaddr_copy(&current_object.summary_from, sender);
linkaddr_copy(&current_object.summary_from, sender);
transition(DELUGE_STATE_RX);
if(ctimer_expired(&rx_timer)) {
@ -579,7 +579,7 @@ handle_profile(struct deluge_msg_profile *msg)
}
static void
command_dispatcher(const rimeaddr_t *sender)
command_dispatcher(const linkaddr_t *sender)
{
char *msg;
int len;
@ -615,13 +615,13 @@ command_dispatcher(const rimeaddr_t *sender)
}
static void
unicast_recv(struct unicast_conn *c, const rimeaddr_t *sender)
unicast_recv(struct unicast_conn *c, const linkaddr_t *sender)
{
command_dispatcher(sender);
}
static void
broadcast_recv(struct broadcast_conn *c, const rimeaddr_t *sender)
broadcast_recv(struct broadcast_conn *c, const linkaddr_t *sender)
{
command_dispatcher(sender);
}

View file

@ -142,7 +142,7 @@ struct deluge_object {
uint8_t current_page[S_PAGE];
uint8_t tx_set;
int cfs_fd;
rimeaddr_t summary_from;
linkaddr_t summary_from;
};
struct deluge_page {

View file

@ -117,7 +117,7 @@ powertrace_print(char *str)
printf("%s %lu P %d.%d %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (radio %d.%02d%% / %d.%02d%% tx %d.%02d%% / %d.%02d%% listen %d.%02d%% / %d.%02d%%)\n",
str,
clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno,
all_cpu, all_lpm, all_transmit, all_listen, all_idle_transmit, all_idle_listen,
cpu, lpm, transmit, listen, idle_transmit, idle_listen,
(int)((100L * (all_transmit + all_listen)) / all_time),
@ -137,7 +137,7 @@ powertrace_print(char *str)
#if ! UIP_CONF_IPV6
printf("%s %lu SP %d.%d %lu %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (channel %d radio %d.%02d%% / %d.%02d%%)\n",
str, clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
str, clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno,
s->channel,
s->num_input, s->input_txtime, s->input_rxtime,
s->input_txtime - s->last_input_txtime,
@ -160,7 +160,7 @@ powertrace_print(char *str)
radio));
#else
printf("%s %lu SP %d.%d %lu %u %u %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu (proto %u(%u) radio %d.%02d%% / %d.%02d%%)\n",
str, clock_time(), rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], seqno,
str, clock_time(), linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], seqno,
s->proto, s->channel,
s->num_input, s->input_txtime, s->input_rxtime,
s->input_txtime - s->last_input_txtime,
@ -287,7 +287,7 @@ output_sniffer(int mac_status)
static void
sniffprint(char *prefix, int seqno)
{
const rimeaddr_t *sender, *receiver, *esender, *ereceiver;
const linkaddr_t *sender, *receiver, *esender, *ereceiver;
sender = packetbuf_addr(PACKETBUF_ADDR_SENDER);
receiver = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
@ -298,7 +298,7 @@ sniffprint(char *prefix, int seqno)
printf("%lu %s %d %u %d %d %d.%d %u %u\n",
clock_time(),
prefix,
rimeaddr_node_addr.u8[0], seqno,
linkaddr_node_addr.u8[0], seqno,
packetbuf_attr(PACKETBUF_ATTR_CHANNEL),
packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE),
esender->u8[0], esender->u8[1],

View file

@ -81,7 +81,7 @@ shell_default_output(const char *text1, int len1, const char *text2, int len2)
void
shell_prompt(char *str)
{
printf("%d.%d: %s\r\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
printf("%d.%d: %s\r\n", linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
str);
}
/*---------------------------------------------------------------------------*/

View file

@ -130,7 +130,7 @@ static const struct rucb_callbacks rucb_call = { write_chunk, read_chunk, timedo
PROCESS_THREAD(shell_download_process, ev, data)
{
const char *nextptr;
static rimeaddr_t addr;
static linkaddr_t addr;
int len;
char buf[32];
@ -185,7 +185,7 @@ PROCESS_THREAD(shell_download_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
request_recv(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
request_recv(struct runicast_conn *c, const linkaddr_t *from, uint8_t seqno)
{
const char *filename;
uint8_t seq;
@ -224,14 +224,14 @@ request_recv(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
}
/*---------------------------------------------------------------------------*/
static void
request_sent(struct runicast_conn *c, const rimeaddr_t *to,
request_sent(struct runicast_conn *c, const linkaddr_t *to,
uint8_t retransmissions)
{
process_poll(&shell_download_process);
}
/*---------------------------------------------------------------------------*/
static void
request_timedout(struct runicast_conn *c, const rimeaddr_t *to,
request_timedout(struct runicast_conn *c, const linkaddr_t *to,
uint8_t retransmissions)
{
shell_output_str(&download_command, "download: request timed out", "");

View file

@ -76,7 +76,7 @@ enum {
} datapath_commands;
struct datapath_msg {
rimeaddr_t receiver;
linkaddr_t receiver;
rtimer_clock_t tx, rx;
uint8_t datapath_command;
uint8_t received;
@ -99,7 +99,7 @@ static struct broadcast_conn broadcast;
static struct mesh_conn mesh;
static struct rucb_conn rucb;
static rimeaddr_t receiver;
static linkaddr_t receiver;
static uint8_t is_sender;
static int left_to_send;
@ -230,11 +230,11 @@ clear_stats(void)
}
/*---------------------------------------------------------------------------*/
static void
setup_sending(rimeaddr_t *to, int num)
setup_sending(linkaddr_t *to, int num)
{
is_sender = 1;
left_to_send = num;
rimeaddr_copy(&receiver, to);
linkaddr_copy(&receiver, to);
clear_stats();
}
/*---------------------------------------------------------------------------*/
@ -291,7 +291,7 @@ construct_next_packet(void)
#else /* TIMESYNCH_CONF_ENABLED */
msg->tx = msg->rx = 0;
#endif /* TIMESYNCH_CONF_ENABLED */
rimeaddr_copy(&msg->receiver, &receiver);
linkaddr_copy(&msg->receiver, &receiver);
left_to_send--;
return 1;
}
@ -344,7 +344,7 @@ process_incoming_packet(void)
}
/*---------------------------------------------------------------------------*/
static int
construct_reply(const rimeaddr_t *from)
construct_reply(const linkaddr_t *from)
{
struct datapath_msg *msg = packetbuf_dataptr();
#if TIMESYNCH_CONF_ENABLED
@ -390,7 +390,7 @@ timedout_mesh(struct mesh_conn *c)
stats.timedout++;
}
static void
recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
recv_mesh(struct mesh_conn *c, const linkaddr_t *from, uint8_t hops)
{
process_incoming_packet();
if(is_sender) {
@ -407,18 +407,18 @@ const static struct mesh_callbacks mesh_callbacks =
{ recv_mesh, sent_mesh, timedout_mesh };
/*---------------------------------------------------------------------------*/
static void
sent_ctrl(struct runicast_conn *c, const rimeaddr_t *to, uint8_t rexmits)
sent_ctrl(struct runicast_conn *c, const linkaddr_t *to, uint8_t rexmits)
{
process_post(&shell_netperf_process, CONTINUE_EVENT, NULL);
}
static void
timedout_ctrl(struct runicast_conn *c, const rimeaddr_t *to, uint8_t rexmits)
timedout_ctrl(struct runicast_conn *c, const linkaddr_t *to, uint8_t rexmits)
{
shell_output_str(&netperf_command, "netperf control connection failed", "");
process_exit(&shell_netperf_process);
}
static void
recv_ctrl(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
recv_ctrl(struct runicast_conn *c, const linkaddr_t *from, uint8_t seqno)
{
static uint8_t last_seqno = -1;
struct stats s;
@ -450,7 +450,7 @@ const static struct runicast_callbacks runicast_callbacks =
{ recv_ctrl, sent_ctrl, timedout_ctrl };
/*---------------------------------------------------------------------------*/
static int
send_ctrl_command(const rimeaddr_t *to, uint8_t command)
send_ctrl_command(const linkaddr_t *to, uint8_t command)
{
struct ctrl_msg *msg;
packetbuf_clear();
@ -461,7 +461,7 @@ send_ctrl_command(const rimeaddr_t *to, uint8_t command)
}
/*---------------------------------------------------------------------------*/
static void
recv_broadcast(struct broadcast_conn *c, const rimeaddr_t *from)
recv_broadcast(struct broadcast_conn *c, const linkaddr_t *from)
{
process_incoming_packet();
if(is_sender) {
@ -473,7 +473,7 @@ const static struct broadcast_callbacks broadcast_callbacks =
{ recv_broadcast };
/*---------------------------------------------------------------------------*/
static void
recv_unicast(struct unicast_conn *c, const rimeaddr_t *from)
recv_unicast(struct unicast_conn *c, const linkaddr_t *from)
{
process_incoming_packet();
if(is_sender) {
@ -517,7 +517,7 @@ shell_netperf_init(void)
PROCESS_THREAD(shell_netperf_process, ev, data)
{
static struct etimer e;
static rimeaddr_t receiver;
static linkaddr_t receiver;
const char *nextptr;
const char *args;
static char recvstr[40];

View file

@ -74,7 +74,7 @@ SHELL_COMMAND(runicast_command,
PROCESS_THREAD(shell_runicast_process, ev, data)
{
struct shell_input *input;
static rimeaddr_t receiver;
static linkaddr_t receiver;
int len;
const char *nextptr;
struct collect_msg *msg;
@ -122,7 +122,7 @@ PROCESS_THREAD(shell_runicast_process, ev, data)
PROCESS_END();
}
static void
recv_ruc(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
recv_ruc(struct runicast_conn *c, const linkaddr_t *from, uint8_t seqno)
{
struct collect_msg *msg;
rtimer_clock_t latency;
@ -147,14 +147,14 @@ recv_ruc(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
msg->data);
}
static void
sent_ruc(struct runicast_conn *c, const rimeaddr_t *to, uint8_t tx)
sent_ruc(struct runicast_conn *c, const linkaddr_t *to, uint8_t tx)
{
printf("runicast message sent to %d.%d, %d transmissions\n",
to->u8[0], to->u8[1],
tx);
}
static void
timedout_ruc(struct runicast_conn *c, const rimeaddr_t *to, uint8_t tx)
timedout_ruc(struct runicast_conn *c, const linkaddr_t *to, uint8_t tx)
{
printf("runicast message to %d.%d timed out after %d transmissions\n",
to->u8[0], to->u8[1],

View file

@ -114,7 +114,7 @@ PROCESS_THREAD(shell_broadcast_process, ev, data)
PROCESS_END();
}
static void
recv_broadcast(struct broadcast_conn *c, const rimeaddr_t *from)
recv_broadcast(struct broadcast_conn *c, const linkaddr_t *from)
{
struct collect_msg *msg;
rtimer_clock_t latency;
@ -138,7 +138,7 @@ static const struct broadcast_callbacks broadcast_callbacks = {recv_broadcast};
PROCESS_THREAD(shell_unicast_process, ev, data)
{
struct shell_input *input;
static rimeaddr_t receiver;
static linkaddr_t receiver;
int len;
const char *nextptr;
struct collect_msg *msg;
@ -186,7 +186,7 @@ PROCESS_THREAD(shell_unicast_process, ev, data)
PROCESS_END();
}
static void
recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
recv_uc(struct unicast_conn *c, const linkaddr_t *from)
{
struct collect_msg *msg;
rtimer_clock_t latency;

View file

@ -51,7 +51,7 @@ static uint8_t listening_for_neighbors = 0;
/*---------------------------------------------------------------------------*/
static void
received_announcement(struct announcement *a, const rimeaddr_t *from,
received_announcement(struct announcement *a, const linkaddr_t *from,
uint16_t id, uint16_t value)
{
struct {
@ -64,7 +64,7 @@ received_announcement(struct announcement *a, const rimeaddr_t *from,
if(listening_for_neighbors) {
memset(&msg, 0, sizeof(msg));
msg.len = 3;
rimeaddr_copy((rimeaddr_t *)&msg.addr, from);
linkaddr_copy((linkaddr_t *)&msg.addr, from);
msg.rssi = packetbuf_attr(PACKETBUF_ATTR_RSSI);
msg.lqi = packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY);
shell_output(&neighbors_command, &msg, sizeof(msg), "", 0);

View file

@ -66,7 +66,7 @@ PROCESS_THREAD(shell_rime_ping_process, ev, data)
{
static int i;
static struct etimer timeout, periodic;
static rimeaddr_t receiver;
static linkaddr_t receiver;
struct rime_ping_msg *ping;
const char *nextptr;
char buf[32];
@ -122,7 +122,7 @@ sent_mesh(struct mesh_conn *c)
{
}
static void
recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
recv_mesh(struct mesh_conn *c, const linkaddr_t *from, uint8_t hops)
{
struct rime_ping_msg ping;
char buf[64];

View file

@ -95,7 +95,7 @@ PROCESS_THREAD(shell_sendcmd_process, ev, data)
{
struct cmd_msg *msg;
int len;
rimeaddr_t addr;
linkaddr_t addr;
const char *nextptr;
char buf[32];
@ -141,7 +141,7 @@ PROCESS_THREAD(shell_sendcmd_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
recv_uc(struct unicast_conn *c, const linkaddr_t *from)
{
struct cmd_msg *msg;
uint16_t crc;

View file

@ -65,7 +65,7 @@ struct sniff_attributes_blob {
uint16_t listen_time;
uint16_t transmit_time;
uint16_t channel;
rimeaddr_t src, dest;
linkaddr_t src, dest;
};
struct sniff_packet_blob {
uint16_t len;
@ -84,8 +84,8 @@ sniff_attributes_output(int type)
msg.listen_time = packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME);
msg.transmit_time = packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME);
msg.channel = packetbuf_attr(PACKETBUF_ATTR_CHANNEL);
rimeaddr_copy(&msg.src, packetbuf_addr(PACKETBUF_ADDR_SENDER));
rimeaddr_copy(&msg.dest, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
linkaddr_copy(&msg.src, packetbuf_addr(PACKETBUF_ADDR_SENDER));
linkaddr_copy(&msg.dest, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
shell_output(&sniff_command, &msg, sizeof(msg), NULL, 0);
}

View file

@ -81,7 +81,7 @@ SHELL_COMMAND(unicast_recv_command,
PROCESS_THREAD(shell_unicast_send_process, ev, data)
{
struct shell_input *input;
static rimeaddr_t receiver;
static linkaddr_t receiver;
int len;
const char *nextptr;
struct unicast_msg *msg;
@ -131,7 +131,7 @@ PROCESS_THREAD(shell_unicast_send_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
recv_uc(struct unicast_conn *c, const linkaddr_t *from)
{
struct unicast_msg *msg;
#define OUTPUT_BLOB_HDRSIZE 6
@ -153,7 +153,7 @@ recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
#else
output_blob.latency = 0;
#endif
rimeaddr_copy((rimeaddr_t *)&output_blob.from, from);
linkaddr_copy((linkaddr_t *)&output_blob.from, from);
memcpy(output_blob.data, msg->data, packetbuf_datalen() - UNICAST_MSG_HDRSIZE);
output_blob.len = 2 + (packetbuf_datalen() - UNICAST_MSG_HDRSIZE) / 2;
shell_output(&unicast_recv_command, &output_blob,

View file

@ -200,8 +200,8 @@ PROCESS_THREAD(shell_routes_process, ev, data)
msg.len = 4;
for(i = 0; i < route_num(); ++i) {
r = route_get(i);
rimeaddr_copy((rimeaddr_t *)&msg.dest, &r->dest);
rimeaddr_copy((rimeaddr_t *)&msg.nexthop, &r->nexthop);
linkaddr_copy((linkaddr_t *)&msg.dest, &r->dest);
linkaddr_copy((linkaddr_t *)&msg.nexthop, &r->nexthop);
msg.hop_count = r->cost;
msg.seqno = r->seqno;
shell_output(&routes_command, &msg, sizeof(msg), "", 0);
@ -292,7 +292,7 @@ PROCESS_THREAD(shell_send_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
recv_collect(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
recv_collect(const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
{
struct collect_msg collect_msg;
char *dataptr;
@ -323,7 +323,7 @@ recv_collect(const rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
if(collect_msg.crc == crc16_data(dataptr, len, 0)) {
msg.len = 5 + (packetbuf_datalen() - COLLECT_MSG_HDRSIZE) / 2;
rimeaddr_copy((rimeaddr_t *)&msg.originator, originator);
linkaddr_copy((linkaddr_t *)&msg.originator, originator);
msg.seqno = seqno;
msg.hops = hops;
msg.latency = latency;

View file

@ -65,7 +65,7 @@ PROCESS(shell_rsh_server_process, "rsh server");
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_rsh_process, ev, data)
{
static rimeaddr_t receiver;
static linkaddr_t receiver;
struct shell_input *input;
const char *nextptr;
char buf[40];

View file

@ -115,7 +115,7 @@ print_usage(void)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_sendtest_process, ev, data)
{
static rimeaddr_t receiver;
static linkaddr_t receiver;
static unsigned long cpu, lpm, rx, tx;
const char *nextptr;
const char *args;

View file

@ -192,7 +192,7 @@ slip_poll_handler(uint8_t *outbuf, uint16_t blen)
rxbuf_init();
rimeaddr_t addr = get_mac_addr();
linkaddr_t addr = get_mac_addr();
/* this is just a test so far... just to see if it works */
slip_arch_writeb('!');
slip_arch_writeb('M');

View file

@ -57,7 +57,7 @@ print_stats(void)
{
#if RIMESTATS_CONF_ENABLED
PRINTA("S %d.%d clock %lu tx %lu rx %lu rtx %lu rrx %lu rexmit %lu acktx %lu noacktx %lu ackrx %lu timedout %lu badackrx %lu toolong %lu tooshort %lu badsynch %lu badcrc %lu contentiondrop %lu sendingdrop %lu lltx %lu llrx %lu\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
clock_seconds(),
RIMESTATS_GET(tx), RIMESTATS_GET(rx),
RIMESTATS_GET(reliabletx), RIMESTATS_GET(reliablerx),
@ -70,7 +70,7 @@ print_stats(void)
#endif /* RIMESTATS_CONF_ENABLED */
#if ENERGEST_CONF_ON
PRINTA("E %d.%d clock %lu cpu %lu lpm %lu irq %lu gled %lu yled %lu rled %lu tx %lu listen %lu sensors %lu serial %lu\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
clock_seconds(),
energest_total_time[ENERGEST_TYPE_CPU].current,
energest_total_time[ENERGEST_TYPE_LPM].current,

View file

@ -50,7 +50,7 @@
#define ROUTE_TIMEOUT CLOCK_SECOND * 4
static struct queuebuf *queued_packet;
static rimeaddr_t queued_receiver;
static linkaddr_t queued_receiver;
/* Connection for route discovery: */
static struct route_discovery_conn route_discovery;
@ -73,15 +73,15 @@ static struct trickle_conn gateway_announce_conn;
#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN])
static struct uip_fw_netif *gw_netif;
static rimeaddr_t gateway;
static linkaddr_t gateway;
static uip_ipaddr_t netaddr, netmask;
/*---------------------------------------------------------------------------*/
static void
recv_data(struct unicast_conn *c, const rimeaddr_t *from)
recv_data(struct unicast_conn *c, const linkaddr_t *from)
{
struct route_entry *e;
rimeaddr_t source;
linkaddr_t source;
uip_len = packetbuf_copyto(&uip_buf[UIP_LLH_LEN]);
@ -106,21 +106,21 @@ recv_data(struct unicast_conn *c, const rimeaddr_t *from)
PRINTF("uip-over-mesh: %d.%d: recv_data with len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], uip_len);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], uip_len);
tcpip_input();
}
/*---------------------------------------------------------------------------*/
static void
send_data(rimeaddr_t *next)
send_data(linkaddr_t *next)
{
PRINTF("uip-over-mesh: %d.%d: send_data with len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_totlen());
unicast_send(&dataconn, next);
}
/*---------------------------------------------------------------------------*/
static void
new_route(struct route_discovery_conn *c, const rimeaddr_t *to)
new_route(struct route_discovery_conn *c, const linkaddr_t *to)
{
struct route_entry *rt;
@ -154,7 +154,7 @@ static const struct unicast_callbacks data_callbacks = { recv_data };
static const struct route_discovery_callbacks rdc = { new_route, timedout };
/*---------------------------------------------------------------------------*/
struct gateway_msg {
rimeaddr_t gateway;
linkaddr_t gateway;
};
static uint8_t is_gateway;
@ -165,7 +165,7 @@ gateway_announce_recv(struct trickle_conn *c)
struct gateway_msg *msg;
msg = packetbuf_dataptr();
PRINTF("%d.%d: gateway message: %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
msg->gateway.u8[0], msg->gateway.u8[1]);
if(!is_gateway) {
@ -182,9 +182,9 @@ uip_over_mesh_make_announced_gateway(void)
gateway. */
if(!is_gateway) {
PRINTF("%d.%d: making myself the gateway\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
uip_over_mesh_set_gateway(&rimeaddr_node_addr);
rimeaddr_copy(&(msg.gateway), &rimeaddr_node_addr);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
uip_over_mesh_set_gateway(&linkaddr_node_addr);
linkaddr_copy(&(msg.gateway), &linkaddr_node_addr);
packetbuf_copyfrom(&msg, sizeof(struct gateway_msg));
trickle_send(&gateway_announce_conn);
is_gateway = 1;
@ -197,7 +197,7 @@ uip_over_mesh_init(uint16_t channels)
{
PRINTF("Our address is %d.%d (%d.%d.%d.%d)\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
uip_hostaddr.u8[0], uip_hostaddr.u8[1],
uip_hostaddr.u8[2], uip_hostaddr.u8[3]);
@ -215,7 +215,7 @@ uip_over_mesh_init(uint16_t channels)
uint8_t
uip_over_mesh_send(void)
{
rimeaddr_t receiver;
linkaddr_t receiver;
struct route_entry *rt;
/* This function is called by the uip-fw module to send out an IP
@ -231,21 +231,21 @@ uip_over_mesh_send(void)
receiver.u8[0] = BUF->destipaddr.u8[2];
receiver.u8[1] = BUF->destipaddr.u8[3];
} else {
if(rimeaddr_cmp(&gateway, &rimeaddr_node_addr)) {
if(linkaddr_cmp(&gateway, &linkaddr_node_addr)) {
PRINTF("uip_over_mesh_send: I am gateway, packet to %d.%d.%d.%d to local interface\n",
uip_ipaddr_to_quad(&BUF->destipaddr));
if(gw_netif != NULL) {
return gw_netif->output();
}
return UIP_FW_DROPPED;
} else if(rimeaddr_cmp(&gateway, &rimeaddr_null)) {
} else if(linkaddr_cmp(&gateway, &linkaddr_null)) {
PRINTF("uip_over_mesh_send: No gateway setup, dropping packet\n");
return UIP_FW_OK;
} else {
PRINTF("uip_over_mesh_send: forwarding packet to %d.%d.%d.%d towards gateway %d.%d\n",
uip_ipaddr_to_quad(&BUF->destipaddr),
gateway.u8[0], gateway.u8[1]);
rimeaddr_copy(&receiver, &gateway);
linkaddr_copy(&receiver, &gateway);
}
}
@ -270,9 +270,9 @@ uip_over_mesh_send(void)
PRINTF("uIP over mesh no route to %d.%d\n", receiver.u8[0], receiver.u8[1]);
if(queued_packet == NULL) {
queued_packet = queuebuf_new_from_packetbuf();
rimeaddr_copy(&queued_receiver, &receiver);
linkaddr_copy(&queued_receiver, &receiver);
route_discovery_discover(&route_discovery, &receiver, ROUTE_TIMEOUT);
} else if(!rimeaddr_cmp(&queued_receiver, &receiver)) {
} else if(!linkaddr_cmp(&queued_receiver, &receiver)) {
route_discovery_discover(&route_discovery, &receiver, ROUTE_TIMEOUT);
}
} else {
@ -289,9 +289,9 @@ uip_over_mesh_set_gateway_netif(struct uip_fw_netif *n)
}
/*---------------------------------------------------------------------------*/
void
uip_over_mesh_set_gateway(rimeaddr_t *gw)
uip_over_mesh_set_gateway(linkaddr_t *gw)
{
rimeaddr_copy(&gateway, gw);
linkaddr_copy(&gateway, gw);
}
/*---------------------------------------------------------------------------*/
void

View file

@ -48,7 +48,7 @@ void uip_over_mesh_init(uint16_t channels);
uint8_t uip_over_mesh_send(void);
void uip_over_mesh_set_gateway_netif(struct uip_fw_netif *netif);
void uip_over_mesh_set_gateway(rimeaddr_t *gw);
void uip_over_mesh_set_gateway(linkaddr_t *gw);
void uip_over_mesh_set_net(uip_ipaddr_t *addr, uip_ipaddr_t *mask);
void uip_over_mesh_make_announced_gateway(void);

View file

@ -244,7 +244,7 @@ static uint16_t my_tag;
static uint16_t reass_tag;
/** When reassembling, the source address of the fragments being merged */
rimeaddr_t frag_sender;
linkaddr_t frag_sender;
/** Reassembly %process %timer. */
static struct timer reass_timer;
@ -488,7 +488,7 @@ uncompress_addr(uip_ipaddr_t *ipaddr, uint8_t const prefix[],
* dest
*/
static void
compress_hdr_hc06(rimeaddr_t *rime_destaddr)
compress_hdr_hc06(linkaddr_t *rime_destaddr)
{
uint8_t tmp, iphc0, iphc1;
#if DEBUG
@ -1076,7 +1076,7 @@ uncompress_hdr_hc06(uint16_t ip_len)
* IP destination field
*/
static void
compress_hdr_hc1(rimeaddr_t *rime_destaddr)
compress_hdr_hc1(linkaddr_t *rime_destaddr)
{
/*
* Check if all the assumptions for full compression
@ -1286,7 +1286,7 @@ uncompress_hdr_hc1(uint16_t ip_len)
* \endverbatim
*/
static void
compress_hdr_ipv6(rimeaddr_t *rime_destaddr)
compress_hdr_ipv6(linkaddr_t *rime_destaddr)
{
*rime_ptr = SICSLOWPAN_DISPATCH_IPV6;
rime_hdr_len += SICSLOWPAN_IPV6_HDR_LEN;
@ -1321,7 +1321,7 @@ packet_sent(void *ptr, int status, int transmissions)
* \param dest the link layer destination address of the packet
*/
static void
send_packet(rimeaddr_t *dest)
send_packet(linkaddr_t *dest)
{
/* Set the link layer destination address for the packet as a
* packetbuf attribute. The MAC layer can access the destination
@ -1363,7 +1363,7 @@ output(const uip_lladdr_t *localdest)
int framer_hdrlen;
/* The MAC address of the destination of the packet */
rimeaddr_t dest;
linkaddr_t dest;
/* Number of bytes processed. */
uint16_t processed_ip_out_len;
@ -1406,9 +1406,9 @@ output(const uip_lladdr_t *localdest)
* broadcast packet.
*/
if(localdest == NULL) {
rimeaddr_copy(&dest, &rimeaddr_null);
linkaddr_copy(&dest, &linkaddr_null);
} else {
rimeaddr_copy(&dest, (const rimeaddr_t *)localdest);
linkaddr_copy(&dest, (const linkaddr_t *)localdest);
}
PRINTFO("sicslowpan output: sending packet len %d\n", uip_len);
@ -1677,7 +1677,7 @@ input(void)
sicslowpan_len = 0;
processed_ip_in_len = 0;
} else if(processed_ip_in_len > 0 && first_fragment
&& !rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) {
&& !linkaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER))) {
sicslowpan_len = 0;
processed_ip_in_len = 0;
}
@ -1689,7 +1689,7 @@ input(void)
if((frag_size > 0 &&
(frag_size != sicslowpan_len ||
reass_tag != frag_tag ||
!rimeaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)))) ||
!linkaddr_cmp(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER)))) ||
frag_size == 0) {
/*
* the packet is a fragment that does not belong to the packet
@ -1715,7 +1715,7 @@ input(void)
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND / 16);
PRINTFI("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n",
sicslowpan_len, reass_tag);
rimeaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));
linkaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));
}
}

View file

@ -47,7 +47,7 @@
#include <stdlib.h>
#include <stddef.h>
#include "lib/list.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/packetbuf.h"
#include "net/ipv6/uip-ds6-nbr.h"
@ -63,7 +63,7 @@ void NEIGHBOR_STATE_CHANGED(uip_ds6_nbr_t *n);
#ifdef UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK
#define LINK_NEIGHBOR_CALLBACK(addr, status, numtx) UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK(addr, status, numtx)
void LINK_NEIGHBOR_CALLBACK(const rimeaddr_t *addr, int status, int numtx);
void LINK_NEIGHBOR_CALLBACK(const linkaddr_t *addr, int status, int numtx);
#else
#define LINK_NEIGHBOR_CALLBACK(addr, status, numtx)
#endif /* UIP_CONF_DS6_LINK_NEIGHBOR_CALLBACK */
@ -81,7 +81,7 @@ uip_ds6_nbr_t *
uip_ds6_nbr_add(const uip_ipaddr_t *ipaddr, const uip_lladdr_t *lladdr,
uint8_t isrouter, uint8_t state)
{
uip_ds6_nbr_t *nbr = nbr_table_add_lladdr(ds6_neighbors, (rimeaddr_t*)lladdr);
uip_ds6_nbr_t *nbr = nbr_table_add_lladdr(ds6_neighbors, (linkaddr_t*)lladdr);
if(nbr) {
uip_ipaddr_copy(&nbr->ipaddr, ipaddr);
nbr->isrouter = isrouter;
@ -171,7 +171,7 @@ uip_ds6_nbr_lookup(const uip_ipaddr_t *ipaddr)
uip_ds6_nbr_t *
uip_ds6_nbr_ll_lookup(const uip_lladdr_t *lladdr)
{
return nbr_table_get_from_lladdr(ds6_neighbors, (rimeaddr_t*)lladdr);
return nbr_table_get_from_lladdr(ds6_neighbors, (linkaddr_t*)lladdr);
}
/*---------------------------------------------------------------------------*/
@ -193,8 +193,8 @@ uip_ds6_nbr_lladdr_from_ipaddr(const uip_ipaddr_t *ipaddr)
void
uip_ds6_link_neighbor_callback(int status, int numtx)
{
const rimeaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
if(rimeaddr_cmp(dest, &rimeaddr_null)) {
const linkaddr_t *dest = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
if(linkaddr_cmp(dest, &linkaddr_null)) {
return;
}

View file

@ -297,7 +297,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
list.
*/
routes = nbr_table_get_from_lladdr(nbr_routes,
(rimeaddr_t *)nexthop_lladdr);
(linkaddr_t *)nexthop_lladdr);
if(routes == NULL) {
/* If the neighbor did not have an entry in our neighbor table,
@ -306,7 +306,7 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
initialize this pointer with the list of routing entries that
are attached to this neighbor. */
routes = nbr_table_add_lladdr(nbr_routes,
(rimeaddr_t *)nexthop_lladdr);
(linkaddr_t *)nexthop_lladdr);
if(routes == NULL) {
/* This should not happen, as we explicitly deallocated one
route table entry above. */
@ -478,7 +478,7 @@ uip_ds6_route_rm_by_nexthop(uip_ipaddr_t *nexthop)
nexthop_lladdr = uip_ds6_nbr_lladdr_from_ipaddr(nexthop);
routes = nbr_table_get_from_lladdr(nbr_routes,
(rimeaddr_t *)nexthop_lladdr);
(linkaddr_t *)nexthop_lladdr);
rm_routelist(routes);
}
/*---------------------------------------------------------------------------*/

View file

@ -1,5 +1,5 @@
/**
* \addtogroup rimeaddr
* \addtogroup linkaddr
* @{
*/
@ -42,36 +42,36 @@
* Adam Dunkels <adam@sics.se>
*/
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include <string.h>
rimeaddr_t rimeaddr_node_addr;
#if RIMEADDR_SIZE == 2
const rimeaddr_t rimeaddr_null = { { 0, 0 } };
#else /*RIMEADDR_SIZE == 2*/
#if RIMEADDR_SIZE == 8
const rimeaddr_t rimeaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } };
#endif /*RIMEADDR_SIZE == 8*/
#endif /*RIMEADDR_SIZE == 2*/
linkaddr_t linkaddr_node_addr;
#if LINKADDR_SIZE == 2
const linkaddr_t linkaddr_null = { { 0, 0 } };
#else /*LINKADDR_SIZE == 2*/
#if LINKADDR_SIZE == 8
const linkaddr_t linkaddr_null = { { 0, 0, 0, 0, 0, 0, 0, 0 } };
#endif /*LINKADDR_SIZE == 8*/
#endif /*LINKADDR_SIZE == 2*/
/*---------------------------------------------------------------------------*/
void
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
linkaddr_copy(linkaddr_t *dest, const linkaddr_t *src)
{
memcpy(dest, src, RIMEADDR_SIZE);
memcpy(dest, src, LINKADDR_SIZE);
}
/*---------------------------------------------------------------------------*/
int
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2)
{
return (memcmp(addr1, addr2, RIMEADDR_SIZE) == 0);
return (memcmp(addr1, addr2, LINKADDR_SIZE) == 0);
}
/*---------------------------------------------------------------------------*/
void
rimeaddr_set_node_addr(rimeaddr_t *t)
linkaddr_set_node_addr(linkaddr_t *t)
{
rimeaddr_copy(&rimeaddr_node_addr, t);
linkaddr_copy(&linkaddr_node_addr, t);
}
/*---------------------------------------------------------------------------*/
/** @} */

View file

@ -4,10 +4,10 @@
*/
/**
* \defgroup rimeaddr Rime addresses
* \defgroup linkaddr Rime addresses
* @{
*
* The rimeaddr module is an abstract representation of addresses in
* The linkaddr module is an abstract representation of addresses in
* Rime.
*
*/
@ -51,20 +51,20 @@
* Adam Dunkels <adam@sics.se>
*/
#ifndef RIMEADDR_H_
#define RIMEADDR_H_
#ifndef LINKADDR_H_
#define LINKADDR_H_
#include "contiki-conf.h"
#ifdef RIMEADDR_CONF_SIZE
#define RIMEADDR_SIZE RIMEADDR_CONF_SIZE
#else /* RIMEADDR_SIZE */
#define RIMEADDR_SIZE 2
#endif /* RIMEADDR_SIZE */
#ifdef LINKADDR_CONF_SIZE
#define LINKADDR_SIZE LINKADDR_CONF_SIZE
#else /* LINKADDR_SIZE */
#define LINKADDR_SIZE 2
#endif /* LINKADDR_SIZE */
typedef union {
unsigned char u8[RIMEADDR_SIZE];
} rimeaddr_t;
unsigned char u8[LINKADDR_SIZE];
} linkaddr_t;
/**
@ -76,7 +76,7 @@ typedef union {
* to another.
*
*/
void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *from);
/**
* \brief Compare two Rime addresses
@ -90,7 +90,7 @@ void rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *from);
* are the same, and zero if the addresses are different.
*
*/
int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2);
/**
@ -100,18 +100,18 @@ int rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2);
* This function sets the Rime address of the node.
*
*/
void rimeaddr_set_node_addr(rimeaddr_t *addr);
void linkaddr_set_node_addr(linkaddr_t *addr);
/**
* \brief The Rime address of the node
*
* This variable contains the Rime address of the
* node. This variable should not be changed directly;
* rather, the rimeaddr_set_node_addr() function should be
* rather, the linkaddr_set_node_addr() function should be
* used.
*
*/
extern rimeaddr_t rimeaddr_node_addr;
extern linkaddr_t linkaddr_node_addr;
/**
* \brief The null Rime address
@ -124,8 +124,8 @@ extern rimeaddr_t rimeaddr_node_addr;
* with other nodes.
*
*/
extern const rimeaddr_t rimeaddr_null;
extern const linkaddr_t linkaddr_null;
#endif /* RIMEADDR_H_ */
#endif /* LINKADDR_H_ */
/** @} */
/** @} */

View file

@ -554,9 +554,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
#if !NETSTACK_CONF_BRIDGE_MODE
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
#endif
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
is_broadcast = 1;
PRINTDEBUG("contikimac: send broadcast\n");
@ -950,10 +950,10 @@ input_packet(void)
if(packetbuf_datalen() > 0 &&
packetbuf_totlen() > 0 &&
(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr) ||
rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null))) {
(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr) ||
linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_null))) {
/* This is a regular packet that is destined to us or to the
broadcast address. */

View file

@ -94,7 +94,7 @@ struct qbuf_metadata {
/* Every neighbor has its own packet queue */
struct neighbor_queue {
struct neighbor_queue *next;
rimeaddr_t addr;
linkaddr_t addr;
struct ctimer transmit_timer;
uint8_t transmissions;
uint8_t collisions, deferrals;
@ -119,11 +119,11 @@ static void transmit_packet_list(void *ptr);
/*---------------------------------------------------------------------------*/
static struct neighbor_queue *
neighbor_queue_from_addr(const rimeaddr_t *addr)
neighbor_queue_from_addr(const linkaddr_t *addr)
{
struct neighbor_queue *n = list_head(neighbor_list);
while(n != NULL) {
if(rimeaddr_cmp(&n->addr, addr)) {
if(linkaddr_cmp(&n->addr, addr)) {
return n;
}
n = list_item_next(n);
@ -308,7 +308,7 @@ send_packet(mac_callback_t sent, void *ptr)
struct neighbor_queue *n;
static uint8_t initialized = 0;
static uint16_t seqno;
const rimeaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
const linkaddr_t *addr = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
if(!initialized) {
initialized = 1;
@ -330,7 +330,7 @@ send_packet(mac_callback_t sent, void *ptr)
n = memb_alloc(&neighbor_memb);
if(n != NULL) {
/* Init neighbor entry */
rimeaddr_copy(&n->addr, addr);
linkaddr_copy(&n->addr, addr);
n->transmissions = 0;
n->collisions = 0;
n->deferrals = 0;

View file

@ -201,7 +201,7 @@ static struct compower_activity current_packet;
struct encounter {
struct encounter *next;
rimeaddr_t neighbor;
linkaddr_t neighbor;
rtimer_clock_t time;
};
@ -211,7 +211,7 @@ MEMB(encounter_memb, struct encounter, MAX_ENCOUNTERS);
#endif /* WITH_ENCOUNTER_OPTIMIZATION */
static uint8_t is_streaming;
static rimeaddr_t is_streaming_to, is_streaming_to_too;
static linkaddr_t is_streaming_to, is_streaming_to_too;
static rtimer_clock_t stream_until;
#define DEFAULT_STREAM_TIME (RTIMER_ARCH_SECOND)
@ -283,8 +283,8 @@ cpowercycle(void *ptr)
if(is_streaming) {
if(!RTIMER_CLOCK_LT(RTIMER_NOW(), stream_until)) {
is_streaming = 0;
rimeaddr_copy(&is_streaming_to, &rimeaddr_null);
rimeaddr_copy(&is_streaming_to_too, &rimeaddr_null);
linkaddr_copy(&is_streaming_to, &linkaddr_null);
linkaddr_copy(&is_streaming_to_too, &linkaddr_null);
}
}
@ -323,7 +323,7 @@ cpowercycle(void *ptr)
/*---------------------------------------------------------------------------*/
#if CXMAC_CONF_ANNOUNCEMENTS
static int
parse_announcements(const rimeaddr_t *from)
parse_announcements(const linkaddr_t *from)
{
/* Parse incoming announcements */
struct announcement_msg adata;
@ -332,7 +332,7 @@ parse_announcements(const rimeaddr_t *from)
memcpy(&adata, packetbuf_dataptr(), MIN(packetbuf_datalen(), sizeof(adata)));
/* printf("%d.%d: probe from %d.%d with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], adata->num);*/
/* for(i = 0; i < packetbuf_datalen(); ++i) {
printf("%02x ", ((uint8_t *)packetbuf_dataptr())[i]);
@ -341,7 +341,7 @@ parse_announcements(const rimeaddr_t *from)
for(i = 0; i < adata.num; ++i) {
/* printf("%d.%d: announcement %d: %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
adata->data[i].id,
adata->data[i].value);*/
@ -383,13 +383,13 @@ format_announcement(char *hdr)
/*---------------------------------------------------------------------------*/
#if WITH_ENCOUNTER_OPTIMIZATION
static void
register_encounter(const rimeaddr_t *neighbor, rtimer_clock_t time)
register_encounter(const linkaddr_t *neighbor, rtimer_clock_t time)
{
struct encounter *e;
/* If we have an entry for this neighbor already, we renew it. */
for(e = list_head(encounter_list); e != NULL; e = list_item_next(e)) {
if(rimeaddr_cmp(neighbor, &e->neighbor)) {
if(linkaddr_cmp(neighbor, &e->neighbor)) {
e->time = time;
break;
}
@ -401,7 +401,7 @@ register_encounter(const rimeaddr_t *neighbor, rtimer_clock_t time)
/* We could not allocate memory for this encounter, so we just drop it. */
return;
}
rimeaddr_copy(&e->neighbor, neighbor);
linkaddr_copy(&e->neighbor, neighbor);
e->time = time;
list_add(encounter_list, e);
}
@ -431,9 +431,9 @@ send_packet(void)
/* Create the X-MAC header for the data packet. */
#if !NETSTACK_CONF_BRIDGE_MODE
/* If NETSTACK_CONF_BRIDGE_MODE is set, assume PACKETBUF_ADDR_SENDER is already set. */
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
#endif
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
is_broadcast = 1;
PRINTDEBUG("cxmac: send broadcast\n");
} else {
@ -477,19 +477,19 @@ send_packet(void)
#if WITH_STREAMING
if(is_streaming == 1 &&
(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&is_streaming_to) ||
rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&is_streaming_to_too))) {
is_already_streaming = 1;
}
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_STREAM) {
is_streaming = 1;
if(rimeaddr_cmp(&is_streaming_to, &rimeaddr_null)) {
rimeaddr_copy(&is_streaming_to, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
} else if(!rimeaddr_cmp(&is_streaming_to, packetbuf_addr(PACKETBUF_ADDR_RECEIVER))) {
rimeaddr_copy(&is_streaming_to_too, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
if(linkaddr_cmp(&is_streaming_to, &linkaddr_null)) {
linkaddr_copy(&is_streaming_to, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
} else if(!linkaddr_cmp(&is_streaming_to, packetbuf_addr(PACKETBUF_ADDR_RECEIVER))) {
linkaddr_copy(&is_streaming_to_too, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
}
stream_until = RTIMER_NOW() + DEFAULT_STREAM_TIME;
}
@ -503,9 +503,9 @@ send_packet(void)
the time for the next expected encounter and setup a ctimer to
switch on the radio just before the encounter. */
for(e = list_head(encounter_list); e != NULL; e = list_item_next(e)) {
const rimeaddr_t *neighbor = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
const linkaddr_t *neighbor = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
if(rimeaddr_cmp(neighbor, &e->neighbor)) {
if(linkaddr_cmp(neighbor, &e->neighbor)) {
rtimer_clock_t wait, now, expected;
/* We expect encounters to happen every DEFAULT_PERIOD time
@ -573,8 +573,8 @@ send_packet(void)
is_dispatch = hdr->dispatch == DISPATCH;
is_strobe_ack = hdr->type == TYPE_STROBE_ACK;
if(is_dispatch && is_strobe_ack) {
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr)) {
/* We got an ACK from the receiver, so we can immediately send
the packet. */
got_strobe_ack = 1;
@ -723,10 +723,10 @@ input_packet(void)
if(hdr->dispatch != DISPATCH) {
someone_is_sending = 0;
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr) ||
rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr) ||
linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_null)) {
/* This is a regular packet that is destined to us or to the
broadcast address. */
@ -760,8 +760,8 @@ input_packet(void)
} else if(hdr->type == TYPE_STROBE) {
someone_is_sending = 2;
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr)) {
/* This is a strobe packet for us. */
/* If the sender address is someone else, we should
@ -771,7 +771,7 @@ input_packet(void)
hdr->type = TYPE_STROBE_ACK;
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER,
packetbuf_addr(PACKETBUF_ADDR_SENDER));
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
packetbuf_compact();
if(NETSTACK_FRAMER.create() >= 0) {
/* We turn on the radio in anticipation of the incoming
@ -784,8 +784,8 @@ input_packet(void)
} else {
PRINTF("cxmac: failed to send strobe ack\n");
}
} else if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null)) {
} else if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_null)) {
/* If the receiver address is null, the strobe is sent to
prepare for an incoming broadcast packet. If this is the
case, we turn on the radio and wait for the incoming
@ -834,8 +834,8 @@ send_announcement(void *ptr)
hdr->dispatch = DISPATCH;
hdr->type = TYPE_ANNOUNCEMENT;
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &rimeaddr_null);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &linkaddr_null);
packetbuf_set_attr(PACKETBUF_ATTR_RADIO_TXPOWER, announcement_radio_txpower);
if(NETSTACK_FRAMER.create() >= 0) {
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());

View file

@ -290,7 +290,7 @@ frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
/* } */
/* p += l; */
if(fcf.dest_addr_mode == FRAME802154_SHORTADDRMODE) {
rimeaddr_copy((rimeaddr_t *)&(pf->dest_addr), &rimeaddr_null);
linkaddr_copy((linkaddr_t *)&(pf->dest_addr), &linkaddr_null);
pf->dest_addr[0] = p[1];
pf->dest_addr[1] = p[0];
p += 2;
@ -301,7 +301,7 @@ frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
p += 8;
}
} else {
rimeaddr_copy((rimeaddr_t *)&(pf->dest_addr), &rimeaddr_null);
linkaddr_copy((linkaddr_t *)&(pf->dest_addr), &linkaddr_null);
pf->dest_pid = 0;
}
@ -322,7 +322,7 @@ frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
/* } */
/* p += l; */
if(fcf.src_addr_mode == FRAME802154_SHORTADDRMODE) {
rimeaddr_copy((rimeaddr_t *)&(pf->src_addr), &rimeaddr_null);
linkaddr_copy((linkaddr_t *)&(pf->src_addr), &linkaddr_null);
pf->src_addr[0] = p[1];
pf->src_addr[1] = p[0];
p += 2;
@ -333,7 +333,7 @@ frame802154_parse(uint8_t *data, int len, frame802154_t *pf)
p += 8;
}
} else {
rimeaddr_copy((rimeaddr_t *)&(pf->src_addr), &rimeaddr_null);
linkaddr_copy((linkaddr_t *)&(pf->src_addr), &linkaddr_null);
pf->src_pid = 0;
}

View file

@ -62,7 +62,7 @@
#define FRAME_802154_H
#include "contiki-conf.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#ifdef IEEE802154_CONF_PANID
#define IEEE802154_PANID IEEE802154_CONF_PANID

View file

@ -104,7 +104,7 @@ create(void)
params.fcf.frame_type = FRAME802154_DATAFRAME;
params.fcf.security_enabled = 0;
params.fcf.frame_pending = packetbuf_attr(PACKETBUF_ATTR_PENDING);
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
params.fcf.ack_required = 0;
} else {
params.fcf.ack_required = packetbuf_attr(PACKETBUF_ATTR_MAC_ACK);
@ -128,8 +128,8 @@ create(void)
\todo For phase 1 the addresses are all long. We'll need a mechanism
in the rime attributes to tell the mac to use long or short for phase 2.
*/
if(sizeof(rimeaddr_t) == 2) {
/* Use short address mode if rimeaddr size is short. */
if(sizeof(linkaddr_t) == 2) {
/* Use short address mode if linkaddr size is short. */
params.fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
} else {
params.fcf.src_addr_mode = FRAME802154_LONGADDRMODE;
@ -140,17 +140,17 @@ create(void)
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
/* Broadcast requires short address mode. */
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
params.dest_addr[0] = 0xFF;
params.dest_addr[1] = 0xFF;
} else {
rimeaddr_copy((rimeaddr_t *)&params.dest_addr,
linkaddr_copy((linkaddr_t *)&params.dest_addr,
packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
/* Use short address mode if rimeaddr size is small */
if(sizeof(rimeaddr_t) == 2) {
/* Use short address mode if linkaddr size is small */
if(sizeof(linkaddr_t) == 2) {
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
} else {
params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
@ -164,7 +164,7 @@ create(void)
* Set up the source address using only the long address mode for
* phase 1.
*/
rimeaddr_copy((rimeaddr_t *)&params.src_addr, &rimeaddr_node_addr);
linkaddr_copy((linkaddr_t *)&params.src_addr, &linkaddr_node_addr);
params.payload = packetbuf_dataptr();
params.payload_len = packetbuf_datalen();
@ -199,10 +199,10 @@ parse(void)
return FRAMER_FAILED;
}
if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) {
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (rimeaddr_t *)&frame.dest_addr);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr);
}
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (rimeaddr_t *)&frame.src_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending);
/* packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, frame.fcf.ack_required);*/
packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, frame.seq);

View file

@ -51,8 +51,8 @@
#endif
struct nullmac_hdr {
rimeaddr_t receiver;
rimeaddr_t sender;
linkaddr_t receiver;
linkaddr_t sender;
};
/*---------------------------------------------------------------------------*/
@ -63,8 +63,8 @@ create(void)
if(packetbuf_hdralloc(sizeof(struct nullmac_hdr))) {
hdr = packetbuf_hdrptr();
rimeaddr_copy(&(hdr->sender), &rimeaddr_node_addr);
rimeaddr_copy(&(hdr->receiver), packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
linkaddr_copy(&(hdr->sender), &linkaddr_node_addr);
linkaddr_copy(&(hdr->receiver), packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
return sizeof(struct nullmac_hdr);
}
PRINTF("PNULLMAC-UT: too large header: %u\n", sizeof(struct nullmac_hdr));

View file

@ -50,7 +50,7 @@
#include "net/rime/rime.h"
struct seqno {
rimeaddr_t sender;
linkaddr_t sender;
uint8_t seqno;
};
@ -72,7 +72,7 @@ mac_sequence_is_duplicate(void)
* packet with the last few ones we saw.
*/
for(i = 0; i < MAX_SEQNOS; ++i) {
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
&received_seqnos[i].sender)) {
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == received_seqnos[i].seqno) {
/* Duplicate packet. */
@ -91,7 +91,7 @@ mac_sequence_register_seqno(void)
/* Locate possible previous sequence number for this address. */
for(i = 0; i < MAX_SEQNOS; ++i) {
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
&received_seqnos[i].sender)) {
i++;
break;
@ -103,7 +103,7 @@ mac_sequence_register_seqno(void)
memcpy(&received_seqnos[j], &received_seqnos[j - 1], sizeof(struct seqno));
}
received_seqnos[0].seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
rimeaddr_copy(&received_seqnos[0].sender,
linkaddr_copy(&received_seqnos[0].sender,
packetbuf_addr(PACKETBUF_ADDR_SENDER));
}
/*---------------------------------------------------------------------------*/

View file

@ -115,7 +115,7 @@ send_one_packet(mac_callback_t sent, void *ptr)
int ret;
int last_sent_ok = 0;
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
#if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
#endif /* NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW */
@ -137,8 +137,8 @@ send_one_packet(mac_callback_t sent, void *ptr)
NETSTACK_RADIO.prepare(packetbuf_hdrptr(), packetbuf_totlen());
is_broadcast = rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null);
is_broadcast = linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_null);
if(NETSTACK_RADIO.receiving_packet() ||
(!is_broadcast && NETSTACK_RADIO.pending_packet())) {
@ -288,10 +288,10 @@ packet_input(void)
if(NETSTACK_FRAMER.parse() < 0) {
PRINTF("nullrdc: failed to parse %u\n", packetbuf_datalen());
#if NULLRDC_ADDRESS_FILTER
} else if(!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr) &&
!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_null)) {
} else if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr) &&
!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_null)) {
PRINTF("nullrdc: not for us\n");
#endif /* NULLRDC_ADDRESS_FILTER */
} else {
@ -315,8 +315,8 @@ packet_input(void)
frame802154_parse(original_dataptr, original_datalen, &info154);
if(info154.fcf.frame_type == FRAME802154_DATAFRAME &&
info154.fcf.ack_required != 0 &&
rimeaddr_cmp((rimeaddr_t *)&info154.dest_addr,
&rimeaddr_node_addr)) {
linkaddr_cmp((linkaddr_t *)&info154.dest_addr,
&linkaddr_node_addr)) {
uint8_t ackdata[ACK_LEN] = {0, 0, 0};
ackdata[0] = FRAME802154_ACKFRAME;

View file

@ -88,7 +88,7 @@ NBR_TABLE(struct phase, nbr_phase);
#endif
/*---------------------------------------------------------------------------*/
void
phase_update(const rimeaddr_t *neighbor, rtimer_clock_t time,
phase_update(const linkaddr_t *neighbor, rtimer_clock_t time,
int mac_status)
{
struct phase *e;
@ -151,13 +151,13 @@ send_packet(void *ptr)
}
/*---------------------------------------------------------------------------*/
phase_status_t
phase_wait(const rimeaddr_t *neighbor, rtimer_clock_t cycle_time,
phase_wait(const linkaddr_t *neighbor, rtimer_clock_t cycle_time,
rtimer_clock_t guard_time,
mac_callback_t mac_callback, void *mac_callback_ptr,
struct rdc_buf_list *buf_list)
{
struct phase *e;
// const rimeaddr_t *neighbor = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
// const linkaddr_t *neighbor = packetbuf_addr(PACKETBUF_ADDR_RECEIVER);
/* We go through the list of phases to find if we have recorded a
phase for this particular neighbor. If so, we can compute the
time for the next expected phase and setup a ctimer to switch on

View file

@ -40,7 +40,7 @@
#ifndef PHASE_H
#define PHASE_H
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "sys/timer.h"
#include "sys/rtimer.h"
#include "lib/list.h"
@ -55,12 +55,12 @@ typedef enum {
void phase_init(void);
phase_status_t phase_wait(const rimeaddr_t *neighbor,
phase_status_t phase_wait(const linkaddr_t *neighbor,
rtimer_clock_t cycle_time, rtimer_clock_t wait_before,
mac_callback_t mac_callback, void *mac_callback_ptr,
struct rdc_buf_list *buf_list);
void phase_update(const rimeaddr_t *neighbor,
void phase_update(const linkaddr_t *neighbor,
rtimer_clock_t time, int mac_status);
void phase_remove(const rimeaddr_t *neighbor);
void phase_remove(const linkaddr_t *neighbor);
#endif /* PHASE_H */

View file

@ -127,14 +127,14 @@ send_packet(mac_callback_t sent, void *ptr)
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null)) {
/* Broadcast requires short address mode. */
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
params.dest_addr[0] = 0xFF;
params.dest_addr[1] = 0xFF;
} else {
rimeaddr_copy((rimeaddr_t *)&params.dest_addr,
linkaddr_copy((linkaddr_t *)&params.dest_addr,
packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
}
@ -147,9 +147,9 @@ send_packet(mac_callback_t sent, void *ptr)
* phase 1.
*/
#if NETSTACK_CONF_BRIDGE_MODE
rimeaddr_copy((rimeaddr_t *)&params.src_addr,packetbuf_addr(PACKETBUF_ADDR_SENDER));
linkaddr_copy((linkaddr_t *)&params.src_addr,packetbuf_addr(PACKETBUF_ADDR_SENDER));
#else
rimeaddr_copy((rimeaddr_t *)&params.src_addr, &rimeaddr_node_addr);
linkaddr_copy((linkaddr_t *)&params.src_addr, &linkaddr_node_addr);
#endif
params.payload = packetbuf_dataptr();
@ -206,10 +206,10 @@ input_packet(void)
return;
}
if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) {
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (rimeaddr_t *)&frame.dest_addr);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr);
#if !NETSTACK_CONF_BRIDGE_MODE
if(!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&rimeaddr_node_addr)) {
if(!linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER),
&linkaddr_node_addr)) {
/* Not for this node */
PRINTF("6MAC: not for us\n");
return;
@ -217,7 +217,7 @@ input_packet(void)
#endif
}
}
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (rimeaddr_t *)&frame.src_addr);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr);
PRINTF("6MAC-IN: %2X", frame.fcf.frame_type);
PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER));

View file

@ -43,7 +43,7 @@
/* List of link-layer addresses of the neighbors, used as key in the tables */
typedef struct nbr_table_key {
struct nbr_table_key *next;
rimeaddr_t lladdr;
linkaddr_t lladdr;
} nbr_table_key_t;
/* For each neighbor, a map of the tables that use the neighbor.
@ -107,17 +107,17 @@ key_from_item(nbr_table_t *table, const nbr_table_item_t *item)
/*---------------------------------------------------------------------------*/
/* Get the index of a neighbor from its link-layer address */
static int
index_from_lladdr(const rimeaddr_t *lladdr)
index_from_lladdr(const linkaddr_t *lladdr)
{
nbr_table_key_t *key;
/* Allow lladdr-free insertion, useful e.g. for IPv6 ND.
* Only one such entry is possible at a time, indexed by rimeaddr_null. */
* Only one such entry is possible at a time, indexed by linkaddr_null. */
if(lladdr == NULL) {
lladdr = &rimeaddr_null;
lladdr = &linkaddr_null;
}
key = list_head(nbr_table_keys);
while(key != NULL) {
if(lladdr && rimeaddr_cmp(lladdr, &key->lladdr)) {
if(lladdr && linkaddr_cmp(lladdr, &key->lladdr)) {
return index_from_key(key);
}
key = list_item_next(key);
@ -269,16 +269,16 @@ nbr_table_next(nbr_table_t *table, nbr_table_item_t *item)
/*---------------------------------------------------------------------------*/
/* Add a neighbor indexed with its link-layer address */
nbr_table_item_t *
nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr)
nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr)
{
int index;
nbr_table_item_t *item;
nbr_table_key_t *key;
/* Allow lladdr-free insertion, useful e.g. for IPv6 ND.
* Only one such entry is possible at a time, indexed by rimeaddr_null. */
* Only one such entry is possible at a time, indexed by linkaddr_null. */
if(lladdr == NULL) {
lladdr = &rimeaddr_null;
lladdr = &linkaddr_null;
}
if((index = index_from_lladdr(lladdr)) == -1) {
@ -297,7 +297,7 @@ nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr)
index = index_from_key(key);
/* Set link-layer address */
rimeaddr_copy(&key->lladdr, lladdr);
linkaddr_copy(&key->lladdr, lladdr);
}
/* Get item in the current table */
@ -312,7 +312,7 @@ nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr)
/*---------------------------------------------------------------------------*/
/* Get an item from its link-layer address */
void *
nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr)
nbr_table_get_from_lladdr(nbr_table_t *table, const linkaddr_t *lladdr)
{
void *item = item_from_index(table, index_from_lladdr(lladdr));
return nbr_get_bit(used_map, table, item) ? item : NULL;
@ -342,7 +342,7 @@ nbr_table_unlock(nbr_table_t *table, void *item)
}
/*---------------------------------------------------------------------------*/
/* Get link-layer address of an item */
rimeaddr_t *
linkaddr_t *
nbr_table_get_lladdr(nbr_table_t *table, const void *item)
{
nbr_table_key_t *key = key_from_item(table, item);

View file

@ -36,7 +36,7 @@
#define NBR_TABLE_H_
#include "contiki.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/netstack.h"
/* Neighbor table size */
@ -84,8 +84,8 @@ nbr_table_item_t *nbr_table_next(nbr_table_t *table, nbr_table_item_t *item);
/** \name Neighbor tables: add and get data */
/** @{ */
nbr_table_item_t *nbr_table_add_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr);
nbr_table_item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const rimeaddr_t *lladdr);
nbr_table_item_t *nbr_table_add_lladdr(nbr_table_t *table, const linkaddr_t *lladdr);
nbr_table_item_t *nbr_table_get_from_lladdr(nbr_table_t *table, const linkaddr_t *lladdr);
/** @} */
/** \name Neighbor tables: set flags (unused, locked, unlocked) */
@ -97,7 +97,7 @@ int nbr_table_unlock(nbr_table_t *table, nbr_table_item_t *item);
/** \name Neighbor tables: address manipulation */
/** @{ */
rimeaddr_t *nbr_table_get_lladdr(nbr_table_t *table, const nbr_table_item_t *item);
linkaddr_t *nbr_table_get_lladdr(nbr_table_t *table, const nbr_table_item_t *item);
/** @} */
#endif /* NBR_TABLE_H_ */

View file

@ -261,7 +261,7 @@ packetbuf_attr_clear(void)
packetbuf_attrs[i].val = 0;
}
for(i = 0; i < PACKETBUF_NUM_ADDRS; ++i) {
rimeaddr_copy(&packetbuf_addrs[i].addr, &rimeaddr_null);
linkaddr_copy(&packetbuf_addrs[i].addr, &linkaddr_null);
}
}
/*---------------------------------------------------------------------------*/
@ -297,14 +297,14 @@ packetbuf_attr(uint8_t type)
}
/*---------------------------------------------------------------------------*/
int
packetbuf_set_addr(uint8_t type, const rimeaddr_t *addr)
packetbuf_set_addr(uint8_t type, const linkaddr_t *addr)
{
/* packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].type = type; */
rimeaddr_copy(&packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr, addr);
linkaddr_copy(&packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr, addr);
return 1;
}
/*---------------------------------------------------------------------------*/
const rimeaddr_t *
const linkaddr_t *
packetbuf_addr(uint8_t type)
{
return &packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr;

View file

@ -53,7 +53,7 @@
#define PACKETBUF_H_
#include "contiki-conf.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
/**
* \brief The size of the packetbuf, in bytes
@ -323,7 +323,7 @@ struct packetbuf_attr {
};
struct packetbuf_addr {
/* uint8_t type; */
rimeaddr_t addr;
linkaddr_t addr;
};
#define PACKETBUF_ATTR_PACKET_TYPE_DATA 0
@ -386,8 +386,8 @@ extern struct packetbuf_addr packetbuf_addrs[];
static int packetbuf_set_attr(uint8_t type, const packetbuf_attr_t val);
static packetbuf_attr_t packetbuf_attr(uint8_t type);
static int packetbuf_set_addr(uint8_t type, const rimeaddr_t *addr);
static const rimeaddr_t *packetbuf_addr(uint8_t type);
static int packetbuf_set_addr(uint8_t type, const linkaddr_t *addr);
static const linkaddr_t *packetbuf_addr(uint8_t type);
static inline int
packetbuf_set_attr(uint8_t type, const packetbuf_attr_t val)
@ -403,14 +403,14 @@ packetbuf_attr(uint8_t type)
}
static inline int
packetbuf_set_addr(uint8_t type, const rimeaddr_t *addr)
packetbuf_set_addr(uint8_t type, const linkaddr_t *addr)
{
/* packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].type = type; */
rimeaddr_copy(&packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr, addr);
linkaddr_copy(&packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr, addr);
return 1;
}
static inline const rimeaddr_t *
static inline const linkaddr_t *
packetbuf_addr(uint8_t type)
{
return &packetbuf_addrs[type - PACKETBUF_ADDR_FIRST].addr;
@ -418,8 +418,8 @@ packetbuf_addr(uint8_t type)
#else /* PACKETBUF_CONF_ATTRS_INLINE */
int packetbuf_set_attr(uint8_t type, const packetbuf_attr_t val);
packetbuf_attr_t packetbuf_attr(uint8_t type);
int packetbuf_set_addr(uint8_t type, const rimeaddr_t *addr);
const rimeaddr_t *packetbuf_addr(uint8_t type);
int packetbuf_set_addr(uint8_t type, const linkaddr_t *addr);
const linkaddr_t *packetbuf_addr(uint8_t type);
#endif /* PACKETBUF_CONF_ATTRS_INLINE */
void packetbuf_attr_clear(void);
@ -434,7 +434,7 @@ void packetbuf_attr_copyfrom(struct packetbuf_attr *attrs,
#define PACKETBUF_ATTR_BIT 1
#define PACKETBUF_ATTR_BYTE 8
#define PACKETBUF_ADDRSIZE (sizeof(rimeaddr_t) * PACKETBUF_ATTR_BYTE)
#define PACKETBUF_ADDRSIZE (sizeof(linkaddr_t) * PACKETBUF_ATTR_BYTE)
struct packetbuf_attrlist {
uint8_t type;

View file

@ -472,7 +472,7 @@ queuebuf_datalen(struct queuebuf *b)
return buframptr->len;
}
/*---------------------------------------------------------------------------*/
rimeaddr_t *
linkaddr_t *
queuebuf_addr(struct queuebuf *b, uint8_t type)
{
struct queuebuf_data *buframptr = queuebuf_load_to_ram(b);

View file

@ -103,7 +103,7 @@ void queuebuf_free(struct queuebuf *b);
void *queuebuf_dataptr(struct queuebuf *b);
int queuebuf_datalen(struct queuebuf *b);
rimeaddr_t *queuebuf_addr(struct queuebuf *b, uint8_t type);
linkaddr_t *queuebuf_addr(struct queuebuf *b, uint8_t type);
packetbuf_attr_t queuebuf_attr(struct queuebuf *b, uint8_t type);
void queuebuf_debug_print(void);

View file

@ -80,7 +80,7 @@ int
abc_send(struct abc_conn *c)
{
PRINTF("%d.%d: abc: abc_send on channel %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->channel.channelno);
return rime_output(&c->channel);
}
@ -90,7 +90,7 @@ abc_input(struct channel *channel)
{
struct abc_conn *c = (struct abc_conn *)channel;
PRINTF("%d.%d: abc: abc_input_packet on channel %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
channel->channelno);
if(c->u->recv) {
@ -103,7 +103,7 @@ abc_sent(struct channel *channel, int status, int num_tx)
{
struct abc_conn *c = (struct abc_conn *)channel;
PRINTF("%d.%d: abc: abc_sent on channel %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
channel->channelno);
if(c->u->sent) {

View file

@ -137,7 +137,7 @@ announcement_list(void)
}
/*---------------------------------------------------------------------------*/
void
announcement_heard(const rimeaddr_t *from, uint16_t id, uint16_t value)
announcement_heard(const linkaddr_t *from, uint16_t id, uint16_t value)
{
struct announcement *a;
for(a = list_head(announcements); a != NULL; a = list_item_next(a)) {

View file

@ -66,12 +66,12 @@
#ifndef ANNOUNCEMENT_H_
#define ANNOUNCEMENT_H_
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
struct announcement;
typedef void (*announcement_callback_t)(struct announcement *a,
const rimeaddr_t *from,
const linkaddr_t *from,
uint16_t id, uint16_t val);
/**
@ -224,7 +224,7 @@ struct announcement *announcement_list(void);
* neighbor has been heard.
*
*/
void announcement_heard(const rimeaddr_t *from, uint16_t id, uint16_t value);
void announcement_heard(const linkaddr_t *from, uint16_t id, uint16_t value);
/**
* \brief Register a listen callback with the announcement module

View file

@ -114,19 +114,19 @@ send_adv(void *ptr)
sizeof(struct announcement_data) * adata->num);
PRINTF("%d.%d: sending neighbor advertisement with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], adata->num);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], adata->num);
if(adata->num > 0) {
/* Send the packet only if it contains more than zero announcements. */
broadcast_send(&c.c);
}
PRINTF("%d.%d: sending neighbor advertisement with val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
c.val);
}
/*---------------------------------------------------------------------------*/
static void
adv_packet_received(struct broadcast_conn *ibc, const rimeaddr_t *from)
adv_packet_received(struct broadcast_conn *ibc, const linkaddr_t *from)
{
struct announcement_msg adata;
struct announcement_data data;
@ -138,7 +138,7 @@ adv_packet_received(struct broadcast_conn *ibc, const rimeaddr_t *from)
/* Copy number of announcements */
memcpy(&adata, ptr, sizeof(struct announcement_msg));
PRINTF("%d.%d: adv_packet_received from %d.%d with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], adata.num);
if(ANNOUNCEMENT_MSG_HEADERLEN + adata.num * sizeof(struct announcement_data) > packetbuf_datalen()) {

View file

@ -62,13 +62,13 @@ static const struct packetbuf_attrlist attributes[] =
static void
recv_from_abc(struct abc_conn *bc)
{
rimeaddr_t sender;
linkaddr_t sender;
struct broadcast_conn *c = (struct broadcast_conn *)bc;
rimeaddr_copy(&sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));
linkaddr_copy(&sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));
PRINTF("%d.%d: broadcast: from %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
sender.u8[0], sender.u8[1]);
if(c->u->recv) {
c->u->recv(c, &sender);
@ -81,7 +81,7 @@ sent_by_abc(struct abc_conn *bc, int status, int num_tx)
struct broadcast_conn *c = (struct broadcast_conn *)bc;
PRINTF("%d.%d: sent to %d.%d status %d num_tx %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[1],
status, num_tx);
@ -111,8 +111,8 @@ int
broadcast_send(struct broadcast_conn *c)
{
PRINTF("%d.%d: broadcast_send\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &rimeaddr_node_addr);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, &linkaddr_node_addr);
return abc_send(&c->c);
}
/*---------------------------------------------------------------------------*/

View file

@ -66,7 +66,7 @@
#define BROADCAST_H_
#include "net/rime/abc.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
struct broadcast_conn;
@ -79,7 +79,7 @@ struct broadcast_conn;
*/
struct broadcast_callbacks {
/** Called when a packet has been received by the broadcast module. */
void (* recv)(struct broadcast_conn *ptr, const rimeaddr_t *sender);
void (* recv)(struct broadcast_conn *ptr, const linkaddr_t *sender);
void (* sent)(struct broadcast_conn *ptr, int status, int num_tx);
};

View file

@ -266,7 +266,7 @@ pack_header(struct channel *c)
}
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: pack_header type %d, len %d, bitptr %d, ",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, a->len, bitptr);
/* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/
len = a->len;
@ -275,7 +275,7 @@ pack_header(struct channel *c)
set_bits(&hdrptr[byteptr], bitptr & 7,
(uint8_t *)packetbuf_addr(a->type), len);
PRINTF("address %d.%d\n",
/* rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],*/
/* linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],*/
((uint8_t *)packetbuf_addr(a->type))[0],
((uint8_t *)packetbuf_addr(a->type))[1]);
} else {
@ -284,7 +284,7 @@ pack_header(struct channel *c)
set_bits(&hdrptr[byteptr], bitptr & 7,
(uint8_t *)&val, len);
PRINTF("value %d\n",
/*rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],*/
/*linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],*/
val);
}
/* printhdr(hdrptr, hdrbytesize);*/
@ -336,16 +336,16 @@ unpack_header(void)
}
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: unpack_header type %d, len %d, bitptr %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, a->len, bitptr);
/* len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);*/
len = a->len;
byteptr = bitptr / 8;
if(PACKETBUF_IS_ADDR(a->type)) {
rimeaddr_t addr;
linkaddr_t addr;
get_bits((uint8_t *)&addr, &hdrptr[byteptr], bitptr & 7, len);
PRINTF("%d.%d: unpack_header type %d, addr %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, addr.u8[0], addr.u8[1]);
packetbuf_set_addr(a->type, &addr);
} else {
@ -354,7 +354,7 @@ unpack_header(void)
packetbuf_set_attr(a->type, val);
PRINTF("%d.%d: unpack_header type %d, val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, val);
}
/* byteptr += len / 8;*/

View file

@ -104,14 +104,14 @@ input(void)
}
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: unpack_header type %d, len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, a->len);
len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);
if(PACKETBUF_IS_ADDR(a->type)) {
const rimeaddr_t addr;
const linkaddr_t addr;
memcpy((uint8_t *)&addr, &hdrptr[byteptr], len / 8);
PRINTF("%d.%d: unpack_header type %d, addr %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, addr.u8[0], addr.u8[1]);
packetbuf_set_addr(a->type, &addr);
} else {
@ -120,7 +120,7 @@ input(void)
packetbuf_set_attr(a->type, val);
PRINTF("%d.%d: unpack_header type %d, val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, val);
}
byteptr += len / 8;
@ -158,18 +158,18 @@ output(struct channel *c)
}
#endif /* CHAMELEON_WITH_MAC_LINK_ADDRESSES */
PRINTF("%d.%d: pack_header type %d, len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
a->type, a->len);
len = (a->len & 0xf8) + ((a->len & 7) ? 8: 0);
if(PACKETBUF_IS_ADDR(a->type)) {
const rimeaddr_t *rimeaddr;
const linkaddr_t *linkaddr;
/* memcpy(&hdrptr[byteptr], (uint8_t *)packetbuf_attr_aget(a->type), len / 8);*/
rimeaddr = packetbuf_addr(a->type);
hdrptr[byteptr] = rimeaddr->u8[0];
hdrptr[byteptr + 1] = rimeaddr->u8[1];
linkaddr = packetbuf_addr(a->type);
hdrptr[byteptr] = linkaddr->u8[0];
hdrptr[byteptr + 1] = linkaddr->u8[1];
PRINTF("%d.%d: address %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
((uint8_t *)packetbuf_addr(a->type))[0],
((uint8_t *)packetbuf_addr(a->type))[1]);
} else {
@ -177,7 +177,7 @@ output(struct channel *c)
val = packetbuf_attr(a->type);
memcpy(&hdrptr[byteptr], &val, len / 8);
PRINTF("%d.%d: value %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
val);
}
byteptr += len / 8;

View file

@ -112,19 +112,19 @@ chameleon_parse(void)
{
struct channel *c = NULL;
PRINTF("%d.%d: chameleon_input\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
#if DEBUG
printhdr(packetbuf_dataptr(), packetbuf_datalen());
#endif /* DEBUG */
c = CHAMELEON_MODULE.input();
if(c != NULL) {
PRINTF("%d.%d: chameleon_input channel %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->channelno);
packetbuf_set_attr(PACKETBUF_ATTR_CHANNEL, c->channelno);
} else {
PRINTF("%d.%d: chameleon_input channel not found for incoming packet\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
}
return c;
}
@ -135,7 +135,7 @@ chameleon_create(struct channel *c)
int ret;
PRINTF("%d.%d: chameleon_output channel %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->channelno);
ret = CHAMELEON_MODULE.output(c);

View file

@ -126,14 +126,14 @@ collect_neighbor_list_new(struct collect_neighbor_list *neighbors_list)
/*---------------------------------------------------------------------------*/
struct collect_neighbor *
collect_neighbor_list_find(struct collect_neighbor_list *neighbors_list,
const rimeaddr_t *addr)
const linkaddr_t *addr)
{
struct collect_neighbor *n;
if(neighbors_list == NULL) {
return NULL;
}
for(n = list_head(neighbors_list->list); n != NULL; n = list_item_next(n)) {
if(rimeaddr_cmp(&n->addr, addr)) {
if(linkaddr_cmp(&n->addr, addr)) {
return n;
}
}
@ -142,7 +142,7 @@ collect_neighbor_list_find(struct collect_neighbor_list *neighbors_list,
/*---------------------------------------------------------------------------*/
int
collect_neighbor_list_add(struct collect_neighbor_list *neighbors_list,
const rimeaddr_t *addr, uint16_t nrtmetric)
const linkaddr_t *addr, uint16_t nrtmetric)
{
struct collect_neighbor *n;
@ -159,7 +159,7 @@ collect_neighbor_list_add(struct collect_neighbor_list *neighbors_list,
/* Check if the collect_neighbor is already on the list. */
for(n = list_head(neighbors_list->list); n != NULL; n = list_item_next(n)) {
if(rimeaddr_cmp(&n->addr, addr)) {
if(linkaddr_cmp(&n->addr, addr)) {
PRINTF("collect_neighbor_add: already on list %d.%d\n",
addr->u8[0], addr->u8[1]);
break;
@ -214,7 +214,7 @@ collect_neighbor_list_add(struct collect_neighbor_list *neighbors_list,
if(n != NULL) {
n->age = 0;
rimeaddr_copy(&n->addr, addr);
linkaddr_copy(&n->addr, addr);
n->rtmetric = nrtmetric;
collect_link_estimate_new(&n->le);
n->le_age = 0;
@ -235,7 +235,7 @@ collect_neighbor_list(struct collect_neighbor_list *neighbors_list)
/*---------------------------------------------------------------------------*/
void
collect_neighbor_list_remove(struct collect_neighbor_list *neighbors_list,
const rimeaddr_t *addr)
const linkaddr_t *addr)
{
struct collect_neighbor *n;
@ -337,7 +337,7 @@ collect_neighbor_update_rtmetric(struct collect_neighbor *n, uint16_t rtmetric)
{
if(n != NULL) {
PRINTF("%d.%d: collect_neighbor_update %d.%d rtmetric %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1], rtmetric);
n->rtmetric = rtmetric;
n->age = 0;

View file

@ -51,7 +51,7 @@
#ifndef COLLECT_NEIGHBOR_H_
#define COLLECT_NEIGHBOR_H_
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/rime/collect-link-estimate.h"
#include "lib/list.h"
@ -62,7 +62,7 @@ struct collect_neighbor_list {
struct collect_neighbor {
struct collect_neighbor *next;
rimeaddr_t addr;
linkaddr_t addr;
uint16_t rtmetric;
uint16_t age;
uint16_t le_age;
@ -77,11 +77,11 @@ list_t collect_neighbor_list(struct collect_neighbor_list *neighbor_list);
void collect_neighbor_list_new(struct collect_neighbor_list *neighbor_list);
int collect_neighbor_list_add(struct collect_neighbor_list *neighbor_list,
const rimeaddr_t *addr, uint16_t rtmetric);
const linkaddr_t *addr, uint16_t rtmetric);
void collect_neighbor_list_remove(struct collect_neighbor_list *neighbor_list,
const rimeaddr_t *addr);
const linkaddr_t *addr);
struct collect_neighbor *collect_neighbor_list_find(struct collect_neighbor_list *neighbor_list,
const rimeaddr_t *addr);
const linkaddr_t *addr);
struct collect_neighbor *collect_neighbor_list_best(struct collect_neighbor_list *neighbor_list);
int collect_neighbor_list_num(struct collect_neighbor_list *neighbor_list);
struct collect_neighbor *collect_neighbor_list_get(struct collect_neighbor_list *neighbor_list, int num);

View file

@ -74,7 +74,7 @@ static const struct packetbuf_attrlist attributes[] =
struct recent_packet {
struct collect_conn *conn;
rimeaddr_t originator;
linkaddr_t originator;
uint8_t eseqno;
};
@ -313,17 +313,17 @@ update_parent(struct collect_conn *tc)
by Gnawali et al (SenSys 2009). */
if(best != NULL) {
rimeaddr_t previous_parent;
linkaddr_t previous_parent;
if(DRAW_TREE) {
rimeaddr_copy(&previous_parent, &tc->parent);
linkaddr_copy(&previous_parent, &tc->parent);
}
if(current == NULL) {
/* New parent. */
PRINTF("update_parent: new parent %d.%d\n",
best->addr.u8[0], best->addr.u8[1]);
rimeaddr_copy(&tc->parent, &best->addr);
linkaddr_copy(&tc->parent, &best->addr);
stats.foundroute++;
bump_advertisement(tc);
} else {
@ -340,7 +340,7 @@ update_parent(struct collect_conn *tc)
collect_neighbor_rtmetric(best),
tc->parent.u8[0], tc->parent.u8[1],
collect_neighbor_rtmetric(current));
rimeaddr_copy(&tc->parent, &best->addr);
linkaddr_copy(&tc->parent, &best->addr);
stats.newparent++;
/* Since we now have a significantly better or worse rtmetric than
we had before, we let our neighbors know this quickly. */
@ -376,8 +376,8 @@ update_parent(struct collect_conn *tc)
}
}
if(DRAW_TREE) {
if(!rimeaddr_cmp(&previous_parent, &tc->parent)) {
if(!rimeaddr_cmp(&previous_parent, &rimeaddr_null)) {
if(!linkaddr_cmp(&previous_parent, &tc->parent)) {
if(!linkaddr_cmp(&previous_parent, &linkaddr_null)) {
PRINTF("#L %d 0\n", previous_parent.u8[0]);
}
PRINTF("#L %d 1\n", tc->parent.u8[0]);
@ -385,13 +385,13 @@ update_parent(struct collect_conn *tc)
}
} else {
/* No parent. */
if(!rimeaddr_cmp(&tc->parent, &rimeaddr_null)) {
if(!linkaddr_cmp(&tc->parent, &linkaddr_null)) {
if(DRAW_TREE) {
PRINTF("#L %d 0\n", tc->parent.u8[0]);
}
stats.routelost++;
}
rimeaddr_copy(&tc->parent, &rimeaddr_null);
linkaddr_copy(&tc->parent, &linkaddr_null);
}
}
/*---------------------------------------------------------------------------*/
@ -445,7 +445,7 @@ update_rtmetric(struct collect_conn *tc)
}
PRINTF("%d.%d: new rtmetric %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
tc->rtmetric);
/* We got a new, working, route we send any queued packets we may have. */
@ -468,13 +468,13 @@ enqueue_dummy_packet(struct collect_conn *c, int rexmits)
packetbuf_clear();
packetbuf_set_attr(PACKETBUF_ATTR_EPACKET_ID, c->eseqno - 1);
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &linkaddr_node_addr);
packetbuf_set_attr(PACKETBUF_ATTR_HOPS, 1);
packetbuf_set_attr(PACKETBUF_ATTR_TTL, 1);
packetbuf_set_attr(PACKETBUF_ATTR_MAX_REXMIT, rexmits);
PRINTF("%d.%d: enqueueing dummy packet %d, max_rexmits %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID),
packetbuf_attr(PACKETBUF_ATTR_MAX_REXMIT));
@ -538,23 +538,23 @@ proactive_probing_callback(void *ptr)
n != NULL; n = list_item_next(n)) {
if(n->rtmetric + COLLECT_LINK_ESTIMATE_UNIT < c->rtmetric &&
collect_link_estimate_num_estimates(&n->le) == 0) {
rimeaddr_t current_parent;
linkaddr_t current_parent;
PRINTF("proactive_probing_callback: found neighbor with no link estimate, %d.%d\n",
n->addr.u8[RIMEADDR_SIZE - 2], n->addr.u8[RIMEADDR_SIZE - 1]);
n->addr.u8[LINKADDR_SIZE - 2], n->addr.u8[LINKADDR_SIZE - 1]);
rimeaddr_copy(&current_parent, &c->parent);
rimeaddr_copy(&c->parent, &n->addr);
linkaddr_copy(&current_parent, &c->parent);
linkaddr_copy(&c->parent, &n->addr);
if(enqueue_dummy_packet(c, PROACTIVE_PROBING_REXMITS)) {
send_queued_packet(c);
}
rimeaddr_copy(&c->parent, &current_parent);
linkaddr_copy(&c->parent, &current_parent);
return;
}
}
}
PRINTF("%d.%d: nothing on queue\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
return;
}
}
@ -579,7 +579,7 @@ send_queued_packet(struct collect_conn *c)
another one. */
if(c->sending) {
PRINTF("%d.%d: queue, c is sending\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
return;
}
@ -588,7 +588,7 @@ send_queued_packet(struct collect_conn *c)
i = packetqueue_first(&c->send_queue);
if(i == NULL) {
PRINTF("%d.%d: nothing on queue\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
return;
}
@ -610,7 +610,7 @@ send_queued_packet(struct collect_conn *c)
Collect connection structure and send the packet. */
PRINTF("%d.%d: sending packet to %d.%d with eseqno %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID));
@ -618,7 +618,7 @@ send_queued_packet(struct collect_conn *c)
c->sending = 1;
/* Remember the parent that we sent this packet to. */
rimeaddr_copy(&c->current_parent, &c->parent);
linkaddr_copy(&c->current_parent, &c->parent);
/* This is the first time we transmit this packet, so set
transmissions to zero. */
@ -688,7 +688,7 @@ retransmit_current_packet(struct collect_conn *c)
i = packetqueue_first(&c->send_queue);
if(i == NULL) {
PRINTF("%d.%d: nothing on queue\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
/* No packet on the queue, so there is nothing for us to send. */
return;
}
@ -706,7 +706,7 @@ retransmit_current_packet(struct collect_conn *c)
a better parent while we were transmitting this packet, we
chose that neighbor instead. If so, we need to attribute the
transmissions we made for the parent to that neighbor. */
if(!rimeaddr_cmp(&c->current_parent, &c->parent)) {
if(!linkaddr_cmp(&c->current_parent, &c->parent)) {
/* struct collect_neighbor *current_neighbor;
current_neighbor = collect_neighbor_list_find(&c->neighbor_list,
&c->current_parent);
@ -719,7 +719,7 @@ retransmit_current_packet(struct collect_conn *c)
c->parent.u8[0], c->parent.u8[1],
c->transmissions);
rimeaddr_copy(&c->current_parent, &c->parent);
linkaddr_copy(&c->current_parent, &c->parent);
c->transmissions = 0;
}
n = collect_neighbor_list_find(&c->neighbor_list, &c->current_parent);
@ -731,7 +731,7 @@ retransmit_current_packet(struct collect_conn *c)
Collect connection structure and send the packet. */
PRINTF("%d.%d: sending packet to %d.%d with eseqno %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID));
@ -786,7 +786,7 @@ handle_ack(struct collect_conn *tc)
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[1],
tc->current_parent.u8[0], tc->current_parent.u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID), tc->seqno);
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_SENDER),
&tc->current_parent) &&
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == tc->seqno) {
@ -820,7 +820,7 @@ handle_ack(struct collect_conn *tc)
}
PRINTF("%d.%d: ACK from %d.%d after %d transmissions, flags %02x, rtmetric %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
tc->current_parent.u8[0], tc->current_parent.u8[1],
tc->transmissions,
msg.flags,
@ -875,7 +875,7 @@ handle_ack(struct collect_conn *tc)
}
/*---------------------------------------------------------------------------*/
static void
send_ack(struct collect_conn *tc, const rimeaddr_t *to, int flags)
send_ack(struct collect_conn *tc, const linkaddr_t *to, int flags)
{
struct ack_msg *ack;
uint16_t packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
@ -896,7 +896,7 @@ send_ack(struct collect_conn *tc, const rimeaddr_t *to, int flags)
unicast_send(&tc->unicast_conn, to);
PRINTF("%d.%d: collect: Sending ACK to %d.%d for %d (epacket_id %d)\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
to->u8[0], to->u8[1], packet_seqno,
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID));
@ -914,7 +914,7 @@ add_packet_to_recent_packets(struct collect_conn *tc)
if(packetbuf_datalen() > sizeof(struct data_msg_hdr)) {
recent_packets[recent_packet_ptr].eseqno =
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID);
rimeaddr_copy(&recent_packets[recent_packet_ptr].originator,
linkaddr_copy(&recent_packets[recent_packet_ptr].originator,
packetbuf_addr(PACKETBUF_ADDR_ESENDER));
recent_packets[recent_packet_ptr].conn = tc;
recent_packet_ptr = (recent_packet_ptr + 1) % NUM_RECENT_PACKETS;
@ -922,7 +922,7 @@ add_packet_to_recent_packets(struct collect_conn *tc)
}
/*---------------------------------------------------------------------------*/
static void
node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
node_packet_received(struct unicast_conn *c, const linkaddr_t *from)
{
struct collect_conn *tc = (struct collect_conn *)
((char *)c - offsetof(struct collect_conn, unicast_conn));
@ -950,14 +950,14 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
the packet. */
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_DATA) {
rimeaddr_t ack_to;
linkaddr_t ack_to;
uint8_t packet_seqno;
stats.datarecv++;
/* Remember to whom we should send the ACK, since we reuse the
packet buffer and its attributes when sending the ACK. */
rimeaddr_copy(&ack_to, packetbuf_addr(PACKETBUF_ADDR_SENDER));
linkaddr_copy(&ack_to, packetbuf_addr(PACKETBUF_ADDR_SENDER));
packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
/* If the queue is more than half filled, we add the CONGESTED
@ -972,12 +972,12 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
for(i = 0; i < NUM_RECENT_PACKETS; i++) {
if(recent_packets[i].conn == tc &&
recent_packets[i].eseqno == packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID) &&
rimeaddr_cmp(&recent_packets[i].originator,
linkaddr_cmp(&recent_packets[i].originator,
packetbuf_addr(PACKETBUF_ADDR_ESENDER))) {
/* This is a duplicate of a packet we recently received, so we
just send an ACK. */
PRINTF("%d.%d: found duplicate packet from %d.%d with seqno %d, via %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
recent_packets[i].originator.u8[0], recent_packets[i].originator.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID),
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[0],
@ -1004,7 +1004,7 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
queuebuf_free(q);
} else {
PRINTF("%d.%d: collect: could not send ACK to %d.%d for %d: no queued buffers\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
ack_to.u8[0], ack_to.u8[1],
packet_seqno);
stats.ackdrop++;
@ -1012,7 +1012,7 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
PRINTF("%d.%d: sink received packet %d from %d.%d via %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID),
packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[1],
@ -1047,7 +1047,7 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
PRINTF("%d.%d: packet received from %d.%d via %d.%d, sending %d, max_rexmits %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_ESENDER)->u8[1],
from->u8[0], from->u8[1], tc->sending,
@ -1072,12 +1072,12 @@ node_packet_received(struct unicast_conn *c, const rimeaddr_t *from)
send_ack(tc, &ack_to,
ackflags | ACK_FLAGS_DROPPED | ACK_FLAGS_CONGESTED);
PRINTF("%d.%d: packet dropped: no queue buffer available\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
stats.qdrop++;
}
} else if(packetbuf_attr(PACKETBUF_ATTR_TTL) <= 1) {
PRINTF("%d.%d: packet dropped: ttl %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_TTL));
send_ack(tc, &ack_to, ackflags |
ACK_FLAGS_DROPPED | ACK_FLAGS_LIFETIME_EXCEEDED);
@ -1104,11 +1104,11 @@ timedout(struct collect_conn *tc)
{
struct collect_neighbor *n;
PRINTF("%d.%d: timedout after %d retransmissions to %d.%d (max retransmissions %d): packet dropped\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], tc->transmissions,
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], tc->transmissions,
tc->current_parent.u8[0], tc->current_parent.u8[1],
tc->max_rexmits);
PRINTF("%d.%d: timedout after %d retransmissions to %d.%d (max retransmissions %d): packet dropped\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], tc->transmissions,
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], tc->transmissions,
tc->current_parent.u8[0], tc->current_parent.u8[1],
tc->max_rexmits);
@ -1136,7 +1136,7 @@ node_packet_sent(struct unicast_conn *c, int status, int transmissions)
tc->transmissions += transmissions;
PRINTF("tx %d\n", tc->transmissions);
PRINTF("%d.%d: MAC sent %d transmissions to %d.%d, status %d, total transmissions %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
transmissions,
tc->current_parent.u8[0], tc->current_parent.u8[1],
status, tc->transmissions);
@ -1194,7 +1194,7 @@ retransmit_callback(void *ptr)
/*---------------------------------------------------------------------------*/
#if !COLLECT_ANNOUNCEMENTS
static void
adv_received(struct neighbor_discovery_conn *c, const rimeaddr_t *from,
adv_received(struct neighbor_discovery_conn *c, const linkaddr_t *from,
uint16_t rtmetric)
{
struct collect_conn *tc = (struct collect_conn *)
@ -1223,7 +1223,7 @@ adv_received(struct neighbor_discovery_conn *c, const rimeaddr_t *from,
}
collect_neighbor_update_rtmetric(n, rtmetric);
PRINTF("%d.%d: updating neighbor %d.%d, etx %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1], rtmetric);
}
@ -1231,7 +1231,7 @@ adv_received(struct neighbor_discovery_conn *c, const rimeaddr_t *from,
}
#else
static void
received_announcement(struct announcement *a, const rimeaddr_t *from,
received_announcement(struct announcement *a, const linkaddr_t *from,
uint16_t id, uint16_t value)
{
struct collect_conn *tc = (struct collect_conn *)
@ -1246,7 +1246,7 @@ received_announcement(struct announcement *a, const rimeaddr_t *from,
if(value < tc->rtmetric) {
collect_neighbor_list_add(&tc->neighbor_list, from, value);
PRINTF("%d.%d: new neighbor %d.%d, rtmetric %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], value);
}
if(value == RTMETRIC_MAX && tc->rtmetric != RTMETRIC_MAX) {
@ -1267,7 +1267,7 @@ received_announcement(struct announcement *a, const rimeaddr_t *from,
}
collect_neighbor_update_rtmetric(n, value);
PRINTF("%d.%d: updating neighbor %d.%d, etx %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1], value);
}
@ -1346,7 +1346,7 @@ send_keepalive(void *ptr)
if(c->sending == 0 && packetqueue_len(&c->send_queue) == 0) {
if(enqueue_dummy_packet(c, KEEPALIVE_REXMITS)) {
PRINTF("%d.%d: sending keepalive\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
send_queued_packet(c);
}
}
@ -1437,7 +1437,7 @@ collect_send(struct collect_conn *tc, int rexmits)
if(tc->eseqno == 0) {
tc->eseqno = ((int)(1 << COLLECT_PACKET_ID_BITS)) / 2;
}
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &linkaddr_node_addr);
packetbuf_set_attr(PACKETBUF_ATTR_HOPS, 1);
packetbuf_set_attr(PACKETBUF_ATTR_TTL, MAX_HOPLIM);
if(rexmits > MAX_REXMITS) {
@ -1447,7 +1447,7 @@ collect_send(struct collect_conn *tc, int rexmits)
}
PRINTF("%d.%d: originating packet %d, max_rexmits %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID),
packetbuf_attr(PACKETBUF_ATTR_MAX_REXMIT));
@ -1472,9 +1472,9 @@ collect_send(struct collect_conn *tc, int rexmits)
ret = 1;
} else {
PRINTF("%d.%d: drop originated packet: no queuebuf\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
PRINTF("%d.%d: drop originated packet: no queuebuf\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
ret = 0;
}
@ -1482,11 +1482,11 @@ collect_send(struct collect_conn *tc, int rexmits)
n = collect_neighbor_list_find(&tc->neighbor_list, &tc->parent);
if(n != NULL) {
PRINTF("%d.%d: sending to %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
n->addr.u8[0], n->addr.u8[1]);
} else {
PRINTF("%d.%d: did not find any neighbor to send to\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
#if COLLECT_ANNOUNCEMENTS
#if COLLECT_CONF_WITH_LISTEN
PRINTF("listen\n");
@ -1508,9 +1508,9 @@ collect_send(struct collect_conn *tc, int rexmits)
return 1;
} else {
PRINTF("%d.%d: drop originated packet: no queuebuf\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
PRINTF("%d.%d: drop originated packet: no queuebuf\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
}*/
}
}
@ -1523,7 +1523,7 @@ collect_depth(struct collect_conn *tc)
return tc->rtmetric;
}
/*---------------------------------------------------------------------------*/
const rimeaddr_t *
const linkaddr_t *
collect_parent(struct collect_conn *tc)
{
return &tc->current_parent;
@ -1533,12 +1533,12 @@ void
collect_purge(struct collect_conn *tc)
{
collect_neighbor_list_purge(&tc->neighbor_list);
rimeaddr_copy(&tc->parent, &rimeaddr_null);
linkaddr_copy(&tc->parent, &linkaddr_null);
update_rtmetric(tc);
if(DRAW_TREE) {
PRINTF("#L %d 0\n", tc->parent.u8[0]);
}
rimeaddr_copy(&tc->parent, &rimeaddr_null);
linkaddr_copy(&tc->parent, &linkaddr_null);
}
/*---------------------------------------------------------------------------*/
void

View file

@ -101,7 +101,7 @@
UNICAST_ATTRIBUTES
struct collect_callbacks {
void (* recv)(const rimeaddr_t *originator, uint8_t seqno,
void (* recv)(const linkaddr_t *originator, uint8_t seqno,
uint8_t hops);
};
@ -133,7 +133,7 @@ struct collect_conn {
struct ctimer proactive_probing_timer;
rimeaddr_t parent, current_parent;
linkaddr_t parent, current_parent;
uint16_t rtmetric;
uint8_t seqno;
uint8_t sending, transmissions, max_rexmits;
@ -158,7 +158,7 @@ int collect_send(struct collect_conn *c, int rexmits);
void collect_set_sink(struct collect_conn *c, int should_be_sink);
int collect_depth(struct collect_conn *c);
const rimeaddr_t *collect_parent(struct collect_conn *c);
const linkaddr_t *collect_parent(struct collect_conn *c);
void collect_set_keepalive(struct collect_conn *c, clock_time_t period);

View file

@ -66,7 +66,7 @@
/*---------------------------------------------------------------------------*/
static void
recv(struct broadcast_conn *broadcast, const rimeaddr_t *from)
recv(struct broadcast_conn *broadcast, const linkaddr_t *from)
{
struct ipolite_conn *c = (struct ipolite_conn *)broadcast;
if(c->q != NULL &&
@ -103,7 +103,7 @@ send(void *ptr)
struct ipolite_conn *c = ptr;
PRINTF("%d.%d: ipolite: send queuebuf %p\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->q);
if(c->q != NULL) {
@ -146,14 +146,14 @@ ipolite_send(struct ipolite_conn *c, clock_time_t interval, uint8_t hdrsize)
if(c->q != NULL) {
/* If we are already about to send a packet, we cancel the old one. */
PRINTF("%d.%d: ipolite_send: cancel old send\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
queuebuf_free(c->q);
}
c->dups = 0;
c->hdrsize = hdrsize;
if(interval == 0) {
PRINTF("%d.%d: ipolite_send: interval 0\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
if(broadcast_send(&c->c)) {
if(c->cb->sent) {
c->cb->sent(c);
@ -170,7 +170,7 @@ ipolite_send(struct ipolite_conn *c, clock_time_t interval, uint8_t hdrsize)
return 1;
}
PRINTF("%d.%d: ipolite_send: could not allocate queue buffer\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
}
return 0;
}

View file

@ -114,7 +114,7 @@ struct ipolite_callbacks {
/**
* Called when a packet is received on the connection.
*/
void (* recv)(struct ipolite_conn *c, const rimeaddr_t *from);
void (* recv)(struct ipolite_conn *c, const linkaddr_t *from);
/**
* Called when a packet is sent on the connection.

View file

@ -62,8 +62,8 @@
/*---------------------------------------------------------------------------*/
static void
data_packet_received(struct multihop_conn *multihop,
const rimeaddr_t *from,
const rimeaddr_t *prevhop, uint8_t hops)
const linkaddr_t *from,
const linkaddr_t *prevhop, uint8_t hops)
{
struct mesh_conn *c = (struct mesh_conn *)
((char *)multihop - offsetof(struct mesh_conn, multihop));
@ -81,11 +81,11 @@ data_packet_received(struct multihop_conn *multihop,
}
}
/*---------------------------------------------------------------------------*/
static rimeaddr_t *
static linkaddr_t *
data_packet_forward(struct multihop_conn *multihop,
const rimeaddr_t *originator,
const rimeaddr_t *dest,
const rimeaddr_t *prevhop, uint8_t hops)
const linkaddr_t *originator,
const linkaddr_t *dest,
const linkaddr_t *prevhop, uint8_t hops)
{
struct route_entry *rt;
struct mesh_conn *c = (struct mesh_conn *)
@ -99,7 +99,7 @@ data_packet_forward(struct multihop_conn *multihop,
PRINTF("data_packet_forward: queueing data, sending rreq\n");
c->queued_data = queuebuf_new_from_packetbuf();
rimeaddr_copy(&c->queued_data_dest, dest);
linkaddr_copy(&c->queued_data_dest, dest);
route_discovery_discover(&c->route_discovery_conn, dest, PACKET_TIMEOUT);
return NULL;
@ -111,7 +111,7 @@ data_packet_forward(struct multihop_conn *multihop,
}
/*---------------------------------------------------------------------------*/
static void
found_route(struct route_discovery_conn *rdc, const rimeaddr_t *dest)
found_route(struct route_discovery_conn *rdc, const linkaddr_t *dest)
{
struct route_entry *rt;
struct mesh_conn *c = (struct mesh_conn *)
@ -120,7 +120,7 @@ found_route(struct route_discovery_conn *rdc, const rimeaddr_t *dest)
PRINTF("found_route\n");
if(c->queued_data != NULL &&
rimeaddr_cmp(dest, &c->queued_data_dest)) {
linkaddr_cmp(dest, &c->queued_data_dest)) {
queuebuf_to_packetbuf(c->queued_data);
queuebuf_free(c->queued_data);
c->queued_data = NULL;
@ -181,12 +181,12 @@ mesh_close(struct mesh_conn *c)
}
/*---------------------------------------------------------------------------*/
int
mesh_send(struct mesh_conn *c, const rimeaddr_t *to)
mesh_send(struct mesh_conn *c, const linkaddr_t *to)
{
int could_send;
PRINTF("%d.%d: mesh_send to %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
to->u8[0], to->u8[1]);
could_send = multihop_send(&c->multihop, to);

View file

@ -72,7 +72,7 @@ struct mesh_conn;
*/
struct mesh_callbacks {
/** Called when a packet is received. */
void (* recv)(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops);
void (* recv)(struct mesh_conn *c, const linkaddr_t *from, uint8_t hops);
/** Called when a packet, sent with mesh_send(), is actually transmitted. */
void (* sent)(struct mesh_conn *c);
/** Called when a packet, sent with mesh_send(), times out and is dropped. */
@ -83,7 +83,7 @@ struct mesh_conn {
struct multihop_conn multihop;
struct route_discovery_conn route_discovery_conn;
struct queuebuf *queued_data;
rimeaddr_t queued_data_dest;
linkaddr_t queued_data_dest;
const struct mesh_callbacks *cb;
};
@ -131,7 +131,7 @@ void mesh_close(struct mesh_conn *c);
* must have previously been set up with mesh_open().
*
*/
int mesh_send(struct mesh_conn *c, const rimeaddr_t *dest);
int mesh_send(struct mesh_conn *c, const linkaddr_t *dest);
/**
* \brief Test if mesh is ready to send a packet (or packet is queued)

View file

@ -65,17 +65,17 @@ static const struct packetbuf_attrlist attributes[] =
/*---------------------------------------------------------------------------*/
void
data_packet_received(struct unicast_conn *uc, const rimeaddr_t *from)
data_packet_received(struct unicast_conn *uc, const linkaddr_t *from)
{
struct multihop_conn *c = (struct multihop_conn *)uc;
rimeaddr_t *nexthop;
rimeaddr_t sender, receiver;
linkaddr_t *nexthop;
linkaddr_t sender, receiver;
/* Copy the packet attributes to avoid them being overwritten or
cleared by an application program that uses the packet buffer for
its own needs. */
rimeaddr_copy(&sender, packetbuf_addr(PACKETBUF_ADDR_ESENDER));
rimeaddr_copy(&receiver, packetbuf_addr(PACKETBUF_ADDR_ERECEIVER));
linkaddr_copy(&sender, packetbuf_addr(PACKETBUF_ADDR_ESENDER));
linkaddr_copy(&receiver, packetbuf_addr(PACKETBUF_ADDR_ERECEIVER));
PRINTF("data_packet_received from %d.%d towards %d.%d len %d\n",
from->u8[0], from->u8[1],
@ -83,8 +83,8 @@ data_packet_received(struct unicast_conn *uc, const rimeaddr_t *from)
packetbuf_addr(PACKETBUF_ADDR_ERECEIVER)->u8[1],
packetbuf_datalen());
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_ERECEIVER),
&rimeaddr_node_addr)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_ERECEIVER),
&linkaddr_node_addr)) {
PRINTF("for us!\n");
if(c->cb->recv) {
c->cb->recv(c, &sender, from,
@ -123,18 +123,18 @@ multihop_close(struct multihop_conn *c)
}
/*---------------------------------------------------------------------------*/
int
multihop_send(struct multihop_conn *c, const rimeaddr_t *to)
multihop_send(struct multihop_conn *c, const linkaddr_t *to)
{
rimeaddr_t *nexthop;
linkaddr_t *nexthop;
if(c->cb->forward == NULL) {
return 0;
}
packetbuf_compact();
packetbuf_set_addr(PACKETBUF_ADDR_ERECEIVER, to);
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &rimeaddr_node_addr);
packetbuf_set_addr(PACKETBUF_ADDR_ESENDER, &linkaddr_node_addr);
packetbuf_set_attr(PACKETBUF_ATTR_HOPS, 1);
nexthop = c->cb->forward(c, &rimeaddr_node_addr, to, NULL, 0);
nexthop = c->cb->forward(c, &linkaddr_node_addr, to, NULL, 0);
if(nexthop == NULL) {
PRINTF("multihop_send: no route\n");
@ -148,7 +148,7 @@ multihop_send(struct multihop_conn *c, const rimeaddr_t *to)
}
/*---------------------------------------------------------------------------*/
void
multihop_resend(struct multihop_conn *c, const rimeaddr_t *nexthop)
multihop_resend(struct multihop_conn *c, const linkaddr_t *nexthop)
{
unicast_send(&c->c, nexthop);
}

View file

@ -71,7 +71,7 @@
#define MULTIHOP_H_
#include "net/rime/unicast.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
struct multihop_conn;
@ -84,13 +84,13 @@ struct multihop_conn;
struct multihop_callbacks {
void (* recv)(struct multihop_conn *ptr,
const rimeaddr_t *sender,
const rimeaddr_t *prevhop,
const linkaddr_t *sender,
const linkaddr_t *prevhop,
uint8_t hops);
rimeaddr_t *(* forward)(struct multihop_conn *ptr,
const rimeaddr_t *originator,
const rimeaddr_t *dest,
const rimeaddr_t *prevhop,
linkaddr_t *(* forward)(struct multihop_conn *ptr,
const linkaddr_t *originator,
const linkaddr_t *dest,
const linkaddr_t *prevhop,
uint8_t hops);
};
@ -102,8 +102,8 @@ struct multihop_conn {
void multihop_open(struct multihop_conn *c, uint16_t channel,
const struct multihop_callbacks *u);
void multihop_close(struct multihop_conn *c);
int multihop_send(struct multihop_conn *c, const rimeaddr_t *to);
void multihop_resend(struct multihop_conn *c, const rimeaddr_t *nexthop);
int multihop_send(struct multihop_conn *c, const linkaddr_t *to);
void multihop_resend(struct multihop_conn *c, const linkaddr_t *nexthop);
#endif /* MULTIHOP_H_ */
/** @} */

View file

@ -87,12 +87,12 @@ send_adv(void *ptr)
c->u->sent(c);
}
PRINTF("%d.%d: sending neighbor advertisement with val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
c->val);
}
/*---------------------------------------------------------------------------*/
static void
adv_packet_received(struct broadcast_conn *ibc, const rimeaddr_t *from)
adv_packet_received(struct broadcast_conn *ibc, const linkaddr_t *from)
{
struct neighbor_discovery_conn *c = (struct neighbor_discovery_conn *)ibc;
struct adv_msg msg;
@ -100,7 +100,7 @@ adv_packet_received(struct broadcast_conn *ibc, const rimeaddr_t *from)
memcpy(&msg, packetbuf_dataptr(), sizeof(struct adv_msg));
PRINTF("%d.%d: adv_packet_received from %d.%d with val %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], msg.val);
/* If we receive an announcement with a lower value than ours, we
@ -162,7 +162,7 @@ neighbor_discovery_open(struct neighbor_discovery_conn *c, uint16_t channel,
const struct neighbor_discovery_callbacks *cb)
{
PRINTF("%d.%d: neighbor discovery open channel %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
channel);
broadcast_open(&c->c, channel, &broadcast_callbacks);
c->u = cb;

View file

@ -66,7 +66,7 @@ struct neighbor_discovery_conn;
struct neighbor_discovery_callbacks {
void (* recv)(struct neighbor_discovery_conn *c,
const rimeaddr_t *from, uint16_t val);
const linkaddr_t *from, uint16_t val);
void (* sent)(struct neighbor_discovery_conn *c);
};

View file

@ -50,7 +50,7 @@
struct netflood_hdr {
uint16_t originator_seqno;
rimeaddr_t originator;
linkaddr_t originator;
uint16_t hops;
};
@ -67,12 +67,12 @@ static int
send(struct netflood_conn *c)
{
PRINTF("%d.%d: netflood send to ipolite\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
return ipolite_send(&c->c, c->queue_time, 4);
}
/*---------------------------------------------------------------------------*/
static void
recv_from_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
recv_from_ipolite(struct ipolite_conn *ipolite, const linkaddr_t *from)
{
struct netflood_conn *c = (struct netflood_conn *)ipolite;
struct netflood_hdr hdr;
@ -87,7 +87,7 @@ recv_from_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
packetbuf_hdrreduce(sizeof(struct netflood_hdr));
if(c->u->recv != NULL) {
if(!(rimeaddr_cmp(&hdr.originator, &c->last_originator) &&
if(!(linkaddr_cmp(&hdr.originator, &c->last_originator) &&
hdr.originator_seqno <= c->last_originator_seqno)) {
if(c->u->recv(c, from, &hdr.originator, hdr.originator_seqno,
@ -102,7 +102,7 @@ recv_from_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
/* Rebroadcast received packet. */
if(hops < HOPS_MAX) {
PRINTF("%d.%d: netflood rebroadcasting %d.%d/%d (%d.%d/%d) hops %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr.originator.u8[0], hdr.originator.u8[1],
hdr.originator_seqno,
c->last_originator.u8[0], c->last_originator.u8[1],
@ -111,7 +111,7 @@ recv_from_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
hdr.hops++;
memcpy(packetbuf_dataptr(), &hdr, sizeof(struct netflood_hdr));
send(c);
rimeaddr_copy(&c->last_originator, &hdr.originator);
linkaddr_copy(&c->last_originator, &hdr.originator);
c->last_originator_seqno = hdr.originator_seqno;
}
}
@ -163,12 +163,12 @@ netflood_send(struct netflood_conn *c, uint8_t seqno)
{
if(packetbuf_hdralloc(sizeof(struct netflood_hdr))) {
struct netflood_hdr *hdr = packetbuf_hdrptr();
rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);
rimeaddr_copy(&c->last_originator, &hdr->originator);
linkaddr_copy(&hdr->originator, &linkaddr_node_addr);
linkaddr_copy(&c->last_originator, &hdr->originator);
c->last_originator_seqno = hdr->originator_seqno = seqno;
hdr->hops = 0;
PRINTF("%d.%d: netflood sending '%s'\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
(char *)packetbuf_dataptr());
return ipolite_send(&c->c, 0, 4);
}

View file

@ -85,8 +85,8 @@ struct netflood_conn;
IPOLITE_ATTRIBUTES
struct netflood_callbacks {
int (* recv)(struct netflood_conn *c, const rimeaddr_t *from,
const rimeaddr_t *originator, uint8_t seqno, uint8_t hops);
int (* recv)(struct netflood_conn *c, const linkaddr_t *from,
const linkaddr_t *originator, uint8_t seqno, uint8_t hops);
void (* sent)(struct netflood_conn *c);
void (* dropped)(struct netflood_conn *c);
};
@ -95,7 +95,7 @@ struct netflood_conn {
struct ipolite_conn c;
const struct netflood_callbacks *u;
clock_time_t queue_time;
rimeaddr_t last_originator;
linkaddr_t last_originator;
uint8_t last_originator_seqno;
};

View file

@ -112,7 +112,7 @@ send_adv(clock_time_t interval)
sizeof(struct announcement_data) * adata->num);
PRINTF("%d.%d: sending neighbor advertisement with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], adata->num);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], adata->num);
if(adata->num > 0) {
/* Send the packet only if it contains more than zero announcements. */
@ -121,7 +121,7 @@ send_adv(clock_time_t interval)
}
/*---------------------------------------------------------------------------*/
static void
adv_packet_received(struct ipolite_conn *ipolite, const rimeaddr_t *from)
adv_packet_received(struct ipolite_conn *ipolite, const linkaddr_t *from)
{
struct announcement_msg adata;
struct announcement_data data;
@ -133,7 +133,7 @@ adv_packet_received(struct ipolite_conn *ipolite, const rimeaddr_t *from)
/* Copy number of announcements */
memcpy(&adata, ptr, sizeof(struct announcement_msg));
PRINTF("%d.%d: adv_packet_received from %d.%d with %d announcements\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], adata.num);
if(ANNOUNCEMENT_MSG_HEADERLEN + adata.num * sizeof(struct announcement_data) > packetbuf_datalen()) {

View file

@ -55,7 +55,7 @@
#include "net/rime/polite-announcement.h"
#include "net/rime/polite.h"
#include "net/queuebuf.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/packetbuf.h"
#include "net/rime/rimestats.h"
#include "net/rime/rmh.h"

View file

@ -47,8 +47,8 @@
#include "net/rime/rmh.h"
struct data_hdr {
rimeaddr_t dest;
rimeaddr_t originator;
linkaddr_t dest;
linkaddr_t originator;
uint8_t hops;
uint8_t max_rexmits;
};
@ -63,18 +63,18 @@ struct data_hdr {
/*---------------------------------------------------------------------------*/
static void
received(struct runicast_conn *uc, const rimeaddr_t *from, uint8_t seqno)
received(struct runicast_conn *uc, const linkaddr_t *from, uint8_t seqno)
{
struct rmh_conn *c = (struct rmh_conn *)uc;
struct data_hdr *msg = packetbuf_dataptr();
rimeaddr_t *nexthop;
linkaddr_t *nexthop;
PRINTF("data_packet_received from %d.%d towards %d.%d len %d\n",
from->u8[0], from->u8[1],
msg->dest.u8[0], msg->dest.u8[1],
packetbuf_datalen());
if(rimeaddr_cmp(&msg->dest, &rimeaddr_node_addr)) {
if(linkaddr_cmp(&msg->dest, &linkaddr_node_addr)) {
PRINTF("for us!\n");
packetbuf_hdrreduce(sizeof(struct data_hdr));
if(c->cb->recv) {
@ -95,13 +95,13 @@ received(struct runicast_conn *uc, const rimeaddr_t *from, uint8_t seqno)
}
/*---------------------------------------------------------------------------*/
static void
sent(struct runicast_conn *c, const rimeaddr_t *to, uint8_t retransmissions)
sent(struct runicast_conn *c, const linkaddr_t *to, uint8_t retransmissions)
{
}
/*---------------------------------------------------------------------------*/
static void
timedout(struct runicast_conn *c, const rimeaddr_t *to, uint8_t retransmissions)
timedout(struct runicast_conn *c, const linkaddr_t *to, uint8_t retransmissions)
{
}
@ -125,9 +125,9 @@ rmh_close(struct rmh_conn *c)
}
/*---------------------------------------------------------------------------*/
int
rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hops)
rmh_send(struct rmh_conn *c, linkaddr_t *to, uint8_t num_rexmit, uint8_t max_hops)
{
rimeaddr_t *nexthop;
linkaddr_t *nexthop;
struct data_hdr *hdr;
c->num_rexmit = num_rexmit;
@ -136,7 +136,7 @@ rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hop
return 0;
}
nexthop = c->cb->forward(c, &rimeaddr_node_addr, to, NULL, 0);
nexthop = c->cb->forward(c, &linkaddr_node_addr, to, NULL, 0);
if(nexthop == NULL) {
PRINTF("rmh_send: no route\n");
return 0;
@ -146,8 +146,8 @@ rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hop
if(packetbuf_hdralloc(sizeof(struct data_hdr))) {
hdr = packetbuf_hdrptr();
rimeaddr_copy(&hdr->dest, to);
rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);
linkaddr_copy(&hdr->dest, to);
linkaddr_copy(&hdr->originator, &linkaddr_node_addr);
hdr->hops = 1;
hdr->max_rexmits = num_rexmit;
runicast_send(&c->c, nexthop, num_rexmit);

View file

@ -66,7 +66,7 @@
#define RMH_H_
#include "net/rime/runicast.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
struct rmh_conn;
@ -77,11 +77,11 @@ struct rmh_conn;
RUC_ATTRIBUTES
struct rmh_callbacks {
void (* recv)(struct rmh_conn *ptr, rimeaddr_t *sender, uint8_t hops);
rimeaddr_t *(* forward)(struct rmh_conn *ptr,
const rimeaddr_t *originator,
const rimeaddr_t *dest,
const rimeaddr_t *prevhop,
void (* recv)(struct rmh_conn *ptr, linkaddr_t *sender, uint8_t hops);
linkaddr_t *(* forward)(struct rmh_conn *ptr,
const linkaddr_t *originator,
const linkaddr_t *dest,
const linkaddr_t *prevhop,
uint8_t hops);
};
@ -94,7 +94,7 @@ struct rmh_conn {
void rmh_open(struct rmh_conn *c, uint16_t channel,
const struct rmh_callbacks *u);
void rmh_close(struct rmh_conn *c);
int rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit,
int rmh_send(struct rmh_conn *c, linkaddr_t *to, uint8_t num_rexmit,
uint8_t max_hops);
#endif /* RMH_H_ */

View file

@ -51,7 +51,7 @@
#include <stdio.h>
struct route_msg {
rimeaddr_t dest;
linkaddr_t dest;
uint8_t rreq_id;
uint8_t pad;
};
@ -59,8 +59,8 @@ struct route_msg {
struct rrep_hdr {
uint8_t rreq_id;
uint8_t hops;
rimeaddr_t dest;
rimeaddr_t originator;
linkaddr_t dest;
linkaddr_t originator;
};
#if CONTIKI_TARGET_NETSIM
@ -80,12 +80,12 @@ struct rrep_hdr {
static char rrep_pending; /* A reply for a request is pending. */
/*---------------------------------------------------------------------------*/
static void
send_rreq(struct route_discovery_conn *c, const rimeaddr_t *dest)
send_rreq(struct route_discovery_conn *c, const linkaddr_t *dest)
{
rimeaddr_t dest_copy;
linkaddr_t dest_copy;
struct route_msg *msg;
rimeaddr_copy(&dest_copy, dest);
linkaddr_copy(&dest_copy, dest);
dest = &dest_copy;
packetbuf_clear();
@ -94,48 +94,48 @@ send_rreq(struct route_discovery_conn *c, const rimeaddr_t *dest)
msg->pad = 0;
msg->rreq_id = c->rreq_id;
rimeaddr_copy(&msg->dest, dest);
linkaddr_copy(&msg->dest, dest);
netflood_send(&c->rreqconn, c->rreq_id);
c->rreq_id++;
}
/*---------------------------------------------------------------------------*/
static void
send_rrep(struct route_discovery_conn *c, const rimeaddr_t *dest)
send_rrep(struct route_discovery_conn *c, const linkaddr_t *dest)
{
struct rrep_hdr *rrepmsg;
struct route_entry *rt;
rimeaddr_t saved_dest;
linkaddr_t saved_dest;
rimeaddr_copy(&saved_dest, dest);
linkaddr_copy(&saved_dest, dest);
packetbuf_clear();
dest = &saved_dest;
rrepmsg = packetbuf_dataptr();
packetbuf_set_datalen(sizeof(struct rrep_hdr));
rrepmsg->hops = 0;
rimeaddr_copy(&rrepmsg->dest, dest);
rimeaddr_copy(&rrepmsg->originator, &rimeaddr_node_addr);
linkaddr_copy(&rrepmsg->dest, dest);
linkaddr_copy(&rrepmsg->originator, &linkaddr_node_addr);
rt = route_lookup(dest);
if(rt != NULL) {
PRINTF("%d.%d: send_rrep to %d.%d via %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
dest->u8[0],dest->u8[1],
rt->nexthop.u8[0],rt->nexthop.u8[1]);
unicast_send(&c->rrepconn, &rt->nexthop);
} else {
PRINTF("%d.%d: no route for rrep to %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
dest->u8[0],dest->u8[1]);
}
}
/*---------------------------------------------------------------------------*/
static void
insert_route(const rimeaddr_t *originator, const rimeaddr_t *last_hop,
insert_route(const linkaddr_t *originator, const linkaddr_t *last_hop,
uint8_t hops)
{
PRINTF("%d.%d: Inserting %d.%d into routing table, next hop %d.%d, hop count %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
originator->u8[0], originator->u8[1],
last_hop->u8[0], last_hop->u8[1],
hops);
@ -147,7 +147,7 @@ insert_route(const rimeaddr_t *originator, const rimeaddr_t *last_hop,
rt = route_lookup(originator);
if(rt == NULL || hops < rt->hop_count) {
PRINTF("%d.%d: Inserting %d.%d into routing table, next hop %d.%d, hop count %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
originator->u8[0], originator->u8[1],
last_hop->u8[0], last_hop->u8[1],
hops);
@ -160,16 +160,16 @@ insert_route(const rimeaddr_t *originator, const rimeaddr_t *last_hop,
}
/*---------------------------------------------------------------------------*/
static void
rrep_packet_received(struct unicast_conn *uc, const rimeaddr_t *from)
rrep_packet_received(struct unicast_conn *uc, const linkaddr_t *from)
{
struct rrep_hdr *msg = packetbuf_dataptr();
struct route_entry *rt;
rimeaddr_t dest;
linkaddr_t dest;
struct route_discovery_conn *c = (struct route_discovery_conn *)
((char *)uc - offsetof(struct route_discovery_conn, rrepconn));
PRINTF("%d.%d: rrep_packet_received from %d.%d towards %d.%d len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0],from->u8[1],
msg->dest.u8[0],msg->dest.u8[1],
packetbuf_datalen());
@ -182,22 +182,22 @@ rrep_packet_received(struct unicast_conn *uc, const rimeaddr_t *from)
insert_route(&msg->originator, from, msg->hops);
if(rimeaddr_cmp(&msg->dest, &rimeaddr_node_addr)) {
if(linkaddr_cmp(&msg->dest, &linkaddr_node_addr)) {
PRINTF("rrep for us!\n");
rrep_pending = 0;
ctimer_stop(&c->t);
if(c->cb->new_route) {
rimeaddr_t originator;
linkaddr_t originator;
/* If the callback modifies the packet, the originator address
will be lost. Therefore, we need to copy it into a local
variable before calling the callback. */
rimeaddr_copy(&originator, &msg->originator);
linkaddr_copy(&originator, &msg->originator);
c->cb->new_route(c, &originator);
}
} else {
rimeaddr_copy(&dest, &msg->dest);
linkaddr_copy(&dest, &msg->dest);
rt = route_lookup(&msg->dest);
if(rt != NULL) {
@ -205,42 +205,42 @@ rrep_packet_received(struct unicast_conn *uc, const rimeaddr_t *from)
msg->hops++;
unicast_send(&c->rrepconn, &rt->nexthop);
} else {
PRINTF("%d.%d: no route to %d.%d\n", rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], msg->dest.u8[0], msg->dest.u8[1]);
PRINTF("%d.%d: no route to %d.%d\n", linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1], msg->dest.u8[0], msg->dest.u8[1]);
}
}
}
/*---------------------------------------------------------------------------*/
static int
rreq_packet_received(struct netflood_conn *nf, const rimeaddr_t *from,
const rimeaddr_t *originator, uint8_t seqno, uint8_t hops)
rreq_packet_received(struct netflood_conn *nf, const linkaddr_t *from,
const linkaddr_t *originator, uint8_t seqno, uint8_t hops)
{
struct route_msg *msg = packetbuf_dataptr();
struct route_discovery_conn *c = (struct route_discovery_conn *)
((char *)nf - offsetof(struct route_discovery_conn, rreqconn));
PRINTF("%d.%d: rreq_packet_received from %d.%d hops %d rreq_id %d last %d.%d/%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1],
hops, msg->rreq_id,
c->last_rreq_originator.u8[0],
c->last_rreq_originator.u8[1],
c->last_rreq_id);
if(!(rimeaddr_cmp(&c->last_rreq_originator, originator) &&
if(!(linkaddr_cmp(&c->last_rreq_originator, originator) &&
c->last_rreq_id == msg->rreq_id)) {
PRINTF("%d.%d: rreq_packet_received: request for %d.%d originator %d.%d / %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
msg->dest.u8[0], msg->dest.u8[1],
originator->u8[0], originator->u8[1],
msg->rreq_id);
rimeaddr_copy(&c->last_rreq_originator, originator);
linkaddr_copy(&c->last_rreq_originator, originator);
c->last_rreq_id = msg->rreq_id;
if(rimeaddr_cmp(&msg->dest, &rimeaddr_node_addr)) {
if(linkaddr_cmp(&msg->dest, &linkaddr_node_addr)) {
PRINTF("%d.%d: route_packet_received: route request for our address\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
PRINTF("from %d.%d hops %d rssi %d lqi %d\n",
from->u8[0], from->u8[1],
hops,
@ -301,7 +301,7 @@ timeout_handler(void *ptr)
}
/*---------------------------------------------------------------------------*/
int
route_discovery_discover(struct route_discovery_conn *c, const rimeaddr_t *addr,
route_discovery_discover(struct route_discovery_conn *c, const linkaddr_t *addr,
clock_time_t timeout)
{
if(rrep_pending) {

View file

@ -64,7 +64,7 @@
struct route_discovery_conn;
struct route_discovery_callbacks {
void (* new_route)(struct route_discovery_conn *c, const rimeaddr_t *to);
void (* new_route)(struct route_discovery_conn *c, const linkaddr_t *to);
void (* timedout)(struct route_discovery_conn *c);
};
@ -74,7 +74,7 @@ struct route_discovery_conn {
struct netflood_conn rreqconn;
struct unicast_conn rrepconn;
struct ctimer t;
rimeaddr_t last_rreq_originator;
linkaddr_t last_rreq_originator;
uint16_t last_rreq_id;
uint16_t rreq_id;
const struct route_discovery_callbacks *cb;
@ -83,7 +83,7 @@ struct route_discovery_conn {
void route_discovery_open(struct route_discovery_conn *c, clock_time_t time,
uint16_t channels,
const struct route_discovery_callbacks *callbacks);
int route_discovery_discover(struct route_discovery_conn *c, const rimeaddr_t *dest,
int route_discovery_discover(struct route_discovery_conn *c, const linkaddr_t *dest,
clock_time_t timeout);
void route_discovery_close(struct route_discovery_conn *c);

View file

@ -118,14 +118,14 @@ route_init(void)
}
/*---------------------------------------------------------------------------*/
int
route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
route_add(const linkaddr_t *dest, const linkaddr_t *nexthop,
uint8_t cost, uint8_t seqno)
{
struct route_entry *e;
/* Avoid inserting duplicate entries. */
e = route_lookup(dest);
if(e != NULL && rimeaddr_cmp(&e->nexthop, nexthop)) {
if(e != NULL && linkaddr_cmp(&e->nexthop, nexthop)) {
list_remove(route_table, e);
} else {
/* Allocate a new entry or reuse the oldest entry with highest cost. */
@ -140,8 +140,8 @@ route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
}
}
rimeaddr_copy(&e->dest, dest);
rimeaddr_copy(&e->nexthop, nexthop);
linkaddr_copy(&e->dest, dest);
linkaddr_copy(&e->nexthop, nexthop);
e->cost = cost;
e->seqno = seqno;
e->time = 0;
@ -159,7 +159,7 @@ route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
}
/*---------------------------------------------------------------------------*/
struct route_entry *
route_lookup(const rimeaddr_t *dest)
route_lookup(const linkaddr_t *dest)
{
struct route_entry *e;
uint8_t lowest_cost;
@ -173,7 +173,7 @@ route_lookup(const rimeaddr_t *dest)
/* printf("route_lookup: comparing %d.%d.%d.%d with %d.%d.%d.%d\n",
uip_ipaddr_to_quad(dest), uip_ipaddr_to_quad(&e->dest));*/
if(rimeaddr_cmp(dest, &e->dest)) {
if(linkaddr_cmp(dest, &e->dest)) {
if(e->cost < lowest_cost) {
best_entry = e;
lowest_cost = e->cost;

View file

@ -51,12 +51,12 @@
#ifndef ROUTE_H_
#define ROUTE_H_
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
struct route_entry {
struct route_entry *next;
rimeaddr_t dest;
rimeaddr_t nexthop;
linkaddr_t dest;
linkaddr_t nexthop;
uint8_t seqno;
uint8_t cost;
uint8_t time;
@ -66,9 +66,9 @@ struct route_entry {
};
void route_init(void);
int route_add(const rimeaddr_t *dest, const rimeaddr_t *nexthop,
int route_add(const linkaddr_t *dest, const linkaddr_t *nexthop,
uint8_t cost, uint8_t seqno);
struct route_entry *route_lookup(const rimeaddr_t *dest);
struct route_entry *route_lookup(const linkaddr_t *dest);
void route_refresh(struct route_entry *e);
void route_decay(struct route_entry *e);
void route_remove(struct route_entry *e);

View file

@ -65,12 +65,12 @@ read_data(struct rucb_conn *c)
}
/*---------------------------------------------------------------------------*/
static void
acked(struct runicast_conn *ruc, const rimeaddr_t *to, uint8_t retransmissions)
acked(struct runicast_conn *ruc, const linkaddr_t *to, uint8_t retransmissions)
{
struct rucb_conn *c = (struct rucb_conn *)ruc;
int len;
PRINTF("%d.%d: rucb acked\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
c->chunk++;
len = read_data(c);
if(len == 0 && c->last_size == 0) {
@ -86,23 +86,23 @@ acked(struct runicast_conn *ruc, const rimeaddr_t *to, uint8_t retransmissions)
}
/*---------------------------------------------------------------------------*/
static void
timedout(struct runicast_conn *ruc, const rimeaddr_t *to, uint8_t retransmissions)
timedout(struct runicast_conn *ruc, const linkaddr_t *to, uint8_t retransmissions)
{
struct rucb_conn *c = (struct rucb_conn *)ruc;
PRINTF("%d.%d: rucb timedout\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
if(c->u->timedout) {
c->u->timedout(c);
}
}
/*---------------------------------------------------------------------------*/
static void
recv(struct runicast_conn *ruc, const rimeaddr_t *from, uint8_t seqno)
recv(struct runicast_conn *ruc, const linkaddr_t *from, uint8_t seqno)
{
struct rucb_conn *c = (struct rucb_conn *)ruc;
PRINTF("%d.%d: rucb: recv from %d.%d len %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1], packetbuf_totlen());
if(seqno == c->last_seqno) {
@ -110,19 +110,19 @@ recv(struct runicast_conn *ruc, const rimeaddr_t *from, uint8_t seqno)
}
c->last_seqno = seqno;
if(rimeaddr_cmp(&c->sender, &rimeaddr_null)) {
rimeaddr_copy(&c->sender, from);
if(linkaddr_cmp(&c->sender, &linkaddr_null)) {
linkaddr_copy(&c->sender, from);
c->u->write_chunk(c, 0, RUCB_FLAG_NEWFILE, packetbuf_dataptr(), 0);
c->chunk = 0;
}
if(rimeaddr_cmp(&c->sender, from)) {
if(linkaddr_cmp(&c->sender, from)) {
int datalen = packetbuf_datalen();
if(datalen < RUCB_DATASIZE) {
PRINTF("%d.%d: get %d bytes, file complete\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
datalen);
c->u->write_chunk(c, c->chunk * RUCB_DATASIZE,
RUCB_FLAG_LASTCHUNK, packetbuf_dataptr(), datalen);
@ -134,7 +134,7 @@ recv(struct runicast_conn *ruc, const rimeaddr_t *from, uint8_t seqno)
}
if(packetbuf_datalen() < RUCB_DATASIZE) {
rimeaddr_copy(&c->sender, &rimeaddr_null);
linkaddr_copy(&c->sender, &linkaddr_null);
}
}
/*---------------------------------------------------------------------------*/
@ -144,7 +144,7 @@ void
rucb_open(struct rucb_conn *c, uint16_t channel,
const struct rucb_callbacks *u)
{
rimeaddr_copy(&c->sender, &rimeaddr_null);
linkaddr_copy(&c->sender, &linkaddr_null);
runicast_open(&c->c, channel, &ruc);
c->u = u;
c->last_seqno = -1;
@ -158,12 +158,12 @@ rucb_close(struct rucb_conn *c)
}
/*---------------------------------------------------------------------------*/
int
rucb_send(struct rucb_conn *c, const rimeaddr_t *receiver)
rucb_send(struct rucb_conn *c, const linkaddr_t *receiver)
{
c->chunk = 0;
read_data(c);
rimeaddr_copy(&c->receiver, receiver);
rimeaddr_copy(&c->sender, &rimeaddr_node_addr);
linkaddr_copy(&c->receiver, receiver);
linkaddr_copy(&c->sender, &linkaddr_node_addr);
runicast_send(&c->c, receiver, MAX_TRANSMISSIONS);
return 0;
}

View file

@ -63,7 +63,7 @@ struct rucb_callbacks {
struct rucb_conn {
struct runicast_conn c;
const struct rucb_callbacks *u;
rimeaddr_t receiver, sender;
linkaddr_t receiver, sender;
uint16_t chunk;
uint8_t last_seqno;
int last_size;
@ -73,7 +73,7 @@ void rucb_open(struct rucb_conn *c, uint16_t channel,
const struct rucb_callbacks *u);
void rucb_close(struct rucb_conn *c);
int rucb_send(struct rucb_conn *c, const rimeaddr_t *receiver);
int rucb_send(struct rucb_conn *c, const linkaddr_t *receiver);
#endif /* RUCB_H_ */

View file

@ -122,7 +122,7 @@ write_data(struct rudolph1_conn *c, int chunk, uint8_t *data, int datalen)
if(datalen < RUDOLPH1_DATASIZE) {
PRINTF("%d.%d: get %d bytes, file complete\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
datalen);
c->cb->write_chunk(c, chunk * RUDOLPH1_DATASIZE,
RUDOLPH1_FLAG_LASTCHUNK, data, datalen);
@ -145,7 +145,7 @@ send_nack(struct rudolph1_conn *c)
hdr->chunk = c->chunk;
PRINTF("%d.%d: Sending nack for %d:%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->version, hdr->chunk);
ipolite_send(&c->ipolite, NACK_TIMEOUT, sizeof(struct rudolph1_hdr));
}
@ -155,7 +155,7 @@ handle_data(struct rudolph1_conn *c, struct rudolph1_datapacket *p)
{
if(LT(c->version, p->h.version)) {
PRINTF("%d.%d: rudolph1 new version %d, chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.version, p->h.chunk);
c->version = p->h.version;
c->highest_chunk_heard = c->chunk = 0;
@ -168,12 +168,12 @@ handle_data(struct rudolph1_conn *c, struct rudolph1_datapacket *p)
/* }*/
} else if(p->h.version == c->version) {
PRINTF("%d.%d: got chunk %d (%d) highest heard %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk, c->chunk, c->highest_chunk_heard);
if(p->h.chunk == c->chunk) {
PRINTF("%d.%d: received chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk);
write_data(c, p->h.chunk, p->data, p->datalen);
if(c->highest_chunk_heard < c->chunk) {
@ -182,7 +182,7 @@ handle_data(struct rudolph1_conn *c, struct rudolph1_datapacket *p)
c->chunk++;
} else if(p->h.chunk > c->chunk) {
PRINTF("%d.%d: received chunk %d > %d, sending NACK\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk, c->chunk);
send_nack(c);
c->highest_chunk_heard = p->h.chunk;
@ -210,7 +210,7 @@ recv_trickle(struct trickle_conn *trickle)
if(p->h.type == TYPE_DATA) {
PRINTF("%d.%d: received trickle with chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk);
handle_data(c, p);
}
@ -220,39 +220,39 @@ static void
sent_ipolite(struct ipolite_conn *ipolite)
{
PRINTF("%d.%d: Sent ipolite\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
}
/*---------------------------------------------------------------------------*/
static void
dropped_ipolite(struct ipolite_conn *ipolite)
{
PRINTF("%d.%d: dropped ipolite\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
}
/*---------------------------------------------------------------------------*/
static void
recv_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
recv_ipolite(struct ipolite_conn *ipolite, const linkaddr_t *from)
{
struct rudolph1_conn *c = (struct rudolph1_conn *)
((char *)ipolite - offsetof(struct rudolph1_conn, ipolite));
struct rudolph1_datapacket *p = packetbuf_dataptr();
PRINTF("%d.%d: Got ipolite type %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.type);
c->nacks++;
if(p->h.type == TYPE_NACK) {
PRINTF("%d.%d: Got NACK for %d:%d (%d:%d)\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.version, p->h.chunk,
c->version, c->chunk);
if(p->h.version == c->version) {
if(p->h.chunk < c->chunk) {
/* Format and send a repair packet */
PRINTF("%d.%d: sending repair for chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk);
format_data(c, p->h.chunk);
ipolite_send(&c->ipolite, REPAIR_TIMEOUT, sizeof(struct rudolph1_hdr));
@ -264,7 +264,7 @@ recv_ipolite(struct ipolite_conn *ipolite, const rimeaddr_t *from)
} else if(p->h.type == TYPE_DATA) {
/* This is a repair packet from someone else. */
PRINTF("%d.%d: got repair for chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
p->h.chunk);
handle_data(c, p);
}
@ -282,7 +282,7 @@ send_next_packet(void *ptr)
ctimer_set(&c->t, c->send_interval, send_next_packet, c);
}
PRINTF("%d.%d: send_next_packet chunk %d, next %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
c->chunk, c->chunk + 1);
c->highest_chunk_heard = c->chunk;

View file

@ -135,13 +135,13 @@ write_data(struct rudolph2_conn *c, int chunk, uint8_t *data, int datalen)
}
PRINTF("%d.%d: get %d bytes\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
datalen);
if(datalen < RUDOLPH2_DATASIZE) {
PRINTF("%d.%d: get %d bytes, file complete\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
datalen);
c->cb->write_chunk(c, chunk * RUDOLPH2_DATASIZE,
RUDOLPH2_FLAG_LASTCHUNK, data, datalen);
@ -159,7 +159,7 @@ send_data(struct rudolph2_conn *c, clock_time_t interval)
len = format_data(c, c->snd_nxt);
polite_send(&c->c, interval, POLITE_HEADER);
PRINTF("%d.%d: send_data chunk %d, rcv_nxt %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
c->snd_nxt, c->rcv_nxt);
return len;
@ -179,7 +179,7 @@ send_nack(struct rudolph2_conn *c)
hdr->chunk = c->rcv_nxt;
PRINTF("%d.%d: Sending nack for %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->chunk);
polite_send(&c->c, NACK_TIMEOUT, POLITE_HEADER);
}
@ -297,7 +297,7 @@ recv(struct polite_conn *polite)
if(hdr->type == TYPE_NACK && hdr->hops_from_base > c->hops_from_base) {
c->nacks++;
PRINTF("%d.%d: Got NACK for %d:%d (%d:%d)\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->version, hdr->chunk,
c->version, c->rcv_nxt);
if(hdr->version == c->version) {
@ -316,7 +316,7 @@ recv(struct polite_conn *polite)
c->hops_from_base = hdr->hops_from_base + 1;
if(LT(c->version, hdr->version)) {
PRINTF("%d.%d: rudolph2 new version %d, chunk %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->version, hdr->chunk);
c->version = hdr->version;
c->snd_nxt = c->rcv_nxt = 0;
@ -330,14 +330,14 @@ recv(struct polite_conn *polite)
}
} else if(hdr->version == c->version) {
PRINTF("%d.%d: got chunk %d snd_nxt %d rcv_nxt %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->chunk, c->snd_nxt, c->rcv_nxt);
if(hdr->chunk == c->rcv_nxt) {
int len;
packetbuf_hdrreduce(sizeof(struct rudolph2_hdr));
PRINTF("%d.%d: received chunk %d len %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->chunk, packetbuf_totlen());
len = packetbuf_totlen();
write_data(c, hdr->chunk, packetbuf_dataptr(), packetbuf_totlen());
@ -349,7 +349,7 @@ recv(struct polite_conn *polite)
}
} else if(hdr->chunk > c->rcv_nxt) {
PRINTF("%d.%d: received chunk %d > %d, sending NACK\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
hdr->chunk, c->rcv_nxt);
send_nack(c);
} else if(hdr->chunk < c->rcv_nxt) {

View file

@ -85,7 +85,7 @@ sent_by_stunicast(struct stunicast_conn *stunicast, int status, int num_tx)
if(c->rxmit != 0) {
RIMESTATS_ADD(rexmit);
PRINTF("%d.%d: runicast: sent_by_stunicast packet %u (%u) resent %u\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID),
c->sndnxt, c->rxmit);
}
@ -98,7 +98,7 @@ sent_by_stunicast(struct stunicast_conn *stunicast, int status, int num_tx)
}
c->rxmit = 0;
PRINTF("%d.%d: runicast: packet %d timed out\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->sndnxt);
c->sndnxt = (c->sndnxt + 1) % (1 << RUNICAST_PACKET_ID_BITS);
} else {
@ -111,13 +111,13 @@ sent_by_stunicast(struct stunicast_conn *stunicast, int status, int num_tx)
}
/*---------------------------------------------------------------------------*/
static void
recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
recv_from_stunicast(struct stunicast_conn *stunicast, const linkaddr_t *from)
{
struct runicast_conn *c = (struct runicast_conn *)stunicast;
/* struct runicast_hdr *hdr = packetbuf_dataptr();*/
PRINTF("%d.%d: runicast: recv_from_stunicast from %d.%d type %d seqno %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE),
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID));
@ -125,14 +125,14 @@ recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) ==
PACKETBUF_ATTR_PACKET_TYPE_ACK) {
PRINTF("%d.%d: runicast: got ACK from %d.%d, seqno %d (%d)\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID),
c->sndnxt);
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_ID) == c->sndnxt) {
RIMESTATS_ADD(ackrx);
PRINTF("%d.%d: runicast: ACKed %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID));
c->sndnxt = (c->sndnxt + 1) % (1 << RUNICAST_PACKET_ID_BITS);
c->is_tx = 0;
@ -142,7 +142,7 @@ recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
}
} else {
PRINTF("%d.%d: runicast: received bad ACK %d for %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID),
c->sndnxt);
RIMESTATS_ADD(badackrx);
@ -156,7 +156,7 @@ recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
RIMESTATS_ADD(reliablerx);
PRINTF("%d.%d: runicast: got packet %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
packetbuf_attr(PACKETBUF_ATTR_PACKET_ID));
packet_seqno = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID);
@ -166,7 +166,7 @@ recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
q = queuebuf_new_from_packetbuf();
if(q != NULL) {
PRINTF("%d.%d: runicast: Sending ACK to %d.%d for %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1],
packet_seqno);
packetbuf_clear();
@ -183,7 +183,7 @@ recv_from_stunicast(struct stunicast_conn *stunicast, const rimeaddr_t *from)
queuebuf_free(q);
} else {
PRINTF("%d.%d: runicast: could not send ACK to %d.%d for %d: no queued buffers\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1],
packet_seqno);
}
@ -221,13 +221,13 @@ runicast_is_transmitting(struct runicast_conn *c)
}
/*---------------------------------------------------------------------------*/
int
runicast_send(struct runicast_conn *c, const rimeaddr_t *receiver,
runicast_send(struct runicast_conn *c, const linkaddr_t *receiver,
uint8_t max_retransmissions)
{
int ret;
if(runicast_is_transmitting(c)) {
PRINTF("%d.%d: runicast: already transmitting\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1]);
return 0;
}
packetbuf_set_attr(PACKETBUF_ATTR_RELIABLE, 1);
@ -239,7 +239,7 @@ runicast_send(struct runicast_conn *c, const rimeaddr_t *receiver,
c->is_tx = 1;
RIMESTATS_ADD(reliabletx);
PRINTF("%d.%d: runicast: sending packet %d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->sndnxt);
ret = stunicast_send_stubborn(&c->c, receiver, REXMIT_TIME);
if(!ret) {

View file

@ -89,9 +89,9 @@ struct runicast_conn;
{ PACKETBUF_ATTR_PACKET_ID, PACKETBUF_ATTR_BIT * RUNICAST_PACKET_ID_BITS }, \
STUNICAST_ATTRIBUTES
struct runicast_callbacks {
void (* recv)(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno);
void (* sent)(struct runicast_conn *c, const rimeaddr_t *to, uint8_t retransmissions);
void (* timedout)(struct runicast_conn *c, const rimeaddr_t *to, uint8_t retransmissions);
void (* recv)(struct runicast_conn *c, const linkaddr_t *from, uint8_t seqno);
void (* sent)(struct runicast_conn *c, const linkaddr_t *to, uint8_t retransmissions);
void (* timedout)(struct runicast_conn *c, const linkaddr_t *to, uint8_t retransmissions);
};
struct runicast_conn {
@ -107,7 +107,7 @@ void runicast_open(struct runicast_conn *c, uint16_t channel,
const struct runicast_callbacks *u);
void runicast_close(struct runicast_conn *c);
int runicast_send(struct runicast_conn *c, const rimeaddr_t *receiver,
int runicast_send(struct runicast_conn *c, const linkaddr_t *receiver,
uint8_t max_retransmissions);
uint8_t runicast_is_transmitting(struct runicast_conn *c);

View file

@ -49,7 +49,7 @@
/*---------------------------------------------------------------------------*/
static void
recv_from_broadcast(struct broadcast_conn *broadcast, const rimeaddr_t *sender)
recv_from_broadcast(struct broadcast_conn *broadcast, const linkaddr_t *sender)
{
register struct stbroadcast_conn *c = (struct stbroadcast_conn *)broadcast;
/* DEBUGF(3, "stbroadcast: recv_from_broadcast from %d\n", from_id);*/

View file

@ -56,11 +56,11 @@
/*---------------------------------------------------------------------------*/
static void
recv_from_uc(struct unicast_conn *uc, const rimeaddr_t *from)
recv_from_uc(struct unicast_conn *uc, const linkaddr_t *from)
{
register struct stunicast_conn *c = (struct stunicast_conn *)uc;
PRINTF("%d.%d: stunicast: recv_from_uc from %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
from->u8[0], from->u8[1]);
if(c->u->recv != NULL) {
c->u->recv(c, from);
@ -72,7 +72,7 @@ sent_by_uc(struct unicast_conn *uc, int status, int num_tx)
{
register struct stunicast_conn *c = (struct stunicast_conn *)uc;
PRINTF("%d.%d: stunicast: recv_from_uc from %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_SENDER)->u8[1]);
if(c->u->sent != NULL) {
@ -98,7 +98,7 @@ stunicast_close(struct stunicast_conn *c)
stunicast_cancel(c);
}
/*---------------------------------------------------------------------------*/
rimeaddr_t *
linkaddr_t *
stunicast_receiver(struct stunicast_conn *c)
{
return &c->receiver;
@ -110,7 +110,7 @@ send(void *ptr)
struct stunicast_conn *c = ptr;
PRINTF("%d.%d: stunicast: resend to %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->receiver.u8[0], c->receiver.u8[1]);
if(c->buf) {
queuebuf_to_packetbuf(c->buf);
@ -129,7 +129,7 @@ stunicast_set_timer(struct stunicast_conn *c, clock_time_t t)
}
/*---------------------------------------------------------------------------*/
int
stunicast_send_stubborn(struct stunicast_conn *c, const rimeaddr_t *receiver,
stunicast_send_stubborn(struct stunicast_conn *c, const linkaddr_t *receiver,
clock_time_t rxmittime)
{
if(c->buf != NULL) {
@ -139,11 +139,11 @@ stunicast_send_stubborn(struct stunicast_conn *c, const rimeaddr_t *receiver,
if(c->buf == NULL) {
return 0;
}
rimeaddr_copy(&c->receiver, receiver);
linkaddr_copy(&c->receiver, receiver);
ctimer_set(&c->t, rxmittime, send, c);
PRINTF("%d.%d: stunicast_send_stubborn to %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
c->receiver.u8[0],c->receiver.u8[1]);
unicast_send(&c->c, &c->receiver);
/* if(c->u->sent != NULL) {
@ -155,10 +155,10 @@ stunicast_send_stubborn(struct stunicast_conn *c, const rimeaddr_t *receiver,
}
/*---------------------------------------------------------------------------*/
int
stunicast_send(struct stunicast_conn *c, const rimeaddr_t *receiver)
stunicast_send(struct stunicast_conn *c, const linkaddr_t *receiver)
{
PRINTF("%d.%d: stunicast_send to %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
receiver->u8[0], receiver->u8[1]);
return unicast_send(&c->c, receiver);
}

View file

@ -81,7 +81,7 @@ struct stunicast_conn;
#define STUNICAST_ATTRIBUTES UNICAST_ATTRIBUTES
struct stunicast_callbacks {
void (* recv)(struct stunicast_conn *c, const rimeaddr_t *from);
void (* recv)(struct stunicast_conn *c, const linkaddr_t *from);
void (* sent)(struct stunicast_conn *c, int status, int num_tx);
};
@ -90,22 +90,22 @@ struct stunicast_conn {
struct ctimer t;
struct queuebuf *buf;
const struct stunicast_callbacks *u;
rimeaddr_t receiver;
linkaddr_t receiver;
};
void stunicast_open(struct stunicast_conn *c, uint16_t channel,
const struct stunicast_callbacks *u);
void stunicast_close(struct stunicast_conn *c);
int stunicast_send_stubborn(struct stunicast_conn *c, const rimeaddr_t *receiver,
int stunicast_send_stubborn(struct stunicast_conn *c, const linkaddr_t *receiver,
clock_time_t rxmittime);
void stunicast_cancel(struct stunicast_conn *c);
int stunicast_send(struct stunicast_conn *c, const rimeaddr_t *receiver);
int stunicast_send(struct stunicast_conn *c, const linkaddr_t *receiver);
void stunicast_set_timer(struct stunicast_conn *c, clock_time_t t);
rimeaddr_t *stunicast_receiver(struct stunicast_conn *c);
linkaddr_t *stunicast_receiver(struct stunicast_conn *c);
#endif /* STUNICAST_H_ */
/** @} */

View file

@ -128,7 +128,7 @@ adjust_offset(rtimer_clock_t authoritative_time, rtimer_clock_t local_time)
}
/*---------------------------------------------------------------------------*/
static void
broadcast_recv(struct broadcast_conn *c, const rimeaddr_t *from)
broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from)
{
struct timesynch_msg msg;

View file

@ -82,7 +82,7 @@ send(void *ptr)
broadcast_send(&c->c);
} else {
PRINTF("%d.%d: trickle send but c->q == NULL\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1]);
}
}
/*---------------------------------------------------------------------------*/
@ -132,13 +132,13 @@ run_trickle(struct trickle_conn *c)
}
/*---------------------------------------------------------------------------*/
static void
recv(struct broadcast_conn *bc, const rimeaddr_t *from)
recv(struct broadcast_conn *bc, const linkaddr_t *from)
{
struct trickle_conn *c = (struct trickle_conn *)bc;
uint16_t seqno = packetbuf_attr(PACKETBUF_ATTR_EPACKET_ID);
PRINTF("%d.%d: trickle recv seqno %d from %d.%d our %d data len %d channel %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
seqno,
from->u8[0], from->u8[1],
c->seqno,
@ -201,7 +201,7 @@ trickle_send(struct trickle_conn *c)
packetbuf_set_attr(PACKETBUF_ATTR_EPACKET_ID, c->seqno);
c->q = queuebuf_new_from_packetbuf();
PRINTF("%d.%d: trickle send seqno %d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
c->seqno);
reset_interval(c);
send(c);

View file

@ -63,15 +63,15 @@ static const struct packetbuf_attrlist attributes[] =
/*---------------------------------------------------------------------------*/
static void
recv_from_broadcast(struct broadcast_conn *broadcast, const rimeaddr_t *from)
recv_from_broadcast(struct broadcast_conn *broadcast, const linkaddr_t *from)
{
struct unicast_conn *c = (struct unicast_conn *)broadcast;
PRINTF("%d.%d: uc: recv_from_broadcast, receiver %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_node_addr)) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_node_addr)) {
if(c->u->recv) {
c->u->recv(c, from);
}
@ -84,7 +84,7 @@ sent_by_broadcast(struct broadcast_conn *broadcast, int status, int num_tx)
struct unicast_conn *c = (struct unicast_conn *)broadcast;
PRINTF("%d.%d: uc: sent_by_broadcast, receiver %d.%d\n",
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0], linkaddr_node_addr.u8[1],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[0],
packetbuf_addr(PACKETBUF_ADDR_RECEIVER)->u8[1]);
@ -112,10 +112,10 @@ unicast_close(struct unicast_conn *c)
}
/*---------------------------------------------------------------------------*/
int
unicast_send(struct unicast_conn *c, const rimeaddr_t *receiver)
unicast_send(struct unicast_conn *c, const linkaddr_t *receiver)
{
PRINTF("%d.%d: unicast_send to %d.%d\n",
rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
linkaddr_node_addr.u8[0],linkaddr_node_addr.u8[1],
receiver->u8[0], receiver->u8[1]);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, receiver);
return broadcast_send(&c->c);

View file

@ -70,7 +70,7 @@ struct unicast_conn;
BROADCAST_ATTRIBUTES
struct unicast_callbacks {
void (* recv)(struct unicast_conn *c, const rimeaddr_t *from);
void (* recv)(struct unicast_conn *c, const linkaddr_t *from);
void (* sent)(struct unicast_conn *ptr, int status, int num_tx);
};
@ -83,7 +83,7 @@ void unicast_open(struct unicast_conn *c, uint16_t channel,
const struct unicast_callbacks *u);
void unicast_close(struct unicast_conn *c);
int unicast_send(struct unicast_conn *c, const rimeaddr_t *receiver);
int unicast_send(struct unicast_conn *c, const linkaddr_t *receiver);
#endif /* UNICAST_H_ */
/** @} */

View file

@ -93,7 +93,7 @@ rpl_dag_init(void)
rpl_rank_t
rpl_get_parent_rank(uip_lladdr_t *addr)
{
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)addr);
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)addr);
if(p != NULL) {
return p->rank;
} else {
@ -104,7 +104,7 @@ rpl_get_parent_rank(uip_lladdr_t *addr)
uint16_t
rpl_get_parent_link_metric(const uip_lladdr_t *addr)
{
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (const rimeaddr_t *)addr);
rpl_parent_t *p = nbr_table_get_from_lladdr(rpl_parents, (const linkaddr_t *)addr);
if(p != NULL) {
return p->link_metric;
} else {
@ -115,7 +115,7 @@ rpl_get_parent_link_metric(const uip_lladdr_t *addr)
uip_ipaddr_t *
rpl_get_parent_ipaddr(rpl_parent_t *p)
{
rimeaddr_t *lladdr = nbr_table_get_lladdr(rpl_parents, p);
linkaddr_t *lladdr = nbr_table_get_lladdr(rpl_parents, p);
return uip_ds6_nbr_ipaddr_from_lladdr((uip_lladdr_t *)lladdr);
}
/*---------------------------------------------------------------------------*/
@ -552,7 +552,7 @@ rpl_add_parent(rpl_dag_t *dag, rpl_dio_t *dio, uip_ipaddr_t *addr)
PRINTF("\n");
if(lladdr != NULL) {
/* Add parent in rpl_parents */
p = nbr_table_add_lladdr(rpl_parents, (rimeaddr_t *)lladdr);
p = nbr_table_add_lladdr(rpl_parents, (linkaddr_t *)lladdr);
if(p == NULL) {
PRINTF("RPL: rpl_add_parent p NULL\n");
} else {
@ -574,7 +574,7 @@ find_parent_any_dag_any_instance(uip_ipaddr_t *addr)
{
uip_ds6_nbr_t *ds6_nbr = uip_ds6_nbr_lookup(addr);
const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(ds6_nbr);
return nbr_table_get_from_lladdr(rpl_parents, (rimeaddr_t *)lladdr);
return nbr_table_get_from_lladdr(rpl_parents, (linkaddr_t *)lladdr);
}
/*---------------------------------------------------------------------------*/
rpl_parent_t *

View file

@ -209,7 +209,7 @@ rpl_add_route(rpl_dag_t *dag, uip_ipaddr_t *prefix, int prefix_len,
}
/*---------------------------------------------------------------------------*/
void
rpl_link_neighbor_callback(const rimeaddr_t *addr, int status, int numtx)
rpl_link_neighbor_callback(const linkaddr_t *addr, int status, int numtx)
{
uip_ipaddr_t ipaddr;
rpl_parent_t *parent;

View file

@ -256,8 +256,8 @@ sicslowmac_dataIndication(void)
byte_reverse((uint8_t *)dest_reversed, UIP_LLADDR_LEN);
byte_reverse((uint8_t *)src_reversed, UIP_LLADDR_LEN);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const linkaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const linkaddr_t *)src_reversed);
#elif UIP_CONF_USE_RUM
/* Finally, get the stuff into the rime buffer.... */
@ -297,8 +297,8 @@ sicslowmac_dataIndication(void)
src_reversed[4] = MSB(parsed_frame->src_addr->addr16);
src_reversed[5] = LSB(parsed_frame->src_addr->addr16);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const linkaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const linkaddr_t *)src_reversed);
#endif
@ -325,8 +325,8 @@ sicslowmac_unknownIndication(void)
byte_reverse((uint8_t *)dest_reversed, UIP_LLADDR_LEN);
byte_reverse((uint8_t *)src_reversed, UIP_LLADDR_LEN);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const linkaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const linkaddr_t *)src_reversed);
#elif UIP_CONF_USE_RUM
@ -360,8 +360,8 @@ sicslowmac_unknownIndication(void)
src_reversed[4] = MSB(parsed_frame->src_addr->addr16);
src_reversed[5] = LSB(parsed_frame->src_addr->addr16);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const rimeaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const rimeaddr_t *)src_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (const linkaddr_t *)dest_reversed);
packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (const linkaddr_t *)src_reversed);
#endif
@ -430,7 +430,7 @@ sicslowmac_dataRequest(void)
* If the output address is NULL in the Rime buf, then it is broadcast
* on the 802.15.4 network.
*/
if(rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &rimeaddr_null) ) {
if(linkaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), &linkaddr_null) ) {
/* Broadcast requires short address mode. */
params.fcf.destAddrMode = SHORTADDRMODE;
params.dest_pid = BROADCASTPANDID;

View file

@ -41,7 +41,7 @@
#include "sys/rtimer.h"
#include "net/packetbuf.h"
#include "net/rime/rimestats.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/netstack.h"
#include "sys/energest.h"
#include "dev/cc2538-rf.h"
@ -169,21 +169,21 @@ cc2538_rf_power_set(uint8_t new_power)
void
cc2538_rf_set_addr(uint16_t pan)
{
#if RIMEADDR_SIZE==8
#if LINKADDR_SIZE==8
/* EXT_ADDR[7:0] is ignored when using short addresses */
int i;
for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
for(i = (LINKADDR_SIZE - 1); i >= 0; --i) {
((uint32_t *)RFCORE_FFSM_EXT_ADDR0)[i] =
rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1 - i];
linkaddr_node_addr.u8[LINKADDR_SIZE - 1 - i];
}
#endif
REG(RFCORE_FFSM_PAN_ID0) = pan & 0xFF;
REG(RFCORE_FFSM_PAN_ID1) = pan >> 8;
REG(RFCORE_FFSM_SHORT_ADDR0) = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1];
REG(RFCORE_FFSM_SHORT_ADDR1) = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 2];
REG(RFCORE_FFSM_SHORT_ADDR0) = linkaddr_node_addr.u8[LINKADDR_SIZE - 1];
REG(RFCORE_FFSM_SHORT_ADDR1) = linkaddr_node_addr.u8[LINKADDR_SIZE - 2];
}
/*---------------------------------------------------------------------------*/
int

View file

@ -163,7 +163,7 @@ uint8_t cc2538_rf_power_set(uint8_t new_power);
* \param pan The PAN Identifier
*
* Values for short and extended addresses are not needed as parameters
* since they exist in the rimeaddr buffer in the contiki core. They
* since they exist in the linkaddr buffer in the contiki core. They
* are thus simply copied over from there.
*/
void cc2538_rf_set_addr(uint16_t pan);

View file

@ -36,7 +36,7 @@
* Driver for the cc2538 IEEE addresses
*/
#include "contiki-conf.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "ieee-addr.h"
#include <stdint.h>

View file

@ -46,7 +46,7 @@
*/
#include "contiki.h"
#include "sys/process.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "usb-api.h"
#include "usb.h"
#include "usb-arch.h"

View file

@ -46,7 +46,7 @@
#include "net/packetbuf.h"
#include "net/rime/rimestats.h"
#include "net/rimeaddr.h"
#include "net/linkaddr.h"
#include "net/netstack.h"
#include <string.h>
@ -146,18 +146,18 @@ cc2530_rf_power_set(uint8_t new_power)
void
cc2530_rf_set_addr(uint16_t pan)
{
#if RIMEADDR_SIZE==8 /* EXT_ADDR[7:0] is ignored when using short addresses */
#if LINKADDR_SIZE==8 /* EXT_ADDR[7:0] is ignored when using short addresses */
int i;
for(i = (RIMEADDR_SIZE - 1); i >= 0; --i) {
((uint8_t *)&EXT_ADDR0)[i] = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1 - i];
for(i = (LINKADDR_SIZE - 1); i >= 0; --i) {
((uint8_t *)&EXT_ADDR0)[i] = linkaddr_node_addr.u8[LINKADDR_SIZE - 1 - i];
}
#endif
PAN_ID0 = pan & 0xFF;
PAN_ID1 = pan >> 8;
SHORT_ADDR0 = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 1];
SHORT_ADDR1 = rimeaddr_node_addr.u8[RIMEADDR_SIZE - 2];
SHORT_ADDR0 = linkaddr_node_addr.u8[LINKADDR_SIZE - 1];
SHORT_ADDR1 = linkaddr_node_addr.u8[LINKADDR_SIZE - 2];
}
/*---------------------------------------------------------------------------*/
/* Netstack API radio driver functions */

View file

@ -101,7 +101,7 @@ static process_event_t event_data_ready;
static volatile packet_t prepped_p;
void contiki_maca_set_mac_address(uint64_t eui) {
rimeaddr_t addr;
linkaddr_t addr;
uint8_t i;
/* setup mac address registers in maca hardware */
@ -116,14 +116,14 @@ void contiki_maca_set_mac_address(uint64_t eui) {
ANNOTATE("setting long mac 0x%08x_%08x\n\r", *MACA_MAC64HI, *MACA_MAC64LO);
/* setup mac addresses in Contiki (RIME) */
rimeaddr_copy(&addr, &rimeaddr_null);
linkaddr_copy(&addr, &linkaddr_null);
for(i=0; i < RIMEADDR_CONF_SIZE; i++) {
addr.u8[RIMEADDR_CONF_SIZE - 1 - i] = (mc1322x_config.eui >> (i * 8)) & 0xff;
for(i=0; i < LINKADDR_CONF_SIZE; i++) {
addr.u8[LINKADDR_CONF_SIZE - 1 - i] = (mc1322x_config.eui >> (i * 8)) & 0xff;
}
node_id = (addr.u8[6] << 8 | addr.u8[7]);
rimeaddr_set_node_addr(&addr);
linkaddr_set_node_addr(&addr);
#if DEBUG_ANNOTATE
ANNOTATE("Rime configured with address ");

View file

@ -294,7 +294,7 @@ stm32w_radio_init(void)
CLEAN_RXBUFS();
CLEAN_TXBUF();
#if ST_RADIO_AUTOACK && !(UIP_CONF_LL_802154 && RIMEADDR_CONF_SIZE==8)
#if ST_RADIO_AUTOACK && !(UIP_CONF_LL_802154 && LINKADDR_CONF_SIZE==8)
#error "Autoack and address filtering can only be used with EUI 64"
#endif
ST_RadioEnableAutoAck(ST_RADIO_AUTOACK);

View file

@ -62,7 +62,7 @@ PROCESS(shell_process, "Shell Process");
PROCESS_THREAD(shell_process, ev, data)
{
rimeaddr_t addr;
linkaddr_t addr;
PROCESS_BEGIN();
@ -99,7 +99,7 @@ timedout(struct mesh_conn *c)
}
static void
received(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
received(struct mesh_conn *c, const linkaddr_t *from, uint8_t hops)
{
char *data;
unsigned len;

Some files were not shown because too many files have changed in this diff Show more