//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / ILMI protocol
//
//File: ilmiarstate_idle.cpp
//
//Version: $Revision: 1.4 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/07/09 13:09:07 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Timo Pärnänen
//
//Description:
//      See corresponding header file.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History:

#include "pf/debug.h"
#include "ilmiarstate_idle.h"
#include "ilmiarstate_poll.h"
#include "ilmiarstate_prefix.h"

// Implementation of the singleton pattern

ilmiARState_Idle *ilmiARState_Idle::_only = 0;

ilmiARState_Idle *ilmiARState_Idle :: instance(void)
{
    if (_only == 0)
    {
        _only = new ilmiARState_Idle;
    }
    return _only;
}

ilmiARState_Idle :: ilmiARState_Idle(void)
{
    return;
}

ilmiARState_Idle :: ~ilmiARState_Idle(void)
{
    _only = 0;
    return;
}

void ilmiARState_Idle :: listPrefixes(ilmiAddressRegistration *protocol_,
                                      mgmtCommand &command_)
{
    debugUser("ilmiARState_Idle::listPrefixes");
    protocol_->storeLocalPrefixes(command_);
    protocol_->registerPrefixes();
    protocol_->changeState(ilmiARState_Prefix::instance());
    return;
}

void ilmiARState_Idle :: ilmiARpollTimeoutAct(
    ilmiAddressRegistration *protocol_)
{
    debugUser("ilmiARState_Idle::ilmiARpollTimeoutAct");
    protocol_->sendGetNextRequest(firstNetworkPrefixTableEntry);
    protocol_->changeState(ilmiARState_Poll::instance());
    return;
}
   
