Hi Sarthak,

You can also get the node id like this

Total number of Nodes: God::instance()->nodes();
Node ID: Node::*nodeid*();

Don't forget the include God.h

You can access this node id which is mention in Node.cc File in a C++ file
by using

Node* thisnode = Node::get_node_by_address(n_id); //you can also give
index variable
as an argument to this function

cout<<"Node ID:\t"<<thisnode->*nodeid*()<<endl;

Regards
Mubashir Husain Rehmani

On 12 July 2010 21:46, Sarthak Grover <shahifaq...@gmail.com> wrote:

>
> Hi,
>
> I'm trying to access node ids through my mac-802_11.cc file as i want to
> implement different mac timers for different nodes.
>
> the src and dst addresses which i get from the headers dh->dh_ta and dh_ra
> are MAC addresses.
>
> But what i wanted to access was the node id i provided in my tcl script.
> #by
> set node_($i)
>
> Does anyone know a good way of getting mobile node ids?
>
> (i dont want the pointer to mobilenode but just the id which could be
> output
> as an integer say eg printf("%d\n",nodeid))
>
> i tried using get_node_by_id(netif_->node()->nodeid_) but got an error
> saying this function is out of scope. whereas using node() directly gives
> the octet address i think.
>
> also read some other suggestion on using netif_ in the archives but couldnt
> understand how to do it.
>
> i guess this is a common doubt so i apologize for its obvious "noobness"!
> if
> anyone has any suggestions please reply.
>
> thanx
>
> --
> Sarthak
>



-- 
Mubashir Husain Rehmani

Reply via email to