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


#include <assert.h>
#include "unisaalrelay.h"
#include "unisaalrelaystate1.h"
#include "iface/uaalif/uaalupprimitives.h"


// ----------------------------------------------------------------------

uniSaalRelay :: uniSaalRelay(void)
    : pfProtocol()
{
    changeState(uniSaalRelayIdle::instance());
    return;
}

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


// ----------------------------------------------------------------------

void uniSaalRelay :: sendUaalESTABLISHind(bool toA_)
{
    uaalESTABLISHind *messenger = new uaalESTABLISHind;
    assert(messenger);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}

void uniSaalRelay :: sendUaalESTABLISHconf(bool toA_)
{
    uaalESTABLISHconf *messenger = new uaalESTABLISHconf;
    assert(messenger);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}

void uniSaalRelay :: sendUaalRELEASEind(bool toA_)
{
    uaalRELEASEind *messenger = new uaalRELEASEind;
    assert(messenger);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}

void uniSaalRelay :: sendUaalRELEASEconf(bool toA_)
{
    uaalRELEASEconf *messenger = new uaalRELEASEconf;
    assert(messenger);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}

void uniSaalRelay :: sendUaalDATAind(const pfFrame &mu_, bool toA_)
{
    uaalDATAind *messenger = new uaalDATAind;
    assert(messenger);
    messenger->setMessageUnit(mu_);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}

void uniSaalRelay :: sendUaalUNITDATAind(const pfFrame &mu_, bool toA_)
{
    uaalUNITDATAind *messenger = new uaalUNITDATAind;
    assert(messenger);
    messenger->setMessageUnit(mu_);
    if (toA_ != 0)
    {
        toA(messenger);
    }
    else
    {
        toB(messenger);
    }
    return;
}
