annotate OrthancFramework/Sources/DicomNetworking/DicomServer.cpp @ 5858:66fd63b8601e find-refactoring tip

StorageAccessOnFind: cont
author Alain Mazy <am@orthanc.team>
date Mon, 04 Nov 2024 22:34:14 +0100
parents 9d27024a431f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1243
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5450
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 * the License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 128
diff changeset
13 *
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * Lesser General Public License for more details.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * <http://www.gnu.org/licenses/>.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
25 #include "../PrecompiledHeaders.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "DicomServer.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3965
7f296ae25039 reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3818
diff changeset
28 #include "../Logging.h"
7f296ae25039 reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3818
diff changeset
29 #include "../MultiThreading/RunnableWorkersPool.h"
7f296ae25039 reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3818
diff changeset
30 #include "../OrthancException.h"
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
31 #include "../SystemToolbox.h"
3965
7f296ae25039 reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3818
diff changeset
32 #include "../Toolbox.h"
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
33 #include "DicomAssociationParameters.h"
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
34 #include "Internals/CommandDispatcher.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 #include <boost/thread.hpp>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
38 #if ORTHANC_ENABLE_SSL == 1
4432
fcbac3e8ac1c dicom tls for scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4430
diff changeset
39 # include "Internals/DicomTls.h"
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
40 #endif
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
41
1976
325772dadcd6 Macro "__linux" (now obsolete) replaced by macro "__linux__"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
42 #if defined(__linux__)
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
43 # include <cstdlib>
376
2cef9c2d4148 separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
44 #endif
2cef9c2d4148 separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 357
diff changeset
45
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
47 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 struct DicomServer::PImpl
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
1681
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
51 boost::thread thread_;
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
52 T_ASC_Network *network_;
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
53 std::unique_ptr<RunnableWorkersPool> workers_;
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
54
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
55 #if ORTHANC_ENABLE_SSL == 1
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
56 std::unique_ptr<DcmTLSTransportLayer> tls_;
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
57 #endif
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
61 void DicomServer::ServerThread(DicomServer* server,
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
62 unsigned int maximumPduLength,
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
63 bool useDicomTls)
685
b01cc78caba4 possibility to disable the DICOM/HTTP servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 660
diff changeset
64 {
5450
9ffd6d18daf3 log lines now contain the thread name
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
65 Logging::SetCurrentThreadName("DICOM-SERVER");
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
66 CLOG(INFO, DICOM) << "DICOM server started";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 while (server->continue_)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 /* receive an association and acknowledge or reject it. If the association was */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 /* acknowledged, offer corresponding services and invoke one or more if required. */
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
72 std::unique_ptr<Internals::CommandDispatcher> dispatcher(
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
73 Internals::AcceptAssociation(*server, server->pimpl_->network_, maximumPduLength, useDicomTls));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
75 try
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
77 if (dispatcher.get() != NULL)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
1681
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
79 server->pimpl_->workers_->Add(dispatcher.release());
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
81 }
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
82 catch (OrthancException& e)
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
83 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
84 CLOG(ERROR, DICOM) << "Exception in the DICOM server thread: " << e.What();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
88 CLOG(INFO, DICOM) << "DICOM server stopping";
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
89 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
92 DicomServer::DicomServer() :
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 494
diff changeset
93 pimpl_(new PImpl),
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
94 checkCalledAet_(true),
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
95 aet_("ANY-SCP"),
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
96 port_(104),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
97 continue_(false),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
98 associationTimeout_(30),
4795
22d5b611dea7 fix init var
Alain Mazy <am@osimis.io>
parents: 4793
diff changeset
99 threadsCount_(4),
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
100 modalities_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
101 findRequestHandlerFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
102 moveRequestHandlerFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
103 getRequestHandlerFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
104 storeRequestHandlerFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
105 worklistRequestHandlerFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
106 storageCommitmentFactory_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
107 applicationEntityFilter_(NULL),
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
108 useDicomTls_(false),
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
109 maximumPduLength_(ASC_DEFAULTMAXPDU),
5646
9d27024a431f fix uninitialized variable minimumTlsVersion_ in DicomServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5643
diff changeset
110 remoteCertificateRequired_(true),
9d27024a431f fix uninitialized variable minimumTlsVersion_ in DicomServer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5643
diff changeset
111 minimumTlsVersion_(0)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 DicomServer::~DicomServer()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 {
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
117 if (continue_)
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
118 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
119 CLOG(ERROR, DICOM) << "INTERNAL ERROR: DicomServer::Stop() should be invoked manually to avoid mess in the destruction order!";
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
120 Stop();
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
121 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123
128
2a24f43d9dca fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
124 void DicomServer::SetPortNumber(uint16_t port)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 port_ = port;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129
128
2a24f43d9dca fix for windows
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 125
diff changeset
130 uint16_t DicomServer::GetPortNumber() const
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 return port_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
135 void DicomServer::SetAssociationTimeout(uint32_t seconds)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
137 CLOG(INFO, DICOM) << "Setting timeout for DICOM connections if Orthanc acts as SCP (server): "
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
138 << seconds << " seconds (0 = no timeout)";
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
139
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 Stop();
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
141 associationTimeout_ = seconds;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1976
diff changeset
144 uint32_t DicomServer::GetAssociationTimeout() const
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1976
diff changeset
146 return associationTimeout_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 void DicomServer::SetCalledApplicationEntityTitleCheck(bool check)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 checkCalledAet_ = check;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 bool DicomServer::HasCalledApplicationEntityTitleCheck() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 return checkCalledAet_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 void DicomServer::SetApplicationEntityTitle(const std::string& aet)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 if (aet.size() == 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
165 throw OrthancException(ErrorCode_BadApplicationEntityTitle);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
1234
a65ad39596cb fix issue 25
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1193
diff changeset
168 if (aet.size() > 16)
a65ad39596cb fix issue 25
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1193
diff changeset
169 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
170 throw OrthancException(ErrorCode_BadApplicationEntityTitle);
1234
a65ad39596cb fix issue 25
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1193
diff changeset
171 }
a65ad39596cb fix issue 25
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1193
diff changeset
172
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 for (size_t i = 0; i < aet.size(); i++)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 {
1243
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1234
diff changeset
175 if (!(aet[i] == '-' ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1234
diff changeset
176 aet[i] == '_' ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1234
diff changeset
177 isdigit(aet[i]) ||
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1234
diff changeset
178 (aet[i] >= 'A' && aet[i] <= 'Z')))
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
180 CLOG(WARNING, DICOM) << "For best interoperability, only upper case, alphanumeric characters should be present in AET: \"" << aet << "\"";
1234
a65ad39596cb fix issue 25
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1193
diff changeset
181 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 aet_ = aet;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 const std::string& DicomServer::GetApplicationEntityTitle() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 return aet_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
194 void DicomServer::SetRemoteModalities(IRemoteModalities& modalities)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
195 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
196 Stop();
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
197 modalities_ = &modalities;
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
198 }
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
199
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
200 DicomServer::IRemoteModalities& DicomServer::GetRemoteModalities() const
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
201 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
202 if (modalities_ == NULL)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
203 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
204 throw OrthancException(ErrorCode_BadSequenceOfCalls);
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
205 }
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
206 else
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
207 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
208 return *modalities_;
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
209 }
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
210 }
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
211
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 void DicomServer::SetFindRequestHandlerFactory(IFindRequestHandlerFactory& factory)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 findRequestHandlerFactory_ = &factory;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 bool DicomServer::HasFindRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 return (findRequestHandlerFactory_ != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 IFindRequestHandlerFactory& DicomServer::GetFindRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 if (HasFindRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 return *findRequestHandlerFactory_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
231 throw OrthancException(ErrorCode_NoCFindHandler);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 moveRequestHandlerFactory_ = &factory;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 bool DicomServer::HasMoveRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 return (moveRequestHandlerFactory_ != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 IMoveRequestHandlerFactory& DicomServer::GetMoveRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 if (HasMoveRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 return *moveRequestHandlerFactory_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
254 throw OrthancException(ErrorCode_NoCMoveHandler);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
258 void DicomServer::SetGetRequestHandlerFactory(IGetRequestHandlerFactory& factory)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
259 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
260 Stop();
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
261 getRequestHandlerFactory_ = &factory;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
262 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
263
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
264 bool DicomServer::HasGetRequestHandlerFactory() const
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
265 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
266 return (getRequestHandlerFactory_ != NULL);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
267 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
268
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
269 IGetRequestHandlerFactory& DicomServer::GetGetRequestHandlerFactory() const
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
270 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
271 if (HasGetRequestHandlerFactory())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
272 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
273 return *getRequestHandlerFactory_;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
274 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
275 else
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
276 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
277 throw OrthancException(ErrorCode_NoCGetHandler);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
278 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
279 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3713
diff changeset
280
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 storeRequestHandlerFactory_ = &factory;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 bool DicomServer::HasStoreRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 return (storeRequestHandlerFactory_ != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 IStoreRequestHandlerFactory& DicomServer::GetStoreRequestHandlerFactory() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 if (HasStoreRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 return *storeRequestHandlerFactory_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
300 throw OrthancException(ErrorCode_NoCStoreHandler);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
304 void DicomServer::SetWorklistRequestHandlerFactory(IWorklistRequestHandlerFactory& factory)
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
305 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
306 Stop();
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
307 worklistRequestHandlerFactory_ = &factory;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
308 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
309
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
310 bool DicomServer::HasWorklistRequestHandlerFactory() const
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
311 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
312 return (worklistRequestHandlerFactory_ != NULL);
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
313 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
314
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
315 IWorklistRequestHandlerFactory& DicomServer::GetWorklistRequestHandlerFactory() const
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
316 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
317 if (HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
318 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
319 return *worklistRequestHandlerFactory_;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
320 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
321 else
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
322 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
323 throw OrthancException(ErrorCode_NoWorklistHandler);
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
324 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
325 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1682
diff changeset
326
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
327 void DicomServer::SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& factory)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
328 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
329 Stop();
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
330 storageCommitmentFactory_ = &factory;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
331 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
332
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
333 bool DicomServer::HasStorageCommitmentRequestHandlerFactory() const
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
334 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
335 return (storageCommitmentFactory_ != NULL);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
336 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
337
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
338 IStorageCommitmentRequestHandlerFactory& DicomServer::GetStorageCommitmentRequestHandlerFactory() const
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
339 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
340 if (HasStorageCommitmentRequestHandlerFactory())
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
341 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
342 return *storageCommitmentFactory_;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
343 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
344 else
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
345 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
346 throw OrthancException(ErrorCode_NoStorageCommitmentHandler);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
347 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
348 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3330
diff changeset
349
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
351 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 applicationEntityFilter_ = &factory;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 bool DicomServer::HasApplicationEntityFilter() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 return (applicationEntityFilter_ != NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 IApplicationEntityFilter& DicomServer::GetApplicationEntityFilter() const
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 if (HasApplicationEntityFilter())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365 return *applicationEntityFilter_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 {
1582
bd1889029cbb encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
369 throw OrthancException(ErrorCode_NoApplicationEntityFilter);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
373
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 void DicomServer::Start()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 {
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
376 if (modalities_ == NULL)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
377 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
378 throw OrthancException(ErrorCode_BadSequenceOfCalls,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
379 "No list of modalities was provided to the DICOM server");
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
380 }
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
381
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
382 if (useDicomTls_)
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
383 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
384 if (ownCertificatePath_.empty() ||
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
385 ownPrivateKeyPath_.empty())
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
386 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
387 throw OrthancException(ErrorCode_ParameterOutOfRange,
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
388 "DICOM TLS is enabled in Orthanc SCP, but no certificate was provided");
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
389 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
390 }
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
391
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 Stop();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
394 /* initialize network, i.e. create an instance of T_ASC_Network*. */
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
395 OFCondition cond = ASC_initializeNetwork
2069
fabf7820d1f1 New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
396 (NET_ACCEPTOR, OFstatic_cast(int, port_), /*opt_acse_timeout*/ 30, &pimpl_->network_);
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
397 if (cond.bad())
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
399 throw OrthancException(ErrorCode_DicomPortInUse,
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
400 " (port = " + boost::lexical_cast<std::string>(port_) +
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
401 ") cannot create network: " + std::string(cond.text()));
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
402 }
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
403
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
404 #if ORTHANC_ENABLE_SSL == 1
4432
fcbac3e8ac1c dicom tls for scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4430
diff changeset
405 assert(pimpl_->tls_.get() == NULL);
fcbac3e8ac1c dicom tls for scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4430
diff changeset
406
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
407 if (useDicomTls_)
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
408 {
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
409 CLOG(INFO, DICOM) << "Orthanc SCP will use DICOM TLS";
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
410
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
411 try
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
412 {
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
413 pimpl_->tls_.reset(Internals::InitializeDicomTls(
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
414 pimpl_->network_, NET_ACCEPTOR, ownPrivateKeyPath_, ownCertificatePath_,
5643
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
415 trustedCertificatesPath_, remoteCertificateRequired_, minimumTlsVersion_, acceptedCiphers_));
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
416 }
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
417 catch (OrthancException&)
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
418 {
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
419 ASC_dropNetwork(&pimpl_->network_);
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
420 throw;
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
421 }
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
422 }
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
423 else
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
424 {
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
425 CLOG(INFO, DICOM) << "Orthanc SCP will *not* use DICOM TLS";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426 }
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
427 #else
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
428 CLOG(INFO, DICOM) << "Orthanc SCP will *not* use DICOM TLS";
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
429 #endif
1680
4113a9a668b1 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
430
1675
131136aeeaa7 improved exception handling in the main program
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1656
diff changeset
431 continue_ = true;
4793
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
432
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
433 CLOG(INFO, DICOM) << "The embedded DICOM server will use " << threadsCount_ << " threads";
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
434
5450
9ffd6d18daf3 log lines now contain the thread name
Alain Mazy <am@osimis.io>
parents: 5185
diff changeset
435 pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_, "DICOM-"));
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
436 pimpl_->thread_ = boost::thread(ServerThread, this, maximumPduLength_, useDicomTls_);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
439
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 void DicomServer::Stop()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 {
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
442 if (continue_)
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
443 {
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
444 continue_ = false;
431
16b52fb8d034 fix by cyril paulus
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
445
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
446 if (pimpl_->thread_.joinable())
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
447 {
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
448 pimpl_->thread_.join();
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
449 }
1454
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1453
diff changeset
450
1681
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
451 pimpl_->workers_.reset(NULL);
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
452
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
453 #if ORTHANC_ENABLE_SSL == 1
4432
fcbac3e8ac1c dicom tls for scu
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4430
diff changeset
454 pimpl_->tls_.reset(NULL); // Transport layer must be destroyed before the association itself
4430
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
455 #endif
f5d44e30b429 testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
456
1681
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
457 /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
458 /* is the counterpart of ASC_initializeNetwork(...) which was called above. */
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
459 OFCondition cond = ASC_dropNetwork(&pimpl_->network_);
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
460 if (cond.bad())
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
461 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
462 CLOG(ERROR, DICOM) << "Error while dropping the network: " << cond.text();
1681
ee4367497d0d got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1680
diff changeset
463 }
431
16b52fb8d034 fix by cyril paulus
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
464 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 }
690
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
466
1453
c0bdc47165ef code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
467
690
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
468 bool DicomServer::IsMyAETitle(const std::string& aet) const
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
469 {
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
470 if (modalities_ == NULL)
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
471 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
472 throw OrthancException(ErrorCode_BadSequenceOfCalls);
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
473 }
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
474
690
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
475 if (!HasCalledApplicationEntityTitleCheck())
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
476 {
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
477 // OK, no check on the AET.
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
478 return true;
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
479 }
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
480 else
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
481 {
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
482 return modalities_->IsSameAETitle(aet, GetApplicationEntityTitle());
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2380
diff changeset
483 }
690
2e67366aab83 case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
484 }
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
485
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
486
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
487 void DicomServer::SetDicomTlsEnabled(bool enabled)
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
488 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
489 Stop();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
490 useDicomTls_ = enabled;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
491 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
492
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
493 bool DicomServer::IsDicomTlsEnabled() const
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
494 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
495 return useDicomTls_;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
496 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
497
5643
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
498 void DicomServer::SetMinimumTlsVersion(unsigned int version)
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
499 {
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
500 minimumTlsVersion_ = version;
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
501 DicomAssociationParameters::SetMinimumTlsVersion(version);
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
502 }
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
503
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
504 void DicomServer::SetAcceptedCiphers(const std::set<std::string>& ciphers)
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
505 {
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
506 acceptedCiphers_ = ciphers;
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
507 DicomAssociationParameters::SetAcceptedCiphers(ciphers);
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
508 }
b1a18218860c 2 new configurations: DicomTlsMinimumProtocolVersion + DicomTlsCiphersAccepted
Alain Mazy <am@orthanc.team>
parents: 5640
diff changeset
509
4439
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
510 void DicomServer::SetOwnCertificatePath(const std::string& privateKeyPath,
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
511 const std::string& certificatePath)
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
512 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
513 Stop();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
514
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
515 if (!privateKeyPath.empty() &&
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
516 !certificatePath.empty())
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
517 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
518 CLOG(INFO, DICOM) << "Setting the TLS certificate for DICOM SCP connections: "
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
519 << privateKeyPath << " (key), " << certificatePath << " (certificate)";
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
520
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
521 if (certificatePath.empty())
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
522 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
523 throw OrthancException(ErrorCode_ParameterOutOfRange, "No path to the default DICOM TLS certificate was provided");
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
524 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
525
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
526 if (privateKeyPath.empty())
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
527 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
528 throw OrthancException(ErrorCode_ParameterOutOfRange,
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
529 "No path to the private key for the default DICOM TLS certificate was provided");
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
530 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
531
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
532 if (!SystemToolbox::IsRegularFile(privateKeyPath))
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
533 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
534 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + privateKeyPath);
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
535 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
536
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
537 if (!SystemToolbox::IsRegularFile(certificatePath))
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
538 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
539 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + certificatePath);
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
540 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
541
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
542 ownPrivateKeyPath_ = privateKeyPath;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
543 ownCertificatePath_ = certificatePath;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
544 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
545 else
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
546 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
547 ownPrivateKeyPath_.clear();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
548 ownCertificatePath_.clear();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
549 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
550 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
551
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
552 const std::string& DicomServer::GetOwnPrivateKeyPath() const
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
553 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
554 return ownPrivateKeyPath_;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
555 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
556
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
557 const std::string& DicomServer::GetOwnCertificatePath() const
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
558 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
559 return ownCertificatePath_;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
560 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
561
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
562 void DicomServer::SetTrustedCertificatesPath(const std::string& path)
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
563 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
564 Stop();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
565
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
566 if (!path.empty())
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
567 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
568 CLOG(INFO, DICOM) << "Setting the trusted certificates for DICOM SCP connections: " << path;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
569
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
570 if (!SystemToolbox::IsRegularFile(path))
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
571 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
572 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + path);
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
573 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
574
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
575 trustedCertificatesPath_ = path;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
576 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
577 else
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
578 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
579 trustedCertificatesPath_.clear();
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
580 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
581 }
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
582
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
583 const std::string& DicomServer::GetTrustedCertificatesPath() const
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
584 {
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
585 return trustedCertificatesPath_;
5209a9ff6e38 configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
586 }
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
587
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
588 unsigned int DicomServer::GetMaximumPduLength() const
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
589 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
590 return maximumPduLength_;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
591 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
592
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
593 void DicomServer::SetMaximumPduLength(unsigned int pdu)
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
594 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
595 DicomAssociationParameters::CheckMaximumPduLength(pdu);
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
596
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
597 Stop();
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
598 maximumPduLength_ = pdu;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4439
diff changeset
599 }
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
600
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
601 void DicomServer::SetRemoteCertificateRequired(bool required)
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
602 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
603 Stop();
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
604 remoteCertificateRequired_ = required;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
605 }
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
606
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
607 bool DicomServer::IsRemoteCertificateRequired() const
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
608 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
609 return remoteCertificateRequired_;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4481
diff changeset
610 }
4793
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
611
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
612 void DicomServer::SetThreadsCount(unsigned int threads)
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
613 {
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
614 if (threads == 0)
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
615 {
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
616 throw OrthancException(ErrorCode_ParameterOutOfRange);
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
617 }
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
618
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
619 Stop();
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
620 threadsCount_ = threads;
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
621 }
fc2ba1ce6538 new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents: 4656
diff changeset
622
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 }