//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / ILMI protocol
//
//File: ilmiarstate_restart.cpp
//
//Version: $Revision: 1.4 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/07/09 13:09:08 $
//
//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_restart.h"
#include "ilmiarstate_prefix.h"

// Implementation of the singleton pattern

ilmiARState_Restart *ilmiARState_Restart::_only = 0;

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

ilmiARState_Restart :: ilmiARState_Restart(void)
{
    return;
}

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

void ilmiARState_Restart :: receiveColdStartTrap(
    ilmiAddressRegistration *protocol_,
    VarBindList &list_)
{
    debugUser("ilmiARState_Restart :: receiveColdStartTrap");    
    return;
}

void ilmiARState_Restart :: receiveGetResponse(
    ilmiAddressRegistration *protocol_,
    PDUInt &errorStatus_,
    AsnInt &errorIndex_,
    VarBindList &list_)
{
    debugUser("ilmiARState_Restart :: receiveGetResponse");
    if (errorStatus_ == PDUInt::noSuchName)
    {
        protocol_->registerPrefixes();
        protocol_->changeState(ilmiARState_Prefix::instance());
    }
    else
    {
        start(protocol_);
    }
    return;
}

// Timeouts
void ilmiARState_Restart :: ilmiARresponseTimeoutAct(
    ilmiAddressRegistration *protocol_)
{
    debugUser("ilmiARState_Restart::ilmiARresponseTimeoutAct");
    start(protocol_);
    return;
}
