Mercurial > hg > orthanc
annotate Core/DicomNetworking/Internals/CommandDispatcher.cpp @ 3349:ef18ea68a362
merge
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 18 Apr 2019 15:52:56 +0200 |
parents | 6e42d676401c |
children | 1bcc35e4615a |
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:
1164
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
3060
4e43e67f8ecf
preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2786
diff
changeset
|
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium |
0 | 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. | |
136 | 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. | |
0 | 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 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
34 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
35 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
36 /*========================================================================= |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
37 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
38 This file is based on portions of the following project: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
39 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
40 Program: DCMTK 3.6.0 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
41 Module: http://dicom.offis.de/dcmtk.php.en |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
42 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
43 Copyright (C) 1994-2011, OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
44 All rights reserved. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
45 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
46 This software and supporting documentation were developed by |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
47 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
48 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
49 R&D Division Health |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
50 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
51 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
52 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
53 Redistribution and use in source and binary forms, with or without |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
54 modification, are permitted provided that the following conditions |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
55 are met: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
56 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
57 - Redistributions of source code must retain the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
58 notice, this list of conditions and the following disclaimer. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
59 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
60 - Redistributions in binary form must reproduce the above copyright |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
61 notice, this list of conditions and the following disclaimer in the |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
62 documentation and/or other materials provided with the distribution. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
63 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
64 - Neither the name of OFFIS nor the names of its contributors may be |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
65 used to endorse or promote products derived from this software |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
66 without specific prior written permission. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
67 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
68 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
69 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
70 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
71 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
72 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
73 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
74 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
75 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
76 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
77 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
78 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
79 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
80 =========================================================================*/ |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
81 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
82 |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
83 #include "../../PrecompiledHeaders.h" |
0 | 84 #include "CommandDispatcher.h" |
85 | |
3118 | 86 #if !defined(DCMTK_VERSION_NUMBER) |
87 # error The macro DCMTK_VERSION_NUMBER must be defined | |
88 #endif | |
89 | |
0 | 90 #include "FindScp.h" |
91 #include "StoreScp.h" | |
92 #include "MoveScp.h" | |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
93 #include "../../Toolbox.h" |
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
94 #include "../../Logging.h" |
0 | 95 |
96 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */ | |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
97 #include <dcmtk/dcmdata/dcuid.h> /* for variable dcmAllStorageSOPClassUIDs */ |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
98 |
101 | 99 #include <boost/lexical_cast.hpp> |
0 | 100 |
101 static OFBool opt_rejectWithoutImplementationUID = OFFalse; | |
102 | |
103 | |
503 | 104 |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
105 static DUL_PRESENTATIONCONTEXT * |
503 | 106 findPresentationContextID(LST_HEAD * head, |
107 T_ASC_PresentationContextID presentationContextID) | |
108 { | |
109 DUL_PRESENTATIONCONTEXT *pc; | |
110 LST_HEAD **l; | |
111 OFBool found = OFFalse; | |
112 | |
113 if (head == NULL) | |
114 return NULL; | |
115 | |
116 l = &head; | |
117 if (*l == NULL) | |
118 return NULL; | |
119 | |
120 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l)); | |
121 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc)); | |
122 | |
123 while (pc && !found) { | |
124 if (pc->presentationContextID == presentationContextID) { | |
125 found = OFTrue; | |
126 } else { | |
127 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l)); | |
128 } | |
129 } | |
130 return pc; | |
131 } | |
132 | |
133 | |
134 /** accept all presenstation contexts for unknown SOP classes, | |
135 * i.e. UIDs appearing in the list of abstract syntaxes | |
136 * where no corresponding name is defined in the UID dictionary. | |
137 * @param params pointer to association parameters structure | |
138 * @param transferSyntax transfer syntax to accept | |
139 * @param acceptedRole SCU/SCP role to accept | |
140 */ | |
141 static OFCondition acceptUnknownContextsWithTransferSyntax( | |
142 T_ASC_Parameters * params, | |
143 const char* transferSyntax, | |
144 T_ASC_SC_ROLE acceptedRole) | |
145 { | |
146 OFCondition cond = EC_Normal; | |
147 int n, i, k; | |
148 DUL_PRESENTATIONCONTEXT *dpc; | |
149 T_ASC_PresentationContext pc; | |
150 OFBool accepted = OFFalse; | |
151 OFBool abstractOK = OFFalse; | |
152 | |
153 n = ASC_countPresentationContexts(params); | |
154 for (i = 0; i < n; i++) | |
155 { | |
156 cond = ASC_getPresentationContext(params, i, &pc); | |
157 if (cond.bad()) return cond; | |
158 abstractOK = OFFalse; | |
159 accepted = OFFalse; | |
160 | |
161 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL) | |
162 { | |
163 abstractOK = OFTrue; | |
164 | |
165 /* check the transfer syntax */ | |
166 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++) | |
167 { | |
168 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0) | |
169 { | |
170 accepted = OFTrue; | |
171 } | |
172 } | |
173 } | |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
174 |
503 | 175 if (accepted) |
176 { | |
177 cond = ASC_acceptPresentationContext( | |
178 params, pc.presentationContextID, | |
179 transferSyntax, acceptedRole); | |
180 if (cond.bad()) return cond; | |
181 } else { | |
182 T_ASC_P_ResultReason reason; | |
183 | |
184 /* do not refuse if already accepted */ | |
185 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext, | |
186 pc.presentationContextID); | |
187 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE))) | |
188 { | |
189 | |
190 if (abstractOK) { | |
191 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
192 } else { | |
193 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED; | |
194 } | |
195 /* | |
196 * If previously this presentation context was refused | |
197 * because of bad transfer syntax let it stay that way. | |
198 */ | |
199 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED)) | |
200 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
201 | |
202 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason); | |
203 if (cond.bad()) return cond; | |
204 } | |
205 } | |
206 } | |
207 return EC_Normal; | |
208 } | |
209 | |
210 | |
211 /** accept all presenstation contexts for unknown SOP classes, | |
212 * i.e. UIDs appearing in the list of abstract syntaxes | |
213 * where no corresponding name is defined in the UID dictionary. | |
214 * This method is passed a list of "preferred" transfer syntaxes. | |
215 * @param params pointer to association parameters structure | |
216 * @param transferSyntax transfer syntax to accept | |
217 * @param acceptedRole SCU/SCP role to accept | |
218 */ | |
219 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes( | |
220 T_ASC_Parameters * params, | |
221 const char* transferSyntaxes[], int transferSyntaxCount, | |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
222 T_ASC_SC_ROLE acceptedRole) |
503 | 223 { |
224 OFCondition cond = EC_Normal; | |
225 /* | |
226 ** Accept in the order "least wanted" to "most wanted" transfer | |
227 ** syntax. Accepting a transfer syntax will override previously | |
228 ** accepted transfer syntaxes. | |
229 */ | |
230 for (int i = transferSyntaxCount - 1; i >= 0; i--) | |
231 { | |
232 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole); | |
233 if (cond.bad()) return cond; | |
234 } | |
235 return cond; | |
236 } | |
237 | |
238 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
239 |
62 | 240 namespace Orthanc |
0 | 241 { |
242 namespace Internals | |
243 { | |
244 OFCondition AssociationCleanup(T_ASC_Association *assoc) | |
245 { | |
246 OFCondition cond = ASC_dropSCPAssociation(assoc); | |
247 if (cond.bad()) | |
248 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
249 LOG(FATAL) << cond.text(); |
0 | 250 return cond; |
251 } | |
252 | |
253 cond = ASC_destroyAssociation(&assoc); | |
254 if (cond.bad()) | |
255 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
256 LOG(FATAL) << cond.text(); |
0 | 257 return cond; |
258 } | |
259 | |
260 return cond; | |
261 } | |
262 | |
263 | |
264 | |
265 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net) | |
266 { | |
267 DcmAssociationConfiguration asccfg; | |
268 char buf[BUFSIZ]; | |
269 T_ASC_Association *assoc; | |
270 OFCondition cond; | |
271 OFString sprofile; | |
272 OFString temp_str; | |
273 | |
274 std::vector<const char*> knownAbstractSyntaxes; | |
275 | |
276 // For C-STORE | |
277 if (server.HasStoreRequestHandlerFactory()) | |
278 { | |
279 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass); | |
280 } | |
281 | |
282 // For C-FIND | |
283 if (server.HasFindRequestHandlerFactory()) | |
284 { | |
285 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); | |
286 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); | |
287 } | |
288 | |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
289 if (server.HasWorklistRequestHandlerFactory()) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
290 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
291 knownAbstractSyntaxes.push_back(UID_FINDModalityWorklistInformationModel); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
292 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
293 |
0 | 294 // For C-MOVE |
295 if (server.HasMoveRequestHandlerFactory()) | |
296 { | |
297 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); | |
665 | 298 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel); |
0 | 299 } |
300 | |
301 cond = ASC_receiveAssociation(net, &assoc, | |
302 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU, | |
303 NULL, NULL, | |
304 /*opt_secureConnection*/ OFFalse, | |
305 DUL_NOBLOCK, 1); | |
306 | |
307 if (cond == DUL_NOASSOCIATIONREQUEST) | |
308 { | |
309 // Timeout | |
310 AssociationCleanup(assoc); | |
311 return NULL; | |
312 } | |
313 | |
314 // if some kind of error occured, take care of it | |
315 if (cond.bad()) | |
316 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
317 LOG(ERROR) << "Receiving Association failed: " << cond.text(); |
0 | 318 // no matter what kind of error occurred, we need to do a cleanup |
319 AssociationCleanup(assoc); | |
320 return NULL; | |
321 } | |
322 | |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
323 // Retrieve the AET and the IP address of the remote modality |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
324 std::string remoteAet; |
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
325 std::string remoteIp; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
326 std::string calledAet; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
327 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
328 { |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
329 DIC_AE remoteAet_C; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
330 DIC_AE calledAet_C; |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
331 DIC_AE remoteIp_C; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
332 DIC_AE calledIP_C; |
3118 | 333 |
334 if ( | |
335 #if DCMTK_VERSION_NUMBER >= 364 | |
336 ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() || | |
337 ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad() | |
338 #else | |
339 ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || | |
340 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad() | |
341 #endif | |
342 ) | |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
343 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
344 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
345 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
346 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
347 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
348 ASC_REASON_SU_NOREASON |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
349 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
350 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
351 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
352 return NULL; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
353 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
354 |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
355 remoteIp = std::string(/*OFSTRING_GUARD*/(remoteIp_C)); |
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
356 remoteAet = std::string(/*OFSTRING_GUARD*/(remoteAet_C)); |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
357 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
358 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
359 |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
360 LOG(INFO) << "Association Received from AET " << remoteAet |
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
361 << " on IP " << remoteIp; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
362 |
0 | 363 |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
364 std::vector<const char*> transferSyntaxes; |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
365 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
366 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
367 transferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
368 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
369 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); |
665 | 370 |
371 // New transfer syntaxes supported since Orthanc 0.7.2 | |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
372 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
373 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Deflated)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
374 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
375 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
376 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
377 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
378 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
379 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
380 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
381 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
382 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
383 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
384 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
385 transferSyntaxes.push_back(UID_JPEGProcess7_9TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
386 transferSyntaxes.push_back(UID_JPEGProcess10_12TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
387 transferSyntaxes.push_back(UID_JPEGProcess11_13TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
388 transferSyntaxes.push_back(UID_JPEGProcess14TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
389 transferSyntaxes.push_back(UID_JPEGProcess15TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
390 transferSyntaxes.push_back(UID_JPEGProcess16_18TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
391 transferSyntaxes.push_back(UID_JPEGProcess17_19TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
392 transferSyntaxes.push_back(UID_JPEGProcess20_22TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
393 transferSyntaxes.push_back(UID_JPEGProcess21_23TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
394 transferSyntaxes.push_back(UID_JPEGProcess24_26TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
395 transferSyntaxes.push_back(UID_JPEGProcess25_27TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
396 transferSyntaxes.push_back(UID_JPEGProcess28TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
397 transferSyntaxes.push_back(UID_JPEGProcess29TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
398 transferSyntaxes.push_back(UID_JPEGProcess14SV1TransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
399 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
400 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
401 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
402 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg2000)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
403 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
404 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
405 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
2786
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
406 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
407 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
408 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); |
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
409 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
410 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
411 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
412 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
413 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_JpegLossless)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
414 { |
2786
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
415 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); |
e7a10626645f
Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
416 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
417 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
418 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
419 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
420 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpip)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
421 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
422 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
423 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
424 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
425 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
426 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
427 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Mpeg2)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
428 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
429 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
430 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
431 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
432 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
433 if (!server.HasApplicationEntityFilter() || |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
434 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Rle)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
435 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
436 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
437 } |
0 | 438 |
439 /* accept the Verification SOP Class if presented */ | |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
440 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
441 assoc->params, |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
442 &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
443 &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 444 if (cond.bad()) |
445 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
446 LOG(INFO) << cond.text(); |
0 | 447 AssociationCleanup(assoc); |
448 return NULL; | |
449 } | |
450 | |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
451 /* the array of Storage SOP Class UIDs that is defined within "dcmdata/libsrc/dcuid.cc" */ |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
452 size_t count = 0; |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
453 while (dcmAllStorageSOPClassUIDs[count] != NULL) |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
454 { |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
455 count++; |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
456 } |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
457 |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
458 #if DCMTK_VERSION_NUMBER >= 362 |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
459 // The global variable "numberOfDcmAllStorageSOPClassUIDs" is |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
460 // only published if DCMTK >= 3.6.2: |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
461 // https://bitbucket.org/sjodogne/orthanc/issues/137 |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
462 assert(count == numberOfDcmAllStorageSOPClassUIDs); |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
463 #endif |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
464 |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
465 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
466 assoc->params, |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
467 dcmAllStorageSOPClassUIDs, count, |
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
468 &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 469 if (cond.bad()) |
470 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
471 LOG(INFO) << cond.text(); |
0 | 472 AssociationCleanup(assoc); |
473 return NULL; | |
474 } | |
475 | |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
476 if (!server.HasApplicationEntityFilter() || |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
477 server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet)) |
503 | 478 { |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
479 /* |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
480 * Promiscous mode is enabled: Accept everything not known not |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
481 * to be a storage SOP class. |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
482 **/ |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
483 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( |
3343
6e42d676401c
Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3249
diff
changeset
|
484 assoc->params, &transferSyntaxes[0], transferSyntaxes.size(), ASC_SC_ROLE_DEFAULT); |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
485 if (cond.bad()) |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
486 { |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
487 LOG(INFO) << cond.text(); |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
488 AssociationCleanup(assoc); |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
489 return NULL; |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
490 } |
503 | 491 } |
492 | |
0 | 493 /* set our app title */ |
494 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str()); | |
495 | |
496 /* acknowledge or reject this association */ | |
3118 | 497 #if DCMTK_VERSION_NUMBER >= 364 |
498 cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf)); | |
499 #else | |
0 | 500 cond = ASC_getApplicationContextName(assoc->params, buf); |
3118 | 501 #endif |
502 | |
0 | 503 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0) |
504 { | |
505 /* reject: the application context name is not supported */ | |
506 T_ASC_RejectParameters rej = | |
507 { | |
508 ASC_RESULT_REJECTEDPERMANENT, | |
509 ASC_SOURCE_SERVICEUSER, | |
510 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED | |
511 }; | |
512 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
513 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf; |
0 | 514 cond = ASC_rejectAssociation(assoc, &rej); |
515 if (cond.bad()) | |
516 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
517 LOG(INFO) << cond.text(); |
0 | 518 } |
519 AssociationCleanup(assoc); | |
520 return NULL; | |
521 } | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
522 |
0 | 523 /* check the AETs */ |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
524 if (!server.IsMyAETitle(calledAet)) |
0 | 525 { |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
526 LOG(WARNING) << "Rejected association, because of a bad called AET in the request (" << calledAet << ")"; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
527 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
528 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
529 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
530 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
531 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
532 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
533 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
534 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
535 return NULL; |
0 | 536 } |
537 | |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
538 if (server.HasApplicationEntityFilter() && |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
539 !server.GetApplicationEntityFilter().IsAllowedConnection(remoteIp, remoteAet, calledAet)) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
540 { |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
541 LOG(WARNING) << "Rejected association for remote AET " << remoteAet << " on IP " << remoteIp; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
542 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
543 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
544 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
545 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
546 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
547 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
548 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
549 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
550 return NULL; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
551 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
552 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
553 if (opt_rejectWithoutImplementationUID && |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
554 strlen(assoc->params->theirImplementationClassUID) == 0) |
0 | 555 { |
556 /* reject: the no implementation Class UID provided */ | |
557 T_ASC_RejectParameters rej = | |
558 { | |
559 ASC_RESULT_REJECTEDPERMANENT, | |
560 ASC_SOURCE_SERVICEUSER, | |
561 ASC_REASON_SU_NOREASON | |
562 }; | |
563 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
564 LOG(INFO) << "Association Rejected: No Implementation Class UID provided"; |
0 | 565 cond = ASC_rejectAssociation(assoc, &rej); |
566 if (cond.bad()) | |
567 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
568 LOG(INFO) << cond.text(); |
0 | 569 } |
570 AssociationCleanup(assoc); | |
571 return NULL; | |
572 } | |
573 | |
574 { | |
575 cond = ASC_acknowledgeAssociation(assoc); | |
576 if (cond.bad()) | |
577 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
578 LOG(ERROR) << cond.text(); |
0 | 579 AssociationCleanup(assoc); |
580 return NULL; | |
581 } | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
582 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")"; |
0 | 583 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
584 LOG(INFO) << " (but no valid presentation contexts)"; |
0 | 585 } |
586 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
587 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
588 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter); |
0 | 589 } |
590 | |
2134
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
591 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
592 CommandDispatcher::CommandDispatcher(const DicomServer& server, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
593 T_ASC_Association* assoc, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
594 const std::string& remoteIp, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
595 const std::string& remoteAet, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
596 const std::string& calledAet, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
597 IApplicationEntityFilter* filter) : |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
598 server_(server), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
599 assoc_(assoc), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
600 remoteIp_(remoteIp), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
601 remoteAet_(remoteAet), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
602 calledAet_(calledAet), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
603 filter_(filter) |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
604 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
605 associationTimeout_ = server.GetAssociationTimeout(); |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
606 elapsedTimeSinceLastCommand_ = 0; |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
607 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
608 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
609 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
610 CommandDispatcher::~CommandDispatcher() |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
611 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
612 try |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
613 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
614 AssociationCleanup(assoc_); |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
615 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
616 catch (...) |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
617 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
618 LOG(ERROR) << "Some association was not cleanly aborted"; |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
619 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
620 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
621 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
622 |
0 | 623 bool CommandDispatcher::Step() |
624 /* | |
625 * This function receives DIMSE commmands over the network connection | |
626 * and handles these commands correspondingly. Note that in case of | |
627 * storscp only C-ECHO-RQ and C-STORE-RQ commands can be processed. | |
628 */ | |
629 { | |
630 bool finished = false; | |
631 | |
632 // receive a DIMSE command over the network, with a timeout of 1 second | |
633 DcmDataset *statusDetail = NULL; | |
634 T_ASC_PresentationContextID presID = 0; | |
635 T_DIMSE_Message msg; | |
636 | |
637 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail); | |
638 elapsedTimeSinceLastCommand_++; | |
639 | |
640 // if the command which was received has extra status | |
641 // detail information, dump this information | |
642 if (statusDetail != NULL) | |
643 { | |
101 | 644 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail)); |
0 | 645 delete statusDetail; |
646 } | |
647 | |
648 if (cond == DIMSE_OUTOFRESOURCES) | |
649 { | |
650 finished = true; | |
651 } | |
652 else if (cond == DIMSE_NODATAAVAILABLE) | |
653 { | |
654 // Timeout due to DIMSE_NONBLOCKING | |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
655 if (associationTimeout_ != 0 && |
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
656 elapsedTimeSinceLastCommand_ >= associationTimeout_) |
0 | 657 { |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
658 // This timeout is actually a association timeout |
0 | 659 finished = true; |
660 } | |
661 } | |
662 else if (cond == EC_Normal) | |
663 { | |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
664 // Reset the association timeout counter |
0 | 665 elapsedTimeSinceLastCommand_ = 0; |
666 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
667 // Convert the type of request to Orthanc's internal type |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
668 bool supported = false; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
669 DicomRequestType request; |
0 | 670 switch (msg.CommandField) |
671 { | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
672 case DIMSE_C_ECHO_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
673 request = DicomRequestType_Echo; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
674 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
675 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
676 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
677 case DIMSE_C_STORE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
678 request = DicomRequestType_Store; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
679 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
680 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
681 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
682 case DIMSE_C_MOVE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
683 request = DicomRequestType_Move; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
684 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
685 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
686 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
687 case DIMSE_C_FIND_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
688 request = DicomRequestType_Find; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
689 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
690 break; |
0 | 691 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
692 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
693 // we cannot handle this kind of message |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
694 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
695 LOG(ERROR) << "cannot handle command: 0x" << std::hex << msg.CommandField; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
696 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
697 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
698 |
0 | 699 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
700 // Check whether this request is allowed by the security filter |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
701 if (supported && |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
702 filter_ != NULL && |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
703 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request)) |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
704 { |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
705 LOG(WARNING) << "Rejected " << EnumerationToString(request) |
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
706 << " request from remote DICOM modality with AET \"" |
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
707 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\""; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
708 cond = DIMSE_ILLEGALASSOCIATION; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
709 supported = false; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
710 finished = true; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
711 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
712 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
713 // in case we received a supported message, process this command |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
714 if (supported) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
715 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
716 // If anything goes wrong, there will be a "BADCOMMANDTYPE" answer |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
717 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
718 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
719 switch (request) |
0 | 720 { |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
721 case DicomRequestType_Echo: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
722 cond = EchoScp(assoc_, &msg, presID); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
723 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
724 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
725 case DicomRequestType_Store: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
726 if (server_.HasStoreRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
727 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
728 std::auto_ptr<IStoreRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
729 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler()); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
730 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
731 if (handler.get() != NULL) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
732 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
733 cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
734 } |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
735 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
736 break; |
0 | 737 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
738 case DicomRequestType_Move: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
739 if (server_.HasMoveRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
740 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
741 std::auto_ptr<IMoveRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
742 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
743 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
744 if (handler.get() != NULL) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
745 { |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
746 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_); |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
747 } |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
748 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
749 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
750 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
751 case DicomRequestType_Find: |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
752 if (server_.HasFindRequestHandlerFactory() || // Should always be true |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
753 server_.HasWorklistRequestHandlerFactory()) |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
754 { |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
755 std::auto_ptr<IFindRequestHandler> findHandler; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
756 if (server_.HasFindRequestHandlerFactory()) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
757 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
758 findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler()); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
759 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
760 |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
761 std::auto_ptr<IWorklistRequestHandler> worklistHandler; |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
762 if (server_.HasWorklistRequestHandlerFactory()) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
763 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
764 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler()); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
765 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
766 |
2381
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
767 cond = Internals::findScp(assoc_, &msg, presID, server_.GetRemoteModalities(), |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
768 findHandler.get(), worklistHandler.get(), |
b8969010b534
uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2352
diff
changeset
|
769 remoteIp_, remoteAet_, calledAet_); |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
770 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
771 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
772 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
773 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
774 // Should never happen |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
775 break; |
0 | 776 } |
777 } | |
778 } | |
779 else | |
780 { | |
781 // Bad status, which indicates the closing of the connection by | |
782 // the peer or a network error | |
783 finished = true; | |
665 | 784 |
667
aa2ab67d913d
log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
665
diff
changeset
|
785 LOG(INFO) << cond.text(); |
0 | 786 } |
787 | |
788 if (finished) | |
789 { | |
790 if (cond == DUL_PEERREQUESTEDRELEASE) | |
791 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
792 LOG(INFO) << "Association Release"; |
0 | 793 ASC_acknowledgeRelease(assoc_); |
794 } | |
795 else if (cond == DUL_PEERABORTEDASSOCIATION) | |
796 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
797 LOG(INFO) << "Association Aborted"; |
0 | 798 } |
799 else | |
800 { | |
801 OFString temp_str; | |
2352
3ab96768d144
Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2244
diff
changeset
|
802 LOG(INFO) << "DIMSE failure (aborting association): " << cond.text(); |
0 | 803 /* some kind of error so abort the association */ |
804 ASC_abortAssociation(assoc_); | |
805 } | |
806 } | |
807 | |
808 return !finished; | |
809 } | |
810 | |
811 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
812 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) |
0 | 813 { |
814 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
815 LOG(INFO) << "Received Echo Request"; |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
816 //LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID)); |
0 | 817 |
818 /* the echo succeeded !! */ | |
819 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); | |
820 if (cond.bad()) | |
821 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
822 LOG(ERROR) << "Echo SCP Failed: " << cond.text(); |
0 | 823 } |
824 return cond; | |
825 } | |
826 } | |
827 } |