/*++
*******************************************************************************
* Copyright (c) 1999-2000 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				
*																										
*******************************************************************************

Module Name:

   asynlog.c

Abstract:

   Routines to log errors as well as print out debug messages.

Author:

	Sandy Haapala
   
--*/

#include "digiasyn.h"


VOID
AsynLogDsOpenDeviceError( 
	IN ULONG				 Status,
	IN PUNICODE_STRING Name
)
{
	DigiDump( DIGIERROR, 
	           ( "ASYN: Error on DStreams Open for device %S Status = %x\n", Name->Buffer, Status ) );
	DigiLogError( gpDriverObject, ASYN_DSTREAMS_OPEN_ERROR, 1, NULL, 0,
	              Name->Buffer, Name->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogImproperDeviceName( 
	IN ULONG					Status,
   IN PUNICODE_STRING	pDeviceName 
)
{
	DigiDump( DIGIERROR, 
	           ( "ASYN: Error on IoCreateDevice for %S Status = %x\n", pDeviceName->Buffer, Status ) );
	DigiLogError( gpDriverObject, ASYN_IMPROPER_DEVICE_NAME, 2, NULL, 0,
	              	pDeviceName->Buffer, pDeviceName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogNoConfiguredDevice(
	IN PUNICODE_STRING pDeviceName
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: No configured adapters\n" ) );
	DigiLogError( gpDriverObject, ASYN_NO_CONFIGURED_DEVICE, 3, NULL, 0,
	              	NULL, 0, NULL, 0 );
}

VOID
AsynLogNoSymLink( 
	IN ULONG					Status, 
   IN PUNICODE_STRING	pPortName 
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: Error on IoCreateSymbolicLink for %S. Status = %x\n",pPortName->Buffer, Status ) );
	DigiLogError( gpDriverObject, ASYN_NO_SYMLINK_CREATED, 4, NULL, 0,
	              	pPortName->Buffer, pPortName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogNoDeviceMap(
	IN PUNICODE_STRING	pPortName
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: Error on mapping DeviceMap entry for %S. \n",pPortName->Buffer ) );
	DigiLogError( gpDriverObject, ASYN_NO_DEVICE_MAP_CREATED, 5, NULL, 0,
	              	pPortName->Buffer, pPortName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogNoPortsFound( 
	IN PUNICODE_STRING	pName
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: Error logged: No ports found for  %S. \n",pName->Buffer ) );
	DigiLogError( gpDriverObject, ASYN_NO_PORTS, 6, NULL, 0,
	              	pName->Buffer, pName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogRxEngineFailed( 
	IN PUNICODE_STRING	pPortName
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: RX Engine failed on start-up for %S. \n",pPortName->Buffer ) );
	DigiLogError( gpDriverObject, ASYN_RXENGINE_FAILED, 7, NULL, 0,
	              	pPortName->Buffer, pPortName->Length + sizeof(WCHAR), NULL, 0 );
}

VOID
AsynLogDsOpenFailed( 
	IN PUNICODE_STRING	pPortName
)
{
	DigiDump( DIGIERROR,
	           ( "ASYN: DsOpen failed for %S. \n",pPortName->Buffer ) );
	DigiLogError( gpDriverObject, ASYN_DSOPEN_FAILED, 8, NULL, 0,
	              	pPortName->Buffer, pPortName->Length + sizeof(WCHAR), NULL, 0 );
}
