//+---------------------------------------------------------------------------
//
//  Contents:   NetMeeting pluggable transport interfaces
//
//  Copyright 1999-2002 Microsoft Corporation. All Rights Reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF 
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 
// PARTICULAR PURPOSE.
//----------------------------------------------------------------------------

import "oaidl.idl";
import "ocidl.idl";


#define UUID_IPluggableTransport        FB7045F0-A4DC-11D2-B724-00104BC51339


typedef unsigned int HCOMMDEV;
typedef unsigned int HEVENT;


typedef enum tagPLUGXPRT_FRAMING
{
    FRAMING_LEGACY_PSTN     = 0,    // legacy PSTN framing
    FRAMING_X224            = 1,    // X224 Connect + X224 Data Transfer
}
    PLUGXPRT_FRAMING;


typedef enum tagPLUGXPRT_CALL_TYPE
{
    PLUGXPRT_UNKNOWN_CALL_TYPE  = 0,
    PLUGXPRT_CALLER             = 1,
    PLUGXPRT_CALLEE             = 2,
}
    PLUGXPRT_CALL_TYPE;


typedef enum tagPLUGXPRT_PSTN_CALL_CONTROL
{
    PLUGXPRT_PSTN_CALL_CONTROL_PORT_HANDLE    = 0,  // default, for normal PSTN
    PLUGXPRT_PSTN_CALL_CONTROL_MANUAL         = 1,  // for legacy null modem
}
    PLUGXPRT_PSTN_CALL_CONTROL;



typedef struct tagPLUGXPRT_PARAMETERS
{
    ULONG       cbStructSize;                       // size of this structure, must be initialized
    DWORD       dwFlags;                            // valid fields defined below
    /* PSTN framing */
    PLUGXPRT_PSTN_CALL_CONTROL  eCallControl;       // PSTN call control
    ULONG       cbReadFileBufferSize;               // 10K default; must be no less than 1K
    ULONG       cbPhysicalLayerSendBufferSize;      //  1K default; must be no less than the default
    ULONG       cbPhysicalLayerReceiveBufferSize;   // 10K default; must be no less than 1K
    ULONG       cMaximumT200TimeoutsInQ922;         //   5 default; must be no less than the default
    ULONG       nT203TimeoutInQ922;                 // must be no less than the default, which is
                                                    // 30000 for PLUGXPRT_PSTN_CALL_CONTROL_PORT_HANDLE,
                                                    //   600 for PLUGXPRT_PSTN_CALL_CONTROL_MANUAL
    /* X.224 framing */
}
    PLUGXPRT_PARAMETERS;

cpp_quote("#define PSTN_PARAM__CALL_CONTROL                      0x0001")
cpp_quote("#define PSTN_PARAM__READ_FILE_BUFFER_SIZE             0x0002")
cpp_quote("#define PSTN_PARAM__PHYSICAL_LAYER_SEND_BUFFER_SIZE   0x0004")
cpp_quote("#define PSTN_PARAM__PHSYICAL_LAYER_RECV_BUFFER_SIZE   0x0008")
cpp_quote("#define PSTN_PARAM__MAX_T200_TIMEOUT_COUNT_IN_Q922    0x0010")
cpp_quote("#define PSTN_PARAM__T203_TIMEOUT_IN_Q922              0x0020")



[
    object,
    uuid(UUID_IPluggableTransport),
    pointer_default(unique)
]
interface IPluggableTransport : IUnknown
{
    HRESULT CreateConnection(
        [out] BSTR             *pbstrConnectionID,      // For placing a call and closing connection
        [in] PLUGXPRT_CALL_TYPE eCaller,                // caller vs callee
        [in] DWORD              dwProcessID,            // Used for DuplicateHandle
        [in] HCOMMDEV           hCommLink,              // Handle to communications file handle
        [in] HEVENT             hevtDataAvailable,      // Ready To Read event ( data avail )
        [in] HEVENT             hevtWriteReady,         // Ready To Write event 
        [in] HEVENT             hevtConnectionClosed,   // Connection closed ( unexpectedly???) 
        [in] PLUGXPRT_FRAMING   eFraming,               // framing of bits sent on link
        [in] PLUGXPRT_PARAMETERS *pParams               // OPTIONAL framing specific parameters
    );

    HRESULT CloseConnection(
        [in] BSTR               bstrConnectionID); 

    HRESULT EnableWinsock( ); 

    HRESULT DisableWinsock( ); 
};


