Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomServer.cpp @ 5546:42a33df3db3c
fix framework MD5
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 26 Mar 2024 10:17:28 +0100 |
parents | 48b8dae6dc77 |
children | f7adfb22e20e |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 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 |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5450
diff
changeset
|
5 * Copyright (C) 2017-2024 Osimis S.A., Belgium |
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5450
diff
changeset
|
6 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 7 * |
8 * 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
|
9 * 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
|
10 * 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
|
11 * the License, or (at your option) any later version. |
136 | 12 * |
0 | 13 * This program is distributed in the hope that it will be useful, but |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * 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
|
16 * Lesser General Public License for more details. |
0 | 17 * |
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
|
18 * 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
|
19 * 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
|
20 * <http://www.gnu.org/licenses/>. |
0 | 21 **/ |
22 | |
23 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
24 #include "../PrecompiledHeaders.h" |
0 | 25 #include "DicomServer.h" |
26 | |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3818
diff
changeset
|
27 #include "../Logging.h" |
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3818
diff
changeset
|
28 #include "../MultiThreading/RunnableWorkersPool.h" |
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3818
diff
changeset
|
29 #include "../OrthancException.h" |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
30 #include "../SystemToolbox.h" |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3818
diff
changeset
|
31 #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
|
32 #include "DicomAssociationParameters.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
33 #include "Internals/CommandDispatcher.h" |
0 | 34 |
35 #include <boost/thread.hpp> | |
36 | |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
37 #if ORTHANC_ENABLE_SSL == 1 |
4432 | 38 # include "Internals/DicomTls.h" |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
39 #endif |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
40 |
1976
325772dadcd6
Macro "__linux" (now obsolete) replaced by macro "__linux__"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
41 #if defined(__linux__) |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
42 # include <cstdlib> |
376
2cef9c2d4148
separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
357
diff
changeset
|
43 #endif |
2cef9c2d4148
separate path for SQLite index, manual loading of external dictionaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
357
diff
changeset
|
44 |
0 | 45 |
62 | 46 namespace Orthanc |
0 | 47 { |
48 struct DicomServer::PImpl | |
49 { | |
1681
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
50 boost::thread thread_; |
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
51 T_ASC_Network *network_; |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
52 std::unique_ptr<RunnableWorkersPool> workers_; |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
53 |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
54 #if ORTHANC_ENABLE_SSL == 1 |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
55 std::unique_ptr<DcmTLSTransportLayer> tls_; |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
56 #endif |
0 | 57 }; |
58 | |
59 | |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
60 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
|
61 unsigned int maximumPduLength, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
62 bool useDicomTls) |
685
b01cc78caba4
possibility to disable the DICOM/HTTP servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
660
diff
changeset
|
63 { |
5450
9ffd6d18daf3
log lines now contain the thread name
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
64 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
|
65 CLOG(INFO, DICOM) << "DICOM server started"; |
0 | 66 |
67 while (server->continue_) | |
68 { | |
69 /* receive an association and acknowledge or reject it. If the association was */ | |
70 /* 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
|
71 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
|
72 Internals::AcceptAssociation(*server, server->pimpl_->network_, maximumPduLength, useDicomTls)); |
0 | 73 |
1680 | 74 try |
0 | 75 { |
1680 | 76 if (dispatcher.get() != NULL) |
0 | 77 { |
1681
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
78 server->pimpl_->workers_->Add(dispatcher.release()); |
0 | 79 } |
1680 | 80 } |
81 catch (OrthancException& e) | |
82 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
83 CLOG(ERROR, DICOM) << "Exception in the DICOM server thread: " << e.What(); |
0 | 84 } |
85 } | |
86 | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
87 CLOG(INFO, DICOM) << "DICOM server stopping"; |
1680 | 88 } |
0 | 89 |
90 | |
656 | 91 DicomServer::DicomServer() : |
92 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
|
93 checkCalledAet_(true), |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
94 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
|
95 port_(104), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
96 continue_(false), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
97 associationTimeout_(30), |
4795 | 98 threadsCount_(4), |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
99 modalities_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
100 findRequestHandlerFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
101 moveRequestHandlerFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
102 getRequestHandlerFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
103 storeRequestHandlerFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
104 worklistRequestHandlerFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
105 storageCommitmentFactory_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
106 applicationEntityFilter_(NULL), |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
107 useDicomTls_(false), |
4656
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
108 maximumPduLength_(ASC_DEFAULTMAXPDU), |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
109 remoteCertificateRequired_(true) |
0 | 110 { |
111 } | |
112 | |
113 DicomServer::~DicomServer() | |
114 { | |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
115 if (continue_) |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
116 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
117 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
|
118 Stop(); |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
119 } |
0 | 120 } |
121 | |
128 | 122 void DicomServer::SetPortNumber(uint16_t port) |
0 | 123 { |
124 Stop(); | |
125 port_ = port; | |
126 } | |
127 | |
128 | 128 uint16_t DicomServer::GetPortNumber() const |
0 | 129 { |
130 return port_; | |
131 } | |
132 | |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
133 void DicomServer::SetAssociationTimeout(uint32_t seconds) |
0 | 134 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
135 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
|
136 << 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
|
137 |
0 | 138 Stop(); |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
139 associationTimeout_ = seconds; |
0 | 140 } |
141 | |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
142 uint32_t DicomServer::GetAssociationTimeout() const |
0 | 143 { |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1976
diff
changeset
|
144 return associationTimeout_; |
0 | 145 } |
146 | |
147 | |
148 void DicomServer::SetCalledApplicationEntityTitleCheck(bool check) | |
149 { | |
150 Stop(); | |
151 checkCalledAet_ = check; | |
152 } | |
153 | |
154 bool DicomServer::HasCalledApplicationEntityTitleCheck() const | |
155 { | |
156 return checkCalledAet_; | |
157 } | |
158 | |
159 void DicomServer::SetApplicationEntityTitle(const std::string& aet) | |
160 { | |
161 if (aet.size() == 0) | |
162 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
163 throw OrthancException(ErrorCode_BadApplicationEntityTitle); |
0 | 164 } |
165 | |
1234 | 166 if (aet.size() > 16) |
167 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
168 throw OrthancException(ErrorCode_BadApplicationEntityTitle); |
1234 | 169 } |
170 | |
0 | 171 for (size_t i = 0; i < aet.size(); i++) |
172 { | |
1243 | 173 if (!(aet[i] == '-' || |
174 aet[i] == '_' || | |
175 isdigit(aet[i]) || | |
176 (aet[i] >= 'A' && aet[i] <= 'Z'))) | |
0 | 177 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
178 CLOG(WARNING, DICOM) << "For best interoperability, only upper case, alphanumeric characters should be present in AET: \"" << aet << "\""; |
1234 | 179 break; |
0 | 180 } |
181 } | |
182 | |
183 Stop(); | |
184 aet_ = aet; | |
185 } | |
186 | |
187 const std::string& DicomServer::GetApplicationEntityTitle() const | |
188 { | |
189 return aet_; | |
190 } | |
191 | |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
192 void DicomServer::SetRemoteModalities(IRemoteModalities& modalities) |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
193 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
194 Stop(); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
195 modalities_ = &modalities; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
196 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
197 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
198 DicomServer::IRemoteModalities& DicomServer::GetRemoteModalities() const |
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 if (modalities_ == NULL) |
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 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
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 else |
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 return *modalities_; |
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 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
209 |
0 | 210 void DicomServer::SetFindRequestHandlerFactory(IFindRequestHandlerFactory& factory) |
211 { | |
212 Stop(); | |
213 findRequestHandlerFactory_ = &factory; | |
214 } | |
215 | |
216 bool DicomServer::HasFindRequestHandlerFactory() const | |
217 { | |
218 return (findRequestHandlerFactory_ != NULL); | |
219 } | |
220 | |
221 IFindRequestHandlerFactory& DicomServer::GetFindRequestHandlerFactory() const | |
222 { | |
223 if (HasFindRequestHandlerFactory()) | |
224 { | |
225 return *findRequestHandlerFactory_; | |
226 } | |
227 else | |
228 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
229 throw OrthancException(ErrorCode_NoCFindHandler); |
0 | 230 } |
231 } | |
232 | |
233 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory) | |
234 { | |
235 Stop(); | |
236 moveRequestHandlerFactory_ = &factory; | |
237 } | |
238 | |
239 bool DicomServer::HasMoveRequestHandlerFactory() const | |
240 { | |
241 return (moveRequestHandlerFactory_ != NULL); | |
242 } | |
243 | |
244 IMoveRequestHandlerFactory& DicomServer::GetMoveRequestHandlerFactory() const | |
245 { | |
246 if (HasMoveRequestHandlerFactory()) | |
247 { | |
248 return *moveRequestHandlerFactory_; | |
249 } | |
250 else | |
251 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
252 throw OrthancException(ErrorCode_NoCMoveHandler); |
0 | 253 } |
254 } | |
255 | |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
256 void DicomServer::SetGetRequestHandlerFactory(IGetRequestHandlerFactory& factory) |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
257 { |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
258 Stop(); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
259 getRequestHandlerFactory_ = &factory; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
260 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
261 |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
262 bool DicomServer::HasGetRequestHandlerFactory() const |
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 return (getRequestHandlerFactory_ != NULL); |
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 |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
267 IGetRequestHandlerFactory& DicomServer::GetGetRequestHandlerFactory() const |
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 if (HasGetRequestHandlerFactory()) |
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 return *getRequestHandlerFactory_; |
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 else |
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 throw OrthancException(ErrorCode_NoCGetHandler); |
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 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3713
diff
changeset
|
278 |
0 | 279 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory) |
280 { | |
281 Stop(); | |
282 storeRequestHandlerFactory_ = &factory; | |
283 } | |
284 | |
285 bool DicomServer::HasStoreRequestHandlerFactory() const | |
286 { | |
287 return (storeRequestHandlerFactory_ != NULL); | |
288 } | |
289 | |
290 IStoreRequestHandlerFactory& DicomServer::GetStoreRequestHandlerFactory() const | |
291 { | |
292 if (HasStoreRequestHandlerFactory()) | |
293 { | |
294 return *storeRequestHandlerFactory_; | |
295 } | |
296 else | |
297 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
298 throw OrthancException(ErrorCode_NoCStoreHandler); |
0 | 299 } |
300 } | |
301 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
302 void DicomServer::SetWorklistRequestHandlerFactory(IWorklistRequestHandlerFactory& factory) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
303 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
304 Stop(); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
305 worklistRequestHandlerFactory_ = &factory; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
306 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
307 |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
308 bool DicomServer::HasWorklistRequestHandlerFactory() const |
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 return (worklistRequestHandlerFactory_ != NULL); |
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 |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
313 IWorklistRequestHandlerFactory& DicomServer::GetWorklistRequestHandlerFactory() const |
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 if (HasWorklistRequestHandlerFactory()) |
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 return *worklistRequestHandlerFactory_; |
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 else |
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 throw OrthancException(ErrorCode_NoWorklistHandler); |
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 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
324 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
325 void DicomServer::SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& factory) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
326 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
327 Stop(); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
328 storageCommitmentFactory_ = &factory; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
329 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
330 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
331 bool DicomServer::HasStorageCommitmentRequestHandlerFactory() const |
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 return (storageCommitmentFactory_ != NULL); |
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 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
336 IStorageCommitmentRequestHandlerFactory& DicomServer::GetStorageCommitmentRequestHandlerFactory() const |
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 if (HasStorageCommitmentRequestHandlerFactory()) |
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 return *storageCommitmentFactory_; |
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 else |
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 throw OrthancException(ErrorCode_NoStorageCommitmentHandler); |
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 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3330
diff
changeset
|
347 |
0 | 348 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory) |
349 { | |
350 Stop(); | |
351 applicationEntityFilter_ = &factory; | |
352 } | |
353 | |
354 bool DicomServer::HasApplicationEntityFilter() const | |
355 { | |
356 return (applicationEntityFilter_ != NULL); | |
357 } | |
358 | |
359 IApplicationEntityFilter& DicomServer::GetApplicationEntityFilter() const | |
360 { | |
361 if (HasApplicationEntityFilter()) | |
362 { | |
363 return *applicationEntityFilter_; | |
364 } | |
365 else | |
366 { | |
1582
bd1889029cbb
encoding of exceptions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1486
diff
changeset
|
367 throw OrthancException(ErrorCode_NoApplicationEntityFilter); |
0 | 368 } |
369 } | |
370 | |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
371 |
0 | 372 void DicomServer::Start() |
373 { | |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
374 if (modalities_ == NULL) |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
375 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
376 throw OrthancException(ErrorCode_BadSequenceOfCalls, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
377 "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
|
378 } |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
379 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
380 if (useDicomTls_) |
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 (ownCertificatePath_.empty() || |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
383 ownPrivateKeyPath_.empty()) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
384 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
385 throw OrthancException(ErrorCode_ParameterOutOfRange, |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
386 "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
|
387 } |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
388 } |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
389 |
0 | 390 Stop(); |
391 | |
1680 | 392 /* initialize network, i.e. create an instance of T_ASC_Network*. */ |
393 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
|
394 (NET_ACCEPTOR, OFstatic_cast(int, port_), /*opt_acse_timeout*/ 30, &pimpl_->network_); |
1680 | 395 if (cond.bad()) |
0 | 396 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
397 throw OrthancException(ErrorCode_DicomPortInUse, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
398 " (port = " + boost::lexical_cast<std::string>(port_) + |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
399 ") cannot create network: " + std::string(cond.text())); |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
400 } |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
401 |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
402 #if ORTHANC_ENABLE_SSL == 1 |
4432 | 403 assert(pimpl_->tls_.get() == NULL); |
404 | |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
405 if (useDicomTls_) |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
406 { |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
407 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
|
408 |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
409 try |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
410 { |
4656
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
411 pimpl_->tls_.reset(Internals::InitializeDicomTls( |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
412 pimpl_->network_, NET_ACCEPTOR, ownPrivateKeyPath_, ownCertificatePath_, |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
413 trustedCertificatesPath_, remoteCertificateRequired_)); |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
414 } |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
415 catch (OrthancException&) |
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 ASC_dropNetwork(&pimpl_->network_); |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
418 throw; |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
419 } |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
420 } |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
421 else |
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 CLOG(INFO, DICOM) << "Orthanc SCP will *not* use DICOM TLS"; |
0 | 424 } |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
425 #else |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
426 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
|
427 #endif |
1680 | 428 |
1675
131136aeeaa7
improved exception handling in the main program
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1656
diff
changeset
|
429 continue_ = true; |
4793
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
430 |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
431 CLOG(INFO, DICOM) << "The embedded DICOM server will use " << threadsCount_ << " threads"; |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
432 |
5450
9ffd6d18daf3
log lines now contain the thread name
Alain Mazy <am@osimis.io>
parents:
5185
diff
changeset
|
433 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
|
434 pimpl_->thread_ = boost::thread(ServerThread, this, maximumPduLength_, useDicomTls_); |
0 | 435 } |
436 | |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
437 |
0 | 438 void DicomServer::Stop() |
439 { | |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
440 if (continue_) |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
441 { |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
442 continue_ = false; |
431
16b52fb8d034
fix by cyril paulus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
443 |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
444 if (pimpl_->thread_.joinable()) |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
445 { |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
446 pimpl_->thread_.join(); |
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
447 } |
1454 | 448 |
1681
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
449 pimpl_->workers_.reset(NULL); |
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
450 |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
451 #if ORTHANC_ENABLE_SSL == 1 |
4432 | 452 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
|
453 #endif |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
454 |
1681
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
455 /* 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
|
456 /* 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
|
457 OFCondition cond = ASC_dropNetwork(&pimpl_->network_); |
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
458 if (cond.bad()) |
ee4367497d0d
got rid of buggy BagOfRunnablesBySteps
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1680
diff
changeset
|
459 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
460 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
|
461 } |
431
16b52fb8d034
fix by cyril paulus
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
399
diff
changeset
|
462 } |
0 | 463 } |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
464 |
1453
c0bdc47165ef
code to warn about possible threading problems
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
465 |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
466 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
|
467 { |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
468 if (modalities_ == NULL) |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
469 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
470 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
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 |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
473 if (!HasCalledApplicationEntityTitleCheck()) |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
474 { |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
475 // OK, no check on the AET. |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
476 return true; |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
477 } |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
478 else |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
479 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
480 return modalities_->IsSameAETitle(aet, GetApplicationEntityTitle()); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
481 } |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
482 } |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
483 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
484 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
485 void DicomServer::SetDicomTlsEnabled(bool enabled) |
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 Stop(); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
488 useDicomTls_ = enabled; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
489 } |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
490 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
491 bool DicomServer::IsDicomTlsEnabled() const |
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 return useDicomTls_; |
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 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
496 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
|
497 const std::string& certificatePath) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
498 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
499 Stop(); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
500 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
501 if (!privateKeyPath.empty() && |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
502 !certificatePath.empty()) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
503 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
504 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
|
505 << privateKeyPath << " (key), " << certificatePath << " (certificate)"; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
506 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
507 if (certificatePath.empty()) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
508 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
509 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
|
510 } |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
511 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
512 if (privateKeyPath.empty()) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
513 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
514 throw OrthancException(ErrorCode_ParameterOutOfRange, |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
515 "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
|
516 } |
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 if (!SystemToolbox::IsRegularFile(privateKeyPath)) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
519 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
520 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
|
521 } |
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 if (!SystemToolbox::IsRegularFile(certificatePath)) |
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 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
|
526 } |
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 ownPrivateKeyPath_ = privateKeyPath; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
529 ownCertificatePath_ = certificatePath; |
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 else |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
532 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
533 ownPrivateKeyPath_.clear(); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
534 ownCertificatePath_.clear(); |
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 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
538 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
|
539 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
540 return ownPrivateKeyPath_; |
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 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
543 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
|
544 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
545 return ownCertificatePath_; |
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 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
548 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
|
549 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
550 Stop(); |
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 if (!path.empty()) |
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 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
|
555 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
556 if (!SystemToolbox::IsRegularFile(path)) |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
557 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
558 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
|
559 } |
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 trustedCertificatesPath_ = path; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
562 } |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
563 else |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
564 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
565 trustedCertificatesPath_.clear(); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
566 } |
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 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
569 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
|
570 { |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
571 return trustedCertificatesPath_; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
572 } |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
573 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
574 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
|
575 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
576 return maximumPduLength_; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
577 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
578 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
579 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
|
580 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
581 DicomAssociationParameters::CheckMaximumPduLength(pdu); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
582 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
583 Stop(); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
584 maximumPduLength_ = pdu; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
585 } |
4656
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
586 |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
587 void DicomServer::SetRemoteCertificateRequired(bool required) |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
588 { |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
589 Stop(); |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
590 remoteCertificateRequired_ = required; |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
591 } |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
592 |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
593 bool DicomServer::IsRemoteCertificateRequired() const |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
594 { |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
595 return remoteCertificateRequired_; |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4481
diff
changeset
|
596 } |
4793
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
597 |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
598 void DicomServer::SetThreadsCount(unsigned int threads) |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
599 { |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
600 if (threads == 0) |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
601 { |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
602 throw OrthancException(ErrorCode_ParameterOutOfRange); |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
603 } |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
604 |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
605 Stop(); |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
606 threadsCount_ = threads; |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
607 } |
fc2ba1ce6538
new configuration 'DicomThreadsCount'
Alain Mazy <am@osimis.io>
parents:
4656
diff
changeset
|
608 |
0 | 609 } |