[ns] Mobile Node Positions and neighbor lists in MANET
Saeed SHAHBAZI
shahbazi at csse.unimelb.edu.au
Mon Jun 18 22:07:10 PDT 2007
Hi all,
I have tried different ways to access the list of neighbors and their
locations including:
1- Node *nd = nd->get_node_by_address(addr());
neighbor_list_node* nb = nd->neighbor_list_;
but nb is always NULL
2- bool Adian::IsNeighbor(int id)
{
if(addr() == id)
return false;
Node *nd1 = nd1->get_node_by_address(addr());
Node *nd2 = nd2->get_node_by_address(id);
vector a(nd1->location()->X, nd1->location()->Y, nd1->location()->Z);
vector b(nd2->location()->X, nd2->location()->Y, nd2->location()->Z);
vector d = a - b;
if (d.length() < 250)
return true;
return false;
}
but location() is always NULL and cause segment fault
3- int* neighborLstNode = God::instance()->GetNeighborList(addr());
I have added GetNeighborList(int) to the GOD but the result is NULL (segment
fault)
int* God::GetNeighborList(int id)
{
//list<int> neighborlist;
int neighborlist /*[] = new int*/ [nodes() + 1];
int i = -1;
neighborlist[0] = 0;
while(mb_node[++i] != NULL)
{
if (i == id)
continue;
vector a(mb_node[i]->X(), mb_node[i]->Y(), mb_node[i]->Z());
vector b(mb_node[id]->X(), mb_node[id]->Y(), mb_node[id]->Z());
vector d = a - b;
if (d.length() < RANGE)
{
//neighborlist.push_back(i);
neighborlist[0]++;
neighborlist[neighborlist[0]] = i;
}
}
}
Is there any solution to access to the location of mobile nodes or their
neighbors?
--
Best Regards,
Saeed Shahbazi
More information about the Ns-users
mailing list