Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/DicomServer.h @ 4664:f9eda86f9045
ImageProcessing::Convert() from Float32 to RGB24
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 14 May 2021 11:46:57 +0200 |
parents | 82a314325351 |
children | fc2ba1ce6538 |
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_; |
4656
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
90 bool remoteCertificateRequired_; // New in 1.9.3 |
4439
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
91 |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
92 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
|
93 unsigned int maximumPduLength, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
94 bool useDicomTls); |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4119
diff
changeset
|
95 |
0 | 96 public: |
97 DicomServer(); | |
98 | |
99 ~DicomServer(); | |
100 | |
128 | 101 void SetPortNumber(uint16_t port); |
102 uint16_t GetPortNumber() const; | |
0 | 103 |
2069
fabf7820d1f1
New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
104 void SetAssociationTimeout(uint32_t seconds); |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
105 uint32_t GetAssociationTimeout() const; |
0 | 106 |
107 void SetCalledApplicationEntityTitleCheck(bool check); | |
108 bool HasCalledApplicationEntityTitleCheck() const; | |
109 | |
110 void SetApplicationEntityTitle(const std::string& aet); | |
111 const std::string& GetApplicationEntityTitle() const; | |
112 | |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
113 void SetRemoteModalities(IRemoteModalities& modalities); |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
114 IRemoteModalities& GetRemoteModalities() const; |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2380
diff
changeset
|
115 |
0 | 116 void SetFindRequestHandlerFactory(IFindRequestHandlerFactory& handler); |
117 bool HasFindRequestHandlerFactory() const; | |
118 IFindRequestHandlerFactory& GetFindRequestHandlerFactory() const; | |
119 | |
120 void SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& handler); | |
121 bool HasMoveRequestHandlerFactory() const; | |
122 IMoveRequestHandlerFactory& GetMoveRequestHandlerFactory() const; | |
123 | |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
124 void SetGetRequestHandlerFactory(IGetRequestHandlerFactory& handler); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
125 bool HasGetRequestHandlerFactory() const; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
126 IGetRequestHandlerFactory& GetGetRequestHandlerFactory() const; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3641
diff
changeset
|
127 |
0 | 128 void SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& handler); |
129 bool HasStoreRequestHandlerFactory() const; | |
130 IStoreRequestHandlerFactory& GetStoreRequestHandlerFactory() const; | |
131 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
132 void SetWorklistRequestHandlerFactory(IWorklistRequestHandlerFactory& handler); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
133 bool HasWorklistRequestHandlerFactory() const; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
134 IWorklistRequestHandlerFactory& GetWorklistRequestHandlerFactory() const; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1682
diff
changeset
|
135 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
136 void SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& handler); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
137 bool HasStorageCommitmentRequestHandlerFactory() const; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
138 IStorageCommitmentRequestHandlerFactory& GetStorageCommitmentRequestHandlerFactory() const; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
139 |
0 | 140 void SetApplicationEntityFilter(IApplicationEntityFilter& handler); |
141 bool HasApplicationEntityFilter() const; | |
142 IApplicationEntityFilter& GetApplicationEntityFilter() const; | |
143 | |
144 void Start(); | |
145 | |
146 void Stop(); | |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
147 |
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
148 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
|
149 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
150 void SetDicomTlsEnabled(bool enabled); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
151 bool IsDicomTlsEnabled() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
152 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
153 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
|
154 const std::string& certificatePath); |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
155 const std::string& GetOwnPrivateKeyPath() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
156 const std::string& GetOwnCertificatePath() const; |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
157 |
5209a9ff6e38
configuration options for DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
158 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
|
159 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
|
160 |
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4439
diff
changeset
|
161 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
|
162 void SetMaximumPduLength(unsigned int pdu); |
4656
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
163 |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
164 void SetRemoteCertificateRequired(bool required); |
82a314325351
New configuration option: "DicomTlsRemoteCertificateRequired"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
165 bool IsRemoteCertificateRequired() const; |
0 | 166 }; |
167 } |