/**
 * the sensor node subscribed will send the data to the base station via the next hop according to the routing table
 */
void publish(struct runicast_conn *runicast){
    Ru_msg_list *ru_msg_list;
    Rt_table *chosen_route;
    if(list_length(runicast_list)>0){
        for(ru_msg_list = list_head(runicast_list);ru_msg_list!=NULL;){
            chosen_route = find_best_route();
            current_route = chosen_route;
            if(current_route!=NULL){
                packetbuf_copyfrom(&ru_msg_list->runicast_msg, sizeof(Runicast_msg));
                printf("[RU] @%d-@%u.%u->@%u.%u\n", clock_seconds(),rimeaddr_node_addr.u8[0],rimeaddr_node_addr.u8[1],
                       chosen_route->rt_entry.next_hop.u8[0],chosen_route->rt_entry.next_hop.u8[1]);
                runicast_send(runicast,&chosen_route->rt_entry.next_hop,MAX_RETRANSMISSIONS);
                packetbuf_clear();
                Ru_msg_list *to_remove;
                to_remove = ru_msg_list;
                ru_msg_list = ru_msg_list->next;
//                if(ru_send_success == true){
//                    list_remove(runicast_list,to_remove);
//                    memb_free(&runicast_list_memb,to_remove);
//                    printf("[DELET-RU-MSG]\n");
//                }
            }else{
                printf("[ERRO] current route is none");
            }


        }
    }
    remove_all_runicast_entry();
}
Exemplo n.º 2
0
static void
recv_ctrl(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
{
  static uint8_t last_seqno = -1;
  struct stats s;
  struct ctrl_msg *msg = packetbuf_dataptr();

  if(last_seqno == seqno) {
    return;
  }
  last_seqno = seqno;
  switch(msg->command) {
  case CTRL_COMMAND_STATS:
    msg->command = CTRL_COMMAND_STATS_REPLY;
    finalize_stats(&stats);
    memcpy_misaligned(&msg->stats, &stats, sizeof(stats));
    packetbuf_set_datalen(sizeof(struct ctrl_msg));
    runicast_send(c, from, MAX_RETRIES);
    break;
  case CTRL_COMMAND_STATS_REPLY:
    memcpy_misaligned(&s, &msg->stats, sizeof(stats));
    print_remote_stats(&s);
    process_post(&shell_netperf_process, CONTINUE_EVENT, NULL);
    break;
  case CTRL_COMMAND_CLEAR:
    clear_stats();
    break;
  }
}
PROCESS_THREAD(shell_sendfile_process, ev, data)
{
	const char *nextptr;
	static rimeaddr_t addr;
	int len;
	char buf[32];
	PROCESS_BEGIN();
	/* Parse node addr */
	addr.u8[0] = shell_strtolong(data, &nextptr);
	if(nextptr == data || *nextptr != '.') {
	    printf("sendfile <node addr> <filename>: need node address\n");
	    PROCESS_EXIT();
	}
	++nextptr;
	addr.u8[1] = shell_strtolong(nextptr, &nextptr);
	printf("\nnode address: %d.%d\n", addr.u8[0], addr.u8[1]);

	while(nextptr[0] == ' ') nextptr++;
	len = strlen(nextptr);
	//snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);
	if(len > MAX_FILENAME_SIZE) {
	    snprintf(buf, sizeof(buf), "%d", len);
	    printf("filename too large: ", buf);
	    PROCESS_EXIT();
	}
	sendfile_filename = nextptr;
	printf("filename: %s\n", sendfile_filename);
	sprintf(filenameOriginatorSent.name, "%s", sendfile_filename);
	filenameOriginatorSent.originator = node_id;
	packetbuf_copyfrom(&filenameOriginatorSent, sizeof(filenameOriginatorSent));
	runicast_send(&runicastSendCommand, &addr, MAX_RETRANSMISSIONS);
    PROCESS_END();
}
Exemplo n.º 4
0
Arquivo: rmh.c Projeto: EDAyele/wsn430
/*---------------------------------------------------------------------------*/
static void
received(struct runicast_conn *uc, const rimeaddr_t *from, uint8_t seqno)
{
  struct rmh_conn *c = (struct rmh_conn *)uc;
  struct data_hdr *msg = packetbuf_dataptr();
  rimeaddr_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)) {
    PRINTF("for us!\n");
    packetbuf_hdrreduce(sizeof(struct data_hdr));
    if(c->cb->recv) {
      c->cb->recv(c, &msg->originator, msg->hops);
    }
  } else {
    nexthop = NULL;
    if(c->cb->forward) {
      nexthop = c->cb->forward(c, &msg->originator,
			       &msg->dest, from, msg->hops);
    }
    if(nexthop) {
      PRINTF("forwarding to %d.%d\n", nexthop->u8[0], nexthop->u8[1]);
      msg->hops++;
      runicast_send(&c->c, nexthop, c->num_rexmit);
    }
  }
}
Exemplo n.º 5
0
Arquivo: rmh.c Projeto: EDAyele/wsn430
/*---------------------------------------------------------------------------*/
int
rmh_send(struct rmh_conn *c, rimeaddr_t *to, uint8_t num_rexmit, uint8_t max_hops)
{
  rimeaddr_t *nexthop;
  struct data_hdr *hdr;

  c->num_rexmit = num_rexmit;

  if(c->cb->forward == NULL) {
    return 0;
  }

  nexthop = c->cb->forward(c, &rimeaddr_node_addr, to, NULL, 0);
  if(nexthop == NULL) {
    PRINTF("rmh_send: no route\n");
    return 0;
  } else {
    PRINTF("rmh_send: sending data\n");


    if(packetbuf_hdralloc(sizeof(struct data_hdr))) {
      hdr = packetbuf_hdrptr();
      rimeaddr_copy(&hdr->dest, to);
      rimeaddr_copy(&hdr->originator, &rimeaddr_node_addr);
      hdr->hops = 1;
      hdr->max_rexmits = num_rexmit;
      runicast_send(&c->c, nexthop, num_rexmit);
    }
    return 1;
  }
}
Exemplo n.º 6
0
/* this function has been defined to be called when a unicast is being received */
static void recv_runicast(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno)
{
  printf("runicast message received from %d.%d, seqno %d\n", from->u8[0], from->u8[1], seqno);

  /* from the packet we have just received, read the data and write it into the
   * struct tmReceived we have declared and instantiated above (line 26)
   */
  packetbuf_copyto(&tmReceived);

  printf("time received = %d clock ticks", (uint16_t)tmReceived.time);
  printf(" = %d secs ", (uint16_t)tmReceived.time / CLOCK_SECOND);
  printf("%d millis ", (1000L * ((uint16_t)tmReceived.time  % CLOCK_SECOND)) / CLOCK_SECOND);
  printf("originator = %d\n", tmReceived.originator);
  leds_on(LEDS_BLUE);
  ctimer_set(&ledTimer, CLOCK_SECOND / 8, timerCallback_turnOffLeds, NULL);

  // If the packet received is not ours, send it back to the originator
  if(tmReceived.originator != node_id) {
    packetbuf_copyfrom(&tmReceived, sizeof(tmSent));

    runicast_send(&runicast, &addr, MAX_RETRANSMISSIONS);
    printf("sending packet to %u\n", addr.u8[0]);
  } else { // Our packet has completed a round-trip
    rtt -= tmReceived.time;
    printf("RTT = %d ms\n", (1000L * ((uint16_t)rtt  % CLOCK_SECOND)) / CLOCK_SECOND);
  }
}
Exemplo n.º 7
0
void sendToRoomLightNode(unsigned char* c, int bytes)
{
	unsigned char* buffer;
	char bufferLength = setBuffer(&buffer, c, bytes, HT_NODE_HIGH, RL_NODE_HIGH);
	packetbuf_copyfrom(buffer, bufferLength);
	runicast_send(&cuRunicastConnection, &centralNodeAddress, MAX_RETRANSMISSIONS);
	free(buffer);
}
/**
 * publish a single message
 */
void single_publish(struct runicast_conn *runicast,Runicast_msg runicast_msg){

    packetbuf_copyfrom(&runicast_msg, sizeof(Runicast_msg));
    printf("[RU] timestamp @%d seqno %d last hop address %u.%u\n", runicast_msg.timestamp,runicast_msg.seqno,runicast_msg.last_hop.u8[0],runicast_msg.last_hop.u8[1]);

    runicast_send(runicast,&find_best_route()->rt_entry.next_hop,MAX_RETRANSMISSIONS);
    packetbuf_clear();
}
int transmit_runicast(char *message, uint8_t addr_one)
{
	rimeaddr_t recv;
	packetbuf_copyfrom(message, strlen(message));
	recv.u8[0] = addr_one;
	recv.u8[1] = 0;
	packetbuf_copyfrom(message, strlen(message));
	return runicast_send(&runicast, &recv, MAX_RETRANSMISSIONS);
}
Exemplo n.º 10
0
/*---------------------------------------------------------------------------*/
static void
send_queued_packet(void)
{
    struct queuebuf *q;
    struct neighbor *n;
    struct packetqueue_item *i;
    struct collect_conn *c;

    i = packetqueue_first(&forwarding_queue);
    if(i == NULL) {
        PRINTF("%d.%d: nothing on queue\n",
               rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1]);
        /* No packet on the queue, so there is nothing for us to send. */
        return;
    }
    c = packetqueue_ptr(i);
    if(c == NULL) {
        /* c should not be NULL, but we check it just to be sure. */
        PRINTF("%d.%d: queue, c == NULL!\n",
               rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1]);
        return;
    }

    if(c->forwarding) {
        /* If we are currently forwarding a packet, we wait until the
           packet is forwarded and try again then. */
        PRINTF("%d.%d: queue, c is forwarding\n",
               rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1]);
        return;
    }

    q = packetqueue_queuebuf(i);
    if(q != NULL) {
        PRINTF("%d.%d: queue, q is on queue\n",
               rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1]);
        queuebuf_to_packetbuf(q);

        n = neighbor_best();

        /* Don't send to the neighbor if it is the same neighbor that sent
           us the packet. */
        if(n != NULL && !rimeaddr_cmp(&n->addr, packetbuf_addr(PACKETBUF_ADDR_SENDER))) {
#if CONTIKI_TARGET_NETSIM
            ether_set_line(n->addr.u8[0], n->addr.u8[1]);
#endif /* CONTIKI_TARGET_NETSIM */
            PRINTF("%d.%d: sending packet to %d.%d\n",
                   rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1],
                   n->addr.u8[RIMEADDR_SIZE-2], n->addr.u8[RIMEADDR_SIZE-1]);

            c->forwarding = 1;
            runicast_send(&c->runicast_conn, &n->addr, packetbuf_attr(PACKETBUF_ATTR_MAX_REXMIT));
        } else {
            PRINTF("%d.%d: did not find any neighbor to forward to\n",
                   rimeaddr_node_addr.u8[RIMEADDR_SIZE-2], rimeaddr_node_addr.u8[RIMEADDR_SIZE-1]);
        }
    }
}
Exemplo n.º 11
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_download_process, ev, data)
{
  const char *nextptr;
  static rimeaddr_t addr;
  int len;
  char buf[32];

  PROCESS_BEGIN();

  /* Parse node addr */
  addr.u8[0] = shell_strtolong(data, &nextptr);
  if(nextptr == data || *nextptr != '.') {
    shell_output_str(&download_command,
        "download <node addr> <filename>: need node address", "");
    PROCESS_EXIT();
  }
  ++nextptr;
  addr.u8[1] = shell_strtolong(nextptr, &nextptr);

  /* Get the length of the file, excluding a terminating NUL character. */
  while(nextptr[0] == ' ') {
    nextptr++;
  }
  len = strlen(nextptr);

  /*snprintf(buf, sizeof(buf), "%d.%d", addr.u8[0], addr.u8[1]);*/
  /*shell_output_str(&download_command, "Downloading from: ", buf);*/

  if(len > PACKETBUF_SIZE - 32) {
    snprintf(buf, sizeof(buf), "%d", len);
    shell_output_str(&download_command, "filename too large: ", buf);
    PROCESS_EXIT();
  }

  /*shell_output_str(&download_command, "Downloading file: ", nextptr);*/

  /* Send file request */
  downloading = 1;
  rucb_open(&rucb, RUCB_CHANNEL, &rucb_call);
  packetbuf_clear();
  *((uint8_t *)packetbuf_dataptr()) = ++req_seq_counter;
  memcpy(((char *)packetbuf_dataptr()) + 1, nextptr, len + 1);
  packetbuf_set_datalen(len + 2);
  PRINTF("requesting '%s'\n", nextptr);
  runicast_send(&runicast, &addr, MAX_RETRANSMISSIONS);

  /* Wait for download to finish */
  leds_on(LEDS_BLUE);
  PROCESS_WAIT_UNTIL(!runicast_is_transmitting(&runicast) && !downloading);
  leds_off(LEDS_BLUE);

  rucb_close(&rucb);
  /*shell_output_str(&download_command, "Done!", "");*/

  PROCESS_END();
}
Exemplo n.º 12
0
/*---------------------------------------------------------------------------*/
int
rucb_send(struct rucb_conn *c, const rimeaddr_t *receiver)
{
  c->chunk = 0;
  read_data(c);
  rimeaddr_copy(&c->receiver, receiver);
  rimeaddr_copy(&c->sender, &rimeaddr_node_addr);
  runicast_send(&c->c, receiver, MAX_TRANSMISSIONS);
  return 0;
}
Exemplo n.º 13
0
/*---------------------------------------------------------------------------*/
static void
send_ctrl_command(const rimeaddr_t *to, uint8_t command)
{
  struct ctrl_msg *msg;
  packetbuf_clear();
  packetbuf_set_datalen(sizeof(struct ctrl_msg));
  msg = packetbuf_dataptr();
  msg->command = command;
  runicast_send(&ctrl, to, MAX_RETRIES);
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_runicast_process, ev, data)
{
  struct shell_input *input;
  static rimeaddr_t receiver;
  int len;
  const char *nextptr;
  struct collect_msg *msg;
  char buf[30];
  
  PROCESS_BEGIN();
  
  receiver.u8[0] = shell_strtolong(data, &nextptr);
  if(nextptr == data || *nextptr != '.') {
    shell_output_str(&runicast_command,
		     "runicast <receiver>: recevier must be specified", "");
    PROCESS_EXIT();
  }
  ++nextptr;
  receiver.u8[1] = shell_strtolong(nextptr, &nextptr);

  snprintf(buf, sizeof(buf), "%d.%d", receiver.u8[0], receiver.u8[1]);
  shell_output_str(&runicast_command, "Sending runicast packets to ", buf);

  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
    input = data;

    len = input->len1 + input->len2;

    if(len == 0) {
      PROCESS_EXIT();
    }
    
    if(len < PACKETBUF_SIZE) {
      packetbuf_clear();
      packetbuf_set_datalen(len + COLLECT_MSG_HDRSIZE);
      msg = packetbuf_dataptr();
      memcpy(msg->data, input->data1, input->len1);
      memcpy(msg->data + input->len1, input->data2, input->len2);
#if TIMESYNCH_CONF_ENABLED
      msg->timestamp = timesynch_time();
#else
      msg->timestamp = 0;
#endif
      /*      printf("Sending %d bytes\n", len);*/
      runicast_send(&ruc, &receiver, 4);
    }
  }
  PROCESS_END();
}
Exemplo n.º 15
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(unicast_test_process, ev, data)
{
  PROCESS_BEGIN();

  puts("unicast test start");

  runicast_open(&runicast, 144, &runicast_callbacks);

  /* Receiver node: do nothing */
  if(linkaddr_node_addr.u8[0] == RX_ADDR1 &&
     linkaddr_node_addr.u8[1] == RX_ADDR2) {
    puts("wait forever");
  }
  while(1) {
    static struct etimer et;
    static int seqno;

    etimer_set(&et, CLOCK_SECOND * 5);

    PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));

    if(linkaddr_node_addr.u8[0] == RX_ADDR1 &&
       linkaddr_node_addr.u8[1] == RX_ADDR2) {
      puts("tick...");
      continue;
    }

    if(!runicast_is_transmitting(&runicast)) {
      static char buffer[100] = "hello";
      linkaddr_t recv;

      memset(&recv, 0, LINKADDR_SIZE);
      packetbuf_copyfrom(buffer, sizeof(buffer));
      recv.u8[0] = RX_ADDR1;
      recv.u8[1] = RX_ADDR2;

      printf("%u.%u: sending runicast to address %u.%u\n",
             linkaddr_node_addr.u8[0],
             linkaddr_node_addr.u8[1],
             recv.u8[0],
             recv.u8[1]);

      packetbuf_set_attr(PACKETBUF_ATTR_PACKET_ID, ++seqno);
      runicast_send(&runicast, &recv, MAX_RETRANSMISSIONS);
    }
  }

  PROCESS_END();
}
static void
recv_runicast(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
{
    printf("[RECV] runicast\n");
    Runicast_msg *runicast_msg;
    runicast_msg = packetbuf_dataptr();
//
//    if(local_node.sen_type!=BASE_STATION){
    //add_to_RU_list(*runicast_msg);
//    Runicast_msg temp;
//    memcpy(&temp,runicast_msg, sizeof(Runicast_msg));
    // single_publish(&runicast,temp);
    packetbuf_copyfrom(runicast_msg, sizeof(Runicast_msg));
    printf("[RU] timestamp @%d seqno %u last hop address %u.%u\n", runicast_msg->timestamp,runicast_msg->seqno,runicast_msg->last_hop.u8[0],runicast_msg->last_hop.u8[1]);

    runicast_send(&runicast,&find_best_route()->rt_entry.next_hop,MAX_RETRANSMISSIONS);
    packetbuf_clear();
}
Exemplo n.º 17
0
/*---------------------------------------------------------------------------*/
static void
acked(struct runicast_conn *ruc, const rimeaddr_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]);
  c->chunk++;
  len = read_data(c);
  if(len == 0 && c->last_size == 0) {
    /* Nothing more to do */
    return;
  }

  if(len >= 0) {
    runicast_send(&c->c, &c->receiver, MAX_TRANSMISSIONS);
    c->last_size = len;

  }
}
/**
 * subscribe node will assemble the data according to the conditions
 */
void assemble_data(){
    uint8_t value = random_rand()%10;
    assemble_total+=value;
    assemble_count++;
    if(value>max){
        max = value;
    }
    if(assemble_count>= local_node.assemble_count){
        Runicast_msg runicast_msg;
        runicast_msg.native_sen_type = local_node.sen_type;
        runicast_msg.seqno = clct_data_seqno;
        //runicast_msg.timestamp = CLOCK_SECOND;
        if(local_node.condition == MAX){
            runicast_msg.value = max;
        }else if(local_node.condition == AVERAGE ){
            runicast_msg.value = (assemble_total)/(assemble_count);
        }
        rimeaddr_copy(&runicast_msg.last_hop,&rimeaddr_node_addr);
        rimeaddr_copy(&runicast_msg.source,&rimeaddr_node_addr);
        //add_to_RU_list(runicast_msg);

        if(!runicast_is_transmitting(&runicast)){
            printf("[PUBLISH] publish data value->%u seqno %u\n",runicast_msg.value,runicast_msg.seqno);
            //single_publish(&runicast,runicast_msg);
            printf("[RU] timestamp %d seqno %u last hop address %u.%u\n", runicast_msg.timestamp,runicast_msg.seqno,runicast_msg.last_hop.u8[0],runicast_msg.last_hop.u8[1]);
            packetbuf_copyfrom(&runicast_msg, sizeof(Runicast_msg));
            runicast_send(&runicast,&find_best_route()->rt_entry.next_hop,MAX_RETRANSMISSIONS);
            packetbuf_clear();
        }


        if(clct_data_seqno>254){
            clct_data_seqno = 0;
        }
        clct_data_seqno++;
        assemble_count = 0;
        assemble_total = 0.0f;
        max = 0.0f;
    }
}
Exemplo n.º 19
0
static void recv_runicast(struct runicast_conn *c, rimeaddr_t *from, uint8_t seqno)
{
  printf("runicast message received from %d.%d, seqno %d\n", from->u8[0], from->u8[1], seqno);
  packetbuf_copyto(&filenameOriginatorRecv);
  printf("originator: %u\n", filenameOriginatorRecv.originator);
  printf("filename: %s\n", filenameOriginatorRecv.name);

  // request file from initiator
  rucb_open(&rucb, RUCB_CHANNEL, &rucb_call);
  packetbuf_clear();
  *((uint8_t *)packetbuf_dataptr()) = ++req_seq_counter;
  memcpy(((char *)packetbuf_dataptr()) + 1, filenameOriginatorRecv.name, strlen(filenameOriginatorRecv.name)+1);
  packetbuf_set_datalen(strlen(filenameOriginatorRecv.name) + 2);
  rimeaddr_t addr;
  addr.u8[0] = filenameOriginatorRecv.originator;
  addr.u8[1] = 0;
  filename_download = filenameOriginatorRecv.name;
  fd = cfs_open(filename_download, CFS_WRITE );
  runicast_send(&runicast, &addr, MAX_RETRANSMISSIONS);
  downloading = 1;
  process_start(&download_and_execute_process, NULL);

}
Exemplo n.º 20
0
PROCESS_THREAD(shell_ruc_send_process, ev, data)
{
  uint16_t channel;
  long channel_long;
  const char *next;
  linkaddr_t target;
  long rime_long;
  char buf[6];
  char msg_buf[128];
  size_t msg_size;
  PROCESS_BEGIN();

  channel_long = shell_strtolong((char *)data, &next);
  if(channel_long <= 0 || channel_long > 65535){
    shell_output_str(&ruc_send_command, "channel has to be in range [1-65535]", "");
    PROCESS_EXIT();
  }
  channel = (uint16_t) channel_long;
  snprintf(buf, sizeof(buf), "%d", channel);

  rime_long = shell_strtolong(next, &next);
  if(rime_long < 0 || rime_long > 255){
    shell_output_str(&ruc_send_command, "rimeaddress[0] has to be in range [0-255]","");
    PROCESS_EXIT();
  }
  if(*next != '.'){
    shell_output_str(&ruc_send_command, "wrong target address format, need u8[0].u8[1]","");
    PROCESS_EXIT();
  }
  target.u8[0] = (uint8_t) rime_long;
  ++next;
  rime_long = shell_strtolong(next, &next);
  if(rime_long < 0 || rime_long > 255){
    shell_output_str(&ruc_send_command, "rimeaddress[1] has to be in range [0-255]","");
    PROCESS_EXIT();
  }
  target.u8[1] = (uint8_t) rime_long;

  while(*next == ' '){
    next++;
  }

  msg_size = strlen(next);
  if(msg_size == 0){
    shell_output_str(&ruc_send_command, "ruc_send usage:", ruc_send_command.description);
    PROCESS_EXIT();
  }

  memcpy(msg_buf, next, msg_size);

  packetbuf_copyfrom(&msg_buf, msg_size);

  struct runicast_entry *e = NULL;
  for(e = list_head(runicast_list); e != NULL; e = e->next){
    if(e->channel == channel){
      runicast_send(&e->c, &target,3);
      shell_output_str(&ruc_send_command, "sent reliable unicast message on channel: ", buf);
      PROCESS_EXIT();
    }
  }
  shell_output_str(&ruc_send_command, "ruc_send error: channel not open, use ruc_open <channel> before trying to send","");

  PROCESS_END();
}