annotate OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp @ 4450:9bf2f9e0af47

support empty PatientID in OrthancImport.py
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 Jan 2021 09:13:29 +0100
parents 4a4e33c9082d
children 522e13a60cfc
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";
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
48
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
49
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 namespace Orthanc
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
52 void RemoteModalityParameters::Clear()
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
54 aet_ = "ORTHANC";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
55 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
56 port_ = 104;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
57 manufacturer_ = ModalityManufacturer_Generic;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
58 allowEcho_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
59 allowStore_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
60 allowFind_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
61 allowMove_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
62 allowGet_ = true;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
63 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
64 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
65 allowTranscoding_ = true;
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
66 useDicomTls_ = false;
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
69
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
70 RemoteModalityParameters::RemoteModalityParameters()
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
71 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
72 Clear();
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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
75 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
76 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
77 Unserialize(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
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
80 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
81 const std::string& host,
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
82 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
83 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
84 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
85 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
86 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
87 SetHost(host);
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
88 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
89 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
90 }
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
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
92 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
93 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
94 return aet_;
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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
97 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
98 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
99 aet_ = 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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
102 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
103 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
104 return host_;
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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
107 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
108 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
109 host_ = 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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
112 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
113 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
114 return port_;
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
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
117
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
118 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
119 {
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
120 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
121 value >= 65535)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
122 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
123 throw OrthancException(ErrorCode_ParameterOutOfRange,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
124 "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
125 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
126 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
127 }
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
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
130 static uint16_t ReadPortNumber(const Json::Value& value)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
131 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
132 int tmp;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
133
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
134 switch (value.type())
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 case Json::intValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
137 case Json::uintValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
138 tmp = value.asInt();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
139 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
140
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
141 case Json::stringValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
142 try
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
143 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
144 tmp = boost::lexical_cast<int>(value.asString());
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 catch (boost::bad_lexical_cast&)
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 throw OrthancException(ErrorCode_BadFileFormat);
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 break;
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 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
153 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
154 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
155
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
156 CheckPortNumber(tmp);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
157 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
158 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
159
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 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
162 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
163 CheckPortNumber(port);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
164 port_ = port;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
165 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
166
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
167 ModalityManufacturer RemoteModalityParameters::GetManufacturer() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
168 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
169 return manufacturer_;
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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
172 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
173 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
174 manufacturer_ = 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
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
177 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
178 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
179 manufacturer_ = StringToModalityManufacturer(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
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
182
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
183 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized)
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 assert(serialized.type() == Json::arrayValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
186
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
187 if ((serialized.size() != 3 &&
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
188 serialized.size() != 4) ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
189 serialized[0].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
190 serialized[1].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
191 (serialized.size() == 4 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
192 serialized[3].type() != Json::stringValue))
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
193 {
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
194 throw OrthancException(ErrorCode_BadFileFormat);
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
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
197 aet_ = serialized[0].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
198 host_ = serialized[1].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
199 port_ = ReadPortNumber(serialized[2]);
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
200
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
201 if (serialized.size() == 4)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
202 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
203 manufacturer_ = StringToModalityManufacturer(serialized[3].asString());
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
204 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
205 else
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
206 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
207 manufacturer_ = ModalityManufacturer_Generic;
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
208 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
209 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
210
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
211
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
212 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
213 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
214 assert(serialized.type() == Json::objectValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
215
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
216 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
217 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
218
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
219 if (serialized.isMember(KEY_PORT))
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 port_ = ReadPortNumber(serialized[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 else
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 throw OrthancException(ErrorCode_BadFileFormat);
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
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
228 if (serialized.isMember(KEY_MANUFACTURER))
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 manufacturer_ = StringToModalityManufacturer
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
231 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
232 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
233 else
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 manufacturer_ = ModalityManufacturer_Generic;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
236 }
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
237
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
238 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
239 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
240 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
241 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
242
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
243 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
244 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
245 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
246 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
247
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
248 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
249 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
250 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
251 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
252
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
253 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
254 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
255 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
256 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
257
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
258 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
259 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
260 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
261 }
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
262
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
263 if (serialized.isMember(KEY_ALLOW_N_ACTION))
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 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
266 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
267
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
268 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
269 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
270 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
271 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
272
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
273 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
274 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
275 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
276 allowNAction_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
277 allowNEventReport_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
278 }
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
279
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
280 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
281 {
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
282 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
283 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
284
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
285 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
286 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
287 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
288 }
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
289 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
290
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
291
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
292 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
293 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
294 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
295 {
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
296 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
297 return allowEcho_;
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 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
300 return allowFind_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
301
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
302 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
303 return allowGet_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
304
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
305 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
306 return allowMove_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
307
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
308 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
309 return allowStore_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
310
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
311 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
312 return allowNAction_;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
313
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
314 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
315 return allowNEventReport_;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
316
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
317 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
318 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
319 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
320 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
321
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
322
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
323 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
324 bool allowed)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
325 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
326 switch (type)
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 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
329 allowEcho_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
330 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
331
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
332 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
333 allowFind_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
334 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
335
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
336 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
337 allowGet_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
338 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
339
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
340 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
341 allowMove_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
342 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
343
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
344 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
345 allowStore_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
346 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
347
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
348 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
349 allowNAction_ = allowed;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
350 break;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
351
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
352 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
353 allowNEventReport_ = allowed;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
354 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
355
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
356 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
357 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
358 }
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
359 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
360
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
361
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
362 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
363 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
364 return (!allowEcho_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
365 !allowStore_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
366 !allowFind_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
367 !allowGet_ ||
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
368 !allowMove_ ||
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
369 !allowNAction_ ||
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
370 !allowNEventReport_ ||
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
371 !allowTranscoding_ ||
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
372 useDicomTls_);
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
373 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
374
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
375
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
376 void RemoteModalityParameters::Serialize(Json::Value& target,
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
377 bool forceAdvancedFormat) const
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
378 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
379 if (forceAdvancedFormat ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
380 IsAdvancedFormatNeeded())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
381 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
382 target = Json::objectValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
383 target[KEY_AET] = aet_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
384 target[KEY_HOST] = host_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
385 target[KEY_PORT] = port_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
386 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
387 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
388 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
389 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
390 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
391 target[KEY_ALLOW_MOVE] = allowMove_;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
392 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
393 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
394 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
395 target[KEY_USE_DICOM_TLS] = useDicomTls_;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
396 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
397 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
398 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
399 target = Json::arrayValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
400 target.append(GetApplicationEntityTitle());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
401 target.append(GetHost());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
402 target.append(GetPortNumber());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
403 target.append(EnumerationToString(GetManufacturer()));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
404 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
405 }
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
406
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
407
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
408 void RemoteModalityParameters::Unserialize(const Json::Value& serialized)
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
409 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
410 Clear();
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
411
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
412 switch (serialized.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
413 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
414 case Json::objectValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
415 UnserializeObject(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
416 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
417
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
418 case Json::arrayValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
419 UnserializeArray(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
420 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
421
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
422 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
423 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
424 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
425 }
4296
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
426
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
427 bool RemoteModalityParameters::IsTranscodingAllowed() const
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
428 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
429 return allowTranscoding_;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
430 }
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
431
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
432 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
433 {
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
434 allowTranscoding_ = allowed;
3b70a2e6a06c moving inline methods to source files for ABI compatibility
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4119
diff changeset
435 }
4438
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
436
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
437 bool RemoteModalityParameters::IsDicomTlsEnabled() const
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
438 {
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
439 return useDicomTls_;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
440 }
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 void RemoteModalityParameters::SetDicomTlsEnabled(bool enabled)
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 useDicomTls_ = enabled;
4a4e33c9082d configuration options for DICOM TLS in Orthanc SCU
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4437
diff changeset
445 }
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 }