//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project/CC
//
//File: ccodp_noanswer.cpp
//
//Version: $Revison: $
//
//State: $State: Exp $
//
//Date: $Date: 1998/11/11 14:56:17 $
//
//Organisation:
//      University of Technology
// 
//Author:
//      Pasi Nummisalo
//
//Description:
//     
//
//Copyright:
//     University of Technology
//     Laboratory of Telecommunications and Multimedia 
//      
//Licence:
//     
//
//History:

#include "ccostate_analyse.h"
#include "ccostate_selectroute.h"
#include "ccostate_collect.h"
#include "ccostate_exception.h"
#include "protocol/cc/ccprotocol.h"
#include "ccodp_noanswer.h"

ccOdpNoAnswer *ccOdpNoAnswer :: _only = 0;

ccOdpNoAnswer :: ccOdpNoAnswer(void)
{
    return;
}

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

ccOdpNoAnswer *ccOdpNoAnswer :: instance(void)
{
    if(_only == 0)
    {
        _only = new ccOdpNoAnswer;
        assert(_only != 0);
    }
    return _only;
}

//
//Function: proceed
//
//Description:
//   This function is called from PIC when it is time
//   to check DP criteria. Function reads the right
//   dp object from protocol and passes it to common
//   process function in base class.
//
//

void ccOdpNoAnswer :: proceed(ccProtocol *protocol_)
{
#if CC_DEBUG
traceDp(ccCC,"No Answer");
#endif

    process(protocol_->getDp(getInapType()), protocol_);

    return;
}

//
//Function: toNextState
//
//Description:
//   
//
//

void ccOdpNoAnswer :: toNextState(ccDp &, ccProtocol *protocol_)
{
    exitAction(protocol_, ccOstateException::instance());

    return;
}

//
//Functions: 
//
//Description:
//        Get DP specific information   
//


toveinap_EventTypeBCSMType ccOdpNoAnswer :: getInapType(void) const
{
    return toveinap_oNoAnswer;
}

string ccOdpNoAnswer :: getType(void) const
{
    string result("NoAnswer");
    return result;
}

ccIf_TriggersType ccOdpNoAnswer :: allowedTriggers(void) const
{
    ccIf_TriggersType triggers;
    
    triggers.length(0);
    
    return triggers;
}

//
//Functions: binap-inputs
//
//Description:
//   
//
//

void ccOdpNoAnswer :: binapSELECT_ROUTEpduAct(
    binapSELECT_ROUTEpdu *,
    ccProtocol *protocol_)
{
    exitAction(protocol_, ccOstateSelectRoute::instance());
  
    return;
}

void ccOdpNoAnswer :: binapANALYSE_INFORMATIONpduAct(
    binapANALYSE_INFORMATIONpdu *,
    ccProtocol *protocol_)
{
    exitAction(protocol_, ccOstateAnalyseInformation::instance());
   
    return;    
}

void ccOdpNoAnswer :: binapCOLLECT_INFORMATIONpduAct(
    binapCOLLECT_INFORMATIONpdu *,
    ccProtocol *protocol_)
{
    exitAction(protocol_, ccOstateCollectInformation::instance());
   
    return;
}

void ccOdpNoAnswer :: binapCONTINUEpduAct(
    binapCONTINUEpdu *,
    ccProtocol *protocol_)
{
    
    // Is there more TDP-Rs?
    processTDP_R(protocol_->
                 getDpValueObject(ccDpNoAnswer), protocol_);

    return;
}
