comparison Core/DicomNetworking/DicomUserConnection.h @ 2382:7284093111b0

big reorganization to cleanly separate framework vs. server
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Aug 2017 21:17:35 +0200
parents OrthancServer/DicomProtocol/DicomUserConnection.h@96b3ec054b69
children 878b59270859
comparison
equal deleted inserted replaced
2381:b8969010b534 2382:7284093111b0
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017 Osimis, Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * In addition, as a special exception, the copyright holders of this
13 * program give permission to link the code of its release with the
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
15 * that use the same license as the "OpenSSL" library), and distribute
16 * the linked executables. You must obey the GNU General Public License
17 * in all respects for all of the code used other than "OpenSSL". If you
18 * modify file(s) with this exception, you may extend this exception to
19 * your version of the file(s), but you are not obligated to do so. If
20 * you do not wish to do so, delete this exception statement from your
21 * version. If you delete this exception statement from all source files
22 * in the program, then also delete it here.
23 *
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 **/
32
33
34 #pragma once
35
36 #if ORTHANC_ENABLE_DCMTK_NETWORKING != 1
37 # error The macro ORTHANC_ENABLE_DCMTK_NETWORKING must be set to 1
38 #endif
39
40 #include "DicomFindAnswers.h"
41 #include "../Enumerations.h"
42 #include "RemoteModalityParameters.h"
43
44 #include <stdint.h>
45 #include <boost/shared_ptr.hpp>
46 #include <boost/noncopyable.hpp>
47 #include <list>
48
49 namespace Orthanc
50 {
51 class DicomUserConnection : public boost::noncopyable
52 {
53 private:
54 struct PImpl;
55 boost::shared_ptr<PImpl> pimpl_;
56
57 // Connection parameters
58 std::string preferredTransferSyntax_;
59 std::string localAet_;
60 std::string remoteAet_;
61 std::string remoteHost_;
62 uint16_t remotePort_;
63 ModalityManufacturer manufacturer_;
64 std::set<std::string> storageSOPClasses_;
65 std::list<std::string> reservedStorageSOPClasses_;
66 std::set<std::string> defaultStorageSOPClasses_;
67
68 void CheckIsOpen() const;
69
70 void SetupPresentationContexts(const std::string& preferredTransferSyntax);
71
72 void MoveInternal(const std::string& targetAet,
73 ResourceType level,
74 const DicomMap& fields);
75
76 void ResetStorageSOPClasses();
77
78 void CheckStorageSOPClassesInvariant() const;
79
80 public:
81 DicomUserConnection();
82
83 ~DicomUserConnection();
84
85 void SetRemoteModality(const RemoteModalityParameters& parameters);
86
87 void SetLocalApplicationEntityTitle(const std::string& aet);
88
89 const std::string& GetLocalApplicationEntityTitle() const
90 {
91 return localAet_;
92 }
93
94 void SetRemoteApplicationEntityTitle(const std::string& aet);
95
96 const std::string& GetRemoteApplicationEntityTitle() const
97 {
98 return remoteAet_;
99 }
100
101 void SetRemoteHost(const std::string& host);
102
103 const std::string& GetRemoteHost() const
104 {
105 return remoteHost_;
106 }
107
108 void SetRemotePort(uint16_t port);
109
110 uint16_t GetRemotePort() const
111 {
112 return remotePort_;
113 }
114
115 void SetRemoteManufacturer(ModalityManufacturer manufacturer);
116
117 ModalityManufacturer GetRemoteManufacturer() const
118 {
119 return manufacturer_;
120 }
121
122 void ResetPreferredTransferSyntax();
123
124 void SetPreferredTransferSyntax(const std::string& preferredTransferSyntax);
125
126 const std::string& GetPreferredTransferSyntax() const
127 {
128 return preferredTransferSyntax_;
129 }
130
131 void AddStorageSOPClass(const char* sop);
132
133 void Open();
134
135 void Close();
136
137 bool IsOpen() const;
138
139 bool Echo();
140
141 void Store(const char* buffer,
142 size_t size,
143 const std::string& moveOriginatorAET,
144 uint16_t moveOriginatorID);
145
146 void Store(const char* buffer,
147 size_t size)
148 {
149 Store(buffer, size, "", 0); // Not a C-Move
150 }
151
152 void Store(const std::string& buffer,
153 const std::string& moveOriginatorAET,
154 uint16_t moveOriginatorID);
155
156 void Store(const std::string& buffer)
157 {
158 Store(buffer, "", 0); // Not a C-Move
159 }
160
161 void StoreFile(const std::string& path,
162 const std::string& moveOriginatorAET,
163 uint16_t moveOriginatorID);
164
165 void StoreFile(const std::string& path)
166 {
167 StoreFile(path, "", 0); // Not a C-Move
168 }
169
170 void Find(DicomFindAnswers& result,
171 ResourceType level,
172 const DicomMap& fields);
173
174 void Move(const std::string& targetAet,
175 ResourceType level,
176 const DicomMap& findResult);
177
178 void Move(const std::string& targetAet,
179 const DicomMap& findResult);
180
181 void MovePatient(const std::string& targetAet,
182 const std::string& patientId);
183
184 void MoveStudy(const std::string& targetAet,
185 const std::string& studyUid);
186
187 void MoveSeries(const std::string& targetAet,
188 const std::string& studyUid,
189 const std::string& seriesUid);
190
191 void MoveInstance(const std::string& targetAet,
192 const std::string& studyUid,
193 const std::string& seriesUid,
194 const std::string& instanceUid);
195
196 void SetTimeout(uint32_t seconds);
197
198 void DisableTimeout();
199
200 void FindWorklist(DicomFindAnswers& result,
201 ParsedDicomFile& query);
202
203 static void SetDefaultTimeout(uint32_t seconds);
204 };
205 }