//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / UNI
//
//File: unistate_n11.cpp
//
//Version: $Revision: 1.14 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/12/14 06:56:33 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Jari Katajavuori
//
//Description:
//      State Release Request (N11)
//
//Copyright:
//
//
//Licence:
//
//
//History: 

#include "unistate_n11.h"

#include "iface/sigif/sigdownprimitives.h"

#include "unidefs.h"
#include "unistrings.h"
#include "uniprotocol.h"
#include "unipdu.h"

uniNetworkReleaseRequest *
uniNetworkReleaseRequest :: _only = 0;

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

uniNetworkReleaseRequest :: uniNetworkReleaseRequest(void)
    : uniNetworkState()
{
    return;
}

uniNetworkReleaseRequest :: ~uniNetworkReleaseRequest(void)
{
    return;
}

void uniNetworkReleaseRequest :: sigRELEASErespAct(sigRELEASEresp *message_,
                                                   pfProtocol *protocol_)
{
    uniProtocol *protocol = dynamic_cast<uniProtocol*>(protocol_);
    protocol->sendRELEASE_COMPLETEpduToCoOrd(message_);
    protocol->clearCall();    
    return;
}

void uniNetworkReleaseRequest :: uniSTATUSpduAct(uniSTATUSpdu *message_,
                                                 pfProtocol *protocol_)
{
    uniProtocol *protocol = dynamic_cast<uniProtocol*>(protocol_);
    protocol->clearCallIfNullState(message_);
    return;
}

void uniNetworkReleaseRequest :: uniLINK_ESTABLISHindAct(
    uniLINK_ESTABLISHind *,
    pfProtocol *)
{
    return;
}

void uniNetworkReleaseRequest :: uniDROP_PARTYrespAct(
    uniDROP_PARTYresp *message_,
    pfProtocol *protocol_)
{
    uniProtocol *protocol = dynamic_cast<uniProtocol*>(protocol_);
    if (protocol->isMultipointConnection() != 0)
    {
        protocol->sendDROP_PARTY_ACKpduToCoOrd(message_);
        protocol->removePMP(message_);
    }
    return;
}

void uniNetworkReleaseRequest :: uniDROP_PARTYpduAct(
    uniDROP_PARTYpdu *,
    pfProtocol *)
{
    return;
}

void uniNetworkReleaseRequest :: uniDROP_PARTY_ACKpduAct(
    uniDROP_PARTY_ACKpdu *,
    pfProtocol *)
{
    return;
}

void uniNetworkReleaseRequest :: uniTREMOVEDtimeoutAct(pfProtocol *protocol_)
{
    uniProtocol *protocol = dynamic_cast<uniProtocol*>(protocol_);
    protocol->setBooleanTrue(uniAllowFinalClearingStr);
    return;
}

