Enabled external neighbor removal

This commit is contained in:
nvt-se 2010-03-17 15:00:52 +00:00
parent 55f780ec19
commit 4e0ceedc47
2 changed files with 23 additions and 0 deletions

View file

@ -151,6 +151,23 @@ neighbor_attr_add_neighbor(const rimeaddr_t *addr)
return 1;
}
/*---------------------------------------------------------------------------*/
int
neighbor_attr_remove_neighbor(const rimeaddr_t *addr)
{
struct neighbor_addr *item = neighbor_attr_list_neighbors();
while(item != NULL) {
if(rimeaddr_cmp(&item->addr, addr)) {
memb_free(&neighbor_addr_mem, item);
list_remove(neighbor_addrs, item);
return 0;
} else {
item = item->next;
}
}
return -1;
}
/*---------------------------------------------------------------------------*/
void *
neighbor_attr_get_data(struct neighbor_attr *def, const rimeaddr_t *addr)
{

View file

@ -112,6 +112,12 @@ int neighbor_attr_has_neighbor(const rimeaddr_t * addr);
*/
int neighbor_attr_add_neighbor(const rimeaddr_t * addr);
/**
* \brief Remove a neighbor entry to neighbor table
* \retval -1 if unsuccessful, 0 if the neighbor was removed
*/
int neighbor_attr_remove_neighbor(const rimeaddr_t * addr);
/**
* \brief Get pointer to neighbor table data specified by id
* \param requested attribute