//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / TCAP
//
//File: tcapadapter.h
//
//Version: $Revision: 1.1 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/08/03 12:35:03 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
//
//Author: 
//      Timo Pärnänen
//
//
//Description:
//      Tove TCAP (Transaction Capabilities Application Part) 
//      implementation is distributed two main parts using CORBA
//      IDL interface. This file defines the C++ part of TCAP 
//      implementation which implements Transaction Coordinator (TCO).
//
//Copyright:
//
//
//Licence:
//
//
//History: 

#ifndef __TCAP_ADAPTER_H__
#define __TCAP_ADAPTER_H__

#include <OB/CORBA.h>
#include "tcap_skel.h"

#include <typeinfo>
#include <string>
//#include <stdio.h>
#include "pf/adapter.h"
#include "pf/types.h"
#include "pf/storage.h"

class pfConduit;

//
//Class: tcapAdapter
//
//Description:
//    This class defined TCO block of TCAP. This and other parts
//    of TCAP are communicated to each other with CORBA.
//    

// ++TODO++ Kommentit tcap <--> adapter

class tcapAdapter : public tcap_tcapDown_skel,
                    public pfAdapter
{
    public:
        static pfConduit createTCAP(pfUlong pointCode_);
        virtual ~tcapAdapter(void);

        // IDL interface tcap/tcapDown
        virtual void N_UNITDATAreq(const tcap_AddressType &calledAddress_,
                                   const tcap_AddressType &callingAddress_,
                                   const tcap_UserDataType &userData_);

        // Send method
        void sendToTCAP(tcap_AddressType calledAddress_,
                        tcap_AddressType callingAddress_,
                        tcap_UserDataType userData_);
            
//    protected:
        tcapAdapter(pfUlong pointCode_);

    private:
        static const pfByte BEGIN = 0x62;
        
        void resolveIOR(void);
        pfStorage createAddress(const tcap_AddressType &idlAddress_);
        
        tcap_tcapUp_var _tcap;
        pfUlong _pointCode;
};

#endif // __TCAP_ADAPTER_H__
