annotate Core/DicomNetworking/RemoteModalityParameters.cpp @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c

integration Orthanc-1.6.0->SylvainRouquette
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Mar 2020 11:48:30 +0100
parents 763533d6dd67 f6a73611ec5c
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
3785
763533d6dd67 add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents: 3060
diff changeset
41 #include <dcmtk/dcmdata/dcuid.h>
763533d6dd67 add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents: 3060
diff changeset
42
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
43 #include <boost/lexical_cast.hpp>
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
44 #include <stdexcept>
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
45
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
46
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
47 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
48 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
49 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
50 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
51 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
52 static const char* KEY_ALLOW_STORE = "AllowStore";
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
53 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
54 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
55 static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment";
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
56 static const char* KEY_HOST = "Host";
3785
763533d6dd67 add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents: 3060
diff changeset
57 static const char* KEY_PREFERRED_TRANSFER_SYNTAX = "PreferredTransferSyntax";
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
58 static const char* KEY_MANUFACTURER = "Manufacturer";
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
59 static const char* KEY_PORT = "Port";
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
60
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
61
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 namespace Orthanc
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 void RemoteModalityParameters::Clear()
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
66 aet_ = "ORTHANC";
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
67 host_ = "127.0.0.1";
3785
763533d6dd67 add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents: 3060
diff changeset
68 preferredTransferSyntax_ = UID_LittleEndianImplicitTransferSyntax;
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
69 port_ = 104;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
70 manufacturer_ = ModalityManufacturer_Generic;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
71 allowEcho_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
72 allowStore_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
73 allowFind_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
74 allowMove_ = true;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
75 allowGet_ = true;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
76 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
77 allowNEventReport_ = true; // For storage commitment
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 }
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
80
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
81 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
82 const std::string& host,
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
83 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
84 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
85 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
86 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
87 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
88 SetHost(host);
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
89 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
90 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
91 }
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
92
d710ea64f0fd Custom setting of the local AET during C-Store SCU (both in Lua and in the REST API)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
93
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
94 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
95 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
96 if (value <= 0 ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
97 value >= 65535)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
98 {
2954
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
99 throw OrthancException(ErrorCode_ParameterOutOfRange,
d924f9bb61cc taking advantage of details in OrthancException
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2872
diff changeset
100 "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
101 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
102 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
103 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
104
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
105
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
106 static uint16_t ReadPortNumber(const Json::Value& value)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
107 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
108 int tmp;
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 switch (value.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
111 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
112 case Json::intValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
113 case Json::uintValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
114 tmp = value.asInt();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
115 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
116
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
117 case Json::stringValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
118 try
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 tmp = boost::lexical_cast<int>(value.asString());
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 catch (boost::bad_lexical_cast&)
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 throw OrthancException(ErrorCode_BadFileFormat);
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 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
127
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
128 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
129 throw OrthancException(ErrorCode_BadFileFormat);
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
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
132 CheckPortNumber(tmp);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
133 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
134 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
135
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 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
138 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
139 CheckPortNumber(port);
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
140 port_ = port;
2871
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
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 void RemoteModalityParameters::UnserializeArray(const Json::Value& serialized)
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 assert(serialized.type() == Json::arrayValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
147
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
148 if ((serialized.size() != 3 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
149 serialized.size() != 4) ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
150 serialized[0].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
151 serialized[1].type() != Json::stringValue ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
152 (serialized.size() == 4 &&
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
153 serialized[3].type() != Json::stringValue))
807
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 throw OrthancException(ErrorCode_BadFileFormat);
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
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
158 aet_ = serialized[0].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
159 host_ = serialized[1].asString();
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
160 port_ = ReadPortNumber(serialized[2]);
1654
3727a09e7b53 fix some icc warnings
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1427
diff changeset
161
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
162 if (serialized.size() == 4)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
163 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
164 manufacturer_ = StringToModalityManufacturer(serialized[3].asString());
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
165 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
166 else
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
167 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
168 manufacturer_ = ModalityManufacturer_Generic;
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
169 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
170 }
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
171
2715
73bc0c32547c fix embedding openssl within a DLL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2659
diff changeset
172
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
173 void RemoteModalityParameters::UnserializeObject(const Json::Value& serialized)
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
174 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
175 assert(serialized.type() == Json::objectValue);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
176
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
177 aet_ = SerializationToolbox::ReadString(serialized, KEY_AET);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
178 host_ = SerializationToolbox::ReadString(serialized, KEY_HOST);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
179
3786
3801435e34a1 integration Orthanc-1.6.0->SylvainRouquette
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3785 3641
diff changeset
180 if (serialized.isMember(KEY_PREFERRED_TRANSFER_SYNTAX))
3801435e34a1 integration Orthanc-1.6.0->SylvainRouquette
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3785 3641
diff changeset
181 {
3801435e34a1 integration Orthanc-1.6.0->SylvainRouquette
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3785 3641
diff changeset
182 preferredTransferSyntax_ = SerializationToolbox::ReadString(serialized, KEY_PREFERRED_TRANSFER_SYNTAX);
3801435e34a1 integration Orthanc-1.6.0->SylvainRouquette
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3785 3641
diff changeset
183 }
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
184
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
185 if (serialized.isMember(KEY_PORT))
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 port_ = ReadPortNumber(serialized[KEY_PORT]);
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 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
190 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
191 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
192 }
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 if (serialized.isMember(KEY_MANUFACTURER))
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
195 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
196 manufacturer_ = StringToModalityManufacturer
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
197 (SerializationToolbox::ReadString(serialized, KEY_MANUFACTURER));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
198 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
199 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
200 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
201 manufacturer_ = ModalityManufacturer_Generic;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
202 }
2872
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 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
205 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
206 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
207 }
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 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
210 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
211 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
212 }
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 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
215 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
216 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
217 }
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 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
220 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
221 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
222 }
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
223
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
224 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
225 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
226 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
227 }
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
228
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
229 if (serialized.isMember(KEY_ALLOW_N_ACTION))
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
230 {
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
231 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
232 }
3613
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 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
235 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
236 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
237 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
238
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
239 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
240 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
241 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
242 allowNAction_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
243 allowNEventReport_ = allow;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
244 }
2872
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
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 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
249 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
250 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
251 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
252 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
253 return allowEcho_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
254
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
255 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
256 return allowFind_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
257
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
258 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
259 return allowGet_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
260
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
261 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
262 return allowMove_;
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 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
265 return allowStore_;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
266
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
267 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
268 return allowNAction_;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
269
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
270 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
271 return allowNEventReport_;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
272
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
273 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
274 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
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
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 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
280 bool allowed)
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 switch (type)
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
283 {
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
284 case DicomRequestType_Echo:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
285 allowEcho_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
286 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
287
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
288 case DicomRequestType_Find:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
289 allowFind_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
290 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
291
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
292 case DicomRequestType_Get:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
293 allowGet_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
294 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
295
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
296 case DicomRequestType_Move:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
297 allowMove_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
298 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
299
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
300 case DicomRequestType_Store:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
301 allowStore_ = allowed;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
302 break;
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
303
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
304 case DicomRequestType_NAction:
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
305 allowNAction_ = allowed;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
306 break;
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
307
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
308 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
309 allowNEventReport_ = allowed;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
310 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
311
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
312 default:
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
313 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
314 }
2871
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
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
317
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
318 bool RemoteModalityParameters::IsAdvancedFormatNeeded() const
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
319 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
320 return (!allowEcho_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
321 !allowStore_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
322 !allowFind_ ||
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
323 !allowGet_ ||
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
324 !allowMove_ ||
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
325 !allowNAction_ ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3602
diff changeset
326 !allowNEventReport_);
807
566a2fb3c1fb update/delete modalities
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 806
diff changeset
327 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
328
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
329
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
330 void RemoteModalityParameters::Serialize(Json::Value& target,
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
331 bool forceAdvancedFormat) const
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
332 {
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
333 if (forceAdvancedFormat ||
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
334 IsAdvancedFormatNeeded())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
335 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
336 target = Json::objectValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
337 target[KEY_AET] = aet_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
338 target[KEY_HOST] = host_;
3785
763533d6dd67 add PreferredTransferSyntax to RemoteModalityParameters
sylvain.rouquette@incepto-medical.com
parents: 3060
diff changeset
339 target[KEY_PREFERRED_TRANSFER_SYNTAX] = preferredTransferSyntax_;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
340 target[KEY_PORT] = port_;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
341 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
342 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
343 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
344 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
345 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
346 target[KEY_ALLOW_MOVE] = allowMove_;
3602
085283445db0 AllowNAction in remote modality parameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3060
diff changeset
347 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
348 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_;
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
349 }
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
350 else
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
351 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
352 target = Json::arrayValue;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
353 target.append(GetApplicationEntityTitle());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
354 target.append(GetHost());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
355 target.append(GetPortNumber());
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
356 target.append(EnumerationToString(GetManufacturer()));
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
357 }
2655
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
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
360
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
361 void RemoteModalityParameters::Unserialize(const Json::Value& serialized)
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
362 {
2872
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
363 Clear();
9d08edde614b Possibility to restrict the allowed DICOM commands for each modality
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2871
diff changeset
364
2871
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
365 switch (serialized.type())
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
366 {
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
367 case Json::objectValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
368 UnserializeObject(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
369 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
370
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
371 case Json::arrayValue:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
372 UnserializeArray(serialized);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
373 break;
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
374
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
375 default:
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
376 throw OrthancException(ErrorCode_BadFileFormat);
6eebc2eb3168 refactoring serialization of RemoteModalityParameters
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2836
diff changeset
377 }
2655
c196d76cb8fa serialization
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
378 }
806
557575fd93e9 refactoring
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 }