//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / ILMI protocol
//
//File: ilmiarstate_prefix.cpp
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/07/03 14:01:49 $
//
//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_prefix.h"
#include "ilmiarstate_address.h"

// Implementation of the singleton pattern

ilmiARState_Prefix *ilmiARState_Prefix::_only = 0;

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

ilmiARState_Prefix :: ilmiARState_Prefix(void)
{
    return;
}

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

void ilmiARState_Prefix :: receiveGetResponse(
    ilmiAddressRegistration *protocol_,
    PDUInt &errorStatus_,
    AsnInt &errorIndex_,
    VarBindList &list_)
{
    debugUser("ilmiARState_Prefix :: receiveGetResponse");
    if (errorStatus_ == PDUInt::noError)
    {
        debugUser("NetPrefix registered by a User");
        protocol_->changeState(ilmiARState_Address::instance());
    }
    else
    {
        start(protocol_);
    }
    return;
}
