diff OrthancServer/Internals/CommandDispatcher.cpp @ 1806:cd213ebcaefd

UnknownSopClassAccepted option
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 23 Nov 2015 15:24:39 +0100
parents 30e97a1f4093
children b1291df2f780
line wrap: on
line diff
--- a/OrthancServer/Internals/CommandDispatcher.cpp	Fri Nov 20 16:50:01 2015 +0100
+++ b/OrthancServer/Internals/CommandDispatcher.cpp	Mon Nov 23 15:24:39 2015 +0100
@@ -91,15 +91,11 @@
 #include <dcmtk/dcmnet/dcasccfg.h>      /* for class DcmAssociationConfiguration */
 #include <boost/lexical_cast.hpp>
 
-#define ORTHANC_PROMISCUOUS 1
-
 static OFBool    opt_rejectWithoutImplementationUID = OFFalse;
 
 
 
-#if ORTHANC_PROMISCUOUS == 1
-static
-DUL_PRESENTATIONCONTEXT *
+static DUL_PRESENTATIONCONTEXT *
 findPresentationContextID(LST_HEAD * head,
                           T_ASC_PresentationContextID presentationContextID)
 {
@@ -231,7 +227,6 @@
   }
   return cond;
 }
-#endif
 
 
 
@@ -590,17 +585,22 @@
         return NULL;
       }
 
-#if ORTHANC_PROMISCUOUS == 1
-      /* accept everything not known not to be a storage SOP class */
-      cond = acceptUnknownContextsWithPreferredTransferSyntaxes(
-        assoc->params, &transferSyntaxes[0], transferSyntaxes.size());
-      if (cond.bad())
+      if (!server.HasApplicationEntityFilter() ||
+          server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet))
       {
-        LOG(INFO) << cond.text();
-        AssociationCleanup(assoc);
-        return NULL;
+        /*
+         * Promiscous mode is enabled: Accept everything not known not
+         * to be a storage SOP class.
+         **/
+        cond = acceptUnknownContextsWithPreferredTransferSyntaxes(
+          assoc->params, &transferSyntaxes[0], transferSyntaxes.size());
+        if (cond.bad())
+        {
+          LOG(INFO) << cond.text();
+          AssociationCleanup(assoc);
+          return NULL;
+        }
       }
-#endif
 
       /* set our app title */
       ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str());