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