[SDP] SDP support WPP
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 19 Dec 2005 09:04:26 +0000 (09:04 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 19 Dec 2005 09:04:26 +0000 (09:04 +0000)
add define EVEENT_TRACING that move all SDP_PRINT calls to use WPP
in check version if tracing is not enabled then use regular kdprint. (Rev 826)

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@208 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

14 files changed:
ulp/sdp/kernel/SOURCES
ulp/sdp/kernel/SdpArp.cpp
ulp/sdp/kernel/SdpBufferPool.cpp
ulp/sdp/kernel/SdpBufferPool.h
ulp/sdp/kernel/SdpConnectionList.cpp
ulp/sdp/kernel/SdpDriver.cpp
ulp/sdp/kernel/SdpGenUtils.cpp
ulp/sdp/kernel/SdpLock.h
ulp/sdp/kernel/SdpRecvPool.cpp
ulp/sdp/kernel/SdpSocket.cpp
ulp/sdp/kernel/SdpSocket.h
ulp/sdp/kernel/SdpTrace.cpp
ulp/sdp/kernel/SdpTrace.h
ulp/sdp/kernel/SdpUserFile.cpp

index e5a3e4e..59cceaf 100644 (file)
@@ -2,6 +2,8 @@ TARGETNAME=Sdp
 TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)\r
 TARGETTYPE=DRIVER\r
 \r
+ENABLE_EVENT_TRACING=1\r
+\r
 SOURCES= Sdp.rc                 \\r
         SdpDriver.cpp          \\r
         SdpUserFile.cpp        \\r
@@ -34,6 +36,15 @@ TARGETLIBS= \
 TARGETLIBS= $(TARGETLIBS) $(DDK_LIB_PATH)\ntstrsafe.lib\r
 !endif\r
 \r
+!IFDEF ENABLE_EVENT_TRACING\r
+\r
+C_DEFINES = $(C_DEFINES) -DEVENT_TRACING\r
+\r
+RUN_WPP= $(SOURCES) -km -dll -ext: .c .cpp .h .C .CPP .H\\r
+       -preserveext:.cpp .h\\r
+       -func:SDP_PRINT(LEVEL,FLAGS,MSG,...) \r
+!ENDIF\r
+\r
 MSC_WARNING_LEVEL= /W3\r
 \r
 PRECOMPILED_INCLUDE=Precompile.h\r
index 7555600..87ab228 100644 (file)
 \r
 #pragma warning(disable: 4244 ) \r
 \r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpArp.tmh"\r
+#endif\r
+\r
+\r
+\r
 NTSTATUS \r
 SdpArp::Init(PDRIVER_OBJECT  DriverObject) \r
 { \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("Entering"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"Entering");\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;\r
     UNICODE_STRING  DevName1;\r
@@ -67,7 +76,7 @@ SdpArp::Init(PDRIVER_OBJECT  DriverObject)
                          0,\r
                          FILE_NON_DIRECTORY_FILE );\r
     if (!NT_SUCCESS( rc )) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("ZwOpenFile failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"ZwOpenFile failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -81,7 +90,7 @@ SdpArp::Init(PDRIVER_OBJECT  DriverObject)
                                         (PVOID *) &m_FileObject,\r
                                         NULL );\r
     if (!NT_SUCCESS( rc )) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("ObReferenceObjectByHandle failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"ObReferenceObjectByHandle failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -106,7 +115,7 @@ Cleanup:
 VOID \r
 SdpArp::Shutdown()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("this = %p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = %p\n", this);\r
     if (m_FileHandle) {\r
         ZwClose(m_FileHandle);\r
         m_FileHandle = NULL;\r
@@ -126,12 +135,11 @@ SdpArp::SourcePortGidFromIP(
     OUT ib_net64_t *SrcCaGuid\r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("IP = %d.%d.%d.%d\n", \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "IP = %d.%d.%d.%d\n", \r
         (SourceAddr & 0xff000000) >> 24,\r
         (SourceAddr & 0xff0000) >> 16,\r
         (SourceAddr & 0xff00) >> 8 ,        \r
-        SourceAddr & 0xff\r
-        ));\r
+        SourceAddr & 0xff);\r
     NTSTATUS rc = STATUS_SUCCESS;\r
     KEVENT             event;\r
     PIRP               irp;\r
@@ -163,7 +171,7 @@ SdpArp::SourcePortGidFromIP(
 \r
     if(NULL == irp) {\r
         rc = STATUS_INSUFFICIENT_RESOURCES;\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -176,12 +184,12 @@ SdpArp::SourcePortGidFromIP(
     }\r
 \r
     if(!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("IoCallDriver failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoCallDriver failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
     if (pipoib_ports_out->Size > sizeof temp) {\r
         // The number of bytes that we have allocated wasn't enough\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("pipoib_ports_out.Size = %d\n", pipoib_ports_out->Size ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"pipoib_ports_out.Size = %d\n", pipoib_ports_out->Size );\r
         rc = STATUS_INSUFFICIENT_RESOURCES;\r
         goto Cleanup;\r
         // BUGBUG: We should try again, with a bigger buffer\r
@@ -189,7 +197,7 @@ SdpArp::SourcePortGidFromIP(
 \r
     rc = SourcePortGidFromPorts(SourceAddr, pipoib_ports_out, SrcPortGuid, SrcCaGuid);\r
     if(!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("SourcePortGidFromPorts failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"SourcePortGidFromPorts failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -205,7 +213,7 @@ SdpArp::SourcePortGidFromPorts(
     OUT ib_net64_t *SrcCaGuid\r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("Entered\n"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"Entered\n");\r
     NTSTATUS rc = STATUS_SUCCESS;\r
     KEVENT             event;\r
     PIRP               irp;\r
@@ -221,9 +229,8 @@ SdpArp::SourcePortGidFromPorts(
     addresses_in.Version = IBAT_IOCTL_VERSION;\r
 \r
     for (i = 0 ; i < pPorts->NumPorts; i++) {\r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, (\r
-            "%d: ca guid = 0x%I64x port guid=0x%I64x\n",\r
-            i, CL_NTOH64(pPorts->Ports[i].CaGuid), CL_NTOH64(pPorts->Ports[i].PortGuid)));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,  "%d: ca guid = 0x%I64x port guid=0x%I64x\n",\r
+            i, CL_NTOH64(pPorts->Ports[i].CaGuid), CL_NTOH64(pPorts->Ports[i].PortGuid));\r
 \r
         // Do a quary to find out if this is the correct port\r
         ASSERT(m_DeviceObject != NULL);\r
@@ -245,7 +252,7 @@ SdpArp::SourcePortGidFromPorts(
 \r
         if(NULL == irp) {\r
             rc = STATUS_INSUFFICIENT_RESOURCES;\r
-            SDP_PRINT(SDP_ERR, SDP_ARP, ("IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc ));        \r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc );        \r
             goto Cleanup;\r
         }\r
 \r
@@ -258,12 +265,12 @@ SdpArp::SourcePortGidFromPorts(
         }\r
 \r
         if(!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_ARP, ("IoCallDriver failed rc = 0x%x\n", rc ));        \r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoCallDriver failed rc = 0x%x\n", rc );        \r
             goto Cleanup;\r
         }\r
         if (addresses_out->Size > sizeof temp) {\r
         // The number of bytes that we have allocated wasn't enough\r
-            SDP_PRINT(SDP_ERR, SDP_ARP, ("addresses_out.Size = %d\n", addresses_out->Size ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"addresses_out.Size = %d\n", addresses_out->Size );\r
             rc = STATUS_INSUFFICIENT_RESOURCES;\r
             goto Cleanup;\r
             // BUGBUG: We should try again, with a bigger buffer\r
@@ -276,9 +283,9 @@ SdpArp::SourcePortGidFromPorts(
             ASSERT(addresses_out->Address[j].IpVersion == 4);\r
             pIp = (ULONG *) (&addresses_out->Address[j].Address[12]);\r
             if (*pIp == CL_NTOH32(SourceAddr)) {\r
-                SDP_PRINT(SDP_TRACE, SDP_ARP, \r
-                    ("Found the IP: ca guid = 0x%I64x port guid=0x%I64x\n", \r
-                    CL_NTOH64(pPorts->Ports[i].CaGuid), CL_NTOH64(pPorts->Ports[i].PortGuid)));\r
+                SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_ARP, \r
+                    "Found the IP: ca guid = 0x%I64x port guid=0x%I64x\n", \r
+                    CL_NTOH64(pPorts->Ports[i].CaGuid), CL_NTOH64(pPorts->Ports[i].PortGuid));\r
                 ASSERT(rc == STATUS_SUCCESS);\r
                 *SrcPortGuid = pPorts->Ports[i].PortGuid;\r
                 *SrcCaGuid = pPorts->Ports[i].CaGuid;\r
@@ -289,13 +296,13 @@ SdpArp::SourcePortGidFromPorts(
 \r
     }\r
     // If we have reached here the data was not found\r
-    SDP_PRINT(SDP_WARN, SDP_ARP, \r
-        ("HCA not found for ip=%d.%d.%d.%d\n",        \r
+    SDP_PRINT(TRACE_LEVEL_WARNING, SDP_ARP, \r
+        "HCA not found for ip=%d.%d.%d.%d\n",        \r
         (SourceAddr & 0xff000000) >> 24,\r
         (SourceAddr & 0xff0000) >> 16,\r
         (SourceAddr & 0xff00) >> 8 ,        \r
         SourceAddr & 0xff\r
-        ));\r
+        );\r
     rc = STATUS_NOT_FOUND;\r
 \r
 Cleanup:\r
@@ -310,7 +317,7 @@ SdpArp::DestPortGidFromMac(
     IN  MAC_ADDR  DestMac, \r
     OUT ib_gid_t   *pDestPortGid)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("MAC = ????\n"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"MAC = ????\n");\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
     KEVENT             event;\r
@@ -344,7 +351,7 @@ SdpArp::DestPortGidFromMac(
 \r
     if(NULL == irp) {\r
         rc = STATUS_INSUFFICIENT_RESOURCES;\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoBuildDeviceIoControlRequest failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -357,7 +364,7 @@ SdpArp::DestPortGidFromMac(
     }\r
 \r
     if(!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("IoCallDriver failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"IoCallDriver failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
 \r
@@ -394,19 +401,19 @@ SdpArp::QueryPathRecord(
 \r
     query_context.path_rec = path_rec;\r
 \r
-    SDP_PRINT( SDP_TRACE, SDP_ARP, ("Query for path from %I64x to %I64x\n",\r
-        SrcPortGuid, DestPortGid.unicast.interface_id) );\r
+    SDP_PRINT( TRACE_LEVEL_INFORMATION, SDP_ARP, "Query for path from %I64x to %I64x\n",\r
+        SrcPortGuid, DestPortGid.unicast.interface_id);\r
 \r
     ib_status = ib_query( g_pSdpDriver->m_al_handle, &query_req, &query_handle );\r
 \r
     if ( ib_status != IB_SUCCESS) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("ib_query failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"ib_query failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
 \r
     if( query_context.status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_ARP, ("query_context.status failed ib_status = 0x%d\n", query_context.status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_ARP,"query_context.status failed ib_status = 0x%d\n", query_context.status );\r
         rc = IB2Status(query_context.status);\r
         goto Cleanup;\r
     }\r
@@ -437,7 +444,7 @@ SdpArp::query_pr_callback(
     \r
     ib_api_status_t status;\r
 \r
-    SDP_PRINT( SDP_TRACE, SDP_ARP,("query_pr_callback status is %d irql=%d\n", p_query_rec->status, KeGetCurrentIrql()) );\r
+    SDP_PRINT( TRACE_LEVEL_INFORMATION, SDP_ARP,"query_pr_callback status is %d irql=%d\n", p_query_rec->status, KeGetCurrentIrql());\r
 \r
     query_context->status = p_query_rec->status;\r
 \r
@@ -459,7 +466,7 @@ SdpArp::query_pr_callback(
         ASSERT(status == IB_SUCCESS);\r
         if( status != IB_SUCCESS )\r
         {\r
-            SDP_PRINT( SDP_ERR, SDP_ARP, ("ib_put_mad failed (%d)\n", status) );\r
+            SDP_PRINT( TRACE_LEVEL_ERROR, SDP_ARP,"ib_put_mad failed ");\r
         }\r
     } else {\r
         // When do we free this mad ???\r
index 17c93df..c58d34e 100644 (file)
 \r
 // Author: Tzachi Dar\r
 \r
-#pragma warning(disable: 4244 ) \r
 \r
 #include "preCompile.h"\r
 \r
+#pragma warning(disable: 4244 ) \r
+\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpBufferPool.tmh"\r
+#endif\r
+\r
+\r
+\r
 \r
 //static \r
 NTSTATUS \r
 BufferDescriptor::AllocateBuffer(BufferDescriptor ** ppBufferDescriptor, int BufferSize, int Tag)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("\n"));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"\n");\r
     NTSTATUS rc = STATUS_SUCCESS;\r
     BufferDescriptor *pBufferDescriptor = NULL;\r
 \r
@@ -53,7 +63,7 @@ BufferDescriptor::AllocateBuffer(BufferDescriptor ** ppBufferDescriptor, int Buf
                             );\r
         \r
     if (pBufferDescriptor == NULL) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("ExAllocatePoolWithTag failed \n"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"ExAllocatePoolWithTag failed \n");\r
         rc = STATUS_NO_MEMORY;\r
         goto Cleanup;\r
     }\r
@@ -65,7 +75,7 @@ BufferDescriptor::AllocateBuffer(BufferDescriptor ** ppBufferDescriptor, int Buf
     pBufferDescriptor->pBuffer = MmAllocateContiguousMemory(BufferSize, mem);\r
         \r
     if (pBufferDescriptor->pBuffer == NULL) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("ExAllocatePoolWithTag failed BufferSize = %d irql=%d\n",BufferSize, KeGetCurrentIrql()));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"ExAllocatePoolWithTag failed BufferSize = %d irql=%d\n",BufferSize, KeGetCurrentIrql());\r
         rc = STATUS_NO_MEMORY;\r
         goto Cleanup;\r
     }\r
@@ -130,7 +140,7 @@ BufferPool::Init(
 \r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
     m_MaxBuffers = MaxBuffers;\r
     m_MaxConcurrentSends = MaxConcurrentSends;\r
     m_MaxMessageSize = MaxMessageSize;        \r
@@ -165,7 +175,7 @@ BufferPool::GetBuffer(
     BufferDescriptor **ppBufferDescriptor\r
     )\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p \n",this);\r
     AssertLocked();\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;\r
@@ -179,7 +189,7 @@ BufferPool::GetBuffer(
         // we need to alocate a new buffer\r
         rc = BufferDescriptor::AllocateBuffer(ppBufferDescriptor, m_MaxMessageSize, SEND_BUFFERS_ALLOCATION_TAG);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL, "AllocateBuffer failed rc = 0x%x\n", rc );\r
             ASSERT(*ppBufferDescriptor == NULL);\r
             goto Cleanup;\r
         }\r
@@ -201,8 +211,8 @@ queue
 NTSTATUS \r
 BufferPool::AddBufferToQueuedList(BufferDescriptor *pBufferDescriptor)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p pBufferDescriptor = 0x%x\n",this,\r
-        pBufferDescriptor));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p pBufferDescriptor = 0x%p\n",this,\r
+        pBufferDescriptor);\r
     AssertLocked();\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;\r
@@ -218,7 +228,7 @@ BufferPool::AddBufferToQueuedList(BufferDescriptor *pBufferDescriptor)
     m_QueuedPackets.InsertTailList(&pBufferDescriptor->BuffersList);\r
     rc = SendBuffersIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffersIfCan failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"SendBuffersIfCan failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }        \r
 \r
@@ -234,7 +244,7 @@ Cleanup:
 NTSTATUS \r
 BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p buffer=0x%p\n",this, pBufferDescriptor));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p buffer=0x%p\n",this, pBufferDescriptor);\r
     AssertLocked();\r
     bool CreditUpdate = false;\r
     bool DissconnectMessage = false;\r
@@ -242,7 +252,7 @@ BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)
 \r
 #if DBG    \r
     if (m_CurrentlySentBuffers == 1) {\r
-        SDP_PRINT(SDP_WARN, SDP_PERFORMANCE, ("Currently no packets are bing sent\n"));        \r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_PERFORMANCE, "Currently no packets are bing sent \n");        \r
     }\r
 #endif\r
     ASSERT( pBufferDescriptor->GetFlags() == CREDIT_UPDATE ||\r
@@ -262,7 +272,7 @@ BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)
             m_PostCreditsWhenCan = false;\r
             rc = PostCredits();\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("PostCredits failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"PostCredits failed rc = 0x%x\n", rc );\r
                 goto Cleanup;\r
             }        \r
         }\r
@@ -287,7 +297,7 @@ BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)
             if ((RemainingToCopy(pIrp) < m_MaxMessageSize * m_FreePackets.Size())) {\r
                 rc = m_pSdpSocket->RequestCallBack();\r
                 if (!NT_SUCCESS(rc)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("RequestCallBack failed rc = 0x%x\n", rc ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL, "PostCredits failed rc = 0x%x\n", rc );\r
                     goto Cleanup;\r
                 }        \r
                 m_CallBackPending = true;\r
@@ -295,7 +305,7 @@ BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)
         }\r
 \r
         if (DissconnectMessage) {\r
-            SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("We have recieved a DissconnectMessage complition\n" ));\r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"We have recieved a DissconnectMessage complition\n" );\r
             m_pSdpSocket->DisconectSentEvent();\r
         }\r
     }\r
@@ -305,7 +315,7 @@ BufferPool::ReturnBuffer(BufferDescriptor *pBufferDescriptor)
     */\r
     rc = SendBuffersIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffersIfCan failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL, "SendBuffersIfCan failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }        \r
     \r
@@ -328,7 +338,7 @@ BufferPool::AddToUserBuffers(
                         IRP* pIrp\r
                         )\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p \n",this);\r
     AssertLocked();\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -378,7 +388,7 @@ the user mode thread as fast as possible.
 NTSTATUS \r
 BufferPool::UsersThreadCallBack()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p \n",this);\r
     AssertLocked();\r
     ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
     IRP *pIrp = NULL;\r
@@ -394,7 +404,7 @@ BufferPool::UsersThreadCallBack()
     while (m_UserPackets.Size() > 0) {\r
         rc = GetBuffer(&pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("GetBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "GetBuffer failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }\r
 \r
@@ -415,7 +425,7 @@ BufferPool::UsersThreadCallBack()
         \r
         rc = pBufferDescriptor->WriteData((CHAR *)GetUserBuffer(pIrp) + GetCoppied(pIrp), CopySize);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pBufferDescriptor->WriteData failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "pBufferDescriptor->WriteData failed rc = 0x%x\n", rc );\r
             // free the buffer that you have\r
             rc1 = ReturnBuffer(pBufferDescriptor);\r
             ASSERT(NT_SUCCESS(rc1));\r
@@ -428,7 +438,7 @@ BufferPool::UsersThreadCallBack()
         pBufferDescriptor->SetMid(SDP_MID_DATA);\r
         rc = AddBufferToQueuedList(pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("AddBufferToQueuedList failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "AddBufferToQueuedList failed rc = 0x%x\n", rc );\r
             // free the buffer that you have\r
             rc1 = ReturnBuffer(pBufferDescriptor);\r
             ASSERT(NT_SUCCESS(rc1));\r
@@ -466,7 +476,7 @@ Cleanup:
 NTSTATUS\r
 BufferPool::SendBuffersIfCan()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
     AssertLocked();\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -475,7 +485,7 @@ BufferPool::SendBuffersIfCan()
         m_PostCreditsWhenCan = false;\r
         rc = PostCredits();\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("PostCredits failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"PostCredits failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }        \r
     }\r
@@ -488,7 +498,7 @@ BufferPool::SendBuffersIfCan()
         BufferDescriptor *pBufferDescriptor = CONTAINING_RECORD(item, BufferDescriptor , BuffersList);\r
         rc = SendBuffer(pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"SendBuffer failed rc = 0x%x\n", rc );\r
             m_FreePackets.InsertTailList(&pBufferDescriptor->BuffersList);\r
             goto Cleanup;\r
         }        \r
@@ -512,7 +522,7 @@ BufferPool::CloseSocket()
     LIST_ENTRY *item = NULL;\r
     IRP *pIrp = NULL;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL, "this = 0x%p \n",this);\r
     AssertLocked();\r
     // All IRP's that were not compleated, will be compleated as cancelled\r
     while (m_UserPackets.Size() > 0 ) {\r
@@ -534,7 +544,7 @@ BufferPool::CloseSocket()
 VOID \r
 BufferPool::ShutDown()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
 \r
     //AssertLocked();\r
     BufferDescriptor *pBufferDescriptor = NULL;\r
@@ -571,7 +581,7 @@ BufferPool::ShutDown()
 NTSTATUS\r
 BufferPool::SendBuffer(BufferDescriptor *pBufferDescriptor)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
     AssertLocked();\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -604,15 +614,13 @@ BufferPool::SendBuffer(BufferDescriptor *pBufferDescriptor)
     send_wr.ds_array = &pBufferDescriptor->ds_array;\r
 \r
 \r
-    SDP_PRINT(SDP_DEBUG, SDP_CREDITS, ("Sending buffer pHeader->recv_bufs = %d pHeader->seq_ack = %d\n", \r
-        CL_NTOH16(pHeader->recv_bufs),\r
-        CL_NTOH32(pHeader->seq_ack)\r
-        ));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_CREDITS, "Sending buffer pHeader->recv_bufs = %d pHeader->seq_ack = %d\n", CL_NTOH16(pHeader->recv_bufs),\r
+        CL_NTOH32(pHeader->seq_ack));\r
 \r
     \r
     ib_api_status_t ib_status = ib_post_send(m_qp, &send_wr, NULL);\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("ib_post_send failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"ib_post_send failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -629,7 +637,7 @@ Cleanup:
 NTSTATUS \r
 BufferPool::PostCredits()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
     AssertLocked();    \r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -644,8 +652,8 @@ BufferPool::PostCredits()
     }\r
 \r
     if (m_pSdpSocket->GetState() != SS_CONNECTED) {\r
-        SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p - Not sending credits,"\r
-            " because state = %s \n",this, SdpSocket::SS2String(m_pSdpSocket->GetState() )));        \r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL, "this = 0x%p - Not sending credits,"\r
+            " because state = %s \n",this, SdpSocket::SS2String(m_pSdpSocket->GetState() ));        \r
         // We will have to send them once we can\r
         m_PostCreditsWhenCan = true;\r
         goto Cleanup;\r
@@ -660,7 +668,7 @@ BufferPool::PostCredits()
                             SEND_BUFFERS_ALLOCATION_TAG\r
                             );\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"AllocateBuffer failed rc = 0x%x\n", rc );\r
             ASSERT(m_CreditdBufferDescriptor == NULL);\r
             goto Cleanup;\r
         }\r
@@ -673,7 +681,7 @@ BufferPool::PostCredits()
     m_CreditdBufferDescriptor->SetMid(SDP_MID_DATA);\r
     rc = SendBuffer(m_CreditdBufferDescriptor);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffer failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"SendBuffer failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
     \r
@@ -687,7 +695,7 @@ Cleanup:
 \r
 NTSTATUS BufferPool::PostDisConn()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"this = 0x%p \n",this);\r
     AssertLocked();    \r
     NTSTATUS rc = STATUS_SUCCESS;\r
     BufferDescriptor *pBufferDescriptor = NULL;\r
@@ -698,7 +706,7 @@ NTSTATUS BufferPool::PostDisConn()
                         SEND_BUFFERS_ALLOCATION_TAG\r
                         );\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"AllocateBuffer failed rc = 0x%x\n", rc );\r
         ASSERT(m_CreditdBufferDescriptor == NULL);\r
         goto Cleanup;\r
     }\r
@@ -710,7 +718,7 @@ NTSTATUS BufferPool::PostDisConn()
     pBufferDescriptor->SetMid(SDP_MID_DISCONNECT);\r
     rc = AddBufferToQueuedList(pBufferDescriptor);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AddBufferToQueuedList failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"AddBufferToQueuedList failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
        \r
index bfa8a8b..ac7108e 100644 (file)
@@ -75,7 +75,7 @@ public:
     while (current != Item) {\r
         if (current == & m_Data) {\r
             ASSERT(FALSE);\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("Object is not in the list\n"));\r
+            //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"Object is not in the list\n");\r
         }\r
         current = current->Flink;\r
     }\r
@@ -109,7 +109,7 @@ public:
         char *pStart = (char *) pBuffer + sizeof msg_hdr_bsdh;\r
         rc = CopyFromUser(pStart, pData, Size);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("CopyFromUser failed rc = 0x%x\n", rc ));\r
+            //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"CopyFromUser failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }                \r
         DataSize = Size;\r
@@ -125,7 +125,7 @@ public:
         char *pStart = (char *) pBuffer + DataStart;\r
         rc = ::CopyToUser(pData, pStart, Size);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("CopyToUser failed rc = 0x%x\n", rc ));\r
+            //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"CopyToUser failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }\r
         DataStart += Size;\r
@@ -256,7 +256,7 @@ public:
 \r
     VOID SetRemoteRecvBuf (uint16_t rRecvBuf) {\r
         if (m_rRecvBuf == 2) {\r
-            SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL,("m_rRecvBuf = %d, it is being set to %d seqnum = %d\n", m_rRecvBuf, rRecvBuf, m_SendSeq));\r
+            //SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"m_rRecvBuf = %d, it is being set to %d seqnum = %d\n", m_rRecvBuf, rRecvBuf, m_SendSeq);\r
         }\r
         ASSERT(rRecvBuf < 1000);\r
         m_rRecvBuf = rRecvBuf;\r
index fd5c869..c4df366 100644 (file)
 \r
 #include "Precompile.h"\r
 \r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpConnectionList.tmh"\r
+#endif\r
+\r
+\r
 VOID \r
 ConnectionList::Init(SdpSocket *pSdpSocket) \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     m_pSdpSocket = pSdpSocket;\r
     m_ClientWaiting = false;\r
     KeInitializeEvent(&m_WaitForConnection, NotificationEvent , FALSE );\r
@@ -51,8 +59,8 @@ ConnectionList::Init(SdpSocket *pSdpSocket)
 VOID \r
 ConnectionList::CloseSocket()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p m_WaitingClients = %s\n",\r
-    m_ClientWaiting ? "true" : "false"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL, "this = 0x%p m_WaitingClients = %s\n",this,\r
+    m_ClientWaiting ? "true" : "false");\r
     AssertLocked();\r
 \r
     if (m_ClientWaiting) {\r
@@ -67,7 +75,7 @@ ConnectionList::CloseSocket()
 VOID ConnectionList::Shutdown() \r
 {\r
     //?????AssertLocked();\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     // Go over both lists, and shutdown all their objects\r
     LIST_ENTRY *item = NULL;\r
     SdpSocket *pSocket = NULL;\r
@@ -93,7 +101,7 @@ VOID ConnectionList::Shutdown()
 bool \r
 ConnectionList::IsFull() \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     AssertLocked();\r
     int CurrentConnections = \r
         m_ReplySentConnections.Size() + m_ReadyConnections.Size();\r
@@ -103,7 +111,7 @@ ConnectionList::IsFull()
 NTSTATUS \r
 ConnectionList::AddConnectionToReplySent(SdpSocket *pNewSocket) \r
 {   \r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     AssertLocked();\r
     m_ReplySentConnections.InsertTailList(&pNewSocket->m_ListeningSocketList);\r
     pNewSocket->AddRef();\r
@@ -115,7 +123,7 @@ ConnectionList::AddConnectionToReplySent(SdpSocket *pNewSocket)
 NTSTATUS \r
 ConnectionList::VerifyConnictionInReplySent(SdpSocket *pNewSocket) \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     AssertLocked();\r
     SdpSocket *pSocket = NULL;\r
 #if DBG\r
@@ -141,7 +149,7 @@ ConnectionList::VerifyConnictionInReplySent(SdpSocket *pNewSocket)
 VOID \r
 ConnectionList::MoveConnectionFromReplyToReady(SdpSocket *pNewSocket) \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     AssertLocked();\r
     pNewSocket->AssertLocked();\r
     // just take it out from one list and put it in the other\r
@@ -154,7 +162,7 @@ ConnectionList::MoveConnectionFromReplyToReady(SdpSocket *pNewSocket)
 VOID \r
 ConnectionList::FreeWaitingIfCan() \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
     AssertLocked();\r
     if (m_ClientWaiting) {\r
         ASSERT(m_ReadyConnections.Size() > 0);\r
@@ -169,7 +177,7 @@ ConnectionList::AcceptAReadyConnection(
     KEVENT **ppEvent\r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_CONNECTION_LIST, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_CONNECTION_LIST,"this = 0x%p \n", this);\r
 \r
     ASSERT(*ppEvent == NULL);\r
     ASSERT(*ppNewSocket == NULL);\r
index 1158527..3d52f82 100644 (file)
  */\r
 \r
 // Author: Tzachi Dar\r
-\r
 #include "Precompile.h"\r
 \r
+\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpDriver.tmh"\r
+#endif\r
+\r
+\r
+\r
 SdpDriver *g_pSdpDriver = NULL;\r
 \r
 FAST_IO_DISPATCH FastIoDispatch =\r
@@ -54,7 +63,7 @@ VOID DriverUnload (
         IN PDRIVER_OBJECT      pDriverObject   \r
         ) \r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("called pDriverObject = 0x%x\n", pDriverObject ));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"called pDriverObject = 0x%x\n", (uint32_t)pDriverObject );\r
     ib_api_status_t ib_status;\r
 \r
     g_pSdpDriver->Shutdown();\r
@@ -63,7 +72,9 @@ VOID DriverUnload (
     ib_status = ib_close_al(g_pSdpDriver->m_al_handle);\r
     g_pSdpDriver->m_al_handle = NULL;\r
     ASSERT( ib_status == IB_SUCCESS);\r
-\r
+#if defined(EVENT_TRACING)\r
+    WPP_CLEANUP(pDriverObject);\r
+#endif\r
     UNICODE_STRING LinkName;\r
 \r
     RtlInitUnicodeString( &LinkName, SDP_LINK_NAME );\r
@@ -87,8 +98,10 @@ extern "C" NTSTATUS DriverEntry (
     bool LinkCreated = false;\r
     UNICODE_STRING  DevName1, LinkName;\r
     int i;\r
-\r
-    SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("called\n" ));\r
+#if defined(EVENT_TRACING)\r
+    WPP_INIT_TRACING(pDriverObject, pRegistryPath);\r
+#endif\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"called\n" );\r
 \r
     // fill the device functions\r
     pDriverObject->DriverUnload = DriverUnload;\r
@@ -114,7 +127,7 @@ extern "C" NTSTATUS DriverEntry (
                             FALSE,\r
                             &pDevObj );\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("IoCreateDevice failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"IoCreateDevice failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
     DeviceCreated =  true;\r
@@ -123,7 +136,7 @@ extern "C" NTSTATUS DriverEntry (
     rc = pSdpDriver->Init(pDevObj, pDriverObject);\r
 \r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpDriver->Init failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpDriver->Init failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
@@ -135,7 +148,7 @@ extern "C" NTSTATUS DriverEntry (
             );\r
 \r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("IoCreateSymbolicLink failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"IoCreateSymbolicLink failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
     LinkCreated = true;\r
@@ -144,7 +157,7 @@ extern "C" NTSTATUS DriverEntry (
     ib_status = ib_open_al(&pSdpDriver->m_al_handle);\r
 #pragma warning( pop )\r
     if ( ib_status != IB_SUCCESS) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("ib_open_al failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"ib_open_al failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -258,17 +271,17 @@ NTSTATUS SdpDriver::Dispatch(
     switch (pIrpSp->MajorFunction) {\r
 \r
         case IRP_MJ_CREATE: {\r
-                SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IRP_MJ_CREATE pIrpSp->FileObject = 0x%x\n", \r
-                    pIrpSp->FileObject ));\r
+                SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER, "IRP_MJ_CREATE pIrpSp->FileObject = 0x%x\n", \r
+                    (uint32_t)pIrpSp->FileObject );\r
                 pSdpUserFile = new SdpUserFile;\r
                 if (pSdpUserFile == NULL) {\r
                     rc = STATUS_NO_MEMORY;\r
-                    SDP_PRINT(SDP_ERR, SDP_DRIVER, ("new SdpUserFile failed rc = 0x%x\n", rc ));        \r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"new SdpUserFile failed rc = 0x%x\n", rc );        \r
                     goto Cleanup;\r
                 }                 \r
                 rc = pSdpUserFile->Init();\r
                 if (!NT_SUCCESS(rc)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpUserFile->Init failed rc = 0x%x\n", rc ));        \r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpUserFile->Init failed rc = 0x%x\n", rc );        \r
                     goto Cleanup;\r
                 }\r
                 // Everything went well, and windows is still using this object.\r
@@ -282,8 +295,8 @@ NTSTATUS SdpDriver::Dispatch(
         }\r
         case IRP_MJ_CLEANUP: {\r
             // All IRPs that were associated with this device should be cleaned\r
-                SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IRP_MJ_CLEANUP pIrpSp->FileObject = 0x%x\n", \r
-                    pIrpSp->FileObject ));\r
+                SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IRP_MJ_CLEANUP pIrpSp->FileObject = 0x%p\n", \r
+                    pIrpSp->FileObject );\r
                 pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
                 // The object is being shutdown, and it's cleaning should\r
                 // be started\r
@@ -300,16 +313,16 @@ NTSTATUS SdpDriver::Dispatch(
             // Receipt of this request indicates that the last handle of the file object \r
             // that is associated with the target device object has been closed and \r
             //released. All outstanding I/O requests have been completed or canceled.\r
-                SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IRP_MJ_CLOSE pIrpSp->FileObject = 0x%x\n", \r
-                    pIrpSp->FileObject ));\r
+                SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER, "IRP_MJ_CLOSE pIrpSp->FileObject = 0x%p\n", \r
+                    pIrpSp->FileObject);\r
                 pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
                 // Nothing to do, the referance count will be removed once\r
                 // we leave the function\r
             break;\r
         }\r
         case IRP_MJ_DEVICE_CONTROL: {\r
-                SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IRP_MJ_DEVICE_CONTROL pIrpSp->FileObject = 0x%x\n", \r
-                    pIrpSp->FileObject ));\r
+                SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IRP_MJ_DEVICE_CONTROL pIrpSp->FileObject = 0x%p\n", \r
+                    pIrpSp->FileObject);\r
 \r
             // IOCTLs are allowed only for user mode processes\r
             if (UserMode != pIrp->RequestorMode) {\r
@@ -370,8 +383,8 @@ NTSTATUS SdpDriver::Dispatch(
 \r
                 } __except(EXCEPTION_EXECUTE_HANDLER) {\r
                     rc = STATUS_ACCESS_VIOLATION;\r
-                    SDP_PRINT(SDP_ERR, SDP_DRIVER, ("IRP_MJ_DEVICE_CONTROL Access "\r
-                        "violition when trying to read/write data\n" ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"IRP_MJ_DEVICE_CONTROL Access "\r
+                        "violition when trying to read/write data\n");\r
                     \r
                     ASSERT(FALSE);\r
                     goto Cleanup;\r
@@ -413,8 +426,7 @@ Cleanup:
 #define VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, InStruct, OutStruct)  \\r
 if ((InputBufferLength < sizeof (InStruct)) ||                                      \\r
     (OutputBufferLength < sizeof (OutStruct))) {                                    \\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER,                                              \\r
-            ("DispatchDeviceIoControl bad buffer sizes\n" ));                       \\r
+        /*SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER, "DispatchDeviceIoControl bad buffer sizes\n" );  */                     \\r
         ASSERT(FALSE);                                                              \\r
         rc = STATUS_ACCESS_VIOLATION;                                               \\r
         goto Cleanup;                                                               \\r
@@ -427,13 +439,13 @@ SdpDriver::Init(PDEVICE_OBJECT pDevObj, PDRIVER_OBJECT  DriverObject)
     m_pDevObj = pDevObj;\r
     m_pSdpArp = new SdpArp;\r
     if (m_pSdpArp == NULL) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("new SdpArp failed \n"));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"new SdpArp failed \n");        \r
         rc = STATUS_NO_MEMORY;\r
         goto Cleanup;\r
     }\r
     rc = m_pSdpArp->Init(DriverObject);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("m_pSdpArp->Init failed rc = 0x%x\n", rc ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"m_pSdpArp->Init failed rc = 0x%x\n", rc );        \r
         goto Cleanup;\r
     }\r
     \r
@@ -478,7 +490,7 @@ SdpDriver::DispatchDeviceIoControl(
     switch (IoControlCode) {\r
         case IOCTL_WSP_SOCKET :\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_SOCKET recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_SOCKET recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspSocketIn, WspSocketOut);\r
             OutputDataSize = sizeof (WspSocketOut);\r
 \r
@@ -489,17 +501,17 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpSocket = new SdpSocket;\r
             if (pSdpSocket == NULL) {\r
                 rc = STATUS_NO_MEMORY;\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("new SdpSocket failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"new SdpSocket failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
             rc = pSdpSocket->Init(&wspSocketIn, pWspSocketOut, pSdpUserFile);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->Init failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->Init failed rc = 0x%x\n", rc );\r
                 goto Cleanup;\r
             }\r
             rc = pSdpUserFile->AddSocket(pSdpSocket);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpUserFile->AddSocket failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpUserFile->AddSocket failed rc = 0x%x\n", rc );\r
                 pSdpSocket->Shutdown();\r
                 goto Cleanup;\r
             }            \r
@@ -508,7 +520,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_CONNECT :\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_CONNECT recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_CONNECT recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspConnectIn, WspConnectOut);\r
             OutputDataSize = sizeof (WspConnectOut);\r
 \r
@@ -518,14 +530,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspConnectIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_CONNECT socket %x not found\n",wspConnectIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_CONNECT socket %p not found\n",wspConnectIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspConnectOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPConnect(&wspConnectIn, pWspConnectOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPConnect failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPConnect failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
@@ -533,7 +545,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_SEND :\r
         {\r
-            SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_SEND recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_SEND recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspSendIn, WspSendOut);\r
             OutputDataSize = sizeof (WspSendOut);\r
 \r
@@ -543,14 +555,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspSendIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_SEND socket %x not found\n",wspSendIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_SEND socket %p not found\n",wspSendIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspSendOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPSend(&wspSendIn, pWspSendOut, pIrp);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPSend failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPSend failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
@@ -558,7 +570,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_RECV :\r
         {\r
-            SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_RECV recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_RECV recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspRecvIn, WspRecvOut);\r
             OutputDataSize = sizeof (WspRecvOut);\r
 \r
@@ -568,14 +580,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspRecvIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_RECV socket %x not found\n",wspRecvIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_RECV socket %p not found\n",wspRecvIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspRecvOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPRecv(&wspRecvIn, pWspRecvOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPRecv failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPRecv failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
@@ -583,7 +595,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_BIND:\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_BIND recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_BIND recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspBindIn, WspBindOut);\r
             OutputDataSize = sizeof (WspBindOut);\r
 \r
@@ -593,14 +605,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspBindIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_BIND socket %x not found\n", wspBindIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_BIND socket %p not found\n", wspBindIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspBindOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPBind(&wspBindIn, pWspBindOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPBind failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPBind failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
@@ -608,7 +620,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_LISTEN:\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_LISTEN recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_LISTEN recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspListenIn, WspListenOut);\r
             OutputDataSize = sizeof (WspListenOut);\r
 \r
@@ -618,14 +630,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspListenIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_LISTEN socket %x not found\n",wspListenIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_LISTEN socket %p not found\n",wspListenIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspListenOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPListen(&wspListenIn, pWspListenOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPListen failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPListen failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
@@ -633,7 +645,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_ACCEPT:\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_ACCEPT recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_ACCEPT recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspAcceptIn, WspAcceptOut);\r
             OutputDataSize = sizeof (WspAcceptOut);\r
 \r
@@ -643,21 +655,21 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspAcceptIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_ACCEPT socket %x not found\n",wspAcceptIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_ACCEPT socket %p not found\n",wspAcceptIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspAcceptOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPAccept(&wspAcceptIn, pWspAcceptOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPAccept failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPAccept failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
             if (pWspAcceptOut->pAccaptedSocket != NULL) {\r
                 pAcceptedSdpSocket = (SdpSocket *) pWspAcceptOut->pAccaptedSocket;\r
                 rc = pSdpUserFile->AddSocket(pAcceptedSdpSocket);\r
                 if (!NT_SUCCESS(rc)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpUserFile->AddSocket failed rc = 0x%x\n", rc ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpUserFile->AddSocket failed rc = 0x%x\n", rc );\r
                     pAcceptedSdpSocket->Shutdown();\r
                     goto Cleanup;\r
                 }            \r
@@ -667,7 +679,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_GET_XXX_NAME:\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_GET_XXX_NAME recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_GET_XXX_NAME recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspGetSockXXIn, WspGetSockXXOut);\r
             OutputDataSize = sizeof (WspGetSockXXOut);\r
 \r
@@ -677,21 +689,21 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspGetSockXXin.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_GET_XXX_NAME socket %x not found\n", wspGetSockXXin.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_GET_XXX_NAME socket %p not found\n", wspGetSockXXin.pSocket);   \r
                // This is a well defined winsock error\r
                pWspGetSockXXOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPGetXXXName(&wspGetSockXXin, pWspGetSockXXOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPGetXXXName failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPGetXXXName failed rc = 0x%x\n", rc );        \r
                 goto Cleanup;\r
             }\r
         }\r
         break;\r
         case IOCTL_WSP_CLOSE_SOCKET :\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_CLOSE_SOCKET recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"IOCTL_WSP_CLOSE_SOCKET recieved\n" );   \r
             VERIFY_BUFFERS(InputBufferLength, OutputBufferLength, WspSocketCloseIn, WspSocketCloseOut);\r
             OutputDataSize = sizeof (WspSocketCloseOut);\r
 \r
@@ -701,14 +713,14 @@ SdpDriver::DispatchDeviceIoControl(
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
             pSdpSocket = pSdpUserFile->SocketByPointer(wspSocketCloseIn.pSocket);\r
             if (pSdpSocket == NULL) {\r
-               SDP_PRINT(SDP_DEBUG, SDP_DRIVER, ("IOCTL_WSP_CLOSE_SOCKET socket %x not found\n",wspSocketCloseIn.pSocket));   \r
+               SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER,"IOCTL_WSP_CLOSE_SOCKET socket %p not found\n",wspSocketCloseIn.pSocket);   \r
                // This is a well defined winsock error\r
                pWspSocketCloseOut->Errno = WSAENOTSOCK;\r
                goto Cleanup;\r
             }\r
             rc = pSdpSocket->WSPCloseSocket(&wspSocketCloseIn, pWspSocketCloseOut);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_DRIVER, ("pSdpSocket->WSPCloseSocket failed rc = 0x%x\n", rc ));        \r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"pSdpSocket->WSPCloseSocket failed rc = 0x%x\n", rc );        \r
                 goto Cleanup; \r
             }\r
         }\r
@@ -716,7 +728,7 @@ SdpDriver::DispatchDeviceIoControl(
 \r
         case IOCTL_WSP_USER_THREAD :\r
         {\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("IOCTL_WSP_USER_THREAD recieved\n" ));   \r
+            SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_DRIVER, "IOCTL_WSP_USER_THREAD recieved\n" );   \r
             pSdpUserFile = (SdpUserFile *)pIrpSp->FileObject->FsContext;\r
 \r
             /* Ignore Error = */ pSdpUserFile->UsersThread();\r
@@ -726,7 +738,7 @@ SdpDriver::DispatchDeviceIoControl(
     default:\r
         // This is an unrecgnized IOCTL\r
         ASSERT(FALSE);\r
-        SDP_PRINT(SDP_ERR, SDP_DRIVER, ("unknow IOCTL code = 0x%x\n", IoControlCode ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_DRIVER,"unknow IOCTL code = 0x%x\n", IoControlCode );\r
         rc = STATUS_INVALID_PARAMETER;\r
         goto Cleanup;\r
 \r
@@ -746,7 +758,7 @@ Cleanup:
 VOID \r
 SdpDriver::AddThread(ThreadHandle *pThreadHandle)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("this = 0x%x\n", this ));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"this = 0x%p\n", this );\r
     // Check if there is any next thread that can be removed from the queue\r
     LARGE_INTEGER  WaitTime;\r
     WaitTime.QuadPart = 0; // Don't wait for them to die\r
@@ -764,7 +776,7 @@ SdpDriver::AddThread(ThreadHandle *pThreadHandle)
 VOID \r
 SdpDriver::WaitForAllThreadsToDie()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("this = 0x%x\n", this ));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"this = 0x%p\n", this );\r
 \r
     ExAcquireFastMutex(&m_ThreadsMutex);\r
     // Timeout of null will cause a wait forever\r
@@ -777,7 +789,7 @@ SdpDriver::WaitForAllThreadsToDie()
 VOID \r
 SdpDriver::WaitForThreadsToDie(LARGE_INTEGER  *pWaitTime)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("this = 0x%x\n", this ));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"this = 0x%p\n", this );\r
     // Check if there is any next thread that can be removed from the queue\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -799,12 +811,12 @@ SdpDriver::WaitForThreadsToDie(LARGE_INTEGER  *pWaitTime)
 \r
         if (rc == STATUS_TIMEOUT) {\r
             // Nothing that we should do, the thread is not ready yet\r
-            SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("this = 0x%x Former thread is not dead yet\n", this ));\r
+            SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"this = 0x%p Former thread is not dead yet\n", this );\r
             break;\r
         }\r
         // SUCESS means that the thread is dead, we can remove it\r
         // from the list\r
-        SDP_PRINT(SDP_TRACE, SDP_DRIVER, ("this = 0x%x Former thread is already dead\n", this ));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_DRIVER,"this = 0x%p Former thread is already dead\n", this );\r
 \r
         m_ShutDownThreads.RemoveHeadList();\r
         ObDereferenceObject(pNextThreadHandle->ThreadObject);\r
index 651fb54..7762688 100644 (file)
 \r
 #include "Precompile.h"\r
 \r
-//#define DONT_COPY_DATA\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpGenUtils.tmh"\r
+#endif\r
 \r
 USHORT ntohs(USHORT in)\r
 {\r
@@ -86,7 +91,7 @@ NTSTATUS
         );\r
         if (!NT_SUCCESS(rc)) {\r
             ASSERT(FALSE);\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("KeWaitForSingleObject failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"KeWaitForSingleObject failed rc = 0x%x\n", rc );\r
             // No meter what we do the program can't continue, let's crush it\r
             int *i = NULL;\r
             *i = 5;\r
@@ -100,11 +105,11 @@ NTSTATUS
         if (rc != STATUS_USER_APC) {\r
             break;\r
         } else {\r
-            SDP_PRINT(SDP_WARN, SDP_SOCKET, ("KeWaitForSingleObject was stoped because of STATUS_USER_APC\n" ));\r
+            SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"KeWaitForSingleObject was stoped because of STATUS_USER_APC\n" );\r
         }\r
     }\r
     if (i == 20) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("!!!! KeWaitForSingleObject was Exhausted STATUS_USER_APC\n" ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"!!!! KeWaitForSingleObject was Exhausted STATUS_USER_APC\n" );\r
         // This is probably fine if we are runnign for a user thread\r
         ASSERT((WaitReason == UserRequest) && (WaitMode == UserMode));\r
     }\r
@@ -135,7 +140,7 @@ CopyFromUser(
     }\r
     __except(EXCEPTION_EXECUTE_HANDLER)\r
     {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("copying memory from user failed\n"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"copying memory from user failed\n");\r
         ASSERT(FALSE);        \r
         return STATUS_ACCESS_DENIED;\r
     }\r
@@ -166,7 +171,7 @@ CopyToUser(
     }\r
     __except(EXCEPTION_EXECUTE_HANDLER)\r
     {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("copying memory from user failed\n"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"copying memory from user failed\n");\r
         ASSERT(FALSE);        \r
         return STATUS_ACCESS_DENIED;\r
     }\r
@@ -202,14 +207,14 @@ NTSTATUS Sleep(ULONG HandredNanos)
 \r
     LARGE_INTEGER  Timeout = TimeFromLong(HandredNanos);\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("Before Sleep\n"));                        \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"Before Sleep\n");                        \r
     rc = MyKeWaitForSingleObject(\r
             &Event,\r
             UserRequest,\r
             UserMode,\r
             FALSE,\r
             &Timeout);                        \r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("After Sleep rc = 0x%x\n", rc));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"After Sleep rc = 0x%x\n", rc);\r
     return rc;\r
 \r
 }\r
index 4f8d122..5637044 100644 (file)
@@ -141,7 +141,7 @@ public:
                 KeReleaseSpinLock(&m_SpinLock, OldIrql);\r
                 rc = MyKeWaitForSingleObject(&m_Event, UserRequest, UserMode, false, NULL);\r
                 if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) {\r
-                    SDP_PRINT(SDP_WARN, SDP_LOCK, ("MyKeWaitForSingleObject was alerted = 0x%x\n", rc ));\r
+                    //SDP_PRINT(TRACE_LEVEL_WARNING, SDP_LOCK,"MyKeWaitForSingleObject was alerted = 0x%x\n", rc );\r
                     rc = STATUS_UNEXPECTED_IO_ERROR;\r
                     Locked = false;\r
                     goto Cleanup;\r
@@ -159,7 +159,7 @@ public:
             KeReleaseSpinLock(&m_SpinLock, OldIrql);\r
             rc = HandleFlags(OldFlags);\r
             if(!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_LOCK, ("HandleFlags failed rc = 0x%x\n", rc ));\r
+                //SDP_PRINT(SDP_ERR, SDP_LOCK, ("HandleFlags failed rc = 0x%x\n", rc ));\r
             }\r
             if ((Force == false) && \r
                  (!NT_SUCCESS(rc) ||\r
@@ -168,7 +168,7 @@ public:
                  )) {\r
                 // We have to signal the error to the calling side\r
                 if(!NT_SUCCESS(rc1)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_LOCK, ("m_CheckSocketState failed rc1 = 0x%x\n", rc1 ));\r
+                    //SDP_PRINT(SDP_ERR, SDP_LOCK, ("m_CheckSocketState failed rc1 = 0x%x\n", rc1 ));\r
                 }\r
                 Locked = false;\r
                 KeAcquireSpinLock(&m_SpinLock, &OldIrql);\r
@@ -185,7 +185,7 @@ public:
         } while (true);\r
         \r
 Cleanup:\r
-        SDP_PRINT(SDP_DEBUG, SDP_LOCK,("Lock is returing %s\n", Locked ? "true" : "false"));\r
+        //SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_LOCK,"Lock is returing %s\n", Locked ? "true" : "false");\r
         return Locked;\r
     }\r
 \r
@@ -233,7 +233,7 @@ Cleanup:
             rc = HandleFlags(OldFlags); \r
             if (!NT_SUCCESS(rc)) {\r
                 // We have to signal the error to the calling side\r
-                SDP_PRINT(SDP_ERR, SDP_LOCK, ("HandleFlags failed rc = 0x%x\n", rc ));\r
+                //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_LOCK,"HandleFlags failed rc = 0x%x\n", rc );\r
                 ASSERT(m_flags & ERROR_SIGNALLED);\r
             }\r
             // At the time that we were handeling the flags, someone might have \r
@@ -276,7 +276,7 @@ Cleanup:
             rc = HandleFlags(OldFlags); \r
             if (!NT_SUCCESS(rc)) {\r
                 // We have to signal the error to the calling side\r
-                SDP_PRINT(SDP_ERR, SDP_LOCK, ("HandleFlags failed rc = 0x%x\n", rc ));\r
+                //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_LOCK,"HandleFlags failed rc = 0x%x\n", rc );\r
                 ASSERT(m_flags & ERROR_SIGNALLED);\r
             }\r
             KeAcquireSpinLock(&m_SpinLock, &OldIrql);\r
@@ -309,7 +309,7 @@ Cleanup:
             // We need to handle the send CB\r
             rc = m_SendCBHandler(m_pSdpSocket);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_SendCBHandler failed rc = 0x%x\n", rc ));\r
+                //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"m_SendCBHandler failed rc = 0x%x\n", rc );\r
                 m_flags |= ERROR_SIGNALLED;\r
                 // We continue from here since, there might be other things to handle,\r
                 // and this might be in a DPC context\r
@@ -319,7 +319,7 @@ Cleanup:
             // We need to handle the send CB\r
             rc = m_RecvCBHandler(m_pSdpSocket);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_RecvCBHandler failed rc = 0x%x\n", rc ));\r
+                //SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"m_RecvCBHandler failed rc = 0x%x\n", rc );\r
                 m_flags |= ERROR_SIGNALLED;\r
                 // We continue from here since, there might be other things to handle,\r
                 // and this might be in a DPC context\r
index 333f7f4..edbacaa 100644 (file)
 \r
 #include "preCompile.h"\r
 \r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpRecvPool.tmh"\r
+#endif\r
+\r
+\r
+\r
 RecvPool::RecvPool()\r
 {\r
     m_RecvSeq = 0;\r
@@ -57,7 +66,7 @@ RecvPool::Init(
     SdpSocket *pSdpSocket\r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n", pSdpSocket));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"this = 0x%p \n", m_pSdpSocket);\r
     m_MaxBuffers = MaxBuffers;\r
     m_MaxConcurrentRecieves = MaxConcurrentRecieves;\r
     m_MaxMessageSize = MaxMessageSize;        \r
@@ -78,7 +87,7 @@ RecvPool::Init(
     for (int i=0;i < MAX_RECV_PACKETS; i++) {\r
         rc = BufferDescriptor::AllocateBuffer(&pBufferDescriptor, m_MaxMessageSize, RECV_BUFFERS_ALLOCATION_TAG);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("BufferDescriptor::AllocateBuffer failed rc=0x%x \n", rc));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"BufferDescriptor::AllocateBuffer failed rc=0x%x \n", rc);\r
             goto Cleanup;\r
         }\r
 \r
@@ -108,8 +117,8 @@ Cleanup:
 NTSTATUS\r
 RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p pBufferDescriptor = 0x%p sucess = %s\n"\r
-        ,m_pSdpSocket, pBufferDescriptor, error ? "false" : "true"));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p pBufferDescriptor = 0x%p sucess = %s\n"\r
+        ,m_pSdpSocket, pBufferDescriptor, error ? "false" : "true");\r
     AssertLocked();\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -143,11 +152,11 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error)
                 abs (\r
                     (int)m_pSdpSocket->m_SendBufferPool.GetSendSeq()- \r
                     (int)pHeader->seq_ack);\r
-    SDP_PRINT(SDP_DEBUG, SDP_CREDITS,("SetRemoteRecvBuf rRecvBuf = %d, pHeader->recv_bufs = %d, SendSeq = %d , pHeader->seq_ack = %d\n",\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_CREDITS,"SetRemoteRecvBuf rRecvBuf = %d, pHeader->recv_bufs = %d, SendSeq = %d , pHeader->seq_ack = %d\n",\r
         rRecvBuf,\r
         pHeader->recv_bufs,\r
         (int)m_pSdpSocket->m_SendBufferPool.GetSendSeq(),\r
-        (int)pHeader->seq_ack));\r
+        (int)pHeader->seq_ack);\r
     m_pSdpSocket->m_SendBufferPool.SetRemoteRecvBuf(rRecvBuf);\r
 \r
     // m_DisConnRecieved is the last "real" message that should be recieved\r
@@ -193,7 +202,7 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error)
                                                  SDP_RECV_CREDIT_UPDATE) {\r
         rc = m_pSdpSocket->m_SendBufferPool.PostCredits();\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }                \r
     }\r
@@ -201,14 +210,14 @@ RecvPool::RecievedBuffer(BufferDescriptor *pBufferDescriptor, bool error)
     // Wake up the clients of the send (new credits were added)\r
     rc = m_pSdpSocket->m_SendBufferPool.SendBuffersIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("SendBuffersIfCan failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"SendBuffersIfCan failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }        \r
     // We might be able to post a new recieve buffer now\r
     ASSERT(m_CurrentlyPostedRecievedBuffers < m_MaxConcurrentRecieves);\r
     rc = ReceiveIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("RecieveIfCan failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"RecieveIfCan failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 Cleanup:\r
@@ -240,8 +249,8 @@ RecvPool::GetData(
     bool *pNoMoreData\r
     )\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p FirstBuffer = %s\n", m_pSdpSocket,\r
-        FirstBuffer ? "TRUE" : "FALSE"));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p FirstBuffer = %s\n", m_pSdpSocket,\r
+        FirstBuffer ? "TRUE" : "FALSE");\r
     AssertLocked();\r
     bool BufferFreed = false;\r
     *Copied = 0;\r
@@ -277,7 +286,7 @@ RecvPool::GetData(
                 ASSERT(CopySize > *Copied);\r
                 rc = pBufferDescriptor->CopyToUser(pData + *Copied, CopySize - *Copied);\r
                 if (!NT_SUCCESS(rc)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("pBufferDescriptor->CopyToUser failed rc = 0x%x\n", rc ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"pBufferDescriptor->CopyToUser failed rc = 0x%x\n", rc );\r
                     goto Cleanup;\r
                 }\r
                 *Copied += CopySize - *Copied;\r
@@ -286,7 +295,7 @@ RecvPool::GetData(
                 // We copy the entire buffer and remove it\r
                 rc = pBufferDescriptor->CopyToUser(pData + *Copied, OldDataSize);\r
                 if (!NT_SUCCESS(rc)) {\r
-                    SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("pBufferDescriptor->CopyToUser failed rc = 0x%x\n", rc ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"pBufferDescriptor->CopyToUser failed rc = 0x%x\n", rc );\r
                     goto Cleanup;\r
                 }\r
                 *Copied += OldDataSize;\r
@@ -325,7 +334,7 @@ Cleanup:
 VOID \r
 RecvPool::AllowOthersToGet()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n", m_pSdpSocket));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p \n", m_pSdpSocket);\r
     ASSERT(m_ClientBeingServed == true);\r
     m_ClientBeingServed = false;\r
 \r
@@ -336,8 +345,8 @@ RecvPool::AllowOthersToGet()
 NTSTATUS \r
 RecvPool::ReceiveIfCan()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p m_CurrentlyPostedRecievedBuffers = %d m_LocaleAdvertisedBuffers = %d\n",\r
-        m_pSdpSocket, m_CurrentlyPostedRecievedBuffers, m_LocaleAdvertisedBuffers));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL, "this = 0x%p m_CurrentlyPostedRecievedBuffers = %d m_LocaleAdvertisedBuffers = %d\n",\r
+        m_pSdpSocket, m_CurrentlyPostedRecievedBuffers, m_LocaleAdvertisedBuffers);\r
     AssertLocked();\r
     BufferDescriptor *pBufferDescriptor = NULL;\r
     NTSTATUS rc = STATUS_SUCCESS;\r
@@ -353,7 +362,7 @@ RecvPool::ReceiveIfCan()
             // We can allocate more buffers\r
             rc = BufferDescriptor::AllocateBuffer(&pBufferDescriptor, m_MaxMessageSize, RECV_BUFFERS_ALLOCATION_TAG);\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("AllocateBuffer failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"AllocateBuffer failed rc = 0x%x\n", rc );\r
                 goto Cleanup;\r
             }\r
             m_CurrentlyAllocated++;\r
@@ -367,7 +376,7 @@ RecvPool::ReceiveIfCan()
         rc = PostReceiveBuffer(pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
             m_FreePackets.InsertTailList(&pBufferDescriptor->BuffersList);\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("PostReceiveBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"PostReceiveBuffer failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }        \r
     }\r
@@ -376,7 +385,7 @@ RecvPool::ReceiveIfCan()
         // other side that he has more credits\r
         rc = m_pSdpSocket->m_SendBufferPool.PostCredits();\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"m_SendBufferPool.PostCredits failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }        \r
     }\r
@@ -395,7 +404,7 @@ RecvPool::ShutDown()
 {\r
     // Lock is not taken here, but we should be gurantied that no\r
     // one can be racing us in here\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p \n", m_pSdpSocket));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL,"this = 0x%p \n", m_pSdpSocket);\r
     BufferDescriptor *pBufferDescriptor = NULL;\r
     LIST_ENTRY *item = NULL;\r
 \r
@@ -421,10 +430,10 @@ RecvPool::ShutDown()
 VOID \r
 RecvPool::CloseSocket()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_BUFFER_POOL, ("this = 0x%p m_WaitingClients = %s waiting buffer = %d\n",\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_BUFFER_POOL, "this = 0x%p m_WaitingClients = %s waiting buffer = %d\n",\r
         this,\r
         m_ClientWaiting ? "true" : "false",\r
-        m_FullPackets.Size())\r
+        m_FullPackets.Size()\r
         );\r
     AssertLocked();\r
 \r
@@ -439,7 +448,7 @@ RecvPool::CloseSocket()
 NTSTATUS \r
 RecvPool::PostReceiveBuffer(BufferDescriptor *pBufferDescriptor)\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_BUFFER_POOL, ("this = 0x%p \n", m_pSdpSocket));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_BUFFER_POOL,"this = 0x%p \n", m_pSdpSocket);\r
     AssertLocked();\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
@@ -455,7 +464,7 @@ RecvPool::PostReceiveBuffer(BufferDescriptor *pBufferDescriptor)
     \r
     ib_api_status_t ib_status = ib_post_recv(m_qp, &recv_wr, NULL);\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_BUFFER_POOL, ("ib_post_recv failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_BUFFER_POOL,"ib_post_recv failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
index 6511800..81f6328 100644 (file)
 // Author: Tzachi Dar\r
 \r
 #include "Precompile.h"\r
+\r
 #pragma warning(disable: 4244 ) \r
 \r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpSocket.tmh"\r
+#endif\r
+\r
+\r
 NTSTATUS sdp_cm_hello_ack_check(struct sdp_msg_hello_ack *hello_ack);\r
 NTSTATUS sdp_cm_hello_check(struct sdp_msg_hello *msg_hello);\r
 static NTSTATUS __send_cb2(SdpSocket * pSdpSocket);\r
@@ -42,7 +51,7 @@ static NTSTATUS __accept_requests(SdpSocket * pSdpSocket);
 static void AL_API\r
 cm_rej_callback(IN ib_cm_rej_rec_t *p_cm_rej_rec )\r
 {\r
-    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("dispatch level = %d\n", KeGetCurrentIrql()));\r
+    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"dispatch level = %d\n", KeGetCurrentIrql());\r
     // BUGBUG: This should be used to return error to the connecting side\r
 }\r
 \r
@@ -58,7 +67,7 @@ static void AL_API
 cm_mra_callback(\r
     IN  ib_cm_mra_rec_t                                *p_cm_mra_rec )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("cm_mra_callback called"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"cm_mra_callback called");\r
     ASSERT(FALSE);\r
 }\r
 \r
@@ -70,7 +79,7 @@ static void AL_API
 cm_apr_callback(\r
     IN  ib_cm_apr_rec_t     *p_cm_apr_rec )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("cm_apr_callback called"));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"cm_apr_callback called");\r
     ASSERT(FALSE);\r
 }\r
 \r
@@ -85,7 +94,7 @@ static void AL_API
 cm_lap_callback(\r
     IN          ib_cm_lap_rec_t *p_cm_lap_rec )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("dispatch level = %d\n", KeGetCurrentIrql()));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"dispatch level = %d\n", KeGetCurrentIrql());\r
     ASSERT(FALSE);\r
 }\r
 \r
@@ -93,7 +102,7 @@ void
 cm_rtu_callback(\r
     IN          ib_cm_rtu_rec_t *p_cm_rtu_rec )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("dispatch level = %d\n", KeGetCurrentIrql()));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"dispatch level = %d\n", KeGetCurrentIrql());\r
     // Note - Referance count is not increased here since this is a call\r
     // back, and we are gurantied that shuting down ibal will only end\r
     // after all callbacks are finished.\r
@@ -173,7 +182,7 @@ NTSTATUS SdpSocket::Init(
     SdpUserFile *pSdpUserFile)\r
 {\r
     NTSTATUS rc = STATUS_SUCCESS;\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
 \r
     m_CreationFlags = pSocketInParam->dwFlags;\r
 \r
@@ -189,7 +198,7 @@ NTSTATUS SdpSocket::Init(
     // we won't be in trouble after the thread was created\r
     m_pCloseSocketThread = new ThreadHandle;\r
     if (m_pCloseSocketThread == NULL) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to allocate new SocketThread this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to allocate new SocketThread this = 0x%p \n",this);\r
         rc = STATUS_NO_MEMORY;\r
         goto Cleanup;\r
     }\r
@@ -218,7 +227,7 @@ NTSTATUS SdpSocket::WSPSend(
         IRP          *pIrp\r
         )\r
 {    \r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p size = %d \n",this, pWspSendIn->BufferSize));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"this = 0x%p size = %d \n",this, pWspSendIn->BufferSize);\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;    \r
     BufferDescriptor * pBufferDescriptor = NULL;\r
@@ -231,21 +240,20 @@ NTSTATUS SdpSocket::WSPSend(
     // For zero bytes send we currently don't do anything and return with status \r
     // success\r
     if (pWspSendIn->BufferSize == 0) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("this = 0x%p - zero size send \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"this = 0x%p - zero size send \n",this);\r
         goto Cleanup;\r
     }\r
 \r
     if (!m_Lock.Lock()) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "Failed to lock this = 0x%p \n",this);\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         goto Cleanup;\r
     }\r
 \r
     if ((m_state != SS_CONNECTED)) {\r
         // We can not send now.\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("Can't send now, m_state = %s\n",\r
-            SS2String(m_state)\r
-        ));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"Can't send now, m_state = %s\n",\r
+            SS2String(m_state));\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         pWspSendOut->Errno = WSAENOTCONN;\r
             \r
@@ -268,7 +276,7 @@ NTSTATUS SdpSocket::WSPSend(
         if (!NT_SUCCESS(rc)) {\r
             // No need to complete the IRP, as it will be be deleted\r
             // when all other IRPs will be\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "m_Lock.Unlock() failed rc = 0x%x\n", rc );\r
             goto Cleanup;\r
         }\r
         // This IRP will be pending (make sure to change this after the unlock)\r
@@ -285,7 +293,7 @@ NTSTATUS SdpSocket::WSPSend(
 \r
         rc = m_SendBufferPool.GetBuffer(&pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.GetBuffer failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_SendBufferPool.GetBuffer failed rc = 0x%x\n", rc );\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
         }\r
@@ -305,7 +313,7 @@ NTSTATUS SdpSocket::WSPSend(
 \r
             rc = m_Lock.Unlock();\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
                 // No need to complete the IRP, as it will be be deleted\r
                 // when all other IRPs will be\r
                 goto Cleanup;\r
@@ -319,7 +327,7 @@ NTSTATUS SdpSocket::WSPSend(
         \r
         rc = pBufferDescriptor->WriteData(pWspSendIn->pData + Coppied, CopySize);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pBufferDescriptor->WriteData failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pBufferDescriptor->WriteData failed rc = 0x%x\n", rc );\r
             // free the buffer that you have\r
             rc1 = m_SendBufferPool.ReturnBuffer(pBufferDescriptor);\r
             ASSERT(NT_SUCCESS(rc1));\r
@@ -332,7 +340,7 @@ NTSTATUS SdpSocket::WSPSend(
         pBufferDescriptor->SetMid(SDP_MID_DATA);\r
         rc = m_SendBufferPool.AddBufferToQueuedList(pBufferDescriptor);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.AddBufferToQueuedList failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_SendBufferPool.AddBufferToQueuedList failed rc = 0x%x\n", rc );\r
             // free the buffer that you have\r
             rc1 = m_SendBufferPool.ReturnBuffer(pBufferDescriptor);\r
             ASSERT(NT_SUCCESS(rc1));\r
@@ -343,7 +351,7 @@ NTSTATUS SdpSocket::WSPSend(
     \r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
 \r
@@ -363,7 +371,7 @@ Cleanup:
             // Some default value\r
             pWspSendOut->Errno = WSAENOBUFS;\r
         }\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("this = 0x%p rc = 0x%x\n",this, rc));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "this = 0x%p rc = 0x%x\n",this, rc);\r
         // is indeed the case.\r
     }\r
     return rc;\r
@@ -375,7 +383,7 @@ SdpSocket::WSPRecv(
         WspRecvOut   *pWspRecvOut\r
         )\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p BufferSize = %d\n",this, pWspRecvIn->BufferSize));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"this = 0x%p BufferSize = %d\n",this, pWspRecvIn->BufferSize);\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;\r
     bool First = true;\r
@@ -385,13 +393,13 @@ SdpSocket::WSPRecv(
     bool NoMoreData;\r
 \r
     if (pWspRecvIn->BufferSize == 0) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("this = 0x%p - zero size recv \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"this = 0x%p - zero size recv \n",this);\r
         goto Cleanup;\r
     }\r
 \r
     while (Coppied < pWspRecvIn->BufferSize) {\r
         if ((Locked == false) && !m_Lock.Lock()) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
             rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
             goto Cleanup;\r
         }\r
@@ -400,9 +408,8 @@ SdpSocket::WSPRecv(
 \r
         if ((m_state != SS_CONNECTED && m_state!= SS_CONNECTED_DREP_SENT ) ) {\r
             // We can not recv now.\r
-            SDP_PRINT(SDP_WARN, SDP_SOCKET, ("Can't recv now, m_state = %s this = %p\n",\r
-                SS2String(m_state), this\r
-            ));\r
+            SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "Can't recv now, m_state = %s this = %p\n",\r
+                SS2String(m_state), this);\r
             rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
             pWspRecvOut->Errno = WSAENOTCONN;\r
                 \r
@@ -420,7 +427,7 @@ SdpSocket::WSPRecv(
             &NoMoreData\r
             );\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_RecvBufferPool.GetData failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_RecvBufferPool.GetData failed rc = 0x%x\n", rc );\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             Locked = false;\r
             goto Cleanup;\r
@@ -441,7 +448,7 @@ SdpSocket::WSPRecv(
             rc = m_Lock.Unlock();\r
             Locked = false;\r
             if (!NT_SUCCESS(rc)) {\r
-                SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
                 goto Cleanup;\r
             }\r
 \r
@@ -456,7 +463,7 @@ SdpSocket::WSPRecv(
             if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) {\r
                 // BUGBUG: Think what to do here, we should be able to stop the\r
                 // connect, and quit (probably shutdown should be enough)\r
-                SDP_PRINT(SDP_WARN, SDP_SOCKET, ("MyKeWaitForSingleObject was alerted rc = 0x%x\n", rc ));\r
+                SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"MyKeWaitForSingleObject was alerted rc = 0x%x\n", rc );\r
                 rc = STATUS_UNEXPECTED_IO_ERROR;\r
                 //pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
                 Shutdown();\r
@@ -469,7 +476,7 @@ SdpSocket::WSPRecv(
     ASSERT(Locked == true);\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
 \r
@@ -488,7 +495,7 @@ Cleanup:
     }\r
     // Currently in any case, the flags are not being used:\r
     pWspRecvOut->dwFlags = 0;\r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p returning %d bytes \n",this, pWspRecvOut->NumberOfBytesRecieved));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"this = 0x%p returning %d bytes \n",this, pWspRecvOut->NumberOfBytesRecieved);\r
     return rc;\r
 \r
 }\r
@@ -505,19 +512,19 @@ NTSTATUS SdpSocket::WSPConnect(
     ib_path_rec_t path_rec;\r
     ULONG SrcIp = 0;\r
         \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p remote addresses ip=%d.%d.%d.%d:%d\n",\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "this = 0x%p remote addresses ip=%d.%d.%d.%d:%d\n",\r
         this,\r
         (pWspConnectIn->DestIP & 0XFF000000) >> 24,\r
         (pWspConnectIn->DestIP & 0XFF0000) >> 16,\r
         (pWspConnectIn->DestIP & 0XFF00) >> 8,\r
         (pWspConnectIn->DestIP & 0XFF),\r
         pWspConnectIn->DestPort\r
-        ));\r
+        );\r
 \r
     if((pWspConnectIn->DestIP == 0) || \r
         (pWspConnectIn->DestPort == 0) ||\r
         (pWspConnectIn->SrcIP == 0)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Invalid Addresses"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Invalid Addresses");\r
         pWspConnectOut->Errno = WSAEADDRNOTAVAIL;\r
         goto Cleanup;\r
     }\r
@@ -526,9 +533,8 @@ NTSTATUS SdpSocket::WSPConnect(
     m_Lock.Lock();//??? retval\r
     if ((m_state != SS_IDLE)) {\r
         // We can not connect in this state \r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("Can't send now, m_state = %s\n",\r
-            SS2String(m_state)\r
-        ));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "Can't send now, m_state = %s\n",\r
+            SS2String(m_state));\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         pWspConnectOut->Errno = WSAENOTCONN;\r
 \r
@@ -557,7 +563,7 @@ NTSTATUS SdpSocket::WSPConnect(
     if (m_SrcPort == 0) {\r
        rc = g_pSdpDriver->m_pSdpArp->GetPort(m_SrcIp, &m_SrcPort);\r
        if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->GetPort failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->GetPort failed rc = 0x%x\n", rc );\r
             pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
@@ -569,7 +575,7 @@ NTSTATUS SdpSocket::WSPConnect(
     \r
     rc = g_pSdpDriver->m_pSdpArp->SourcePortGidFromIP(SrcIp, &m_SrcPortGuid, &m_SrcCaGuid);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
         goto Cleanup;\r
@@ -577,7 +583,7 @@ NTSTATUS SdpSocket::WSPConnect(
 \r
     rc = g_pSdpDriver->m_pSdpArp->DestPortGidFromMac(m_SrcPortGuid, pWspConnectIn->DestMac, &DestPortGid);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->DestPortGidFromIP failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->DestPortGidFromIP failed rc = 0x%x\n", rc );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
         goto Cleanup;\r
@@ -593,7 +599,7 @@ NTSTATUS SdpSocket::WSPConnect(
 \r
     rc = g_pSdpDriver->m_pSdpArp->QueryPathRecord( m_SrcPortGuid, DestPortGid, &path_rec );\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->QueryPathRecord failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->QueryPathRecord failed rc = 0x%x\n", rc );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         goto Cleanup;\r
     }\r
@@ -601,14 +607,14 @@ NTSTATUS SdpSocket::WSPConnect(
 \r
     // Verify that we are in the correct state (just looking - without the lock)\r
     if (m_state != SS_CONNECTING_QPR_SENT) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("wrong state after QueryPathRecord\n" ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"wrong state after QueryPathRecord\n" );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         goto Cleanup;\r
     }\r
 \r
     rc = CreateQp();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("CreateQp failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"CreateQp failed rc = 0x%x\n", rc );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         goto Cleanup;\r
     }    \r
@@ -630,7 +636,7 @@ NTSTATUS SdpSocket::WSPConnect(
     \r
     ib_status = ib_cm_req( &cm_req );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_req failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_req failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         goto Cleanup;\r
@@ -646,7 +652,7 @@ NTSTATUS SdpSocket::WSPConnect(
     if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) {\r
         // BUGBUG: Think what to do here, we should be able to stop the\r
         // connect, and quit (probably shutdown should be enough)\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("MyKeWaitForSingleObject was alerted rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"MyKeWaitForSingleObject was alerted rc = 0x%x\n", rc );\r
         rc = STATUS_UNEXPECTED_IO_ERROR;\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         Shutdown();\r
@@ -661,7 +667,7 @@ NTSTATUS SdpSocket::WSPConnect(
 \r
     rc = CmSendRTU();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("CmSendRTU failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"CmSendRTU failed rc = 0x%x\n", rc );\r
         pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
         goto Cleanup;\r
     }    \r
@@ -687,8 +693,8 @@ Cleanup:
     ASSERT(((pWspConnectOut->Errno == 0) && (NT_SUCCESS(rc))) |\r
            ((pWspConnectOut->Errno != 0) && (!NT_SUCCESS(rc))));\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("connect is returning %s this = 0x%p\n",\r
-        NT_SUCCESS(rc) ? "SUCCESS" : "FAILURE", this ));    \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"connect is returning %s this = 0x%p\n",\r
+        NT_SUCCESS(rc) ? "SUCCESS" : "FAILURE", this);    \r
     return rc;\r
 \r
 }\r
@@ -701,26 +707,25 @@ SdpSocket::WSPBind(
 {\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p bind address ip=%d.%d.%d.%d:%d\n",\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "this = 0x%p bind address ip=%d.%d.%d.%d:%d\n",\r
         this,\r
         (pWspBindIn->IP & 0XFF000000) >> 24,\r
         (pWspBindIn->IP & 0XFF0000) >> 16,\r
         (pWspBindIn->IP & 0XFF00) >> 8,\r
         (pWspBindIn->IP & 0XFF),\r
         pWspBindIn->Port\r
-        ));\r
+        );\r
 \r
     if (!m_Lock.Lock()) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         goto Cleanup;\r
     }\r
 \r
     /* Verify the state of the socket */\r
     if( m_state != SS_IDLE) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("socket is in invalid state %s this = 0x%p \n",\r
-            this, \r
-            SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "socket is in invalid state %s this = 0x%p \n",\r
+             SS2String(m_state),this );\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
         rc = STATUS_INVALID_DEVICE_STATE;\r
         pWspBindOut->Errno = WSAEINVAL;\r
@@ -734,7 +739,7 @@ SdpSocket::WSPBind(
         ASSERT(m_SrcCaGuid == NULL);\r
         rc = g_pSdpDriver->m_pSdpArp->SourcePortGidFromIP(pWspBindIn->IP, &m_SrcPortGuid, &m_SrcCaGuid);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc );\r
             pWspBindOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
@@ -749,7 +754,7 @@ SdpSocket::WSPBind(
         /* Time to allocate our IB QP */\r
         rc = CreateQp();\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("CreateQp failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"CreateQp failed rc = 0x%x\n", rc );\r
             pWspBindOut->Errno = WSAENOBUFS;\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
@@ -761,7 +766,7 @@ SdpSocket::WSPBind(
         m_SrcPort = 0;\r
         rc = g_pSdpDriver->m_pSdpArp->GetPort(pWspBindIn->IP, &m_SrcPort);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->GetPort failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->GetPort failed rc = 0x%x\n", rc );\r
             pWspBindOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
@@ -778,7 +783,7 @@ SdpSocket::WSPBind(
     m_state = SS_BOUND;\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
 \r
@@ -804,18 +809,17 @@ NTSTATUS SdpSocket::WSPListen(
     ib_cm_listen_t param;\r
     ib_api_status_t ib_status;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p \n",this);\r
     if (!m_Lock.Lock()) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         goto Cleanup;\r
     }\r
 \r
     /* Verify the state of the socket */\r
     if( m_state != SS_BOUND) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("socket is in invalid state %s this = 0x%p \n",\r
-            this, \r
-            SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "socket is in invalid state %s this = 0x%p \n",\r
+            SS2String(m_state),this);\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
         rc = STATUS_INVALID_DEVICE_STATE;\r
         pWspListenOut->Errno = WSAEINVAL;\r
@@ -865,7 +869,7 @@ NTSTATUS SdpSocket::WSPListen(
         );\r
 \r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_listen failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_listen failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         pWspListenOut->Errno = IbalToWsaError( ib_status );\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
@@ -876,7 +880,7 @@ NTSTATUS SdpSocket::WSPListen(
     m_state = SS_LISTENING;\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
 \r
@@ -902,11 +906,11 @@ SdpSocket::WSPAccept(
     SdpSocket *pNewSocket = NULL;\r
     PRKEVENT  pAcceptEvent = NULL;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p \n",this);\r
 \r
     while (true) {\r
         if ((Locked == false) && !m_Lock.Lock()) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
             rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
             goto Cleanup;\r
         }\r
@@ -915,9 +919,8 @@ SdpSocket::WSPAccept(
 \r
         /* Verify the state of the socket */\r
         if( m_state != SS_LISTENING) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("socket is in invalid state %s this = 0x%p \n",\r
-                this, \r
-                SS2String(m_state)));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"socket is in invalid state %s this = 0x%p \n",\r
+                SS2String(m_state),this);\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             Locked = false;\r
             rc = STATUS_INVALID_DEVICE_STATE;\r
@@ -927,7 +930,7 @@ SdpSocket::WSPAccept(
 \r
         rc = m_ConnectionList.AcceptAReadyConnection(&pNewSocket, &pAcceptEvent);\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_ConnectionList.AcceptAReadyConnection failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_ConnectionList.AcceptAReadyConnection failed rc = 0x%x\n", rc );\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             Locked = false;\r
             goto Cleanup;\r
@@ -944,7 +947,7 @@ SdpSocket::WSPAccept(
         rc = m_Lock.Unlock();\r
         Locked = false;\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
             goto Cleanup;\r
         }\r
 \r
@@ -959,7 +962,7 @@ SdpSocket::WSPAccept(
         if (( rc == STATUS_ALERTED ) ||( rc == STATUS_USER_APC )) {\r
             // BUGBUG: Think what to do here, we should be able to stop the\r
             // connect, and quit (probably shutdown should be enough)\r
-            SDP_PRINT(SDP_WARN, SDP_SOCKET, ("MyKeWaitForSingleObject was alerted = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"MyKeWaitForSingleObject was alerted = 0x%x\n", rc );\r
             rc = STATUS_UNEXPECTED_IO_ERROR;\r
             //pWspConnectOut->Errno = WSAENETUNREACH; // BUGBUG: verify this error\r
             Shutdown();\r
@@ -976,14 +979,14 @@ SdpSocket::WSPAccept(
     rc = m_Lock.Unlock();\r
     Locked = false;\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
    \r
 Cleanup:    \r
     ASSERT(Locked == false);\r
     if (NT_SUCCESS(rc) ) {\r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p returning socket 0x%p \n",this, pNewSocket));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p returning socket 0x%p \n",this, pNewSocket);\r
         pWspAcceptOut->pAccaptedSocket = pNewSocket;\r
         pWspAcceptOut->IP = IP;\r
         pWspAcceptOut->Port = Port;\r
@@ -1011,10 +1014,10 @@ SdpSocket::WSPGetXXXName(
     NTSTATUS rc = STATUS_SUCCESS;\r
     ib_api_status_t ib_status;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p \n",this);\r
     rc = m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {        \r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
         pWspGetSockXXOut->Errno = WSAENETDOWN;\r
         goto Cleanup;\r
     }\r
@@ -1030,7 +1033,7 @@ SdpSocket::WSPGetXXXName(
     }\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         pWspGetSockXXOut->Errno = WSAENETDOWN;        \r
         goto Cleanup;\r
     }\r
@@ -1094,20 +1097,20 @@ SdpSocket::WSPCloseSocket(
     )\r
 {\r
     NTSTATUS rc = STATUS_SUCCESS;\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p state = %s \n",this, SS2String(m_state)));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p state = %s \n",this, SS2String(m_state));\r
     OBJECT_ATTRIBUTES   attr;\r
     HANDLE  ThreadHandle;\r
 \r
     if (!m_Lock.Lock()) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Failed to lock this = 0x%p \n",this);\r
         rc = STATUS_SHUTDOWN_IN_PROGRESS;\r
         goto Cleanup;\r
     }\r
 \r
     /* Verify the state of the socket */\r
     if(m_state == SS_IDLE) {\r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("socket is in idle state this = 0x%p \n",\r
-            this));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"socket is in idle state this = 0x%p \n",\r
+            this);\r
         m_Lock.Unlock(); // Error ignored as this is already a Shutdown pass\r
         Shutdown();\r
         pWspSocketCloseOut->Errno = 0;\r
@@ -1129,7 +1132,7 @@ SdpSocket::WSPCloseSocket(
         // Need to send the DisConn message to the remote side and wait\r
         rc = m_SendBufferPool.PostDisConn();\r
         if (!NT_SUCCESS(rc)) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.PostDisConn failed rc = 0x%x\n", rc ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_SendBufferPool.PostDisConn failed rc = 0x%x\n", rc );\r
             m_Lock.Unlock(); // Error ignored as this is already an error pass\r
             goto Cleanup;\r
         }\r
@@ -1157,7 +1160,7 @@ SdpSocket::WSPCloseSocket(
         );\r
 \r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("PsCreateSystemThread failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"PsCreateSystemThread failed rc = 0x%x\n", rc );\r
         m_Lock.Unlock(); // Error ignored as this is already an error pass\r
         // The thread wasn't created so we should remove the refferance\r
         Release();  \r
@@ -1188,7 +1191,7 @@ SdpSocket::WSPCloseSocket(
         rc = STATUS_SUCCESS;\r
     }\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         goto Cleanup;\r
     }\r
     \r
@@ -1202,8 +1205,8 @@ Cleanup:
         // In the current model, we call shutdown in any case (to kill the socket)\r
         Shutdown();        \r
     }\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p returning Errno = %d\n", \r
-        this , pWspSocketCloseOut->Errno));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "this = 0x%p returning Errno = %d\n", \r
+        this , pWspSocketCloseOut->Errno);\r
 \r
 \r
     return rc;\r
@@ -1218,7 +1221,7 @@ Cleanup:
 \r
 VOID SdpSocket::DisconectSentEvent()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "this = 0x%p\n",this);\r
     KeSetEvent( &m_DisconectSentEvent, IO_NO_INCREMENT, FALSE );\r
 }\r
 \r
@@ -1230,7 +1233,7 @@ VOID SdpSocket::DisconectSentEvent()
 VOID SdpSocket::CloseSocketThread()\r
 {\r
     NTSTATUS rc = STATUS_SUCCESS;\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n",this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n",this);\r
 \r
     // wait for the last thread to end.\r
     LARGE_INTEGER  WaitTime;\r
@@ -1245,7 +1248,7 @@ VOID SdpSocket::CloseSocketThread()
         );\r
 \r
     if (rc == STATUS_TIMEOUT) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Wait failed with time out this = 0x%p\n", this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Wait failed with time out\n");\r
     }\r
 \r
     ASSERT(NT_SUCCESS(rc));\r
@@ -1271,12 +1274,12 @@ NTSTATUS SdpSocket::CmSendRTU()
     ib_api_status_t ib_status;\r
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p \n", this);\r
 \r
     if (m_state != SS_CONNECTING_REQ_SENT) {\r
         // There was some error, we can release the waiting thread.\r
         // The error will be handled there\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("this = 0x%p invalid state %s\n", this, SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"this = 0x%p invalid state %s\n", this, SS2String(m_state));\r
         rc = STATUS_UNEXPECTED_IO_ERROR;\r
         goto Cleanup;\r
     } \r
@@ -1288,7 +1291,7 @@ NTSTATUS SdpSocket::CmSendRTU()
 \r
     rc = sdp_cm_hello_ack_check(&m_hello_ack);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("sdp_cm_hello_ack_check failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"sdp_cm_hello_ack_check failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
@@ -1296,13 +1299,13 @@ NTSTATUS SdpSocket::CmSendRTU()
 \r
     rc = m_SendBufferPool.Init(MAX_SEND_PACKETS, SDP_QP_ATTRIB_SQ_DEPTH, MaxMessageSize, m_pd, m_qp, m_lkey, this);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.Init failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_SendBufferPool.Init failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
     rc = m_RecvBufferPool.Init(MAX_RECV_PACKETS, QP_ATTRIB_RQ_DEPTH, MaxMessageSize, m_pd, m_qp, m_lkey, this);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_RecvBufferPool.Init failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_RecvBufferPool.Init failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
     m_SendBufferPool.SetRemoteRecvBuf(m_hello_ack.bsdh.recv_bufs);\r
@@ -1345,7 +1348,7 @@ NTSTATUS SdpSocket::CmSendRTU()
 \r
     ib_status = ib_cm_rtu( m_cm_handle_t, &cm_rtu );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_rtu failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_rtu failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -1356,14 +1359,14 @@ NTSTATUS SdpSocket::CmSendRTU()
     // we now arm the CQs\r
     ib_status = ib_rearm_cq(m_rcq, FALSE);\r
      if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
 \r
     ib_status = ib_rearm_cq(m_scq, FALSE);\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -1372,14 +1375,14 @@ NTSTATUS SdpSocket::CmSendRTU()
 \r
     rc = m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
     \r
     rc = m_RecvBufferPool.ReceiveIfCan(); //??? error\r
     m_Lock.Unlock(); // error ????\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_RecvBufferPool.ReceiveIfCan failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_RecvBufferPool.ReceiveIfCan failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
@@ -1390,13 +1393,13 @@ Cleanup:
 \r
 VOID SdpSocket::CmRepCallback(IN   ib_cm_rep_rec_t *p_cm_rep_rec)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
     ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
 \r
     if (m_state != SS_CONNECTING_REQ_SENT) {\r
         // This is not the state that we waited for, not much that we can\r
         // do. (This might happen in shutdown)\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Not the expacted state %s\n", SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Not the expacted state %s\n", SS2String(m_state));\r
         ASSERT(FALSE);\r
         return;\r
     }\r
@@ -1412,7 +1415,7 @@ VOID SdpSocket::CmRepCallback(IN   ib_cm_rep_rec_t *p_cm_rep_rec)
 VOID \r
 SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
 \r
     NTSTATUS rc = STATUS_SUCCESS;\r
     ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
@@ -1425,34 +1428,34 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     rc = sdp_cm_hello_check(msg_hello);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("sdp_cm_hello_ack_check failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"sdp_cm_hello_ack_check failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
     // Take the lock and verify the state\r
     rc = m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
     if (m_state != SS_LISTENING) {\r
         // This is not the state that we waited for, we drop the request\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Not the expacted state %s\n", SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Not the expacted state %s\n", SS2String(m_state));\r
         ASSERT(FALSE);\r
         goto ErrorLocked;\r
     }\r
 \r
     // Check that we haven't passed the backlog for this connection\r
     if (m_ConnectionList.IsFull()) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("Dropping the connection, because of a backlog that is too small\n"));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"Dropping the connection, because of a backlog that is too small\n");\r
         goto ErrorLocked;        \r
     }\r
 \r
     // Create a new socket for this request\r
     pNewSocket = new SdpSocket;\r
     if (pNewSocket == NULL) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("new pNewSocket failed\n"));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"new pNewSocket failed\n");        \r
         goto ErrorLocked;\r
     }\r
 \r
@@ -1462,7 +1465,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
     SocketInParam.dwFlags = 0;        \r
     rc = pNewSocket->Init(&SocketInParam, &SocketOutParam, m_pSdpUserFile);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.Init() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket.Init()");\r
         goto ErrorLocked;\r
     }\r
     ASSERT(SocketOutParam.Errno == 0);\r
@@ -1503,7 +1506,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     rc = g_pSdpDriver->m_pSdpArp->SourcePortGidFromIP(pNewSocket->m_SrcIp, &SrcPortGuid, &SrcCaGuid);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_pSdpArp->SourcePortGidFromIP failed rc = 0x%x\n", rc );\r
         goto ErrorLocked;\r
     }        \r
 \r
@@ -1516,14 +1519,14 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
     // MAke sure that the port that was recieved muches the one that we\r
     // get based on the source IP.\r
     if (SrcPortGuid != p_cm_req_rec->primary_path.sgid.unicast.interface_id) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Recieved guid is not what we have expected\n" ));        \r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Recieved guid is not what we have expected\n" );        \r
         ASSERT(0);\r
         goto ErrorLocked;\r
     }\r
 \r
     rc = pNewSocket->CreateQp();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.CreateQp() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket.CreateQp()");\r
         goto ErrorLocked;\r
     }\r
 \r
@@ -1532,13 +1535,13 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     rc = pNewSocket->m_SendBufferPool.Init(MAX_SEND_PACKETS, SDP_QP_ATTRIB_SQ_DEPTH, MaxMessageSize, pNewSocket->m_pd, pNewSocket->m_qp, pNewSocket->m_lkey, pNewSocket);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.Init failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_SendBufferPool.Init failed rc = 0x%x\n", rc );\r
         goto ErrorLocked;\r
     }\r
 \r
     rc = pNewSocket->m_RecvBufferPool.Init(MAX_RECV_PACKETS, QP_ATTRIB_RQ_DEPTH, MaxMessageSize, pNewSocket->m_pd, pNewSocket->m_qp, pNewSocket->m_lkey, pNewSocket);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_RecvBufferPool.Init failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_RecvBufferPool.Init failed rc = 0x%x\n", rc );\r
         goto ErrorLocked;\r
     }\r
     pNewSocket->m_SendBufferPool.SetRemoteRecvBuf(msg_hello->bsdh.recv_bufs);\r
@@ -1605,7 +1608,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     ib_status = ib_cm_rep( p_cm_req_rec->h_cm_req, &cm_rep );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_rep failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_rep failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto ErrorLocked;\r
     }\r
@@ -1613,19 +1616,19 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
     // Add this socket to the list of sockets ?????? should this also be done on errors ????\r
     rc = m_ConnectionList.AddConnectionToReplySent(pNewSocket);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.Init() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket.Init()");\r
         goto ErrorLocked;\r
     }\r
 \r
     rc = pNewSocket->m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.Init() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket.Init()");\r
         goto ErrorLocked;\r
     }    \r
 \r
     rc = pNewSocket->m_RecvBufferPool.ReceiveIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket.Init() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket.Init()");\r
         pNewSocket->m_Lock.Unlock(); // Error is ignored, since this is already an error path\r
         goto ErrorLocked;\r
     }\r
@@ -1633,7 +1636,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
     // we now arm the CQs (after that a call back might happen)\r
     ib_status = ib_rearm_cq(pNewSocket->m_rcq, FALSE);\r
      if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         pNewSocket->m_Lock.Unlock(); // Error is ignored, since this is already an error path\r
         goto ErrorLocked;\r
@@ -1641,7 +1644,7 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     ib_status = ib_rearm_cq(pNewSocket->m_scq, FALSE);\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto ErrorLocked;\r
     }\r
@@ -1651,14 +1654,14 @@ SdpSocket::CmReqCallback(IN   ib_cm_req_rec_t *p_cm_req_rec)
 \r
     rc = pNewSocket->m_Lock.Unlock(); // ???????? Error is ignored, since this is already an error path\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pNewSocket->m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pNewSocket->m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
         goto ErrorLocked;\r
     }    \r
     \r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
     }    \r
 \r
@@ -1675,7 +1678,7 @@ ErrorLocked:
     // Previous rc doesn't mater as this function is void\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
     }\r
     goto Cleanup;       \r
@@ -1689,7 +1692,7 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
 \r
     SdpSocket *pSocket = (SdpSocket *) p_cm_rtu_rec->qp_context;\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p pSocket = 0x%p\n", this, pSocket));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p pSocket = 0x%p\n", this, pSocket);\r
 \r
     // In order to make our model more consistent we increase the refcount here.\r
     // (This is not a must since this is a callback and we are gurantied that the last\r
@@ -1700,13 +1703,13 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     // Take the lock and verify the state\r
     rc = m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
     if (m_state != SS_LISTENING) {\r
         // This is not the state that we waited for, we drop the request\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Not the expacted state %s\n", SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Not the expacted state %s\n", SS2String(m_state));\r
         ASSERT(FALSE); // Can this happen on shutdown ?\r
         goto ErrorLocked;\r
     }\r
@@ -1714,7 +1717,7 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     // First step is to verify that we have the new socket\r
     rc = m_ConnectionList.VerifyConnictionInReplySent(pSocket);\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_ConnectionList.GetConnection failed (got a call back on a not existing connection) rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_ConnectionList.GetConnection failed (got a call back on a not existing connection)");\r
         ASSERT(FALSE);\r
         goto ErrorLocked;\r
     }\r
@@ -1722,7 +1725,7 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     // Next step is to move the new socket to the SS_CONNECTED state\r
     rc = pSocket->m_Lock.LockRc();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto ErrorLocked;\r
     }\r
     if (pSocket->m_state != SS_REP_SENT) {\r
@@ -1741,7 +1744,7 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     m_ConnectionList.MoveConnectionFromReplyToReady(pSocket);\r
     rc = pSocket->m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("pSocket->m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"pSocket->m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto ErrorLocked;\r
     }\r
 \r
@@ -1749,7 +1752,7 @@ SdpSocket::CmRtuCallback(IN   ib_cm_rtu_rec_t *p_cm_rtu_rec)
     m_ConnectionList.FreeWaitingIfCan();\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
     \r
@@ -1766,7 +1769,7 @@ ErrorLocked:
     // Previous rc doesn't mater as this function is void\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
     }\r
     goto Cleanup;       \r
@@ -1776,7 +1779,7 @@ ErrorLocked:
 VOID \r
 SdpSocket::CmDreqCallback(IN   ib_cm_dreq_rec_t *p_cm_dreq_rec)\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p, dispatch level = %d\n", this, KeGetCurrentIrql()));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p, dispatch level = %d\n", this, KeGetCurrentIrql());\r
     ASSERT(KeGetCurrentIrql() == PASSIVE_LEVEL);\r
     NTSTATUS rc = STATUS_SUCCESS;\r
     ib_cm_drep_t cm_drep;\r
@@ -1789,13 +1792,13 @@ SdpSocket::CmDreqCallback(IN   ib_cm_dreq_rec_t *p_cm_dreq_rec)
     // BUGBUG: It seems that even when the lock fails we should send\r
     // drep\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Lock failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Lock failed rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
     if (m_state != SS_CONNECTED) {\r
         // This is not the state that we waited for, we drop the request\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Not the expacted state %s\n", SS2String(m_state)));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Not the expacted state %s\n", SS2String(m_state));\r
         ASSERT(FALSE); // Can this happen on shutdown ?\r
         goto ErrorLocked;\r
     }\r
@@ -1805,7 +1808,7 @@ SdpSocket::CmDreqCallback(IN   ib_cm_dreq_rec_t *p_cm_dreq_rec)
 \r
     ib_status = ib_cm_drep( p_cm_dreq_rec->h_cm_dreq, &cm_drep );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_drep failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_drep failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto ErrorLocked;\r
     }\r
@@ -1817,7 +1820,7 @@ SdpSocket::CmDreqCallback(IN   ib_cm_dreq_rec_t *p_cm_dreq_rec)
 \r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
     }    \r
 \r
@@ -1832,7 +1835,7 @@ ErrorLocked:
     // Previous rc doesn't mater as this function is void\r
     rc = m_Lock.Unlock();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock() failed rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_Lock.Unlock()");\r
         // BUGBUG: who is responsibale for the cleanup ???????\r
     }\r
     goto Cleanup;       \r
@@ -1845,7 +1848,7 @@ SdpSocket::__recv_cb1(
     IN  const   ib_cq_handle_t  h_cq,\r
     IN  void *cq_context )\r
 {\r
-   SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("__recv_cb1\n"));\r
+   SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"__recv_cb1\n");\r
 \r
     SdpSocket *pSocket = (SdpSocket *) cq_context;\r
     pSocket->m_Lock.SignalCB(RECV_CB_CALLED);\r
@@ -1854,7 +1857,7 @@ SdpSocket::__recv_cb1(
 NTSTATUS\r
 SdpSocket::recv_cb()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("this = 0x%p \n", this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"this = 0x%p \n", this);\r
     NTSTATUS rc = STATUS_SUCCESS, rc1 = STATUS_SUCCESS;    \r
     ib_api_status_t     ib_status;\r
     ib_wc_t             *p_free, *p_wc1;\r
@@ -1873,7 +1876,7 @@ SdpSocket::recv_cb()
 \r
         ib_status = ib_poll_cq( m_rcq, &p_free, &p_wc1 );\r
         if( (ib_status != IB_SUCCESS) && (ib_status != IB_NOT_FOUND) ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_poll_cq failed ib_status = 0x%d\n", ib_status ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_poll_cq failed ib_status = 0x%d\n", ib_status );\r
             rc = IB2Status(ib_status);\r
             goto Cleanup;\r
         }\r
@@ -1890,7 +1893,7 @@ SdpSocket::recv_cb()
             if (p_wc->status == IB_WCS_WR_FLUSHED_ERR) {\r
                 // We have an error, but we still need to return the packet to the caller\r
                 pBufferDescriptor = (BufferDescriptor *)p_wc->wr_id;\r
-                SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("p_wc->status == IB_WCS_WR_FLUSHED_ERR \n" ));\r
+                SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"p_wc->status == IB_WCS_WR_FLUSHED_ERR \n" );\r
                 // we can not handle it, but we can and should return it to the pool of recieved buffers\r
                 rc1 = m_RecvBufferPool.RecievedBuffer(pBufferDescriptor, true);\r
                 ASSERT(rc1 == STATUS_SUCCESS); // return with error can not fail\r
@@ -1903,7 +1906,7 @@ SdpSocket::recv_cb()
                 ASSERT(len >= sizeof msg_hdr_bsdh);\r
                 if (len < sizeof msg_hdr_bsdh) {\r
                     // This is a message that is not big enough\r
-                    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Recieved a message with a buffer that is too short len = %d\n", len ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Recieved a message with a buffer that is too short len = %d\n", len );\r
                     // we can not handle it, but we can and should return it to the pool of recieved buffers\r
                     rc1 = m_RecvBufferPool.RecievedBuffer(pBufferDescriptor, true);\r
                     ASSERT(rc1 == STATUS_SUCCESS); // return with error can not fail\r
@@ -1916,7 +1919,7 @@ SdpSocket::recv_cb()
                 ASSERT(pHeader->size >= 0x10);\r
                 if (len != pHeader->size) {\r
                     // This is a message that is not formated well\r
-                    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Recieved a message with a len != pHeader->size = %d : %d\n", len , pHeader->size ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Recieved a message with a len != pHeader->size = %d : %d\n", len , pHeader->size );\r
                     // we can not handle it, but we can and should return it to the pool of recieved buffers\r
                     rc1 = m_RecvBufferPool.RecievedBuffer(pBufferDescriptor, true);\r
                     ASSERT(rc1 == STATUS_SUCCESS); // return with error can not fail\r
@@ -1932,7 +1935,7 @@ SdpSocket::recv_cb()
                 rc1 = m_RecvBufferPool.RecievedBuffer(pBufferDescriptor, false);\r
                 if (!NT_SUCCESS(rc1)) {\r
                     // We have an error, but we should continue, or we will have a leak\r
-                    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_RecvBufferPool.RecievedBuffer failed rc = 0x%x\n", rc1 ));\r
+                    SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"m_RecvBufferPool.RecievedBuffer failed rc = 0x%x\n", rc1 );\r
                     UpdateRc(&rc, rc1);\r
                     continue;\r
                 }\r
@@ -1946,7 +1949,7 @@ Cleanup:
     if (NT_SUCCESS(rc)) {    \r
         ib_status = ib_rearm_cq(m_rcq, FALSE );\r
         if( ib_status != IB_SUCCESS ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
             rc = IB2Status(ib_status);\r
             // get out of this function\r
         }\r
@@ -1964,7 +1967,7 @@ SdpSocket::__send_cb1(
     IN  void    *cq_context )\r
 {\r
     SdpSocket *pSocket = (SdpSocket *) cq_context;\r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("called this = 0x%x\n", pSocket ));    \r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"called this = 0x%p\n", pSocket );    \r
     pSocket->m_Lock.SignalCB(SEND_CB_CALLED);\r
 }\r
 \r
@@ -1988,7 +1991,7 @@ static NTSTATUS __accept_requests(SdpSocket * pSdpSocket)
 \r
 NTSTATUS SdpSocket::send_cb()\r
 {\r
-    SDP_PRINT(SDP_DEBUG, SDP_SOCKET, ("called this =0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET,"called this =0x%p\n", this);\r
     NTSTATUS rc = STATUS_SUCCESS, rc1 = STATUS_SUCCESS, rc2 = STATUS_SUCCESS;\r
     AssertLocked();\r
     ib_api_status_t     ib_status;\r
@@ -2007,11 +2010,11 @@ NTSTATUS SdpSocket::send_cb()
         ib_status = ib_poll_cq( m_scq, &p_free, &p_wc );\r
         ASSERT( ib_status == IB_SUCCESS || ib_status == IB_NOT_FOUND);\r
         if (ib_status == IB_NOT_FOUND) {\r
-            SDP_PRINT(SDP_WARN, SDP_SOCKET, ("ib_poll_cq returned IB_NOT_FOUND, this =0x%p\n", this));\r
+            SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET,"ib_poll_cq returned IB_NOT_FOUND, this =0x%p\n", this);\r
             break;\r
         }\r
         if (ib_status != IB_SUCCESS) {            \r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_poll_cq failed ib_status=%d, this =0x%p\n", ib_status,this));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_poll_cq failed ib_status=%d, this =0x%p\n", ib_status,this);\r
             ASSERT(ib_status == IB_INVALID_CQ_HANDLE || ib_status == IB_NOT_FOUND);\r
             rc = IB2Status(ib_status);\r
             goto Cleanup;\r
@@ -2032,11 +2035,11 @@ NTSTATUS SdpSocket::send_cb()
                 break;\r
 \r
             case IB_WCS_WR_FLUSHED_ERR:\r
-                SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Flushed send completion. this =0x%p\n", this));\r
+                SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "Flushed send completion. this =0x%p\n", this);\r
                 // Intentainly fall down\r
             default:\r
-                SDP_PRINT( SDP_ERR, SDP_SOCKET, ("Send failed with %s\n",\r
-                ib_get_wc_status_str( p_wc->status )) );\r
+                SDP_PRINT( TRACE_LEVEL_ERROR, SDP_SOCKET, "Send failed with %s\n",\r
+                ib_get_wc_status_str( p_wc->status ));\r
                 m_Lock.SignalError(IB2Status(ib_status));\r
             }\r
 \r
@@ -2045,7 +2048,7 @@ NTSTATUS SdpSocket::send_cb()
         /* If we didn't use up every WC, break out. */\r
     } while( !p_free );\r
     if (!NT_SUCCESS(rc1)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Error was detected on ReturnBuffer rc1 = 0x%x\n", rc1 ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "Error was detected on ReturnBuffer rc1 = 0x%x\n", rc1 );\r
         ASSERT(NT_SUCCESS(rc));\r
         rc = rc1;\r
         goto Cleanup;\r
@@ -2054,7 +2057,7 @@ NTSTATUS SdpSocket::send_cb()
     /* Rearm the CQ. */\r
     ib_status = ib_rearm_cq(m_scq, FALSE );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_rearm_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "ib_rearm_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2062,7 +2065,7 @@ NTSTATUS SdpSocket::send_cb()
     /* Resume any sends awaiting resources. */\r
     rc = m_SendBufferPool.SendBuffersIfCan();\r
     if (!NT_SUCCESS(rc)) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.Init SendBuffersIfCan rc = 0x%x\n", rc ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "m_SendBufferPool.Init SendBuffersIfCan rc = 0x%x\n", rc );\r
         goto Cleanup;\r
     }\r
 \r
@@ -2093,7 +2096,7 @@ __qp_event1(
     UNUSED_PARAM( p_event_rec );\r
     ASSERT( p_event_rec->context );\r
     /* Place holder for proper error handler. */\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("Async QP event: %d\n", p_event_rec->code));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"Async QP event: %d\n", p_event_rec->code);\r
     ASSERT( p_event_rec->code == IB_AE_UNKNOWN );\r
 }\r
 \r
@@ -2111,7 +2114,7 @@ NTSTATUS SdpSocket::CreateQp()
     net32_t             rkey;\r
 \r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
     ASSERT(m_SrcCaGuid != 0);\r
     /* Open the CA. */\r
     ib_status = ib_open_ca(\r
@@ -2122,7 +2125,7 @@ NTSTATUS SdpSocket::CreateQp()
         &mh_Ca \r
         );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_open_ca failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_open_ca failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2137,7 +2140,7 @@ NTSTATUS SdpSocket::CreateQp()
     \r
     if( ib_status != IB_SUCCESS )\r
     {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_alloc_pd failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_alloc_pd failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2156,7 +2159,7 @@ NTSTATUS SdpSocket::CreateQp()
                     );\r
 \r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_create_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_create_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2174,7 +2177,7 @@ NTSTATUS SdpSocket::CreateQp()
                     );\r
 \r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_create_cq failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_create_cq failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2192,7 +2195,7 @@ NTSTATUS SdpSocket::CreateQp()
     qp_create.sq_signaled = TRUE;\r
     ib_status = ib_create_qp( m_pd, &qp_create, this, __qp_event1, &m_qp );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_create_qp failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_create_qp failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2203,10 +2206,10 @@ NTSTATUS SdpSocket::CreateQp()
         m_qp, &qp_attr );\r
     if( ib_status != IB_SUCCESS )\r
     {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_query_qp failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_query_qp failed ib_status = 0x%d\n", ib_status );\r
         // ignore the error, this is only needed for debug\r
     }\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("QP number is %x\n", CL_NTOH32(qp_attr.num)));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"QP number is %x\n", CL_NTOH32(qp_attr.num));\r
 #endif    \r
 \r
     const net64_t MEM_REG_SIZE = 0xFFFFFFFFFFFFFFFF;\r
@@ -2228,7 +2231,7 @@ NTSTATUS SdpSocket::CreateQp()
                         &rkey, \r
                         &m_mr );\r
     if( ib_status != IB_SUCCESS ) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_reg_phys failed ib_status = 0x%d\n", ib_status ));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_reg_phys failed ib_status = 0x%d\n", ib_status );\r
         rc = IB2Status(ib_status);\r
         goto Cleanup;\r
     }\r
@@ -2247,7 +2250,7 @@ VOID SdpSocket::CreateHelloHeader(
                          \r
                         )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
     ASSERT(DestIp != 0);\r
     ASSERT(m_SrcPort != 0);\r
     ASSERT(m_SrcIp != 0);\r
@@ -2281,7 +2284,7 @@ VOID SdpSocket::CreateHelloAckHeader(
     sdp_msg_hello_ack* hello_ack_msg\r
     )\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("called this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"called this = 0x%p\n", this);\r
 \r
     memset(hello_ack_msg, 0, sizeof(struct sdp_msg_hello_ack));\r
     hello_ack_msg->bsdh.recv_bufs = QP_ATTRIB_RQ_DEPTH; //????conn->l_advt_bf;\r
@@ -2359,7 +2362,7 @@ VOID SdpSocket::UsersThreadCallBack(bool Send)
     NTSTATUS rc = STATUS_SUCCESS;\r
 \r
     if (!m_Lock.Lock()) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Failed to lock this = 0x%p \n",this));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "Failed to lock this = 0x%p \n",this);\r
         // Error is ignored, as it is a callback path, socket is already at an error state\r
         goto Cleanup;\r
     }\r
@@ -2367,8 +2370,8 @@ VOID SdpSocket::UsersThreadCallBack(bool Send)
         InitializeListHead(&m_CallBackRequestList);\r
         rc = m_SendBufferPool.UsersThreadCallBack();\r
         if (!NT_SUCCESS(rc)) {        \r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_SendBufferPool.UsersThreadCallBack failed this = 0x%p, rc = 0x%x \n",\r
-                this, rc));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "m_SendBufferPool.UsersThreadCallBack failed this = 0x%p, rc = 0x%x \n",\r
+                this, rc);\r
             m_Lock.Unlock(); // Error is ignored, as this is already an error path\r
             Shutdown();\r
             goto Cleanup;\r
@@ -2378,8 +2381,8 @@ VOID SdpSocket::UsersThreadCallBack(bool Send)
 \r
     rc = m_Lock.Unlock(); // Error is ignored, as it is a callback path \r
     if (!NT_SUCCESS(rc)) {        \r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("m_Lock.Unlock failed this = 0x%p, rc = 0x%x \n",\r
-            this, rc));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "m_Lock.Unlock failed this = 0x%p, rc = 0x%x \n",\r
+            this, rc);\r
         Shutdown();\r
         goto Cleanup;\r
     }\r
@@ -2419,7 +2422,7 @@ VOID WaitForShutdownEvent(KEVENT *ShutdownCompleteEvent)
         );\r
 \r
     if (rc == STATUS_TIMEOUT) {\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Wait failed with time out \n"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"Wait failed with time out\n");\r
         ASSERT(FALSE);\r
     }\r
 \r
@@ -2439,10 +2442,10 @@ VOID WaitForShutdownEvent(KEVENT *ShutdownCompleteEvent)
 \r
 VOID SdpSocket::DyingProcessDetected()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("called this = 0x%p\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "called this = 0x%p\n", this);\r
     m_Lock.Lock(true); //????? verify must succeed\r
     if (m_CloseSocketCalled) {\r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p m_CloseSocketCalled, letting it finish his job\n", this));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "this = 0x%p m_CloseSocketCalled, letting it finish his job\n", this);\r
         m_Lock.Unlock(); // Error is ignored since this is already\r
                      // shutdown call\r
         return;\r
@@ -2454,12 +2457,8 @@ VOID SdpSocket::DyingProcessDetected()
 \r
 VOID SdpSocket::Shutdown()\r
 {\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("called this = 0x%p\n", this));\r
-    SDP_PRINT(SDP_ERR, SDP_SOCKET, ("this = 0x%p m_NumberOfBytesSent = %d m_NumberOfBytesSentAndAcked = %d "\r
-        "m_NumberOfBuffersRecievedSuccessfully = %d, m_NumberOfBuffersRecievedWithError = %d\n", \r
-        this, m_SendBufferPool.m_NumberOfBytesSent, m_SendBufferPool.m_NumberOfBytesSentAndAcked, \r
-        m_RecvBufferPool.m_NumberOfBuffersRecievedSuccessfully, m_RecvBufferPool.m_NumberOfBuffersRecievedWithError));   \r
-\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "called this = 0x%p\n", this);\r
+   \r
     NTSTATUS rc = STATUS_SUCCESS;\r
     ib_api_status_t     ib_status;\r
     ib_qp_mod_t         qp_mod;\r
@@ -2492,7 +2491,7 @@ VOID SdpSocket::Shutdown()
     if (m_ListenHandle != NULL) {\r
         ib_status = ib_cm_cancel( m_ListenHandle, ShutdownCB );\r
         if( ib_status != IB_SUCCESS ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_cm_cancel failed ib_status = 0x%d\n", ib_status ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_cm_cancel failed ib_status = 0x%d\n", ib_status );\r
             rc = IB2Status(ib_status);\r
         } else {\r
             WaitForShutdownEvent(&m_ShutdownCompleteEvent);\r
@@ -2503,17 +2502,17 @@ VOID SdpSocket::Shutdown()
     m_ConnectionList.Shutdown();\r
 \r
     \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("111111\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"111111%p\n", this);\r
 \r
     if (m_qp != NULL) {\r
 \r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("222222\n", this));\r
+        SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"222222%p\n", this);\r
 \r
         cl_memclr( &qp_mod, sizeof(ib_qp_mod_t) );\r
         qp_mod.req_state = IB_QPS_ERROR;\r
         ib_status = ib_modify_qp( m_qp, &qp_mod );\r
         if( ib_status != IB_SUCCESS ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_modify_qp failed ib_status = 0x%d\n", ib_status ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_modify_qp failed ib_status = 0x%d\n", ib_status );\r
             ASSERT(FALSE);\r
             // We are probably going to leak, but we have to continue\r
         }\r
@@ -2530,7 +2529,7 @@ VOID SdpSocket::Shutdown()
         }\r
     }\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("333333\n", this));\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"333333%p\n", this);\r
     \r
     if (m_scq != NULL) {\r
         ib_status = ib_destroy_cq(m_scq, ShutdownCB);\r
@@ -2540,7 +2539,7 @@ VOID SdpSocket::Shutdown()
         }\r
         //?????m_scq = NULL;\r
     }\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("444444\n", this));   \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"444444%p\n", this);   \r
 \r
     if (m_rcq != NULL) {\r
         ib_status = ib_destroy_cq(m_rcq, ShutdownCB); \r
@@ -2551,7 +2550,7 @@ VOID SdpSocket::Shutdown()
         //??????m_rcq = NULL;\r
 \r
     }\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("555555\n", this));   \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"555555%p\n", this);   \r
     if (m_pd != NULL) {\r
         ib_status = ib_dealloc_pd(m_pd, ShutdownCB); \r
         //???ASSERT(ib_status == IB_SUCCESS);\r
@@ -2561,7 +2560,7 @@ VOID SdpSocket::Shutdown()
         //?????m_pd = NULL;\r
         \r
     }\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("666666\n", this));   \r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"666666%p\n", this);   \r
 \r
     if (mh_Ca != NULL) {\r
         ib_status = ib_close_ca(mh_Ca, ShutdownCB); \r
@@ -2600,7 +2599,7 @@ VOID SdpSocket::Shutdown()
     if (m_mr != NULL) {\r
         ib_status = ib_dereg_mr(m_mr);\r
         if( ib_status != IB_SUCCESS ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("ib_dereg_mr failed ib_status = 0x%d\n", ib_status ));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET,"ib_dereg_mr failed ib_status = 0x%d\n", ib_status );\r
             ASSERT( ib_status == IB_SUCCESS );\r
         }\r
         m_mr = NULL;\r
@@ -2623,44 +2622,42 @@ NTSTATUS sdp_cm_hello_ack_check(struct sdp_msg_hello_ack *hello_ack)
      * validation and consistency checks\r
      */\r
     if (hello_ack->bsdh.size != sizeof(struct sdp_msg_hello_ack)) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("hello ack, size mismatch. (2) <%d:%d>",\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello ack, size mismatch. (2) <%d:%d>",\r
                 hello_ack->bsdh.size,\r
-                sizeof(struct sdp_msg_hello_ack)));\r
+                sizeof(struct sdp_msg_hello_ack));\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 \r
     if (SDP_MID_HELLO_ACK != hello_ack->bsdh.mid) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("hello ack, unexpected message. <%d>",\r
-                hello_ack->bsdh.mid\r
-                ));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello ack, unexpected message. <%d>",\r
+                hello_ack->bsdh.mid);\r
         return STATUS_UNEXPECTED_IO_ERROR;        \r
     }\r
 \r
     if (hello_ack->hah.max_adv <= 0) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("hello ack, bad zcopy advertisment. <%d>",\r
-                hello_ack->hah.max_adv\r
-                ));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello ack, bad zcopy advertisment. <%d>",\r
+                hello_ack->hah.max_adv);\r
         return STATUS_UNEXPECTED_IO_ERROR;                \r
     }\r
 \r
     if ((0xF0 & hello_ack->hah.version) != (0xF0 & SDP_MSG_VERSION)) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET, ("hello ack, version mismatch. <%d:%d>",\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello ack, version mismatch. <%d:%d>",\r
                 ((0xF0 & hello_ack->hah.version) >> 4),\r
-                ((0xF0 & SDP_MSG_VERSION) >> 4)));\r
+                ((0xF0 & SDP_MSG_VERSION) >> 4));\r
         return STATUS_UNEXPECTED_IO_ERROR;                        \r
     }\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("Hello Ack BSDH <%04x:%02x:%02x:%08x:%08x:%08x>",\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "Hello Ack BSDH <%04x:%02x:%02x:%08x:%08x:%08x>",\r
             hello_ack->bsdh.recv_bufs,\r
             hello_ack->bsdh.flags,\r
             hello_ack->bsdh.mid,\r
             hello_ack->bsdh.size,\r
             hello_ack->bsdh.seq_num,\r
-            hello_ack->bsdh.seq_ack));\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("Hello Ack HAH <%02x:%02x:%08x",\r
+            hello_ack->bsdh.seq_ack);\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "Hello Ack HAH <%02x:%02x:%08x",\r
             hello_ack->hah.max_adv,\r
             hello_ack->hah.version, \r
-            hello_ack->hah.l_rcv_size));\r
+            hello_ack->hah.l_rcv_size);\r
 \r
     return STATUS_SUCCESS;\r
 }\r
@@ -2677,28 +2674,28 @@ NTSTATUS sdp_cm_hello_check(struct sdp_msg_hello *msg_hello)
      */\r
      \r
     if (msg_hello->bsdh.size != sizeof(struct sdp_msg_hello)) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET,( "hello msg size mismatch. (2) <%d:%Zu>",\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello msg size mismatch. (2) <%d:%d>",\r
              msg_hello->bsdh.size,\r
-             sizeof(struct sdp_msg_hello)));\r
+             sizeof(struct sdp_msg_hello));\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 \r
     if (SDP_MID_HELLO != msg_hello->bsdh.mid) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET,("hello msg unexpected ID. <%d>",\r
-            msg_hello->bsdh.mid));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello msg unexpected ID. <%d>",\r
+            msg_hello->bsdh.mid);\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 \r
     if (msg_hello->hh.max_adv <= 0) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET,("hello msg, bad zcopy count <%d>",\r
-                msg_hello->hh.max_adv));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello msg, bad zcopy count <%d>",\r
+                msg_hello->hh.max_adv);\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 \r
     if ((0xF0 & msg_hello->hh.version) != (0xF0 & SDP_MSG_VERSION)) {\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET,("hello msg, version mismatch. <%d:%d>",\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello msg, version mismatch. <%d:%d>",\r
             ((0xF0 & msg_hello->hh.version) >> 4),\r
-            ((0xF0 & SDP_MSG_VERSION) >> 4)));\r
+            ((0xF0 & SDP_MSG_VERSION) >> 4));\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 #ifdef _SDP_MS_APRIL_ERROR_COMPAT\r
@@ -2706,20 +2703,19 @@ NTSTATUS sdp_cm_hello_check(struct sdp_msg_hello *msg_hello)
 #else\r
     if ((SDP_MSG_IPVER & 0xF0) != (msg_hello->hh.ip_ver & 0xF0)) {\r
 #endif\r
-        SDP_PRINT(SDP_WARN, SDP_SOCKET,( "hello msg, ip version mismatch. <%d:%d>",\r
-                msg_hello->hh.ip_ver, SDP_MSG_IPVER));\r
+        SDP_PRINT(TRACE_LEVEL_WARNING, SDP_SOCKET, "hello msg, ip version mismatch. <%d:%d>",\r
+                msg_hello->hh.ip_ver, SDP_MSG_IPVER);\r
         return STATUS_UNEXPECTED_IO_ERROR;\r
     }\r
 \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,("Hello BSDH <%04x:%02x:%02x:%08x:%08x:%08x>",\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "Hello BSDH <%04x:%02x:%02x:%08x:%08x:%08x>",\r
                 msg_hello->bsdh.recv_bufs,\r
                 msg_hello->bsdh.flags,\r
                 msg_hello->bsdh.mid,\r
                 msg_hello->bsdh.size,\r
                 msg_hello->bsdh.seq_num,\r
-                msg_hello->bsdh.seq_ack));\r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET,(\r
-            "Hello HH <%02x:%02x:%02x:%08x:%08x:%04x:%08x:%08x>",\r
+                msg_hello->bsdh.seq_ack);\r
+    SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET, "Hello HH <%02x:%02x:%02x:%08x:%08x:%04x:%08x:%08x>",\r
             msg_hello->hh.max_adv,\r
             msg_hello->hh.ip_ver,\r
             msg_hello->hh.version,\r
@@ -2727,7 +2723,7 @@ NTSTATUS sdp_cm_hello_check(struct sdp_msg_hello *msg_hello)
             msg_hello->hh.l_rcv_size,\r
             msg_hello->hh.port,\r
             msg_hello->hh.src.ipv4.addr,\r
-            msg_hello->hh.dst.ipv4.addr));\r
+            msg_hello->hh.dst.ipv4.addr);\r
 \r
     return STATUS_SUCCESS;\r
 }\r
index b44c36c..2f47782 100644 (file)
@@ -41,6 +41,7 @@ It keeps a list of all the objects so we know when to remove them.
 #ifndef _SDP_SOCKET_H\r
 #define _SDP_SOCKET_H\r
 \r
+\r
 const int MAX_SEND_BUFFER_SIZE          = 1*4096; // This is the maximum send packet size\r
 \r
 const int MAX_RECV_BUFFER_SIZE          = 1*4096; // This is the maximum send packet size\r
@@ -173,7 +174,7 @@ public:
     SdpSocket();\r
 \r
     ~SdpSocket() {\r
-        SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("this = 0x%p\n", this));\r
+        //SDP_PRINT(TRACE_LEVEL_INFORMATION, SDP_SOCKET,"this = 0x%p\n", this);\r
     }\r
 \r
     NTSTATUS Init(\r
@@ -280,7 +281,7 @@ public:
     // Used to allow the user file to remember us\r
     LIST_ENTRY m_UserFileList;\r
 \r
-#if DBG\r
+\r
 \r
     static char * SS2String(SocketStates state) {\r
         switch (state) {\r
@@ -301,7 +302,7 @@ public:
         return "Unknown state";\r
     }\r
 \r
-#endif\r
+\r
 \r
     VOID AssertLocked();    \r
 };\r
index 3f70eee..5b8e388 100644 (file)
 // Author: Tzachi Dar\r
 \r
 #include "Precompile.h"\r
+#include <stdio.h> \r
+#include <stdarg.h>\r
+#include  <ntstrsafe.h>\r
 \r
-//int g_SdpDbgLevel = SDP_WARN;\r
-int g_SdpDbgLevel = SDP_TRACE;\r
-//int g_SdpDbgLevel = SDP_DEBUG;\r
 \r
-BOOLEAN CheckCondition(int sev, int top, char *file, int line, char * func)\r
-{\r
-    if (sev < g_SdpDbgLevel) return FALSE;\r
-    if (top == SDP_PERFORMANCE) return FALSE;\r
+#if !defined(EVENT_TRACING)\r
+\r
+\r
+#if DBG \r
+//int g_SdpDbgLevel = TRACE_LEVEL_WARNING;\r
+uint32_t g_SdpDbgLevel = TRACE_LEVEL_INFORMATION;\r
+//int g_SdpDbgLevel = TRACE_LEVEL_VERBOSE;\r
+uint32_t g_SdpDbgFlags= SDP_API;\r
+#endif\r
+\r
+VOID\r
+SDP_PRINT    (\r
+    IN ULONG   lvl,\r
+    IN ULONG   flags,\r
+    IN PCCHAR  msg,\r
+    ...\r
+    )\r
+\r
+/*++\r
+\r
+Routine Description:\r
+\r
+    Debug print for the sample driver.\r
+\r
+Arguments:\r
+\r
+    DebugPrintLevel - print level between 0 and 3, with 3 the most verbose\r
+\r
+Return Value:\r
+\r
+    None.\r
+\r
+ --*/\r
+ {\r
+#if DBG\r
+#define     TEMP_BUFFER_SIZE        1024\r
+    va_list    list;\r
+    UCHAR      debugMessageBuffer[TEMP_BUFFER_SIZE];\r
+    NTSTATUS status;\r
+    \r
+    va_start(list, msg);\r
     \r
-    DbgPrint ("%s: ", func);\r
-    if (sev == SDP_ERR) DbgPrint ("ERROR - ");\r
-    return TRUE;\r
-}
\ No newline at end of file
+    if (msg) {\r
+\r
+        //\r
+        // Using new safe string functions instead of _vsnprintf. This function takes\r
+        // care of NULL terminating if the message is longer than the buffer.\r
+        //\r
+        status = RtlStringCbVPrintfA(msg, sizeof(msg), \r
+                                    msg, list);\r
+        if(!NT_SUCCESS(status)) {\r
+            \r
+            KdPrint ((": RtlStringCbVPrintfA failed %x\n", status));\r
+            return;\r
+        }\r
+        if (lvl <= TRACE_LEVEL_INFORMATION || (lvl <= g_SdpDbgLevel && \r
+                ((flags & g_SdpDbgFlags) == flags))) {\r
+            KdPrint(("%s:",__FUNCTION__));\r
+            if(lvl == TRACE_LEVEL_ERROR) KdPrint (("ERROR - "));\r
+            KdPrint ((":%s", msg));\r
+        }        \r
+    }\r
+    va_end(list);\r
+\r
+    return;\r
+#endif\r
+}\r
+\r
+#endif 
\ No newline at end of file
index 9a8029e..ad1b1d9 100644 (file)
 \r
 #ifndef H_SDP_TRACE_H\r
 #define H_SDP_TRACE_H \r
+extern "C" {\r
+#include <ntddk.h>\r
+#include <evntrace.h>\r
+}\r
+#if defined(EVENT_TRACING)\r
 \r
-// Debug level masks\r
-#define SDP_ALL     0x00000001\r
-#define SDP_DEBUG   0x00000002   // also per packet, (would probably change)\r
-#define SDP_TRACE   0x00000004   // No - per packet (data) print \r
-#define SDP_WARN    0x00000008\r
-#define SDP_ERR     0x00000010\r
+//\r
+// Software Tracing Definitions \r
+//\r
+#define WPP_CONTROL_GUIDS \\r
+       WPP_DEFINE_CONTROL_GUID(SdpCtlGuid,(2D4C03CC, E071, 48e2, BDBD, 526A0D69D6C9),  \\r
+       WPP_DEFINE_BIT( SDP_API) \\r
+       WPP_DEFINE_BIT( SDP_CONNECT) \\r
+       WPP_DEFINE_BIT( SDP_DRIVER) \\r
+       WPP_DEFINE_BIT( SDP_SOCKET) \\r
+       WPP_DEFINE_BIT( SDP_ARP) \\r
+       WPP_DEFINE_BIT( SDP_BUFFER_POOL) \\r
+       WPP_DEFINE_BIT( SDP_LOCK) \\r
+       WPP_DEFINE_BIT( SDP_PERFORMANCE) \\r
+       WPP_DEFINE_BIT( SDP_CONNECTION_LIST) \\r
+       WPP_DEFINE_BIT( SDP_CREDITS))\r
+\r
+#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level  >= lvl)\r
+#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)\r
+#define WPP_FLAG_ENABLED(flags)(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level  >= TRACE_LEVEL_VERBOSE)\r
+#define WPP_FLAG_LOGGER(flags) WPP_LEVEL_LOGGER(flags)\r
+\r
+// begin_wpp config\r
+// SDP_ENTER(FLAG);\r
+// SDP_EXIT(FLAG);\r
+// USESUFFIX(SDP_ENTER, "%!FUNC![");\r
+// USESUFFIX(SDP_ENTER, "%!FUNC!]");\r
+// end_wpp\r
+\r
+#else\r
 \r
 // Debug toppics\r
 #define SDP_API             0x000001\r
 \r
 \r
 \r
-// BUGBUG: CONVERT TO A FUNCTION\r
-\r
-BOOLEAN CheckCondition(int sev, int top, char *file, int line, char * func);\r
+VOID\r
+       SDP_PRINT(\r
+       IN ULONG lvl, \r
+       IN ULONG flags, \r
+       IN PCCHAR msg,\r
+       ...);\r
 \r
-#if DBG\r
-#define SDP_PRINT(sev, toppic ,var_args)                                               \\r
-    if (CheckCondition(sev, toppic ,__FILE__, __LINE__,__FUNCTION__)  != FALSE)  \\r
-    DbgPrint var_args\r
-#else\r
-#define SDP_PRINT(sev, toppic ,var_args)\r
 #endif\r
 \r
 \r
index e4932cc..257d0e2 100644 (file)
 \r
 #include "Precompile.h"\r
 \r
+\r
+#if defined(EVENT_TRACING)\r
+#ifdef offsetof\r
+#undef offsetof\r
+#endif\r
+#include "SdpUserFile.tmh"\r
+#endif\r
+\r
 SdpUserFile::SdpUserFile()\r
 {\r
     InitializeListHead(&m_SocketsList);\r
@@ -50,7 +58,7 @@ NTSTATUS SdpUserFile::Init()
 \r
 void SdpUserFile::Shutdown()\r
 {   \r
-    SDP_PRINT(SDP_TRACE, SDP_SOCKET, ("Called this = 0x%p \n",this));\r
+    SDP_PRINT(TRACE_LEVEL_VERBOSE, SDP_SOCKET, "Called this = 0x%p \n",this);\r
     // go over the entire list, and release it's objects\r
     CSpinLockWrapper Lock(m_Lock);\r
     Lock.Lock();\r
@@ -213,7 +221,7 @@ SdpUserFile::UsersThread()
     long NumberOfThreads = InterlockedIncrement(&m_NumberOfUserThreads);\r
     if(NumberOfThreads != 1) {\r
         // It seems that more than one uesr is here, don't let him\r
-        SDP_PRINT(SDP_ERR, SDP_SOCKET, ("More than one user thread !!! \n"));\r
+        SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "More than one user thread !!! \n");\r
         ASSERT(FALSE);\r
         return STATUS_ACCESS_DENIED;\r
     }\r
@@ -252,7 +260,7 @@ SdpUserFile::UsersThread()
         rc = MyKeWaitForSingleObject(&m_UsersCallEvent, UserRequest, UserMode, TRUE, NULL);\r
         \r
         if (rc == STATUS_USER_APC ) {\r
-            SDP_PRINT(SDP_ERR, SDP_SOCKET, ("Worker thread has recieved a user APC, shuting down the process \n"));\r
+            SDP_PRINT(TRACE_LEVEL_ERROR, SDP_SOCKET, "Worker thread has recieved a user APC, shuting down the process \n");\r
             Shutdown();\r
             return STATUS_SUCCESS;\r
         }\r