Mercurial > hg > orthanc
annotate Core/DicomNetworking/RemoteModalityParameters.cpp @ 3891:5571082a9df6 transcoding
integration mainline->transcoding
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 05 May 2020 18:08:51 +0200 |
parents | f6a73611ec5c |
children | 3801435e34a1 8f7ad4989fec |
rev | line source |
---|---|
806 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
942
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3640
94f4a18a79cc
upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium |
806 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * In addition, as a special exception, the copyright holders of this | |
13 * program give permission to link the code of its release with the | |
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
15 * that use the same license as the "OpenSSL" library), and distribute | |
16 * the linked executables. You must obey the GNU General Public License | |
17 * in all respects for all of the code used other than "OpenSSL". If you | |
18 * modify file(s) with this exception, you may extend this exception to | |
19 * your version of the file(s), but you are not obligated to do so. If | |
20 * you do not wish to do so, delete this exception statement from your | |
21 * version. If you delete this exception statement from all source files | |
22 * in the program, then also delete it here. | |
23 * | |
24 * This program is distributed in the hope that it will be useful, but | |
25 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
27 * General Public License for more details. | |
28 * | |
29 * You should have received a copy of the GNU General Public License | |
30 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
31 **/ | |
32 | |
33 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
34 #include "../PrecompiledHeaders.h" |
806 | 35 #include "RemoteModalityParameters.h" |
36 | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
37 #include "../Logging.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
38 #include "../OrthancException.h" |
2659 | 39 #include "../SerializationToolbox.h" |
806 | 40 |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
41 #include <boost/lexical_cast.hpp> |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
42 #include <stdexcept> |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
43 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
44 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
45 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
|
46 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
|
47 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
|
48 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
|
49 static const char* KEY_ALLOW_MOVE = "AllowMove"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
50 static const char* KEY_ALLOW_STORE = "AllowStore"; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
51 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
|
52 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
|
53 static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment"; |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
54 static const char* KEY_HOST = "Host"; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
55 static const char* KEY_MANUFACTURER = "Manufacturer"; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
56 static const char* KEY_PORT = "Port"; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
57 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
58 |
806 | 59 namespace Orthanc |
60 { | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
61 void RemoteModalityParameters::Clear() |
806 | 62 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
63 aet_ = "ORTHANC"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
64 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
|
65 port_ = 104; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
66 manufacturer_ = ModalityManufacturer_Generic; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
67 allowEcho_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
68 allowStore_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
69 allowFind_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
70 allowMove_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
71 allowGet_ = true; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
72 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
|
73 allowNEventReport_ = true; // For storage commitment |
806 | 74 } |
75 | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
76 |
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
|
77 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
|
78 const std::string& host, |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
79 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
|
80 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
|
81 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
82 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
|
83 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
|
84 SetHost(host); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
85 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
|
86 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
|
87 } |
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 |
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 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
90 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
|
91 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
92 if (value <= 0 || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
93 value >= 65535) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
94 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
95 throw OrthancException(ErrorCode_ParameterOutOfRange, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
96 "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
|
97 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
|
98 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
99 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
100 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
101 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
102 static uint16_t ReadPortNumber(const Json::Value& value) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
103 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
104 int tmp; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
105 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
106 switch (value.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
107 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
108 case Json::intValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
109 case Json::uintValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
110 tmp = value.asInt(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
111 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
112 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
113 case Json::stringValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
114 try |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
115 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
116 tmp = boost::lexical_cast<int>(value.asString()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
117 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
118 catch (boost::bad_lexical_cast&) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
119 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
120 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
121 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
122 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
123 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
124 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
125 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
126 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
127 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
128 CheckPortNumber(tmp); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
129 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
|
130 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
131 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
132 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
133 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
|
134 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
135 CheckPortNumber(port); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
136 port_ = port; |
2871
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 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
139 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
140 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
141 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
142 assert(serialized.type() == Json::arrayValue); |
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 if ((serialized.size() != 3 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
145 serialized.size() != 4) || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
146 serialized[0].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
147 serialized[1].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
148 (serialized.size() == 4 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
149 serialized[3].type() != Json::stringValue)) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
150 { |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
151 throw OrthancException(ErrorCode_BadFileFormat); |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
152 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
153 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
154 aet_ = serialized[0].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
155 host_ = serialized[1].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
156 port_ = ReadPortNumber(serialized[2]); |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
157 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
158 if (serialized.size() == 4) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
159 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
160 manufacturer_ = StringToModalityManufacturer(serialized[3].asString()); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
161 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
162 else |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
163 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
164 manufacturer_ = ModalityManufacturer_Generic; |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
165 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
166 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
167 |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
168 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
169 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
170 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
171 assert(serialized.type() == Json::objectValue); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
172 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
173 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
174 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
175 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
176 if (serialized.isMember(KEY_PORT)) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
177 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
178 port_ = ReadPortNumber(serialized[KEY_PORT]); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
179 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
180 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
181 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
182 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
183 } |
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 if (serialized.isMember(KEY_MANUFACTURER)) |
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 manufacturer_ = StringToModalityManufacturer |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
188 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER)); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
189 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
190 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
191 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
192 manufacturer_ = ModalityManufacturer_Generic; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
193 } |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
194 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
195 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
|
196 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
197 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
|
198 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
199 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
200 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
|
201 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
202 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
|
203 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
204 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
205 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
|
206 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
207 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
|
208 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
209 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
210 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
|
211 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
212 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
|
213 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
214 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
215 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
|
216 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
217 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
|
218 } |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
219 |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
220 if (serialized.isMember(KEY_ALLOW_N_ACTION)) |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
221 { |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
222 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION); |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
223 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
224 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
225 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
|
226 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
227 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
|
228 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
229 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
230 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
|
231 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
232 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
|
233 allowNAction_ = allow; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
234 allowNEventReport_ = allow; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
235 } |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
236 } |
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 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
239 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
|
240 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
241 switch (type) |
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 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
244 return allowEcho_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
245 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
246 case DicomRequestType_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
247 return allowFind_; |
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 case DicomRequestType_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
250 return allowGet_; |
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 case DicomRequestType_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
253 return allowMove_; |
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 case DicomRequestType_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
256 return allowStore_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
257 |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
258 case DicomRequestType_NAction: |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
259 return allowNAction_; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
260 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
261 case DicomRequestType_NEventReport: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
262 return allowNEventReport_; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
263 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
264 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
265 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
|
266 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
267 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
268 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
269 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
270 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
|
271 bool allowed) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
272 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
273 switch (type) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
274 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
275 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
276 allowEcho_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
277 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
278 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
279 case DicomRequestType_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
280 allowFind_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
281 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
282 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
283 case DicomRequestType_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
284 allowGet_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
285 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
286 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
287 case DicomRequestType_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
288 allowMove_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
289 break; |
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 case DicomRequestType_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
292 allowStore_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
293 break; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
294 |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
295 case DicomRequestType_NAction: |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
296 allowNAction_ = allowed; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
297 break; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
298 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
299 case DicomRequestType_NEventReport: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
300 allowNEventReport_ = allowed; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
301 break; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
302 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
303 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
304 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
|
305 } |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
306 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
307 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
308 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
309 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
310 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
311 return (!allowEcho_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
312 !allowStore_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
313 !allowFind_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
314 !allowGet_ || |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
315 !allowMove_ || |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
316 !allowNAction_ || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
317 !allowNEventReport_); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
318 } |
2655 | 319 |
320 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
321 void RemoteModalityParameters::Serialize(Json::Value& target, |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
322 bool forceAdvancedFormat) const |
2655 | 323 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
324 if (forceAdvancedFormat || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
325 IsAdvancedFormatNeeded()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
326 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
327 target = Json::objectValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
328 target[KEY_AET] = aet_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
329 target[KEY_HOST] = host_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
330 target[KEY_PORT] = port_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
331 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
|
332 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
|
333 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
|
334 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
|
335 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
|
336 target[KEY_ALLOW_MOVE] = allowMove_; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
337 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
|
338 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
339 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
340 else |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
341 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
342 target = Json::arrayValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
343 target.append(GetApplicationEntityTitle()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
344 target.append(GetHost()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
345 target.append(GetPortNumber()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
346 target.append(EnumerationToString(GetManufacturer())); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
347 } |
2655 | 348 } |
349 | |
350 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
351 void RemoteModalityParameters::Unserialize(const Json::Value& serialized) |
2655 | 352 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
353 Clear(); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
354 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
355 switch (serialized.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
356 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
357 case Json::objectValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
358 UnserializeObject(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
359 break; |
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 case Json::arrayValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
362 UnserializeArray(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
363 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
364 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
365 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
366 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
367 } |
2655 | 368 } |
806 | 369 } |