Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp @ 4640:66109d24d26e
"ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 26 Apr 2021 15:22:44 +0200 |
parents | cb8fcecf1b02 |
children | 82a314325351 |
rev | line source |
---|---|
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 /** |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 * Orthanc - A Lightweight, RESTful DICOM Store |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4296
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
6 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 * |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 * This program is distributed in the hope that it will be useful, but |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 * WITHOUT ANY WARRANTY; without even the implied warranty of |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
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/>. |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 **/ |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 #include "../PrecompiledHeaders.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 #include "DicomAssociationParameters.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
3828 | 26 #include "../Compatibility.h" |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 #include "../Logging.h" |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 #include "../OrthancException.h" |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
29 #include "../SerializationToolbox.h" |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
30 #include "../SystemToolbox.h" |
3828 | 31 #include "NetworkingCompatibility.h" |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
33 #include <dcmtk/dcmnet/diutil.h> // For ASC_DEFAULTMAXPDU |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
34 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
35 #include <boost/thread/mutex.hpp> |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
36 |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
37 // By default, the default timeout for client DICOM connections is set to 10 seconds |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
38 static boost::mutex defaultConfigurationMutex_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
39 static uint32_t defaultTimeout_ = 10; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
40 static std::string defaultOwnPrivateKeyPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
41 static std::string defaultOwnCertificatePath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
42 static std::string defaultTrustedCertificatesPath_; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
43 static unsigned int defaultMaximumPduLength_ = ASC_DEFAULTMAXPDU; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
44 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
45 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
46 namespace Orthanc |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
47 { |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
48 void DicomAssociationParameters::CheckHost(const std::string& host) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
49 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
50 if (host.size() > HOST_NAME_MAX - 10) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
51 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
52 throw OrthancException(ErrorCode_ParameterOutOfRange, |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
53 "Invalid host name (too long): " + host); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
54 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
55 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
56 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
57 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
58 uint32_t DicomAssociationParameters::GetDefaultTimeout() |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
59 { |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
60 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
61 return defaultTimeout_; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
62 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
63 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
64 |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
65 void DicomAssociationParameters::SetDefaultParameters() |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
66 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
67 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
68 timeout_ = defaultTimeout_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
69 ownPrivateKeyPath_ = defaultOwnPrivateKeyPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
70 ownCertificatePath_ = defaultOwnCertificatePath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
71 trustedCertificatesPath_ = defaultTrustedCertificatesPath_; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
72 maximumPduLength_ = defaultMaximumPduLength_; |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
73 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
74 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
75 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
76 DicomAssociationParameters::DicomAssociationParameters() : |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
77 localAet_("ORTHANC"), |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
78 timeout_(0), // Will be set by SetDefaultParameters() |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
79 maximumPduLength_(0) // Will be set by SetDefaultParameters() |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
80 { |
4518
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
81 SetDefaultParameters(); |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
82 remote_.SetApplicationEntityTitle("ANY-SCP"); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
83 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
84 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
85 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
86 DicomAssociationParameters::DicomAssociationParameters(const std::string& localAet, |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
87 const RemoteModalityParameters& remote) : |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
88 localAet_(localAet), |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
89 timeout_(0), // Will be set by SetDefaultParameters() |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
90 maximumPduLength_(0) // Will be set by SetDefaultParameters() |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
91 { |
4518
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
92 SetDefaultParameters(); |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
93 SetRemoteModality(remote); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
94 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
95 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
96 const std::string &DicomAssociationParameters::GetLocalApplicationEntityTitle() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
97 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
98 return localAet_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
99 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
100 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
101 void DicomAssociationParameters::SetLocalApplicationEntityTitle(const std::string &aet) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
102 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
103 localAet_ = aet; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
104 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
105 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
106 const RemoteModalityParameters &DicomAssociationParameters::GetRemoteModality() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
107 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
108 return remote_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
109 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
110 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
111 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
112 void DicomAssociationParameters::SetRemoteModality(const RemoteModalityParameters& remote) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
113 { |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
114 CheckHost(remote.GetHost()); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
115 remote_ = remote; |
4518
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
116 |
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
117 if (remote.HasTimeout()) |
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
118 { |
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
119 timeout_ = remote.GetTimeout(); |
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
120 assert(timeout_ != 0); |
cb8fcecf1b02
new option "Timeout" in "DicomModalities" to set DICOM SCU timeout on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
121 } |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
122 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
123 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
124 void DicomAssociationParameters::SetRemoteApplicationEntityTitle(const std::string &aet) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
125 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
126 remote_.SetApplicationEntityTitle(aet); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
127 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
128 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
129 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
130 void DicomAssociationParameters::SetRemoteHost(const std::string& host) |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
131 { |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
132 CheckHost(host); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
133 remote_.SetHost(host); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
134 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
135 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
136 void DicomAssociationParameters::SetRemotePort(uint16_t port) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
137 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
138 remote_.SetPortNumber(port); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
139 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
140 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
141 void DicomAssociationParameters::SetRemoteManufacturer(ModalityManufacturer manufacturer) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
142 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
143 remote_.SetManufacturer(manufacturer); |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
144 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
145 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
146 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
147 bool DicomAssociationParameters::IsEqual(const DicomAssociationParameters& other) const |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
148 { |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
149 return (localAet_ == other.localAet_ && |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
150 remote_.GetApplicationEntityTitle() == other.remote_.GetApplicationEntityTitle() && |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
151 remote_.GetHost() == other.remote_.GetHost() && |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
152 remote_.GetPortNumber() == other.remote_.GetPortNumber() && |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
153 remote_.GetManufacturer() == other.remote_.GetManufacturer() && |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
154 timeout_ == other.timeout_ && |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
155 ownPrivateKeyPath_ == other.ownPrivateKeyPath_ && |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
156 ownCertificatePath_ == other.ownCertificatePath_ && |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
157 trustedCertificatesPath_ == other.trustedCertificatesPath_ && |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
158 maximumPduLength_ == other.maximumPduLength_); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
159 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
160 |
4296
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
161 void DicomAssociationParameters::SetTimeout(uint32_t seconds) |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
162 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
163 timeout_ = seconds; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
164 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
165 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
166 uint32_t DicomAssociationParameters::GetTimeout() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
167 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
168 return timeout_; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
169 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
170 |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
171 bool DicomAssociationParameters::HasTimeout() const |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
172 { |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
173 return timeout_ != 0; |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
174 } |
3b70a2e6a06c
moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
175 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
176 |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
177 void DicomAssociationParameters::CheckDicomTlsConfiguration() const |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
178 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
179 if (!remote_.IsDicomTlsEnabled()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
180 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
181 throw OrthancException(ErrorCode_BadSequenceOfCalls, "DICOM TLS is not enabled"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
182 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
183 else if (ownPrivateKeyPath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
184 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
185 throw OrthancException(ErrorCode_BadSequenceOfCalls, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
186 "DICOM TLS - No path to the private key of the local certificate was provided"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
187 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
188 else if (ownCertificatePath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
189 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
190 throw OrthancException(ErrorCode_BadSequenceOfCalls, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
191 "DICOM TLS - No path to the local certificate was provided"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
192 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
193 else if (trustedCertificatesPath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
194 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
195 throw OrthancException(ErrorCode_BadSequenceOfCalls, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
196 "DICOM TLS - No path to the trusted remote certificates was provided"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
197 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
198 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
199 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
200 void DicomAssociationParameters::SetOwnCertificatePath(const std::string& privateKeyPath, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
201 const std::string& certificatePath) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
202 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
203 ownPrivateKeyPath_ = privateKeyPath; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
204 ownCertificatePath_ = certificatePath; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
205 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
206 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
207 void DicomAssociationParameters::SetTrustedCertificatesPath(const std::string& path) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
208 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
209 trustedCertificatesPath_ = path; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
210 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
211 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
212 const std::string& DicomAssociationParameters::GetOwnPrivateKeyPath() const |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
213 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
214 CheckDicomTlsConfiguration(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
215 return ownPrivateKeyPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
216 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
217 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
218 const std::string& DicomAssociationParameters::GetOwnCertificatePath() const |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
219 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
220 CheckDicomTlsConfiguration(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
221 return ownCertificatePath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
222 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
223 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
224 const std::string& DicomAssociationParameters::GetTrustedCertificatesPath() const |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
225 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
226 CheckDicomTlsConfiguration(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
227 return trustedCertificatesPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
228 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
229 |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
230 unsigned int DicomAssociationParameters::GetMaximumPduLength() const |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
231 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
232 return maximumPduLength_; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
233 } |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
234 |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
235 void DicomAssociationParameters::SetMaximumPduLength(unsigned int pdu) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
236 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
237 CheckMaximumPduLength(pdu); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
238 maximumPduLength_ = pdu; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
239 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
240 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
241 |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
242 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
243 static const char* const LOCAL_AET = "LocalAet"; |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
244 static const char* const REMOTE = "Remote"; |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
245 static const char* const TIMEOUT = "Timeout"; // New in Orthanc in 1.7.0 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
246 static const char* const OWN_PRIVATE_KEY = "OwnPrivateKey"; // New in Orthanc 1.9.0 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
247 static const char* const OWN_CERTIFICATE = "OwnCertificate"; // New in Orthanc 1.9.0 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
248 static const char* const TRUSTED_CERTIFICATES = "TrustedCertificates"; // New in Orthanc 1.9.0 |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
249 static const char* const MAXIMUM_PDU_LENGTH = "MaximumPduLength"; // New in Orthanc 1.9.0 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
250 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
251 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
252 void DicomAssociationParameters::SerializeJob(Json::Value& target) const |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
253 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
254 if (target.type() != Json::objectValue) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
255 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
256 throw OrthancException(ErrorCode_InternalError); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
257 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
258 else |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
259 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
260 target[LOCAL_AET] = localAet_; |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
261 remote_.Serialize(target[REMOTE], true /* force advanced format */); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
262 target[TIMEOUT] = timeout_; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
263 target[MAXIMUM_PDU_LENGTH] = maximumPduLength_; |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
264 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
265 // Don't write the DICOM TLS parameters if they are not required |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
266 if (ownPrivateKeyPath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
267 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
268 target.removeMember(OWN_PRIVATE_KEY); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
269 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
270 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
271 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
272 target[OWN_PRIVATE_KEY] = ownPrivateKeyPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
273 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
274 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
275 if (ownCertificatePath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
276 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
277 target.removeMember(OWN_CERTIFICATE); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
278 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
279 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
280 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
281 target[OWN_CERTIFICATE] = ownCertificatePath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
282 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
283 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
284 if (trustedCertificatesPath_.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
285 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
286 target.removeMember(TRUSTED_CERTIFICATES); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
287 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
288 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
289 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
290 target[TRUSTED_CERTIFICATES] = trustedCertificatesPath_; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
291 } |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
292 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
293 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
294 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
295 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
296 DicomAssociationParameters DicomAssociationParameters::UnserializeJob(const Json::Value& serialized) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
297 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
298 if (serialized.type() == Json::objectValue) |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
299 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
300 DicomAssociationParameters result; |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
301 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
302 if (!serialized.isMember(REMOTE)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
303 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
304 throw OrthancException(ErrorCode_BadFileFormat); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
305 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
306 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
307 result.remote_ = RemoteModalityParameters(serialized[REMOTE]); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
308 result.localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
309 result.timeout_ = SerializationToolbox::ReadInteger(serialized, TIMEOUT, GetDefaultTimeout()); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
310 |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
311 // The calls to "isMember()" below are for compatibility with Orthanc <= 1.8.2 serialization |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
312 if (serialized.isMember(MAXIMUM_PDU_LENGTH)) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
313 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
314 result.maximumPduLength_ = SerializationToolbox::ReadUnsignedInteger( |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
315 serialized, MAXIMUM_PDU_LENGTH, defaultMaximumPduLength_); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
316 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
317 |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
318 if (serialized.isMember(OWN_PRIVATE_KEY)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
319 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
320 result.ownPrivateKeyPath_ = SerializationToolbox::ReadString(serialized, OWN_PRIVATE_KEY); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
321 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
322 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
323 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
324 result.ownPrivateKeyPath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
325 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
326 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
327 if (serialized.isMember(OWN_CERTIFICATE)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
328 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
329 result.ownCertificatePath_ = SerializationToolbox::ReadString(serialized, OWN_CERTIFICATE); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
330 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
331 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
332 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
333 result.ownCertificatePath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
334 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
335 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
336 if (serialized.isMember(TRUSTED_CERTIFICATES)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
337 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
338 result.trustedCertificatesPath_ = SerializationToolbox::ReadString(serialized, TRUSTED_CERTIFICATES); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
339 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
340 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
341 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
342 result.trustedCertificatesPath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
343 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
344 |
3875
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
345 return result; |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
346 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
347 else |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
348 { |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
349 throw OrthancException(ErrorCode_BadFileFormat); |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
350 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
351 } |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
352 |
ea1d32861cfc
moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3828
diff
changeset
|
353 |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
354 void DicomAssociationParameters::SetDefaultTimeout(uint32_t seconds) |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
355 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
356 CLOG(INFO, DICOM) << "Default timeout for DICOM connections if Orthanc acts as SCU (client): " |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
357 << seconds << " seconds (0 = no timeout)"; |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
358 |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
359 { |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
360 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
361 defaultTimeout_ = seconds; |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
362 } |
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
363 } |
4438
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
364 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
365 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
366 void DicomAssociationParameters::SetDefaultOwnCertificatePath(const std::string& privateKeyPath, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
367 const std::string& certificatePath) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
368 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
369 if (!privateKeyPath.empty() && |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
370 !certificatePath.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
371 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
372 CLOG(INFO, DICOM) << "Setting the default TLS certificate for DICOM SCU connections: " |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
373 << privateKeyPath << " (key), " << certificatePath << " (certificate)"; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
374 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
375 if (certificatePath.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
376 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
377 throw OrthancException(ErrorCode_ParameterOutOfRange, "No path to the default DICOM TLS certificate was provided"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
378 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
379 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
380 if (privateKeyPath.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
381 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
382 throw OrthancException(ErrorCode_ParameterOutOfRange, |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
383 "No path to the private key for the default DICOM TLS certificate was provided"); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
384 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
385 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
386 if (!SystemToolbox::IsRegularFile(privateKeyPath)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
387 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
388 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + privateKeyPath); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
389 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
390 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
391 if (!SystemToolbox::IsRegularFile(certificatePath)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
392 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
393 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + certificatePath); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
394 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
395 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
396 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
397 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
398 defaultOwnPrivateKeyPath_ = privateKeyPath; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
399 defaultOwnCertificatePath_ = certificatePath; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
400 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
401 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
402 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
403 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
404 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
405 defaultOwnPrivateKeyPath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
406 defaultOwnCertificatePath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
407 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
408 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
409 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
410 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
411 void DicomAssociationParameters::SetDefaultTrustedCertificatesPath(const std::string& path) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
412 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
413 if (!path.empty()) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
414 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
415 CLOG(INFO, DICOM) << "Setting the default trusted certificates for DICOM SCU connections: " << path; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
416 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
417 if (!SystemToolbox::IsRegularFile(path)) |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
418 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
419 throw OrthancException(ErrorCode_InexistentFile, "Inexistent file: " + path); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
420 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
421 |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
422 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
423 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
424 defaultTrustedCertificatesPath_ = path; |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
425 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
426 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
427 else |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
428 { |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
429 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
430 defaultTrustedCertificatesPath_.clear(); |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
431 } |
4a4e33c9082d
configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
432 } |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
433 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
434 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
435 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
436 void DicomAssociationParameters::CheckMaximumPduLength(unsigned int pdu) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
437 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
438 if (pdu > ASC_MAXIMUMPDUSIZE) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
439 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
440 throw OrthancException(ErrorCode_ParameterOutOfRange, "Maximum PDU length must be smaller than " + |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
441 boost::lexical_cast<std::string>(ASC_MAXIMUMPDUSIZE)); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
442 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
443 else if (pdu < ASC_MINIMUMPDUSIZE) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
444 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
445 throw OrthancException(ErrorCode_ParameterOutOfRange, "Maximum PDU length must be greater than " + |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
446 boost::lexical_cast<std::string>(ASC_MINIMUMPDUSIZE)); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
447 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
448 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
449 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
450 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
451 void DicomAssociationParameters::SetDefaultMaximumPduLength(unsigned int pdu) |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
452 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
453 CheckMaximumPduLength(pdu); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
454 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
455 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
456 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
457 defaultMaximumPduLength_ = pdu; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
458 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
459 } |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
460 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
461 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
462 unsigned int DicomAssociationParameters::GetDefaultMaximumPduLength() |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
463 { |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
464 boost::mutex::scoped_lock lock(defaultConfigurationMutex_); |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
465 return defaultMaximumPduLength_; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4438
diff
changeset
|
466 } |
3825
4570c57668a8
refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
467 } |