changeset 4285:544120b34c09

fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Nov 2020 16:27:59 +0100
parents 756126cd2219
children 526bd8bad850
files OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp
diffstat 4 files changed, 68 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Wed Nov 04 15:01:47 2020 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/DicomAssociation.cpp	Wed Nov 04 16:27:59 2020 +0100
@@ -674,10 +674,13 @@
       }
 
       {
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(dataset);
+
         OFString str;
         CLOG(TRACE, DICOM) << "Sending Storage Commitment Report:" << std::endl
                            << DIMSE_dumpMessage(str, message, DIMSE_OUTGOING) << std::endl
-                           << DcmObject::PrintHelper(dataset);
+                           << s.str();
       }
 
       if (!DIMSE_sendMessageUsingMemoryData(
@@ -834,10 +837,13 @@
       }
 
       {
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(dataset);
+
         OFString str;
         CLOG(TRACE, DICOM) << "Sending Storage Commitment Request:" << std::endl
                            << DIMSE_dumpMessage(str, message, DIMSE_OUTGOING) << std::endl
-                           << DcmObject::PrintHelper(dataset);
+                           << s.str();
       }
 
       if (!DIMSE_sendMessageUsingMemoryData(
--- a/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Wed Nov 04 15:01:47 2020 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/DicomControlUserConnection.cpp	Wed Nov 04 16:27:59 2020 +0100
@@ -79,8 +79,9 @@
       
     if (responseIdentifiers != NULL)
     {
-      CLOG(TRACE, DICOM) << "Response Identifiers "  << responseCount << ":" << std::endl
-                         << DcmObject::PrintHelper(*responseIdentifiers);
+      std::stringstream s;  // This is necessary for VS2008
+      s << DcmObject::PrintHelper(*responseIdentifiers);
+      CLOG(TRACE, DICOM) << "Response Identifiers "  << responseCount << ":" << std::endl << s.str();
     }
     
     if (responseIdentifiers != NULL)
@@ -282,10 +283,13 @@
 #endif
 
     {
+      std::stringstream s;  // This is necessary for VS2008
+      s << DcmObject::PrintHelper(*dataset);
+
       OFString str;
       CLOG(TRACE, DICOM) << "Sending Find Request:" << std::endl
                          << DIMSE_dumpMessage(str, request, DIMSE_OUTGOING, NULL, presID) << std::endl
-                         << DcmObject::PrintHelper(*dataset);
+                         << s.str();
     }
 
     OFCondition cond = DIMSE_findUser(
--- a/OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp	Wed Nov 04 15:01:47 2020 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp	Wed Nov 04 16:27:59 2020 +0100
@@ -748,7 +748,10 @@
       // detail information, dump this information
       if (statusDetail != NULL)
       {
-        //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail));
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(*statusDetail);
+        CLOG(TRACE, DICOM) << "Status Detail:" << std::endl << s.str();
+
         delete statusDetail;
       }
 
@@ -1137,7 +1140,14 @@
       
       std::unique_ptr<DcmDataset> dataset(
         ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP", associationTimeout_));
+      assert(dataset.get() != NULL);
 
+      {
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(*dataset);
+        CLOG(TRACE, DICOM) << "Received Storage Commitment Request:" << std::endl << s.str();
+      }
+      
       std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
 
       std::vector<std::string> sopClassUid, sopInstanceUid;
@@ -1200,6 +1210,12 @@
         content.DataSetType = DIMSE_DATASET_NULL;  // Dataset is absent in storage commitment response
         content.opts = O_NACTION_AFFECTEDSOPCLASSUID | O_NACTION_AFFECTEDSOPINSTANCEUID;
 
+        {
+          OFString str;
+          CLOG(TRACE, DICOM) << "Sending Storage Commitment Request Response:" << std::endl
+                             << DIMSE_dumpMessage(str, response, DIMSE_OUTGOING);
+        }
+        
         return DIMSE_sendMessageUsingMemoryData(
           assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */,
           NULL /* callback */, NULL /* callback context */, NULL /* commandSet */);
@@ -1260,7 +1276,14 @@
       
       std::unique_ptr<DcmDataset> dataset(
         ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP", associationTimeout_));
+      assert(dataset.get() != NULL);
 
+      {
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(*dataset);
+        CLOG(TRACE, DICOM) << "Received Storage Commitment Report:" << std::endl << s.str();
+      }
+      
       std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
 
       std::vector<std::string> successSopClassUid, successSopInstanceUid;
@@ -1340,6 +1363,12 @@
         content.DataSetType = DIMSE_DATASET_NULL;  // Dataset is absent in storage commitment response
         content.opts = O_NEVENTREPORT_AFFECTEDSOPCLASSUID | O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID;
 
+        {
+          OFString str;
+          CLOG(TRACE, DICOM) << "Sending Storage Commitment Report Response:" << std::endl
+                             << DIMSE_dumpMessage(str, response, DIMSE_OUTGOING);
+        }
+
         return DIMSE_sendMessageUsingMemoryData(
           assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */,
           NULL /* callback */, NULL /* callback context */, NULL /* commandSet */);
--- a/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp	Wed Nov 04 15:01:47 2020 +0100
+++ b/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp	Wed Nov 04 16:27:59 2020 +0100
@@ -200,6 +200,8 @@
       DcmDataset **responseIdentifiers,
       DcmDataset **statusDetail)
     {
+      assert(requestIdentifiers != NULL);
+      
       bzero(response, sizeof(T_DIMSE_C_FindRSP));
       *statusDetail = NULL;
 
@@ -208,6 +210,12 @@
       FindScpData& data = *reinterpret_cast<FindScpData*>(callbackData);
       if (data.lastRequest_ == NULL)
       {
+        {
+          std::stringstream s;  // This is necessary for VS2008
+          s << DcmObject::PrintHelper(*requestIdentifiers);
+          CLOG(TRACE, DICOM) << "Received C-FIND Request:" << std::endl << s.str();
+        }
+      
         bool ok = false;
 
         try
@@ -333,6 +341,21 @@
         response->DimseStatus = STATUS_FIND_Cancel_MatchingTerminatedDueToCancelRequest;
         *responseIdentifiers = NULL;
       }
+
+      {
+        OFString str;
+        CLOG(TRACE, DICOM) << "Sending C-FIND Response:" << std::endl
+                           << DIMSE_dumpMessage(str, *response, DIMSE_OUTGOING);
+      }
+
+      if (*responseIdentifiers)
+      {
+        std::stringstream s;  // This is necessary for VS2008
+        s << DcmObject::PrintHelper(**responseIdentifiers);
+        CLOG(TRACE, DICOM) << "C-FIND Response Content "
+                           << responseCount << "/" << data.answers_.GetSize() << ":" << std::endl
+                           << s.str();
+      }
     }
   }