//Editor-Info: -*- C++ -*-
//
//Subject: TOVE-project / SAAL
//
//File: unisaalrelaystate.cpp
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/08/06 12:44:24 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications and Multimedia
//
//Author:
//      Juhana Räsänen
//
//Description:
//	See corresponding header file.
//
//Copyright:
//
//
//Licence:
//
//
//History: 
//


#include "unisaalrelaystate.h"
#include "unisaalrelaystate2.h"
#include "unisaalrelay.h"
#include "iface/uaalif/uaaldownprimitives.h"


void uniSaalRelayState :: uaalESTABLISHreqAct(
    uaalESTABLISHreq *messenger_,
    pfProtocol *protocol_)
{
    uniSaalRelay *protocol = (uniSaalRelay *) protocol_;
    if (messenger_->isFromA() != 0)
    {
        protocol->sendUaalESTABLISHind(0);
        protocol->sendUaalESTABLISHconf(1);
    }
    else
    {
        protocol->sendUaalESTABLISHind(1);
        protocol->sendUaalESTABLISHconf(0);
    }
    protocol->changeState(uniSaalRelayLinkOpen::instance());
    return;
}

void uniSaalRelayState :: uaalRELEASEreqAct(
    uaalRELEASEreq *,
    pfProtocol *)
{
    return;
}

void uniSaalRelayState :: uaalDATAreqAct(
    uaalDATAreq *,
    pfProtocol *)
{
    return;
}

void uniSaalRelayState :: uaalUNITDATAreqAct(
    uaalUNITDATAreq *messenger_,
    pfProtocol *protocol_)
{
    uniSaalRelay *protocol = (uniSaalRelay *) protocol_;
    if (messenger_->isFromA() != 0)
    {
        protocol->sendUaalUNITDATAind(messenger_->getMessageUnit(), 0);
    }
    else
    {
        protocol->sendUaalUNITDATAind(messenger_->getMessageUnit(), 1);
    }
    return;
}
