Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomServer.h @ 4640:66109d24d26e
"ETag" headers for metadata and attachments now allow strong comparison (MD5 is included)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 26 Apr 2021 15:22:44 +0200 |
parents | f4dbdb2dcba6 |
children | 82a314325351 |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4432
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
0 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * the License, or (at your option) any later version. |
136 | 11 * |
0 | 12 * This program is distributed in the hope that it will be useful, but |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
15 * Lesser General Public License for more details. |
0 | 16 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * <http://www.gnu.org/licenses/>. |
0 | 20 **/ |
21 | |
22 | |
23 #pragma once | |
24 | |
2380
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
25 #if ORTHANC_ENABLE_DCMTK_NETWORKING != 1 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
26 # error The macro ORTHANC_ENABLE_DCMTK_NETWORKING must be set to 1 |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
27 #endif |
96b3ec054b69
reorganization in macros
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
28 |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
29 #if !defined(ORTHANC_ENABLE_SSL) |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
30 # error The macro ORTHANC_ENABLE_SSL must be defined |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
31 #endif |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
32 |
0 | 33 #include "IFindRequestHandlerFactory.h" |
34 #include "IMoveRequestHandlerFactory.h" | |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
35 #include "IGetRequestHandlerFactory.h" |
0 | 36 #include "IStoreRequestHandlerFactory.h" |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
37 #include "IWorklistRequestHandlerFactory.h" |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
38 #include "IStorageCommitmentRequestHandlerFactory.h" |
0 | 39 #include "IApplicationEntityFilter.h" |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
40 #include "RemoteModalityParameters.h" |
0 | 41 |
42 #include <boost/shared_ptr.hpp> | |
43 #include <boost/noncopyable.hpp> | |
44 | |
1682
6414043df7d8
integration mainline->db-changes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1681
diff
changeset
|
45 |
62 | 46 namespace Orthanc |
0 | 47 { |
48 class DicomServer : public boost::noncopyable | |
49 { | |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
50 public: |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
51 // WARNING: The methods of this class must be thread-safe |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
52 class IRemoteModalities : public boost::noncopyable |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
53 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
54 public: |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
55 virtual ~IRemoteModalities() |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
56 { |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
57 } |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
58 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
59 virtual bool IsSameAETitle(const std::string& aet1, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
60 const std::string& aet2) = 0; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
61 |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
62 virtual bool LookupAETitle(RemoteModalityParameters& modality, |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
63 const std::string& aet) = 0; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
64 }; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
65 |
0 | 66 private: |
67 struct PImpl; | |
68 boost::shared_ptr<PImpl> pimpl_; | |
69 | |
70 bool checkCalledAet_; | |
71 std::string aet_; | |
72 uint16_t port_; | |
73 bool continue_; | |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
74 uint32_t associationTimeout_; |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
75 IRemoteModalities* modalities_; |
0 | 76 IFindRequestHandlerFactory* findRequestHandlerFactory_; |
77 IMoveRequestHandlerFactory* moveRequestHandlerFactory_; | |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
78 IGetRequestHandlerFactory* getRequestHandlerFactory_; |
0 | 79 IStoreRequestHandlerFactory* storeRequestHandlerFactory_; |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
80 IWorklistRequestHandlerFactory* worklistRequestHandlerFactory_; |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
81 IStorageCommitmentRequestHandlerFactory* storageCommitmentFactory_; |
0 | 82 IApplicationEntityFilter* applicationEntityFilter_; |
83 | |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
84 // New in Orthanc 1.9.0 for DICOM TLS |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
85 bool useDicomTls_; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
86 std::string ownPrivateKeyPath_; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
87 std::string ownCertificatePath_; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
88 std::string trustedCertificatesPath_; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
89 unsigned int maximumPduLength_; |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
90 |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
91 static void ServerThread(DicomServer* server, |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
92 unsigned int maximumPduLength, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
93 bool useDicomTls); |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
94 |
0 | 95 public: |
96 DicomServer(); | |
97 | |
98 ~DicomServer(); | |
99 | |
128 | 100 void SetPortNumber(uint16_t port); |
101 uint16_t GetPortNumber() const; | |
0 | 102 |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
103 void SetAssociationTimeout(uint32_t seconds); |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
104 uint32_t GetAssociationTimeout() const; |
0 | 105 |
106 void SetCalledApplicationEntityTitleCheck(bool check); | |
107 bool HasCalledApplicationEntityTitleCheck() const; | |
108 | |
109 void SetApplicationEntityTitle(const std::string& aet); | |
110 const std::string& GetApplicationEntityTitle() const; | |
111 | |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
112 void SetRemoteModalities(IRemoteModalities& modalities); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
113 IRemoteModalities& GetRemoteModalities() const; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
114 |
0 | 115 void SetFindRequestHandlerFactory(IFindRequestHandlerFactory& handler); |
116 bool HasFindRequestHandlerFactory() const; | |
117 IFindRequestHandlerFactory& GetFindRequestHandlerFactory() const; | |
118 | |
119 void SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& handler); | |
120 bool HasMoveRequestHandlerFactory() const; | |
121 IMoveRequestHandlerFactory& GetMoveRequestHandlerFactory() const; | |
122 | |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
123 void SetGetRequestHandlerFactory(IGetRequestHandlerFactory& handler); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
124 bool HasGetRequestHandlerFactory() const; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
125 IGetRequestHandlerFactory& GetGetRequestHandlerFactory() const; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
126 |
0 | 127 void SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& handler); |
128 bool HasStoreRequestHandlerFactory() const; | |
129 IStoreRequestHandlerFactory& GetStoreRequestHandlerFactory() const; | |
130 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
131 void SetWorklistRequestHandlerFactory(IWorklistRequestHandlerFactory& handler); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
132 bool HasWorklistRequestHandlerFactory() const; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
133 IWorklistRequestHandlerFactory& GetWorklistRequestHandlerFactory() const; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
134 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
135 void SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& handler); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
136 bool HasStorageCommitmentRequestHandlerFactory() const; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
137 IStorageCommitmentRequestHandlerFactory& GetStorageCommitmentRequestHandlerFactory() const; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
138 |
0 | 139 void SetApplicationEntityFilter(IApplicationEntityFilter& handler); |
140 bool HasApplicationEntityFilter() const; | |
141 IApplicationEntityFilter& GetApplicationEntityFilter() const; | |
142 | |
143 void Start(); | |
144 | |
145 void Stop(); | |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
146 |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
147 bool IsMyAETitle(const std::string& aet) const; |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
148 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
149 void SetDicomTlsEnabled(bool enabled); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
150 bool IsDicomTlsEnabled() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
151 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
152 void SetOwnCertificatePath(const std::string& privateKeyPath, |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
153 const std::string& certificatePath); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
154 const std::string& GetOwnPrivateKeyPath() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
155 const std::string& GetOwnCertificatePath() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
156 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
157 void SetTrustedCertificatesPath(const std::string& path); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
158 const std::string& GetTrustedCertificatesPath() const; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
159 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
160 unsigned int GetMaximumPduLength() const; |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
161 void SetMaximumPduLength(unsigned int pdu); |
0 | 162 }; |
163 } |