annotate OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp @ 4463:522e13a60cfc

"LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Jan 2021 17:36:23 +0100
parents 4a4e33c9082d
children cb8fcecf1b02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1892
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
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
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
557575fd93e9 refactoring
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.
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
557575fd93e9 refactoring
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.
806
557575fd93e9 refactoring
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/>.
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
23 #include "../PrecompiledHeaders.h"
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "RemoteModalityParameters.h"
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
26 #include "../Logging.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
27 #include "../OrthancException.h"
2659
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
28 #include "../SerializationToolbox.h"
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
30 #include <boost/lexical_cast.hpp>
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
31 #include <stdexcept>
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
32
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
33
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
34 static const char* KEY_AET = "AET";
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
35 static const char* KEY_ALLOW_ECHO = "AllowEcho";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
36 static const char* KEY_ALLOW_FIND = "AllowFind";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
37 static const char* KEY_ALLOW_GET = "AllowGet";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
38 static const char* KEY_ALLOW_MOVE = "AllowMove";
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
39 static const char* KEY_ALLOW_N_ACTION = "AllowNAction";
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
40 static const char* KEY_ALLOW_N_EVENT_REPORT = "AllowEventReport";
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
41 static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment";
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
42 static const char* KEY_ALLOW_STORE = "AllowStore";
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
43 static const char* KEY_ALLOW_TRANSCODING = "AllowTranscoding";
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
44 static const char* KEY_HOST = "Host";
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
45 static const char* KEY_MANUFACTURER = "Manufacturer";
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
46 static const char* KEY_PORT = "Port";
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
47 static const char* KEY_USE_DICOM_TLS = "UseDicomTls";
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
48 static const char* KEY_LOCAL_AET = "LocalAet";
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
49
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
50
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 namespace Orthanc
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
53 void RemoteModalityParameters::Clear()
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
55 aet_ = "ORTHANC";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
56 host_ = "127.0.0.1";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
57 port_ = 104;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
58 manufacturer_ = ModalityManufacturer_Generic;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
59 allowEcho_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
60 allowStore_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
61 allowFind_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
62 allowMove_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
63 allowGet_ = true;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
64 allowNAction_ = true; // For storage commitment
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
65 allowNEventReport_ = true; // For storage commitment
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
66 allowTranscoding_ = true;
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
67 useDicomTls_ = false;
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
68 localAet_.clear();
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 }
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
71
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
72 RemoteModalityParameters::RemoteModalityParameters()
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
73 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
74 Clear();
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
75 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
76
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
77 RemoteModalityParameters::RemoteModalityParameters(const Json::Value &serialized)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
78 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
79 Unserialize(serialized);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
80 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
81
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
82 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet,
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
83 const std::string& host,
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
84 uint16_t port,
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
85 ModalityManufacturer manufacturer)
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
86 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
87 Clear();
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
88 SetApplicationEntityTitle(aet);
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
89 SetHost(host);
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
90 SetPortNumber(port);
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
91 SetManufacturer(manufacturer);
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
92 }
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
93
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
94 const std::string &RemoteModalityParameters::GetApplicationEntityTitle() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
95 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
96 return aet_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
97 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
98
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
99 void RemoteModalityParameters::SetApplicationEntityTitle(const std::string &aet)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
100 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
101 aet_ = aet;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
102 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
103
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
104 const std::string &RemoteModalityParameters::GetHost() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
105 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
106 return host_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
107 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
108
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
109 void RemoteModalityParameters::SetHost(const std::string &host)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
110 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
111 host_ = host;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
112 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
113
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
114 uint16_t RemoteModalityParameters::GetPortNumber() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
115 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
116 return port_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
117 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
118
1427
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
119
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
120 static void CheckPortNumber(int value)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
121 {
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
122 if (value <= 0 ||
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
123 value >= 65535)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
124 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
125 throw OrthancException(ErrorCode_ParameterOutOfRange,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
126 "A TCP port number must be in range [1..65534], but found: " +
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
127 boost::lexical_cast<std::string>(value));
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
128 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
129 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
130
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
131
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
132 static uint16_t ReadPortNumber(const Json::Value& value)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
133 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
134 int tmp;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
135
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
136 switch (value.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
137 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
138 case Json::intValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
139 case Json::uintValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
140 tmp = value.asInt();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
141 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
142
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
143 case Json::stringValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
144 try
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
145 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
146 tmp = boost::lexical_cast<int>(value.asString());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
147 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
148 catch (boost::bad_lexical_cast&)
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
149 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
150 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
151 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
152 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
153
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
154 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
155 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
156 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
157
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
158 CheckPortNumber(tmp);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
159 return static_cast<uint16_t>(tmp);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
160 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
161
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
162
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
163 void RemoteModalityParameters::SetPortNumber(uint16_t port)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
164 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
165 CheckPortNumber(port);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
166 port_ = port;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
167 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
168
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
169 ModalityManufacturer RemoteModalityParameters::GetManufacturer() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
170 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
171 return manufacturer_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
172 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
173
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
174 void RemoteModalityParameters::SetManufacturer(ModalityManufacturer manufacturer)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
175 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
176 manufacturer_ = manufacturer;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
177 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
178
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
179 void RemoteModalityParameters::SetManufacturer(const std::string &manufacturer)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
180 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
181 manufacturer_ = StringToModalityManufacturer(manufacturer);
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
182 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
183
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
184
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
185 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized)
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
186 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
187 assert(serialized.type() == Json::arrayValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
188
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
189 if ((serialized.size() != 3 &&
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
190 serialized.size() != 4) ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
191 serialized[0].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
192 serialized[1].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
193 (serialized.size() == 4 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
194 serialized[3].type() != Json::stringValue))
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
195 {
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
196 throw OrthancException(ErrorCode_BadFileFormat);
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
197 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
198
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
199 aet_ = serialized[0].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
200 host_ = serialized[1].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
201 port_ = ReadPortNumber(serialized[2]);
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
202
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
203 if (serialized.size() == 4)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
204 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
205 manufacturer_ = StringToModalityManufacturer(serialized[3].asString());
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
206 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
207 else
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
208 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
209 manufacturer_ = ModalityManufacturer_Generic;
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
210 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
211 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
212
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
213
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
214 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
215 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
216 assert(serialized.type() == Json::objectValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
217
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
218 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
219 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
220
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
221 if (serialized.isMember(KEY_PORT))
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
222 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
223 port_ = ReadPortNumber(serialized[KEY_PORT]);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
224 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
225 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
226 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
227 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
228 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
229
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
230 if (serialized.isMember(KEY_MANUFACTURER))
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
231 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
232 manufacturer_ = StringToModalityManufacturer
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
233 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
234 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
235 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
236 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
237 manufacturer_ = ModalityManufacturer_Generic;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
238 }
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
239
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
240 if (serialized.isMember(KEY_ALLOW_ECHO))
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
241 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
242 allowEcho_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_ECHO);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
243 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
244
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
245 if (serialized.isMember(KEY_ALLOW_FIND))
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
246 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
247 allowFind_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_FIND);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
248 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
249
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
250 if (serialized.isMember(KEY_ALLOW_STORE))
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
251 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
252 allowStore_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_STORE);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
253 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
254
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
255 if (serialized.isMember(KEY_ALLOW_GET))
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
256 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
257 allowGet_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_GET);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
258 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
259
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
260 if (serialized.isMember(KEY_ALLOW_MOVE))
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
261 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
262 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
263 }
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
264
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
265 if (serialized.isMember(KEY_ALLOW_N_ACTION))
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
266 {
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
267 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
268 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
269
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
270 if (serialized.isMember(KEY_ALLOW_N_EVENT_REPORT))
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
271 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
272 allowNEventReport_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_EVENT_REPORT);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
273 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
274
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
275 if (serialized.isMember(KEY_ALLOW_STORAGE_COMMITMENT))
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
276 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
277 bool allow = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_STORAGE_COMMITMENT);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
278 allowNAction_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
279 allowNEventReport_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
280 }
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
281
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
282 if (serialized.isMember(KEY_ALLOW_TRANSCODING))
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
283 {
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
284 allowTranscoding_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_TRANSCODING);
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
285 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
286
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
287 if (serialized.isMember(KEY_USE_DICOM_TLS))
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
288 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
289 useDicomTls_ = SerializationToolbox::ReadBoolean(serialized, KEY_USE_DICOM_TLS);
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
290 }
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
291
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
292 if (serialized.isMember(KEY_LOCAL_AET))
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
293 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
294 localAet_ = SerializationToolbox::ReadString(serialized, KEY_LOCAL_AET);
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
295 }
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
296 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
297
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
298
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
299 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
300 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
301 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
302 {
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
303 case DicomRequestType_Echo:
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
304 return allowEcho_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
305
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
306 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
307 return allowFind_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
308
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
309 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
310 return allowGet_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
311
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
312 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
313 return allowMove_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
314
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
315 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
316 return allowStore_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
317
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
318 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
319 return allowNAction_;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
320
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
321 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
322 return allowNEventReport_;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
323
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
324 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
325 throw OrthancException(ErrorCode_ParameterOutOfRange);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
326 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
327 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
328
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
329
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
330 void RemoteModalityParameters::SetRequestAllowed(DicomRequestType type,
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
331 bool allowed)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
332 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
333 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
334 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
335 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
336 allowEcho_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
337 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
338
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
339 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
340 allowFind_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
341 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
342
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
343 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
344 allowGet_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
345 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
346
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
347 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
348 allowMove_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
349 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
350
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
351 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
352 allowStore_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
353 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
354
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
355 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
356 allowNAction_ = allowed;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
357 break;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
358
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
359 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
360 allowNEventReport_ = allowed;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
361 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
362
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
363 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
364 throw OrthancException(ErrorCode_ParameterOutOfRange);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
365 }
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
366 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
367
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
368
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
369 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
370 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
371 return (!allowEcho_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
372 !allowStore_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
373 !allowFind_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
374 !allowGet_ ||
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
375 !allowMove_ ||
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
376 !allowNAction_ ||
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
377 !allowNEventReport_ ||
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
378 !allowTranscoding_ ||
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
379 useDicomTls_ ||
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
380 HasLocalAet());
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
381 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
382
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
383
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
384 void RemoteModalityParameters::Serialize(Json::Value& target,
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
385 bool forceAdvancedFormat) const
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
386 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
387 if (forceAdvancedFormat ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
388 IsAdvancedFormatNeeded())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
389 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
390 target = Json::objectValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
391 target[KEY_AET] = aet_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
392 target[KEY_HOST] = host_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
393 target[KEY_PORT] = port_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
394 target[KEY_MANUFACTURER] = EnumerationToString(manufacturer_);
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
395 target[KEY_ALLOW_ECHO] = allowEcho_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
396 target[KEY_ALLOW_STORE] = allowStore_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
397 target[KEY_ALLOW_FIND] = allowFind_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
398 target[KEY_ALLOW_GET] = allowGet_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
399 target[KEY_ALLOW_MOVE] = allowMove_;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
400 target[KEY_ALLOW_N_ACTION] = allowNAction_;
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
401 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_;
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
402 target[KEY_ALLOW_TRANSCODING] = allowTranscoding_;
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
403 target[KEY_USE_DICOM_TLS] = useDicomTls_;
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
404 target[KEY_LOCAL_AET] = localAet_;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
405 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
406 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
407 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
408 target = Json::arrayValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
409 target.append(GetApplicationEntityTitle());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
410 target.append(GetHost());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
411 target.append(GetPortNumber());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
412 target.append(EnumerationToString(GetManufacturer()));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
413 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
414 }
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
415
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
416
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
417 void RemoteModalityParameters::Unserialize(const Json::Value& serialized)
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
418 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
419 Clear();
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
420
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
421 switch (serialized.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
422 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
423 case Json::objectValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
424 UnserializeObject(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
425 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
426
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
427 case Json::arrayValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
428 UnserializeArray(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
429 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
430
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
431 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
432 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
433 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
434 }
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
435
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
436 bool RemoteModalityParameters::IsTranscodingAllowed() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
437 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
438 return allowTranscoding_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
439 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
440
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
441 void RemoteModalityParameters::SetTranscodingAllowed(bool allowed)
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
442 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
443 allowTranscoding_ = allowed;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
444 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
445
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
446 bool RemoteModalityParameters::IsDicomTlsEnabled() const
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 return useDicomTls_;
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
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
451 void RemoteModalityParameters::SetDicomTlsEnabled(bool enabled)
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 useDicomTls_ = enabled;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
454 }
4463
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
455
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
456 bool RemoteModalityParameters::HasLocalAet() const
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
457 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
458 return !localAet_.empty();
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
459 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
460
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
461 const std::string& RemoteModalityParameters::GetLocalAet() const
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
462 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
463 if (localAet_.empty())
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
464 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
465 throw OrthancException(ErrorCode_BadSequenceOfCalls, "You should have called HasLocalAet()");
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
466 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
467 else
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
468 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
469 return localAet_;
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
470 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
471 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
472
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
473 void RemoteModalityParameters::SetLocalAet(const std::string& aet)
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
474 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
475 if (aet.empty())
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
476 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
477 throw OrthancException(ErrorCode_ParameterOutOfRange);
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
478 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
479 else
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
480 {
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
481 localAet_ = aet;
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
482 }
522e13a60cfc "LocalAet" in "DicomModalities" to overwrite global "DicomAet" for SCU on a per-modality basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4438
diff changeset
483 }
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
484 }