Ejemplo n.º 1
0
void
command_down(view_t *v)
{
	if(!address_cmp(&v->range.start, &v->range.end)) {
		view_move_address_line(v, &v->range.start, 1);
	}
	v->range.end = v->range.start;
}
Ejemplo n.º 2
0
void
command_right(view_t *v)
{
	if(!address_cmp(&v->range.start, &v->range.end)) {
		view_move_address(v, &v->range.start, 1);
	}
	v->range.end = v->range.start;
	v->last_x = view_address_to_x(v, &v->range.start);
}
Ejemplo n.º 3
0
void
command_delete(view_t *v)
{
	optype_t type = OP_Replace;
	if(!address_cmp(&v->range.start, &v->range.end)) {
		view_move_address(v, &v->range.end, 1);
		type = OP_Delete;
	}
	range_push(&v->range, "", 0, type);
	v->last_x = view_address_to_x(v, &v->range.start);
}
Ejemplo n.º 4
0
/*----------------------------------------------------------------------------*/
  neighbor_t*
  neighbor_table_contains(address_t* a)
  {
    neighbor_t* tmp;
    for(tmp = list_head(neighbor_table); tmp != NULL; tmp = tmp->next) {
      if(address_cmp(&(tmp->address),a)){
        return tmp;
      }  
    }
    return NULL;
  }
Ejemplo n.º 5
0
/*----------------------------------------------------------------------------*/
  void
  handle_beacon(packet_t* p)
  {
    add_neighbor(&(p->header.src),p->info.rssi);
#if !SINK
    uint8_t new_hops = get_payload_at(p, BEACON_HOPS_INDEX);
    uint8_t new_distance = p->info.rssi;

    if (address_cmp(&(conf.nxh_vs_sink), &(p->header.src)) ||
#if MOBILE
       (new_distance < conf.distance_from_sink)
#else
       (new_hops <= conf.hops_from_sink-1 && new_distance < conf.distance_from_sink)
#endif
    )
    {
      conf.nxh_vs_sink = p->header.src;
      conf.distance_from_sink = new_distance;
      conf.sink_address = p->header.nxh;
      conf.hops_from_sink = new_hops+1;
    }
#endif
    packet_deallocate(p);
  }
Ejemplo n.º 6
0
/*----------------------------------------------------------------------------*/
  uint8_t
  neighbor_cmp(neighbor_t* a, neighbor_t* b)
  {
    return address_cmp(&(a->address),&(b->address));
  }