Hi Mauriwio Bellemo


Here is the example of simple timer
>
>
> *Declare this timer in the header fil***e**
>
>
> class MyTimer : public TimerHandler {
>  public:
>
>   MyTimer(AODV* ms) : TimerHandler() {ms_=ms;};
>
>  protected:
>   virtual void expire(Event* e);
>   AODV* ms_;
>
>
> };
>
>
> MyTimer MS_*timer*_;
>
>
> *Declare in the .cc file *
>
> void MyTimer::expire(Event*) {
>
>
>
>         ms_->MS_*timer*_.resched(10); //delay of 10 seconds
>         cout<<"time is : "<<Scheduler::instance().clock()<<endl;
>         //call any function which you want to schedule....
>
> }
>


Now what you have to do is simply in the expire function, just write the
logic for purging the entries (removal of entries) from the table. For
instance, you can look at AODV.cc file in which they have clearly defined
the logic of purging the routes from the routing table.

I hope it helps.

Mubashir Husain Rehmani

Regards


2008/9/17 Maurizio Bellemo <[EMAIL PROTECTED]>

>
> Hi,
>
> I'm writing a piece of code to create a routing table with the use of std
> map. Does anyone know how I can implement lifetime?? I need to create a
> timer which, at the expiration, causes the removal of the entry in the
> table. Any suggestions?
>
> Thank you very much
> Maurizio
>



-- 
Mubashir Husain Rehmani

Mobile : 00 33 (0)6 32 00 89 35

Reply via email to