/*++

*****************************************************************************
*                                                                           *
*  This software contains proprietary and confiential 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.                                                              *
*                                                                           *
*****************************************************************************

Module Name:

   tapimisc.c

Abstract:


Revision History:

   $Log: /Components/Windows/NT/Sync/Wan/TAPIMISC.C $
 * 
 * 3     4/28/97 1:55p Mikez
 * Updated to use DsApi library.  Uses IoBuildDeviceIoControlRequest to
 * alloc Irps causing two problems.  Because ioctls are METHOD_BUFFERED, a
 * systemBuffer is alloc'd, but, because the completionroutines return
 * STATUS_MORE_PROCESSING_REQUIRED, never gets freed.  Also, SystemBuffer
 * is not copied to OutputBuffer until after completionRoutine returns
 * STATUS_SUCCESS.  Need to move from METHOD_BUFFER or from using
 * IoBuildDeviceIoControlRequest.
 * 
 * 2     10/28/96 1:25p Mikez
 * Updated to support latest firmware release, v1.1.2b.
 * 
 * 1     3/11/96 5:07p Mikez
 * Revision 1.4  1995/10/06  07:00:15  Craig_Harrison
 * Version 1.0.1.2 
 * 
 * Revision 1.3  1995/09/15  00:00:00  Craig_Harrison
 * First beta release
 * 
 * Revision 1.1  1995/01/23  09:23:41  rik
 * Initial revision
 * 

--*/
#include <ntddk.h>
#include <ntddndis.h>
#include <ndis.h>
#include <ndiswan.h>
#include <ndistapi.h>

#include "DsApi.h"
#include "digix25.h"
#include "digix25p.h"



VOID SendTapiEvent( HANDLE MiniportAdapterHandle,
                    HTAPI_LINE htLine,
                    HTAPI_CALL htCall,
                    ULONG ulMsg,
                    PULONG_PTR pParam1,
                    PULONG_PTR pParam2,
                    PULONG_PTR pParam3 )
{
   NDIS_TAPI_EVENT TapiEvent;

   DigiDump( DIGIFLOW, ("SendTapiEvent: htLine=0x%x, htCall=0x%x, ulMsg=0x%x\n"
                        "               Param1=0x%p, Param2=0x%p, Param3=0x%p\n",
                        htLine,
                        htCall,
                        ulMsg,
                        *pParam1,
                        *pParam2,
                        *pParam3) );

   TapiEvent.htLine = htLine;
   TapiEvent.htCall = htCall;
   TapiEvent.ulMsg = ulMsg;
   TapiEvent.ulParam1 = *pParam1;
   TapiEvent.ulParam2 = *pParam2;
   TapiEvent.ulParam3 = *pParam3;

   NdisMIndicateStatus( MiniportAdapterHandle,
                        NDIS_STATUS_TAPI_INDICATION,
                        &TapiEvent,
                        sizeof(TapiEvent) );

	*pParam1 = TapiEvent.ulParam1;
	*pParam2 = TapiEvent.ulParam2;
	*pParam3 = TapiEvent.ulParam3;

   DigiDump( (DIGIFLOW|DIGIINFO), ("   After indication: Param1=0x%p, Param2=0x%p, Param3=0x%p\n",
                                   TapiEvent.ulParam1,
                                   TapiEvent.ulParam2,
                                   TapiEvent.ulParam3) );

   NdisMIndicateStatusComplete( MiniportAdapterHandle );

}  // end SendTapiEvent


