annotate OrthancFramework/Sources/DicomNetworking/DicomAssociationParameters.cpp @ 5640:f7adfb22e20e

updated copyright, as Orthanc Team now replaces Osimis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 30 May 2024 21:19:57 +0200
parents 48b8dae6dc77
children b1a18218860c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 * the License, or (at your option) any later version.
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 *
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * 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
15 * 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
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * Lesser General Public License for more details.
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * <http://www.gnu.org/licenses/>.
3825
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
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "../PrecompiledHeaders.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "DicomAssociationParameters.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
3828
3d1bb2193832 fix build on os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
28 #include "../Compatibility.h"
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "../Logging.h"
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include "../OrthancException.h"
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
31 #include "../SerializationToolbox.h"
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
32 #include "../SystemToolbox.h"
3828
3d1bb2193832 fix build on os x
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3825
diff changeset
33 #include "NetworkingCompatibility.h"
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
35 #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
36
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 #include <boost/thread/mutex.hpp>
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
39 // 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
40 static boost::mutex defaultConfigurationMutex_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
41 static uint32_t defaultTimeout_ = 10;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
42 static std::string defaultOwnPrivateKeyPath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
43 static std::string defaultOwnCertificatePath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
44 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
45 static unsigned int defaultMaximumPduLength_ = ASC_DEFAULTMAXPDU;
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
46 static bool defaultRemoteCertificateRequired_ = true;
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 namespace Orthanc
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 {
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
51 void DicomAssociationParameters::CheckHost(const std::string& host)
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
52 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
53 if (host.size() > HOST_NAME_MAX - 10)
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 throw OrthancException(ErrorCode_ParameterOutOfRange,
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
56 "Invalid host name (too long): " + host);
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 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
59
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
60
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
61 uint32_t DicomAssociationParameters::GetDefaultTimeout()
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 {
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
63 boost::mutex::scoped_lock lock(defaultConfigurationMutex_);
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
64 return defaultTimeout_;
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
68 void DicomAssociationParameters::SetDefaultParameters()
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
69 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
70 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
71 timeout_ = defaultTimeout_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
72 ownPrivateKeyPath_ = defaultOwnPrivateKeyPath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
73 ownCertificatePath_ = defaultOwnCertificatePath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
74 trustedCertificatesPath_ = defaultTrustedCertificatesPath_;
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
75 maximumPduLength_ = defaultMaximumPduLength_;
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
76 remoteCertificateRequired_ = defaultRemoteCertificateRequired_;
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
77 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
78
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
79
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 DicomAssociationParameters::DicomAssociationParameters() :
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
81 localAet_("ORTHANC"),
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
82 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
83 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
84 {
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
85 SetDefaultParameters();
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
86 remote_.SetApplicationEntityTitle("ANY-SCP");
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 DicomAssociationParameters::DicomAssociationParameters(const std::string& localAet,
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 const RemoteModalityParameters& remote) :
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 localAet_(localAet),
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
93 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
94 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
95 {
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
96 SetDefaultParameters();
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
97 SetRemoteModality(remote);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
100 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
101 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
102 return localAet_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
103 }
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 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
106 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
107 localAet_ = aet;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
108 }
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 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
111 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
112 return remote_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
113 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
114
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
115
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
116 void DicomAssociationParameters::SetRemoteModality(const RemoteModalityParameters& remote)
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 {
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
118 CheckHost(remote.GetHost());
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
119 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
120
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 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
122 {
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
123 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
124 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
125 }
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
128 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
129 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
130 remote_.SetApplicationEntityTitle(aet);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
131 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
132
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
134 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
135 {
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
136 CheckHost(host);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
137 remote_.SetHost(host);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
138 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
139
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
140 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
141 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
142 remote_.SetPortNumber(port);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
143 }
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 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
146 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
147 remote_.SetManufacturer(manufacturer);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
148 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
149
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
150
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 bool DicomAssociationParameters::IsEqual(const DicomAssociationParameters& other) const
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 {
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 return (localAet_ == other.localAet_ &&
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
154 remote_.GetApplicationEntityTitle() == other.remote_.GetApplicationEntityTitle() &&
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
155 remote_.GetHost() == other.remote_.GetHost() &&
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
156 remote_.GetPortNumber() == other.remote_.GetPortNumber() &&
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
157 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
158 timeout_ == other.timeout_ &&
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
159 ownPrivateKeyPath_ == other.ownPrivateKeyPath_ &&
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
160 ownCertificatePath_ == other.ownCertificatePath_ &&
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
161 trustedCertificatesPath_ == other.trustedCertificatesPath_ &&
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
162 maximumPduLength_ == other.maximumPduLength_);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
165 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
166 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
167 timeout_ = seconds;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
168 }
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 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
171 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
172 return timeout_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
173 }
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 bool DicomAssociationParameters::HasTimeout() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
176 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
177 return timeout_ != 0;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
178 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
179
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
180
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
181 void DicomAssociationParameters::CheckDicomTlsConfiguration() const
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 if (!remote_.IsDicomTlsEnabled())
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, "DICOM TLS is not enabled");
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
186 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
187 else if (ownPrivateKeyPath_.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
188 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
189 throw OrthancException(ErrorCode_BadSequenceOfCalls,
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
190 "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
191 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
192 else if (ownCertificatePath_.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
193 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
194 throw OrthancException(ErrorCode_BadSequenceOfCalls,
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
195 "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
196 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
197 else if (trustedCertificatesPath_.empty())
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 throw OrthancException(ErrorCode_BadSequenceOfCalls,
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
200 "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
201 }
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
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
204 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
205 const std::string& certificatePath)
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 ownPrivateKeyPath_ = privateKeyPath;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
208 ownCertificatePath_ = certificatePath;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
209 }
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 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
212 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
213 trustedCertificatesPath_ = path;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
214 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
215
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
216 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
217 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
218 CheckDicomTlsConfiguration();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
219 return ownPrivateKeyPath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
220 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
221
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
222 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
223 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
224 CheckDicomTlsConfiguration();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
225 return ownCertificatePath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
226 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
227
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
228 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
229 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
230 CheckDicomTlsConfiguration();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
231 return trustedCertificatesPath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
232 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
233
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
234 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
235 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
236 return maximumPduLength_;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
237 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
238
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
239 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
240 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
241 CheckMaximumPduLength(pdu);
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
242 maximumPduLength_ = pdu;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
243 }
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
244
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
245 void DicomAssociationParameters::SetRemoteCertificateRequired(bool required)
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
246 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
247 remoteCertificateRequired_ = required;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
248 }
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
249
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
250 bool DicomAssociationParameters::IsRemoteCertificateRequired() const
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
251 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
252 return remoteCertificateRequired_;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
253 }
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
254
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
255
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
256
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
257 static const char* const LOCAL_AET = "LocalAet";
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
258 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
259 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
260 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
261 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
262 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
263 static const char* const MAXIMUM_PDU_LENGTH = "MaximumPduLength"; // New in Orthanc 1.9.0
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
264 static const char* const REMOTE_CERTIFICATE_REQUIRED = "RemoteCertificateRequired"; // New in Orthanc 1.9.3
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
265
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
266
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
267 void DicomAssociationParameters::SerializeJob(Json::Value& target) const
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
268 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
269 if (target.type() != Json::objectValue)
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
270 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
271 throw OrthancException(ErrorCode_InternalError);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
272 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
273 else
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
274 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
275 target[LOCAL_AET] = localAet_;
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
276 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
277 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
278 target[MAXIMUM_PDU_LENGTH] = maximumPduLength_;
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
279 target[REMOTE_CERTIFICATE_REQUIRED] = remoteCertificateRequired_;
4438
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 // 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
282 if (ownPrivateKeyPath_.empty())
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 target.removeMember(OWN_PRIVATE_KEY);
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 else
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 target[OWN_PRIVATE_KEY] = ownPrivateKeyPath_;
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
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
291 if (ownCertificatePath_.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
292 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
293 target.removeMember(OWN_CERTIFICATE);
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
294 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
295 else
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
296 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
297 target[OWN_CERTIFICATE] = ownCertificatePath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
298 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
299
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
300 if (trustedCertificatesPath_.empty())
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 target.removeMember(TRUSTED_CERTIFICATES);
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 else
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 target[TRUSTED_CERTIFICATES] = trustedCertificatesPath_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
307 }
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
308 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
309 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
310
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
311
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
312 DicomAssociationParameters DicomAssociationParameters::UnserializeJob(const Json::Value& serialized)
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
313 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
314 if (serialized.type() == Json::objectValue)
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
315 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
316 DicomAssociationParameters result;
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
317
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
318 if (!serialized.isMember(REMOTE))
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 throw OrthancException(ErrorCode_BadFileFormat);
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
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
323 result.remote_ = RemoteModalityParameters(serialized[REMOTE]);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
324 result.localAet_ = SerializationToolbox::ReadString(serialized, LOCAL_AET);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
325 result.timeout_ = SerializationToolbox::ReadInteger(serialized, TIMEOUT, GetDefaultTimeout());
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
326
4451
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
327 // 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
328 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
329 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
330 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
331 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
332 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
333
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
334 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
335 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
336 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
337 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
338 else
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 result.ownPrivateKeyPath_.clear();
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
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
343 if (serialized.isMember(OWN_CERTIFICATE))
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
344 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
345 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
346 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
347 else
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
348 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
349 result.ownCertificatePath_.clear();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
350 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
351
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
352 if (serialized.isMember(TRUSTED_CERTIFICATES))
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
353 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
354 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
355 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
356 else
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
357 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
358 result.trustedCertificatesPath_.clear();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
359 }
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
360
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
361 if (serialized.isMember(REMOTE_CERTIFICATE_REQUIRED))
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
362 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
363 result.remoteCertificateRequired_ = SerializationToolbox::ReadBoolean(serialized, REMOTE_CERTIFICATE_REQUIRED);
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
364 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
365
3875
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
366 return result;
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
367 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
368 else
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
369 {
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
370 throw OrthancException(ErrorCode_BadFileFormat);
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
371 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
372 }
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
373
ea1d32861cfc moving timeout from DicomAssocation to DicomAssociationParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3828
diff changeset
374
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 void DicomAssociationParameters::SetDefaultTimeout(uint32_t seconds)
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
377 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
378 << seconds << " seconds (0 = no timeout)";
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 {
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
381 boost::mutex::scoped_lock lock(defaultConfigurationMutex_);
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 defaultTimeout_ = seconds;
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 }
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 }
4438
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
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
387 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
388 const std::string& certificatePath)
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 if (!privateKeyPath.empty() &&
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
391 !certificatePath.empty())
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 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
394 << privateKeyPath << " (key), " << certificatePath << " (certificate)";
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 if (certificatePath.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
397 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
398 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
399 }
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 if (privateKeyPath.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
402 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
403 throw OrthancException(ErrorCode_ParameterOutOfRange,
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
404 "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
405 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
406
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
407 if (!SystemToolbox::IsRegularFile(privateKeyPath))
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 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
410 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
411
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
412 if (!SystemToolbox::IsRegularFile(certificatePath))
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
413 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
414 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
415 }
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 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
418 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
419 defaultOwnPrivateKeyPath_ = privateKeyPath;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
420 defaultOwnCertificatePath_ = certificatePath;
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 else
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
424 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
425 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
426 defaultOwnPrivateKeyPath_.clear();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
427 defaultOwnCertificatePath_.clear();
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 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
430
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 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
433 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
434 if (!path.empty())
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
435 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
436 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
437
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
438 if (!SystemToolbox::IsRegularFile(path))
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
439 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
440 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
441 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
442
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
443 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
444 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
445 defaultTrustedCertificatesPath_ = path;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
446 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
447 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
448 else
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
449 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
450 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
451 defaultTrustedCertificatesPath_.clear();
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
452 }
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
453 }
4451
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
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
457 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
458 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
459 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
460 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
461 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
462 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
463 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
464 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
465 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
466 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
467 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
468 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
469 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
470
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
471
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
472 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
473 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
474 CheckMaximumPduLength(pdu);
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
475
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
476 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
477 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
478 defaultMaximumPduLength_ = pdu;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
479 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
480 }
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
481
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
482
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
483 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
484 {
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
485 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
486 return defaultMaximumPduLength_;
f4dbdb2dcba6 new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
487 }
4656
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
488
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
489
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
490 void DicomAssociationParameters::SetDefaultRemoteCertificateRequired(bool required)
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
491 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
492 boost::mutex::scoped_lock lock(defaultConfigurationMutex_);
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
493 defaultRemoteCertificateRequired_ = required;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
494 }
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
495
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
496
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
497 bool DicomAssociationParameters::GetDefaultRemoteCertificateRequired()
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
498 {
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
499 boost::mutex::scoped_lock lock(defaultConfigurationMutex_);
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
500 return defaultRemoteCertificateRequired_;
82a314325351 New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4518
diff changeset
501 }
3825
4570c57668a8 refactoring DicomUserConnection as Dicom[Control|Store]UserConnection
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
502 }