//Editor-Info: -*- C++ -*-
//
//Subject: TOVE-project / MTP3 protocol
//
//File: mtp3block_hmrt.cpp
//
//Version: $Revision: 1.10 $
//
//Date: $Date: 1998/11/20 14:07:49 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications and Multimedia
//
//Author:
//      Timo Pärnänen
//      Petteri Koponen
//
//Description:
//      See corresponding header file.
//
//Copyright:
//
//
//Licence:
//
//
//History:

#include "iface/naalif/naaldownprimitives.h"
#include "mtp3state_hmrt_idle.h"
#include "mtp3protocol.h"
#include "mtp3block_hmrt.h"

//Constructor: mtp3BlockHMRT
//
//Description:
//      Initializes member variables. The initial state is idle.
//

mtp3BlockHMRT :: mtp3BlockHMRT(mtp3Protocol *protocol_,
                               ss7Configure &configure_)
    : mtp3Colleague(protocol_, configure_)
{
    // Increment block's reference counter, beacause there is no proxy
    // to block in main function
    incRefCount();
    changeState(mtp3_HMRT_Idle::instance());
    return;
}

//Destructor: mtp3BlockHMRT
//
//Description:
//      Empty.
//

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

void mtp3BlockHMRT :: toLevel2(pfMessenger *messenger_)
{
    _protocol->toLevel2(messenger_);
    return;
}

// Other methods

void mtp3BlockHMRT :: routeMessage(pfUlong DPC_,
                                   pfFrame &frame_)
{
    try
    {
        pfKey AALid = _configure.findAALid(DPC_);
        naalMESSAGE_FOR_TRANSMISSIONreq *messenger =
            new naalMESSAGE_FOR_TRANSMISSIONreq;
        messenger->setMessageUnit(frame_);
        messenger->setAALidentifier(AALid);
        toLevel2(messenger);
    }
    catch (pfException &ex)
    {
        cout << "--not implemented--: No route to DPC --> discarded" << endl;
    }
    return;
}
