//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / NNI SSCF protocol
//
//File: nsscfstate2_4_2.cpp
//
//Version: $Revision: 1.9 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/05/26 14:29:50 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications and Multimedia
//
//Author:
//      Juhana Räsä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 <assert.h>
#include "nsscfstate2_4_2.h"
#include "nsscfprotocol.h"
#include "iface/aaif/aaupprimitives.h"
#include "iface/naalif/naaldownprimitives.h"
#include "pf/frame.h"


//
// Variable: nsscfAlignment_OutgoingDisconnectionPending :: _only
// Function: nsscfAlignment_OutgoingDisconnectionPending :: instance()
//
// Description:
//     Implements the singleton pattern used for actual states
//

nsscfAlignment_OutgoingDisconnectionPending *
nsscfAlignment_OutgoingDisconnectionPending :: _only = 0;

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


nsscfAlignment_OutgoingDisconnectionPending ::
nsscfAlignment_OutgoingDisconnectionPending(void)
    : nsscfState()
{
    return;
}

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


///////////////////////////////////////////////////////////////////////
// void nsscfAlignment_OutgoingDisconnectionPending :: naalSTOPreqAct()
// Implemented as in Q.2140 page 54 SDL description

void nsscfAlignment_OutgoingDisconnectionPending ::
naalSTOPreqAct(naalSTOPreq *, pfProtocol *protocol_)
{
    nsscfProtocol *nsscf = (nsscfProtocol *) protocol_;
    nsscf->sendMaalREPORTind(LBC_EMPTY, UBC_OOS);
    nsscf->timerT2stop();
    nsscf->setUPSnormal();
    nsscf->toNsscfOutOfService_OutgoingDisconnectionPending();
    return;
}


//////////////////////////////////////////////////////////////////////////
// void nsscfAlignment_OutgoingDisconnectionPending :: maalRELEASEreqAct()
// Implemented as in Q.2140 page 54 SDL description

void nsscfAlignment_OutgoingDisconnectionPending ::
maalRELEASEreqAct(maalRELEASEreq *, pfProtocol *protocol_)
{
    nsscfProtocol *nsscf = (nsscfProtocol *) protocol_;
    nsscf->sendNaalOUT_OF_SERVICEind();
    nsscf->timerT2stop();
    nsscf->setUPSnormal();
    nsscf->toNsscfOutOfService_OutgoingDisconnectionPending();
    return;
}


/////////////////////////////////////////////////////////////////////////
// void nsscfAlignment_OutgoingDisconnectionPending :: aaRELEASEconfAct()
// Implemented as in Q.2140 page 54 SDL description

void nsscfAlignment_OutgoingDisconnectionPending ::
aaRELEASEconfAct(aaRELEASEconf *, pfProtocol *protocol_)
{
    nsscfProtocol *nsscf = (nsscfProtocol *) protocol_;
    nsscf->timerT1start();
    nsscf->toNsscfAlignment_Idle();
    return;
}


//////////////////////////////////////////////////////////////////////////
// void nsscfAlignment_OutgoingDisconnectionPending :: nsscfT2timeoutAct()
// Implemented as in Q.2140 page 51 SDL description

void nsscfAlignment_OutgoingDisconnectionPending ::
nsscfT2timeoutAct(nsscfProtocol *protocol_)
{
    nsscfProtocol *nsscf = (nsscfProtocol *) protocol_;
    nsscf->sendNaalOUT_OF_SERVICEind();
    nsscf->sendMaalREPORTind(LBC_EMPTY, UBC_OOS, R_ANS);
    nsscf->setUPSnormal();
    nsscf->toNsscfOutOfService_OutgoingDisconnectionPending();
    return;
}

