//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//
//  Copyright (C) Microsoft Corporation, 1996 - 1999
//
//  File:       datatran.idl
//
//--------------------------------------------------------------------------

[
uuid(67c43840-74be-11cf-b64d-00aa0044fb89),
version(1.0)
]
interface DataTranPerf
{

//
// Context Handles
//
typedef [context_handle] void * DT_FILE_HANDLE;
typedef [context_handle] void * DT_MEM_HANDLE;

//
// Test cases.
//
[v1_enum]
typedef enum {
       SEND_BUFFER_RPC,
       RECV_BUFFER_RPC,
       SEND_BUFFER_PIPES,
       RECV_BUFFER_PIPES,
       SEND_BUFFER_FTP1,
       RECV_BUFFER_FTP1,
       SEND_BUFFER_HTTP,
       RECV_BUFFER_HTTP,
       SEND_FILE_RPC,
       RECV_FILE_RPC,
       SEND_FILE_PIPES,
       RECV_FILE_PIPES,
       SEND_FILE_FTP,
       RECV_FILE_FTP,
       SEND_FILE_FTP1,
       RECV_FILE_FTP1,
       SEND_FILE_HTTP,
       RECV_FILE_HTTP
       } TEST_TYPE;

const unsigned long TEST_MAX = 18;

//
// Client test case control functions follow
//

const unsigned long PERF_TOO_MANY_CLIENTS = 20001;
const unsigned long PERF_TESTS_DONE       = 20002;

	// non-blocking
error_status_t BeginTest( [in] handle_t    Binding,
                          [out] long      *ClientId
                        );

	// blocking
error_status_t NextTest( [in] handle_t    Binding,
                         [out] TEST_TYPE *Test,
                         [out] long      *Iterations,
                         [out] long      *Length,
                         [out] long      *ChunkSize
                       );

	// blocking
error_status_t EndTest( [in] handle_t      Binding,
                        [in] unsigned long mseconds
                      );


//
//  Remote memory stuff
//

DT_MEM_HANDLE RemoteAllocate( [in] handle_t         Binding,
                              [in] unsigned long    Length);

void RemoteFree ([in] DT_MEM_HANDLE *MemHandle);

//
//  Opens temporary file on server w/ optional length
//  Set Length to zero to just open the file.
//
DT_FILE_HANDLE RemoteOpen([in] handle_t             Binding,
                          [in] unsigned long int    ulLength);

//
//  Opens a temporary file in the FTP directory
//
DT_FILE_HANDLE RemoteCreateFtpFile ([in] handle_t           Binding,
                                    [in] boolean            f_StoC,
                                    [in] unsigned long int  ulLength,
                                    [in] unsigned long int  ulBufferSize,
                                    [string,
                                     out,
                                     size_is(ulBufferSize)] byte    szRemotePath[]
                                   );

//
//  Opens a temporary file in the WWW directory
//
DT_FILE_HANDLE RemoteCreateHttpFile ([in] handle_t          Binding,
                                     [in] boolean           f_StoC,
                                     [in] unsigned long int ulLength,
                                     [in] unsigned long int ulBufferSize,
                                     [string,
                                      out,
                                      size_is(ulBufferSize)] byte    szRemotePath[]
                                    );

//
//  Closes a file on the server and optionally delete it
//
void RemoteClose([in,out]   DT_FILE_HANDLE *ppContext,
                 [in]       boolean         fDelete);

//
//  Resets the FilePointer of specified file to zero
//
void RemoteResetFile([in] DT_FILE_HANDLE pContext);

//
//  Gets the server's machine name
//
void GetServerName ([in] handle_t                   Binding,
                    [in] unsigned long int          BufferSize,
                    [out, size_is(BufferSize)] byte Buffer[]);

//
// Test APIs
//

//===================================================================
//  RPC only
//===================================================================

void C_to_S_Buffer ([in] handle_t                   Binding,
                    [in] unsigned long int          BufferSize,
                    [in, size_is(BufferSize)] byte  Buffer[]);

void S_to_C_Buffer ([in] handle_t                   Binding,
                    [in] unsigned long int          BufferSize,
                    [out, size_is(BufferSize)] byte Buffer[]);

long S_to_C_BufferWithFile ([in] handle_t                   Binding,
                            [in] DT_FILE_HANDLE             phContext,
                            [in] unsigned long int          BufferSize,
                            [out, size_is(BufferSize)] byte Buffer[]);

void C_to_S_BufferWithFile ([in] handle_t                   Binding,
                            [in] DT_FILE_HANDLE             phContext,
                            [in] unsigned long int          BufferSize,
                            [in, size_is(BufferSize)] byte  Buffer[]);

//===================================================================
//  RPC pipes
//===================================================================

typedef pipe unsigned char UCHAR_PIPE;

void S_to_C_Pipe ([in]  handle_t        Binding,
                  [out] UCHAR_PIPE      data,
                  [in]  unsigned long   Length,
                  [in]  DT_MEM_HANDLE   MemHandle);

void C_to_S_Pipe ([in] handle_t         Binding,
                  [in] UCHAR_PIPE       data,
                  [in] DT_MEM_HANDLE    MemHandle);

void S_to_C_PipeWithFile ([in]  handle_t        Binding,
                          [out] UCHAR_PIPE      data,
                          [in]  DT_FILE_HANDLE  FileHandle,
                          [in]  DT_MEM_HANDLE   MemHandle);

void C_to_S_PipeWithFile ([in] handle_t         Binding,
                          [in] UCHAR_PIPE       data,
                          [in] DT_FILE_HANDLE   FileHandle,
                          [in] DT_MEM_HANDLE    MemHandle);

//
// Used for fixed binding test.
//

[string] char * GetFixedEp(handle_t Binding);

}