annotate Core/DicomNetworking/RemoteModalityParameters.cpp @ 4007:884b55ce01f6

Private tags returned by C-FIND SCP
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 06 Jun 2020 14:50:21 +0200
parents 8f7ad4989fec
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1892
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 942
diff changeset
4 * Department, University Hospital of Liege, Belgium
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
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * In addition, as a special exception, the copyright holders of this
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * program give permission to link the code of its release with the
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * the linked executables. You must obey the GNU General Public License
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 * you do not wish to do so, delete this exception statement from your
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 * version. If you delete this exception statement from all source files
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * in the program, then also delete it here.
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 *
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 * This program is distributed in the hope that it will be useful, but
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 #include "RemoteModalityParameters.h"
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2655
diff changeset
39 #include "../SerializationToolbox.h"
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
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";
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
54 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
55 static const char* KEY_HOST = "Host";
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
56 static const char* KEY_MANUFACTURER = "Manufacturer";
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
57 static const char* KEY_PORT = "Port";
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
58
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
59
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 namespace Orthanc
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
62 void RemoteModalityParameters::Clear()
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
64 aet_ = "ORTHANC";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
65 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
66 port_ = 104;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
67 manufacturer_ = ModalityManufacturer_Generic;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
68 allowEcho_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
69 allowStore_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
70 allowFind_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
71 allowMove_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
72 allowGet_ = true;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
73 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
74 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
75 allowTranscoding_ = true;
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 }
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
78
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
79 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
80 const std::string& host,
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
81 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
82 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
83 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
84 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
85 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
86 SetHost(host);
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
87 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
88 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
89 }
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
90
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
91
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
92 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
93 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
94 if (value <= 0 ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
95 value >= 65535)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
96 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
97 throw OrthancException(ErrorCode_ParameterOutOfRange,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
98 "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
99 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
100 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
101 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
102
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
103
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
104 static uint16_t ReadPortNumber(const Json::Value& value)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
105 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
106 int tmp;
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 switch (value.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
109 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
110 case Json::intValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
111 case Json::uintValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
112 tmp = value.asInt();
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 case Json::stringValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
116 try
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 tmp = boost::lexical_cast<int>(value.asString());
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 catch (boost::bad_lexical_cast&)
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 throw OrthancException(ErrorCode_BadFileFormat);
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 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
125
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
126 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
127 throw OrthancException(ErrorCode_BadFileFormat);
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
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
130 CheckPortNumber(tmp);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
131 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
132 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
133
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 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
136 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
137 CheckPortNumber(port);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
138 port_ = port;
2871
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
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 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized)
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 assert(serialized.type() == Json::arrayValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
145
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
146 if ((serialized.size() != 3 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
147 serialized.size() != 4) ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
148 serialized[0].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
149 serialized[1].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
150 (serialized.size() == 4 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
151 serialized[3].type() != Json::stringValue))
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 throw OrthancException(ErrorCode_BadFileFormat);
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
154 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
155
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
156 aet_ = serialized[0].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
157 host_ = serialized[1].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
158 port_ = ReadPortNumber(serialized[2]);
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
159
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
160 if (serialized.size() == 4)
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 manufacturer_ = StringToModalityManufacturer(serialized[3].asString());
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
163 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
164 else
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
165 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
166 manufacturer_ = ModalityManufacturer_Generic;
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
167 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
168 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
169
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
170
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
171 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
172 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
173 assert(serialized.type() == Json::objectValue);
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 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
176 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST);
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 if (serialized.isMember(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 port_ = ReadPortNumber(serialized[KEY_PORT]);
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 else
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 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
185 }
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 if (serialized.isMember(KEY_MANUFACTURER))
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
188 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
189 manufacturer_ = StringToModalityManufacturer
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
190 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER));
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 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
193 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
194 manufacturer_ = ModalityManufacturer_Generic;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
195 }
2872
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 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
198 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
199 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
200 }
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 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
203 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
204 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
205 }
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 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
208 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
209 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
210 }
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 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
213 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
214 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
215 }
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 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
218 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
219 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
220 }
3602
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 if (serialized.isMember(KEY_ALLOW_N_ACTION))
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
223 {
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
224 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
225 }
3613
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 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
228 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
229 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
230 }
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 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
233 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
234 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
235 allowNAction_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
236 allowNEventReport_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
237 }
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
238
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
239 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
240 {
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
241 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
242 }
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
243 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
244
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
245
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
246 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
247 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
248 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
249 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
250 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
251 return allowEcho_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
252
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
253 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
254 return allowFind_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
255
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
256 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
257 return allowGet_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
258
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
259 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
260 return allowMove_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
261
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
262 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
263 return allowStore_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
264
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
265 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
266 return allowNAction_;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
267
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
268 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
269 return allowNEventReport_;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
270
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
271 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
272 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
273 }
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
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
276
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
277 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
278 bool allowed)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
279 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
280 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
281 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
282 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
283 allowEcho_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
284 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
285
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
286 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
287 allowFind_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
288 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
289
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
290 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
291 allowGet_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
292 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
293
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
294 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
295 allowMove_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
296 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
297
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
298 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
299 allowStore_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
300 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
301
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
302 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
303 allowNAction_ = allowed;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
304 break;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
305
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
306 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
307 allowNEventReport_ = allowed;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
308 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
309
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
310 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
311 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
312 }
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
313 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
314
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
315
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
316 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
317 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
318 return (!allowEcho_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
319 !allowStore_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
320 !allowFind_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
321 !allowGet_ ||
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
322 !allowMove_ ||
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
323 !allowNAction_ ||
3894
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
324 !allowNEventReport_ ||
8f7ad4989fec transcoding to uncompressed transfer syntaxes over DICOM protocol is implemented
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641
diff changeset
325 !allowTranscoding_);
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
326 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
327
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
328
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
329 void RemoteModalityParameters::Serialize(Json::Value& target,
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
330 bool forceAdvancedFormat) const
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
331 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
332 if (forceAdvancedFormat ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
333 IsAdvancedFormatNeeded())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
334 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
335 target = Json::objectValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
336 target[KEY_AET] = aet_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
337 target[KEY_HOST] = host_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
338 target[KEY_PORT] = port_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
339 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
340 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
341 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
342 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
343 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
344 target[KEY_ALLOW_MOVE] = allowMove_;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
345 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
346 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
347 target[KEY_ALLOW_TRANSCODING] = allowTranscoding_;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
348 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
349 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
350 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
351 target = Json::arrayValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
352 target.append(GetApplicationEntityTitle());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
353 target.append(GetHost());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
354 target.append(GetPortNumber());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
355 target.append(EnumerationToString(GetManufacturer()));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
356 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
357 }
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
358
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
359
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
360 void RemoteModalityParameters::Unserialize(const Json::Value& serialized)
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
361 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
362 Clear();
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
363
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
364 switch (serialized.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
365 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
366 case Json::objectValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
367 UnserializeObject(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
368 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
369
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
370 case Json::arrayValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
371 UnserializeArray(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
372 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
373
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
374 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
375 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
376 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
377 }
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 }