//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / CPCS module
//
//File: cpcsaadapter.h
//
//Version: $Revision: 1.7 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/12/16 13:55:11 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author:
//      Juhana Räsänen
//
//Description:
//      CPCS level interface class from Conduit+ world to outside world.
//
//Copyright:
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//Licence:
//
//
//History: 
//

#ifndef __CPCS_CPCSAADAPTER_H__
#define __CPCS_CPCSAADAPTER_H__

#include "cpcs.h"
#include "pf/atmsocket.h"

//
//Class: cpcsATMAdapter
//
//Description:
//    This class is an interface from the Conduit+ world to a ATM socket.
//    CPCS adapter accepts CPCS SDUs (in cpcsUNITDATAreq messengers),
//    takes the data and sends it as a write request to the device
//    being the adapter.
//    Adapter also provides a callback function for the device so that
//    it can give all messages received from the socket to the adapter,
//    which makes a cpcsUNITDATAind messenger of the data and sends it
//    to the Conduit connencted to the adapter A side.
//

class cpcsATMAdapter : public pfATMsocket
{
    public:
        static pfConduit createATMConnection(
            int port_,
            int vpi_,
            int vci_,            
            pfUlong sduSize_ = CPCS_MAX_SDU_SIZE);

        // ++TODO++ change constructor to protected when saal connection
        //          is deprecated.
        cpcsATMAdapter(pfUlong sduSize_);
        
        virtual ~cpcsATMAdapter(void);

        void readAction(pfFrame &frame_, pfUlong code_);
        void writeAction(pfUlong code_);

    protected:
        // Protected the clone method, because it
        // is not applicable as the CPCS adapter represents a physical
        // resource that cannot be cloned (ATM VC or UDP connection).
        virtual pfProtocol *cloneImplementation(void) const;

#ifdef DEBUG
    public:
        void setDebug(void);
        void clearDebug(void);
        bool debugActive(void) const;

    private:
        cpcsATMAdapter(const cpcsATMAdapter &other_);
        bool _debug;
#endif // DEBUG

};

#endif  // __CPCS_CPCSAADAPTER_H__

