Mercurial > hg > orthanc
changeset 685:b01cc78caba4
possibility to disable the DICOM/HTTP servers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 31 Jan 2014 17:45:27 +0100 |
parents | 96d8410c56cd |
children | dc12a3fa4961 |
files | NEWS OrthancServer/DicomProtocol/DicomServer.cpp OrthancServer/DicomProtocol/DicomServer.h OrthancServer/OrthancInitialization.cpp OrthancServer/main.cpp Resources/Configuration.json |
diffstat | 6 files changed, 43 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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();
--- 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 <boost/lexical_cast.hpp> @@ -142,6 +143,8 @@ HttpClient::GlobalInitialize(); RegisterUserMetadata(); + + DicomServer::InitializeDictionary(); }
--- 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"; }
--- 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 }