/*++
*****************************************************************************
* Copyright (c) 1997 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************

 File: DxbShimInternal.h

--*/
#ifndef DxbShimInternal_h
#define DxbShimInternal_h

typedef enum OPERATION_TYPE
{
	OP_TYPE_BLOCKING,
	OP_TYPE_TIMEOUT,
	OP_TYPE_ASYNC,
	OP_TYPE_INVALID
}
OPERATION_TYPE;

///////////////////////////////////////////////////////////////////////////////
// Context definitions, keeper for user's output data ptrs
// One per IOCTL_DS_X
//

typedef struct DS_OPEN_CONTEXT
{	
	HANDLE * phStream;
	LONG   * pErrorCode;
} DS_OPEN_CONTEXT, *PDS_OPEN_CONTEXT;

typedef struct DS_IOCTL_CONTEXT
{
	LONG *    pcbDataOut;
	LONG *    pReturnValue;
	LONG *    pErrorCode;
} DS_IOCTL_CONTEXT, *PDS_IOCTL_CONTEXT;

typedef struct DS_LINK_CONTEXT
{
	LONG *    pMuxId;
	LONG *    pErrorCode;
} DS_LINK_CONTEXT, *PDS_LINK_CONTEXT;

typedef struct DS_GETMSG_CONTEXT
{
	ULONG * pcbControl;
	ULONG * pcbData;
} DS_GETMSG_CONTEXT, *PDS_GETMSG_CONTEXT;

typedef struct KME_READ_WRITE_CONTEXT
{
	ULONG * pcbBuffer;
} KME_READ_WRITE_CONTEXT, *PKME_READ_WRITE_CONTEXT;

typedef union DS_CONTEXT
{
	DS_OPEN_CONTEXT	DsOpen;
	DS_IOCTL_CONTEXT	DsIoctl;
	DS_LINK_CONTEXT	DsLink;
	DS_GETMSG_CONTEXT	DsGetMsg;
	KME_READ_WRITE_CONTEXT KmeReadWrite;
} DS_CONTEXT, *PDS_CONTEXT;

typedef struct DRIVER_IOCTL
{
	HANDLE	hDriver;			// Handle from DriverOpen()
	DWORD	IoctlCmd;			// defined IOCTL_DS_X command code
	PVOID	pIoctlData;			// ptr to buffer for IOCTL parameters
	DWORD	cbIoctlData;		// IOCTL buffer byte count 
	PVOID	pResultData;		// ptr to buffer to fill with IOCTL output
	DWORD	cbResultData;		// Result buffer byte count
	DS_CONTEXT Context;		// Contains ptrs to user return data
	PVOID pCopyData;			// Contains a copy of any temp data from user
	DWORD	TimeoutMs;			// Timeout for operation in milliseconds
	HANDLE	hEvent;			// Handle to user created event, not used in Ol
	SHIM_STATUS * pStatus;	// ptr to user's shim status storage
	OPERATION_TYPE	Type;		// defined operation type, dictates IOCTL call
	OVERLAPPED Ol;				// Overlapped structure for async operation
}
DRIVER_IOCTL, *PDRIVER_IOCTL;

#endif // #ifndef DxbShimInternal_h
