示例#1
0
/*---------------------------------------------------------------------------*/
static void
send_rreq(struct route_discovery_conn *c, const linkaddr_t *dest)
{
  linkaddr_t dest_copy;
  struct route_msg *msg;

  linkaddr_copy(&dest_copy, dest);
  dest = &dest_copy;

  packetbuf_clear();
  msg = packetbuf_dataptr();
  packetbuf_set_datalen(sizeof(struct route_msg));

  msg->pad = 0;
  msg->rreq_id = c->rreq_id;
  linkaddr_copy(&msg->dest, dest);

  netflood_send(&c->rreqconn, c->rreq_id);
  c->rreq_id++;
}
示例#2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_nodes_process, ev, data)
{
  static struct etimer etimer;
  struct netflood_msg *msg;
  char buf[10];
  PROCESS_BEGIN();

  if(!is_sink) {

    shell_output_str(&nodes_command,
		     "Setting up a collection network...", "");
#if TIMESYNCH_CONF_ENABLED
    timesynch_set_authority_level(0);
#endif
    collect_set_sink(&collect, 1);

    etimer_set(&etimer, CLOCK_SECOND * 2);
    PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
    is_sink = 1;
  }
  
  packetbuf_clear();
  msg = packetbuf_dataptr();
  packetbuf_set_datalen(sizeof(struct netflood_msg));
  msg->type = NETFLOOD_TYPE_NODES;
  netflood_send(&netflood, nodes_seqno++);

  etimer_set(&etimer, CLOCK_SECOND * 10);
  waiting_for_nodes = 1;
  shell_output_str(&nodes_command,
		   "Request sent, waiting for replies...", "");
  messages_received = 0;

  PROCESS_WAIT_UNTIL(etimer_expired(&etimer));
  snprintf(buf, sizeof(buf), "%d", messages_received);
  shell_output_str(&nodes_command, buf, " nodes heard");
  
  waiting_for_nodes = 0;
  PROCESS_END();
}
示例#3
0
void
scopes_flooding_send(struct scopes_msg_generic *gmsg)
{
  netflood_send(&netflood, seqno++);
}