# HG changeset patch # User Sebastien Jodogne # Date 1391186727 -3600 # Node ID b01cc78caba435128099ae3f504ce2acfc5c1000 # Parent 96d8410c56cdd47b55dbbf23ef9d943b535be1a6 possibility to disable the DICOM/HTTP servers diff -r 96d8410c56cd -r b01cc78caba4 NEWS --- a/NEWS Thu Jan 30 16:58:03 2014 +0100 +++ b/NEWS Fri Jan 31 17:45:27 2014 +0100 @@ -1,6 +1,7 @@ Pending changes in the mainline =============================== +* Possibility to disable the HTTP server or the DICOM server * Recover pixel data for more transfer syntaxes (notably JPEG) * Maintenance tool to recover DICOM files compressed by Orthanc * The newline characters in the configuration file are fixed for Linux diff -r 96d8410c56cd -r b01cc78caba4 OrthancServer/DicomProtocol/DicomServer.cpp --- a/OrthancServer/DicomProtocol/DicomServer.cpp Thu Jan 30 16:58:03 2014 +0100 +++ b/OrthancServer/DicomProtocol/DicomServer.cpp Fri Jan 31 17:45:27 2014 +0100 @@ -94,7 +94,7 @@ #endif - void DicomServer::ServerThread(DicomServer* server) + void DicomServer::InitializeDictionary() { /* Disable "gethostbyaddr" (which results in memory leaks) and use raw IP addresses */ dcmDisableGethostbyaddr.set(OFTrue); @@ -148,7 +148,11 @@ throw OrthancException(ErrorCode_InternalError); } } + } + + void DicomServer::ServerThread(DicomServer* server) + { /* initialize network, i.e. create an instance of T_ASC_Network*. */ T_ASC_Network *net; OFCondition cond = ASC_initializeNetwork diff -r 96d8410c56cd -r b01cc78caba4 OrthancServer/DicomProtocol/DicomServer.h --- a/OrthancServer/DicomProtocol/DicomServer.h Thu Jan 30 16:58:03 2014 +0100 +++ b/OrthancServer/DicomProtocol/DicomServer.h Fri Jan 31 17:45:27 2014 +0100 @@ -66,6 +66,8 @@ static void ServerThread(DicomServer* server); public: + static void InitializeDictionary(); + DicomServer(); ~DicomServer(); diff -r 96d8410c56cd -r b01cc78caba4 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Thu Jan 30 16:58:03 2014 +0100 +++ b/OrthancServer/OrthancInitialization.cpp Fri Jan 31 17:45:27 2014 +0100 @@ -35,6 +35,7 @@ #include "../Core/HttpClient.h" #include "../Core/OrthancException.h" #include "../Core/Toolbox.h" +#include "DicomProtocol/DicomServer.h" #include "ServerEnumerations.h" #include @@ -142,6 +143,8 @@ HttpClient::GlobalInitialize(); RegisterUserMetadata(); + + DicomServer::InitializeDictionary(); } diff -r 96d8410c56cd -r b01cc78caba4 OrthancServer/main.cpp --- a/OrthancServer/main.cpp Thu Jan 30 16:58:03 2014 +0100 +++ b/OrthancServer/main.cpp Fri Jan 31 17:45:27 2014 +0100 @@ -402,9 +402,6 @@ httpServer.SetSslEnabled(false); } - LOG(WARNING) << "DICOM server listening on port: " << dicomServer.GetPortNumber(); - LOG(WARNING) << "HTTP server listening on port: " << httpServer.GetPortNumber(); - #if ORTHANC_STANDALONE == 1 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::ORTHANC_EXPLORER)); #else @@ -413,14 +410,31 @@ httpServer.RegisterHandler(new OrthancRestApi(context)); - // GO !!! - httpServer.Start(); - dicomServer.Start(); + // GO !!! Start the requested servers + if (GetGlobalBoolParameter("HttpServerEnabled", true)) + { + httpServer.Start(); + LOG(WARNING) << "HTTP server listening on port: " << httpServer.GetPortNumber(); + } + else + { + LOG(WARNING) << "The HTTP server is disabled"; + } + + if (GetGlobalBoolParameter("DicomServerEnabled", true)) + { + dicomServer.Start(); + LOG(WARNING) << "DICOM server listening on port: " << dicomServer.GetPortNumber(); + } + else + { + LOG(WARNING) << "The DICOM server is disabled"; + } LOG(WARNING) << "Orthanc has started"; Toolbox::ServerBarrier(); - // Stop + // We're done LOG(WARNING) << "Orthanc is stopping"; } diff -r 96d8410c56cd -r b01cc78caba4 Resources/Configuration.json --- a/Resources/Configuration.json Thu Jan 30 16:58:03 2014 +0100 +++ b/Resources/Configuration.json Fri Jan 31 17:45:27 2014 +0100 @@ -132,5 +132,15 @@ // Number of seconds without receiving any instance before a // patient, a study or a series is considered as stable. - "StableAge" : 60 + "StableAge" : 60, + + // Enable the HTTP server. If this parameter is set to "false", + // Orthanc acts as a pure DICOM server. The REST API and Orthanc + // Explorer will not be available. + "HttpServerEnabled" : true, + + // Enable the DICOM server. If this parameter is set to "false", + // Orthanc acts as a pure REST server. It will not be possible to + // receive files or to do query/retrieve through the DICOM protocol. + "DicomServerEnabled" : true }