Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/RemoteModalityParameters.cpp @ 4224:38d446c9ee1d
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Sep 2020 17:59:09 +0200 |
parents | bf7b9edf6b81 |
children | 3b70a2e6a06c |
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 | |
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 | 11 * |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
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 | 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 | 20 **/ |
21 | |
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 | 24 #include "RemoteModalityParameters.h" |
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 | 28 #include "../SerializationToolbox.h" |
806 | 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"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
39 static const char* KEY_ALLOW_STORE = "AllowStore"; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
40 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
|
41 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
|
42 static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment"; |
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"; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
47 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
48 |
806 | 49 namespace Orthanc |
50 { | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
51 void RemoteModalityParameters::Clear() |
806 | 52 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
53 aet_ = "ORTHANC"; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
54 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
|
55 port_ = 104; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
56 manufacturer_ = ModalityManufacturer_Generic; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
57 allowEcho_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
58 allowStore_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
59 allowFind_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
60 allowMove_ = true; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
61 allowGet_ = true; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
62 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
|
63 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
|
64 allowTranscoding_ = true; |
806 | 65 } |
66 | |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
67 |
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
|
68 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
|
69 const std::string& host, |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
70 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
|
71 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
|
72 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
73 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
|
74 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
|
75 SetHost(host); |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
76 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
|
77 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
|
78 } |
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
|
79 |
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 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
81 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
|
82 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
83 if (value <= 0 || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
84 value >= 65535) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
85 { |
2954
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
86 throw OrthancException(ErrorCode_ParameterOutOfRange, |
d924f9bb61cc
taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2872
diff
changeset
|
87 "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
|
88 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
|
89 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
90 } |
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 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
93 static uint16_t ReadPortNumber(const Json::Value& value) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
94 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
95 int tmp; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
96 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
97 switch (value.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
98 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
99 case Json::intValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
100 case Json::uintValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
101 tmp = value.asInt(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
102 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
103 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
104 case Json::stringValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
105 try |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
106 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
107 tmp = boost::lexical_cast<int>(value.asString()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
108 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
109 catch (boost::bad_lexical_cast&) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
110 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
111 throw OrthancException(ErrorCode_BadFileFormat); |
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 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
114 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
115 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
116 throw OrthancException(ErrorCode_BadFileFormat); |
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 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
119 CheckPortNumber(tmp); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
120 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
|
121 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
122 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
123 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
124 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
|
125 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
126 CheckPortNumber(port); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
127 port_ = port; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
128 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
129 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
130 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
131 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
132 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
133 assert(serialized.type() == Json::arrayValue); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
134 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
135 if ((serialized.size() != 3 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
136 serialized.size() != 4) || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
137 serialized[0].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
138 serialized[1].type() != Json::stringValue || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
139 (serialized.size() == 4 && |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
140 serialized[3].type() != Json::stringValue)) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
141 { |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
142 throw OrthancException(ErrorCode_BadFileFormat); |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
143 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
144 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
145 aet_ = serialized[0].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
146 host_ = serialized[1].asString(); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
147 port_ = ReadPortNumber(serialized[2]); |
1654
3727a09e7b53
fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1427
diff
changeset
|
148 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
149 if (serialized.size() == 4) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
150 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
151 manufacturer_ = StringToModalityManufacturer(serialized[3].asString()); |
807
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 else |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
154 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
155 manufacturer_ = ModalityManufacturer_Generic; |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
156 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
157 } |
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
158 |
2715
73bc0c32547c
fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2659
diff
changeset
|
159 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
160 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized) |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
161 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
162 assert(serialized.type() == Json::objectValue); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
163 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
164 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
165 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
166 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
167 if (serialized.isMember(KEY_PORT)) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
168 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
169 port_ = ReadPortNumber(serialized[KEY_PORT]); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
170 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
171 else |
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 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
174 } |
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_MANUFACTURER)) |
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 manufacturer_ = StringToModalityManufacturer |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
179 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER)); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
180 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
181 else |
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 manufacturer_ = ModalityManufacturer_Generic; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
184 } |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
185 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
186 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
|
187 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
188 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
|
189 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
190 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
191 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
|
192 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
193 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
|
194 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
195 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
196 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
|
197 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
198 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
|
199 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
200 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
201 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
|
202 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
203 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
|
204 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
205 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
206 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
|
207 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
208 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
|
209 } |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
210 |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
211 if (serialized.isMember(KEY_ALLOW_N_ACTION)) |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
212 { |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
213 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION); |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
214 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
215 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
216 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
|
217 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
218 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
|
219 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
220 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
221 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
|
222 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
223 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
|
224 allowNAction_ = allow; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
225 allowNEventReport_ = allow; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
226 } |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
227 |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
228 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
|
229 { |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
230 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
|
231 } |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
232 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
233 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
234 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
235 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
|
236 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
237 switch (type) |
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 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
240 return allowEcho_; |
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 case DicomRequestType_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
243 return allowFind_; |
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 case DicomRequestType_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
246 return allowGet_; |
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 case DicomRequestType_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
249 return allowMove_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
250 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
251 case DicomRequestType_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
252 return allowStore_; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
253 |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
254 case DicomRequestType_NAction: |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
255 return allowNAction_; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
256 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
257 case DicomRequestType_NEventReport: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
258 return allowNEventReport_; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
259 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
260 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
261 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
|
262 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
263 } |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
264 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
265 |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
266 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
|
267 bool allowed) |
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 switch (type) |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
270 { |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
271 case DicomRequestType_Echo: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
272 allowEcho_ = allowed; |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
273 break; |
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_Find: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
276 allowFind_ = 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_Get: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
280 allowGet_ = 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_Move: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
284 allowMove_ = 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_Store: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
288 allowStore_ = 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 |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
291 case DicomRequestType_NAction: |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
292 allowNAction_ = allowed; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
293 break; |
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
294 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
295 case DicomRequestType_NEventReport: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
296 allowNEventReport_ = allowed; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
297 break; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
298 |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
299 default: |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
300 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
|
301 } |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
302 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
303 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
304 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
305 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
306 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
307 return (!allowEcho_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
308 !allowStore_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
309 !allowFind_ || |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
310 !allowGet_ || |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
311 !allowMove_ || |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3602
diff
changeset
|
312 !allowNAction_ || |
3894
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
313 !allowNEventReport_ || |
8f7ad4989fec
transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3641
diff
changeset
|
314 !allowTranscoding_); |
807
566a2fb3c1fb
update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
806
diff
changeset
|
315 } |
2655 | 316 |
317 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
318 void RemoteModalityParameters::Serialize(Json::Value& target, |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
319 bool forceAdvancedFormat) const |
2655 | 320 { |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
321 if (forceAdvancedFormat || |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
322 IsAdvancedFormatNeeded()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
323 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
324 target = Json::objectValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
325 target[KEY_AET] = aet_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
326 target[KEY_HOST] = host_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
327 target[KEY_PORT] = port_; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
328 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
|
329 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
|
330 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
|
331 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
|
332 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
|
333 target[KEY_ALLOW_MOVE] = allowMove_; |
3602
085283445db0
AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
334 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
|
335 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
|
336 target[KEY_ALLOW_TRANSCODING] = allowTranscoding_; |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
337 } |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
338 else |
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 target = Json::arrayValue; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
341 target.append(GetApplicationEntityTitle()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
342 target.append(GetHost()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
343 target.append(GetPortNumber()); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
344 target.append(EnumerationToString(GetManufacturer())); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
345 } |
2655 | 346 } |
347 | |
348 | |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
349 void RemoteModalityParameters::Unserialize(const Json::Value& serialized) |
2655 | 350 { |
2872
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
351 Clear(); |
9d08edde614b
Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2871
diff
changeset
|
352 |
2871
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
353 switch (serialized.type()) |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
354 { |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
355 case Json::objectValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
356 UnserializeObject(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
357 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
358 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
359 case Json::arrayValue: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
360 UnserializeArray(serialized); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
361 break; |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
362 |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
363 default: |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
364 throw OrthancException(ErrorCode_BadFileFormat); |
6eebc2eb3168
refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2836
diff
changeset
|
365 } |
2655 | 366 } |
806 | 367 } |