//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project
//
//File: 
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/08/03 11:40:43 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//	Jussi Turunen
//
//Description:
//	This file contains declarations for the class gsnProtocol.
//	The code is by no means perfect and grammatically correct since
//	this is only a file in which ideas pertaining to the protocol are
//	explained and are left open for discussion and modification.
//	Hopefully this file will explain the idea behind the protocol.
//	There *will* be changes to this file!!!!
//      GsnProtocol is the responsible for "switching" the data between
//      input and output connections.
//Copyright:
//
//
//Licence:
//
//
//History: 

#ifndef __GSMPSWITCH_GSN_PROTOCOL__
#define __GSMPSWITCH_GSN_PROTOCOL__

#include "pf/protocol.h"
#include "pf/types.h"

// vain classina, koska tyyppimäärittely on vain pointterina
class cpcsUNITDATAind;
class cpcsUNITDATAreq;
class saalConnection;

class gsnProtocol : public pfProtocol
{
    public:
        gsnProtocol(void);
        gsnProtocol(const gsnProtocol &other_);
        virtual ~gsnProtocol();

        // ***************************************************************
        // Methods required by the framework

        static pfConduit createGsnProtocol(pfUlong inputVCI_,
                                           pfUlong inputVPI_,
                                           pfUlong inputPort_,
                                           pfUlong outputVPI_,
                                           pfUlong outputVCI_,
                                           pfUlong outputPort_);

        virtual pfProtocol *cloneImplementation(void);

        void release(void);

        // ***************************************************************
        // Other methods. UNDER CONSTRUCTION!

        cpcsUNITDATAreq *switchData(cpcsUNITDATAind *messenger_) const;

        pfConduit openConnection(pfUlong port_,
                                 pfUlong VPI_,
                                 pfUlong VCI_,
                                 saalConnection *saal_);
        
private: 

        // ***************************************************************
        // The constructor will be called with values
        // of input and output connection and the constructor will create
        // the necessary saalConnections (input and output).

        gsnProtocol(pfUlong inputVPI_,
                    pfUlong inputVCI_,
		    pfUlong inputPort_,
                    pfUlong outputVPI_,
		    pfUlong outputVCI_,
                    pfUlong outputPort_);

        pfUlong _inputVPI;       // VPI 0, port 0?
        pfUlong _inputVCI;
        pfUlong _inputPort;
        pfUlong _outputVPI;       // VPI 0, port 0?
        pfUlong _outputVCI;
        pfUlong _outputPort;

        // names should be _sideAConnection/_sideBConnection
        saalConnection *_inputConnection;  // needed for closing connections
        saalConnection *_outputConnection;
	
};

#endif // __GSMPSWITCH_GSN_PROTOCOL__


