Mercurial > hg > orthanc
annotate OrthancServer/Internals/CommandDispatcher.cpp @ 1099:060e8918d7a4
More fault-tolerant commands in Lua scripts
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Aug 2014 10:02:22 +0200 |
parents | b161593551db |
children | 3db41779d8f9 |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
689 | 3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
0 | 4 * Belgium |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
33 |
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 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
|
38 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
39 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
|
40 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
|
41 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
42 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
|
43 All rights reserved. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
44 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
45 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
|
46 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
47 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
48 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
|
49 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
50 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
51 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
52 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
|
53 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
|
54 are met: |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
55 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
56 - 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
|
57 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
|
58 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
59 - 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
|
60 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
|
61 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
|
62 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
63 - 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
|
64 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
|
65 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
|
66 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
67 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
|
68 "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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 (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
|
77 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
|
78 |
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 |
831
84513f2ee1f3
pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
824
diff
changeset
|
82 #include "../PrecompiledHeadersServer.h" |
0 | 83 #include "CommandDispatcher.h" |
84 | |
85 #include "FindScp.h" | |
86 #include "StoreScp.h" | |
87 #include "MoveScp.h" | |
88 #include "../../Core/Toolbox.h" | |
89 | |
90 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */ | |
101 | 91 #include <boost/lexical_cast.hpp> |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
92 #include <glog/logging.h> |
0 | 93 |
503 | 94 #define ORTHANC_PROMISCUOUS 1 |
95 | |
0 | 96 static OFBool opt_rejectWithoutImplementationUID = OFFalse; |
97 | |
98 | |
503 | 99 |
100 #if ORTHANC_PROMISCUOUS == 1 | |
101 static | |
102 DUL_PRESENTATIONCONTEXT * | |
103 findPresentationContextID(LST_HEAD * head, | |
104 T_ASC_PresentationContextID presentationContextID) | |
105 { | |
106 DUL_PRESENTATIONCONTEXT *pc; | |
107 LST_HEAD **l; | |
108 OFBool found = OFFalse; | |
109 | |
110 if (head == NULL) | |
111 return NULL; | |
112 | |
113 l = &head; | |
114 if (*l == NULL) | |
115 return NULL; | |
116 | |
117 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l)); | |
118 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc)); | |
119 | |
120 while (pc && !found) { | |
121 if (pc->presentationContextID == presentationContextID) { | |
122 found = OFTrue; | |
123 } else { | |
124 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l)); | |
125 } | |
126 } | |
127 return pc; | |
128 } | |
129 | |
130 | |
131 /** accept all presenstation contexts for unknown SOP classes, | |
132 * i.e. UIDs appearing in the list of abstract syntaxes | |
133 * where no corresponding name is defined in the UID dictionary. | |
134 * @param params pointer to association parameters structure | |
135 * @param transferSyntax transfer syntax to accept | |
136 * @param acceptedRole SCU/SCP role to accept | |
137 */ | |
138 static OFCondition acceptUnknownContextsWithTransferSyntax( | |
139 T_ASC_Parameters * params, | |
140 const char* transferSyntax, | |
141 T_ASC_SC_ROLE acceptedRole) | |
142 { | |
143 OFCondition cond = EC_Normal; | |
144 int n, i, k; | |
145 DUL_PRESENTATIONCONTEXT *dpc; | |
146 T_ASC_PresentationContext pc; | |
147 OFBool accepted = OFFalse; | |
148 OFBool abstractOK = OFFalse; | |
149 | |
150 n = ASC_countPresentationContexts(params); | |
151 for (i = 0; i < n; i++) | |
152 { | |
153 cond = ASC_getPresentationContext(params, i, &pc); | |
154 if (cond.bad()) return cond; | |
155 abstractOK = OFFalse; | |
156 accepted = OFFalse; | |
157 | |
158 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL) | |
159 { | |
160 abstractOK = OFTrue; | |
161 | |
162 /* check the transfer syntax */ | |
163 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++) | |
164 { | |
165 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0) | |
166 { | |
167 accepted = OFTrue; | |
168 } | |
169 } | |
170 } | |
171 | |
172 if (accepted) | |
173 { | |
174 cond = ASC_acceptPresentationContext( | |
175 params, pc.presentationContextID, | |
176 transferSyntax, acceptedRole); | |
177 if (cond.bad()) return cond; | |
178 } else { | |
179 T_ASC_P_ResultReason reason; | |
180 | |
181 /* do not refuse if already accepted */ | |
182 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext, | |
183 pc.presentationContextID); | |
184 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE))) | |
185 { | |
186 | |
187 if (abstractOK) { | |
188 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
189 } else { | |
190 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED; | |
191 } | |
192 /* | |
193 * If previously this presentation context was refused | |
194 * because of bad transfer syntax let it stay that way. | |
195 */ | |
196 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED)) | |
197 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
198 | |
199 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason); | |
200 if (cond.bad()) return cond; | |
201 } | |
202 } | |
203 } | |
204 return EC_Normal; | |
205 } | |
206 | |
207 | |
208 /** accept all presenstation contexts for unknown SOP classes, | |
209 * i.e. UIDs appearing in the list of abstract syntaxes | |
210 * where no corresponding name is defined in the UID dictionary. | |
211 * This method is passed a list of "preferred" transfer syntaxes. | |
212 * @param params pointer to association parameters structure | |
213 * @param transferSyntax transfer syntax to accept | |
214 * @param acceptedRole SCU/SCP role to accept | |
215 */ | |
216 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes( | |
217 T_ASC_Parameters * params, | |
218 const char* transferSyntaxes[], int transferSyntaxCount, | |
219 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT) | |
220 { | |
221 OFCondition cond = EC_Normal; | |
222 /* | |
223 ** Accept in the order "least wanted" to "most wanted" transfer | |
224 ** syntax. Accepting a transfer syntax will override previously | |
225 ** accepted transfer syntaxes. | |
226 */ | |
227 for (int i = transferSyntaxCount - 1; i >= 0; i--) | |
228 { | |
229 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole); | |
230 if (cond.bad()) return cond; | |
231 } | |
232 return cond; | |
233 } | |
234 #endif | |
235 | |
236 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
237 |
62 | 238 namespace Orthanc |
0 | 239 { |
240 namespace Internals | |
241 { | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
242 /** |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
243 * EXTRACT OF FILE "dcmdata/libsrc/dcuid.cc" FROM DCMTK 3.6.0 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
244 * (dcmAllStorageSOPClassUIDs). |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
245 * |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
246 * an array of const strings containing all known Storage SOP |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
247 * Classes that fit into the conventional |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
248 * PATIENT-STUDY-SERIES-INSTANCE information model, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
249 * i.e. everything a Storage SCP might want to store in a PACS. |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
250 * Special cases such as hanging protocol storage or the Storage |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
251 * SOP Class are not included in this list. |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
252 * |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
253 * THIS LIST CONTAINS ALL STORAGE SOP CLASSES INCLUDING RETIRED |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
254 * ONES AND IS LARGER THAN 64 ENTRIES. |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
255 */ |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
256 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
257 const char* orthancStorageSOPClassUIDs[] = |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
258 { |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
259 UID_AmbulatoryECGWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
260 UID_ArterialPulseWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
261 UID_AutorefractionMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
262 UID_BasicStructuredDisplayStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
263 UID_BasicTextSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
264 UID_BasicVoiceAudioWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
265 UID_BlendingSoftcopyPresentationStateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
266 UID_BreastTomosynthesisImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
267 UID_CardiacElectrophysiologyWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
268 UID_ChestCADSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
269 UID_ColonCADSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
270 UID_ColorSoftcopyPresentationStateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
271 UID_ComprehensiveSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
272 UID_ComputedRadiographyImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
273 UID_CTImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
274 UID_DeformableSpatialRegistrationStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
275 UID_DigitalIntraOralXRayImageStorageForPresentation, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
276 UID_DigitalIntraOralXRayImageStorageForProcessing, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
277 UID_DigitalMammographyXRayImageStorageForPresentation, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
278 UID_DigitalMammographyXRayImageStorageForProcessing, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
279 UID_DigitalXRayImageStorageForPresentation, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
280 UID_DigitalXRayImageStorageForProcessing, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
281 UID_EncapsulatedCDAStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
282 UID_EncapsulatedPDFStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
283 UID_EnhancedCTImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
284 UID_EnhancedMRColorImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
285 UID_EnhancedMRImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
286 UID_EnhancedPETImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
287 UID_EnhancedSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
288 UID_EnhancedUSVolumeStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
289 UID_EnhancedXAImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
290 UID_EnhancedXRFImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
291 UID_GeneralAudioWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
292 UID_GeneralECGWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
293 UID_GenericImplantTemplateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
294 UID_GrayscaleSoftcopyPresentationStateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
295 UID_HemodynamicWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
296 UID_ImplantAssemblyTemplateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
297 UID_ImplantationPlanSRDocumentStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
298 UID_ImplantTemplateGroupStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
299 UID_IntraocularLensCalculationsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
300 UID_KeratometryMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
301 UID_KeyObjectSelectionDocumentStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
302 UID_LensometryMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
303 UID_MacularGridThicknessAndVolumeReportStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
304 UID_MammographyCADSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
305 UID_MRImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
306 UID_MRSpectroscopyStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
307 UID_MultiframeGrayscaleByteSecondaryCaptureImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
308 UID_MultiframeGrayscaleWordSecondaryCaptureImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
309 UID_MultiframeSingleBitSecondaryCaptureImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
310 UID_MultiframeTrueColorSecondaryCaptureImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
311 UID_NuclearMedicineImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
312 UID_OphthalmicAxialMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
313 UID_OphthalmicPhotography16BitImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
314 UID_OphthalmicPhotography8BitImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
315 UID_OphthalmicTomographyImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
316 UID_OphthalmicVisualFieldStaticPerimetryMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
317 UID_PositronEmissionTomographyImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
318 UID_ProcedureLogStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
319 UID_PseudoColorSoftcopyPresentationStateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
320 UID_RawDataStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
321 UID_RealWorldValueMappingStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
322 UID_RespiratoryWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
323 UID_RTBeamsTreatmentRecordStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
324 UID_RTBrachyTreatmentRecordStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
325 UID_RTDoseStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
326 UID_RTImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
327 UID_RTIonBeamsTreatmentRecordStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
328 UID_RTIonPlanStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
329 UID_RTPlanStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
330 UID_RTStructureSetStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
331 UID_RTTreatmentSummaryRecordStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
332 UID_SecondaryCaptureImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
333 UID_SegmentationStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
334 UID_SpatialFiducialsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
335 UID_SpatialRegistrationStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
336 UID_SpectaclePrescriptionReportStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
337 UID_StereometricRelationshipStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
338 UID_SubjectiveRefractionMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
339 UID_SurfaceSegmentationStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
340 UID_TwelveLeadECGWaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
341 UID_UltrasoundImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
342 UID_UltrasoundMultiframeImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
343 UID_VideoEndoscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
344 UID_VideoMicroscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
345 UID_VideoPhotographicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
346 UID_VisualAcuityMeasurementsStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
347 UID_VLEndoscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
348 UID_VLMicroscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
349 UID_VLPhotographicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
350 UID_VLSlideCoordinatesMicroscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
351 UID_VLWholeSlideMicroscopyImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
352 UID_XAXRFGrayscaleSoftcopyPresentationStateStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
353 UID_XRay3DAngiographicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
354 UID_XRay3DCraniofacialImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
355 UID_XRayAngiographicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
356 UID_XRayRadiationDoseSRStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
357 UID_XRayRadiofluoroscopicImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
358 // retired |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
359 UID_RETIRED_HardcopyColorImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
360 UID_RETIRED_HardcopyGrayscaleImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
361 UID_RETIRED_NuclearMedicineImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
362 UID_RETIRED_StandaloneCurveStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
363 UID_RETIRED_StandaloneModalityLUTStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
364 UID_RETIRED_StandaloneOverlayStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
365 UID_RETIRED_StandalonePETCurveStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
366 UID_RETIRED_StandaloneVOILUTStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
367 UID_RETIRED_StoredPrintStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
368 UID_RETIRED_UltrasoundImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
369 UID_RETIRED_UltrasoundMultiframeImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
370 UID_RETIRED_VLImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
371 UID_RETIRED_VLMultiFrameImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
372 UID_RETIRED_XRayAngiographicBiPlaneImageStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
373 // draft |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
374 UID_DRAFT_SRAudioStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
375 UID_DRAFT_SRComprehensiveStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
376 UID_DRAFT_SRDetailStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
377 UID_DRAFT_SRTextStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
378 UID_DRAFT_WaveformStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
379 UID_DRAFT_RTBeamsDeliveryInstructionStorage, |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
380 NULL |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
381 }; |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
382 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
383 const int orthancStorageSOPClassUIDsCount = (sizeof(orthancStorageSOPClassUIDs) / sizeof(const char*)) - 1; |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
384 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
385 |
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
386 |
0 | 387 OFCondition AssociationCleanup(T_ASC_Association *assoc) |
388 { | |
389 OFString temp_str; | |
390 OFCondition cond = ASC_dropSCPAssociation(assoc); | |
391 if (cond.bad()) | |
392 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
393 LOG(FATAL) << cond.text(); |
0 | 394 return cond; |
395 } | |
396 | |
397 cond = ASC_destroyAssociation(&assoc); | |
398 if (cond.bad()) | |
399 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
400 LOG(FATAL) << cond.text(); |
0 | 401 return cond; |
402 } | |
403 | |
404 return cond; | |
405 } | |
406 | |
407 | |
408 | |
409 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net) | |
410 { | |
411 DcmAssociationConfiguration asccfg; | |
412 char buf[BUFSIZ]; | |
413 T_ASC_Association *assoc; | |
414 OFCondition cond; | |
415 OFString sprofile; | |
416 OFString temp_str; | |
417 | |
418 std::vector<const char*> knownAbstractSyntaxes; | |
419 | |
420 // For C-STORE | |
421 if (server.HasStoreRequestHandlerFactory()) | |
422 { | |
423 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass); | |
424 } | |
425 | |
426 // For C-FIND | |
427 if (server.HasFindRequestHandlerFactory()) | |
428 { | |
429 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); | |
430 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); | |
431 } | |
432 | |
433 // For C-MOVE | |
434 if (server.HasMoveRequestHandlerFactory()) | |
435 { | |
436 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); | |
665 | 437 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel); |
0 | 438 } |
439 | |
440 cond = ASC_receiveAssociation(net, &assoc, | |
441 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU, | |
442 NULL, NULL, | |
443 /*opt_secureConnection*/ OFFalse, | |
444 DUL_NOBLOCK, 1); | |
445 | |
446 if (cond == DUL_NOASSOCIATIONREQUEST) | |
447 { | |
448 // Timeout | |
449 AssociationCleanup(assoc); | |
450 return NULL; | |
451 } | |
452 | |
453 // if some kind of error occured, take care of it | |
454 if (cond.bad()) | |
455 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
456 LOG(ERROR) << "Receiving Association failed: " << cond.text(); |
0 | 457 // no matter what kind of error occurred, we need to do a cleanup |
458 AssociationCleanup(assoc); | |
459 return NULL; | |
460 } | |
461 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
462 LOG(INFO) << "Association Received"; |
0 | 463 |
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
|
464 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
|
465 |
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
|
466 // 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
|
467 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
|
468 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
|
469 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); |
665 | 470 |
471 // New transfer syntaxes supported since Orthanc 0.7.2 | |
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
|
472 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); |
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
|
473 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); |
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
|
474 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); |
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
|
475 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); |
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
|
476 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); |
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
|
477 transferSyntaxes.push_back(UID_JPEGProcess7_9TransferSyntax); |
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
|
478 transferSyntaxes.push_back(UID_JPEGProcess10_12TransferSyntax); |
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
|
479 transferSyntaxes.push_back(UID_JPEGProcess11_13TransferSyntax); |
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
|
480 transferSyntaxes.push_back(UID_JPEGProcess14TransferSyntax); |
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
|
481 transferSyntaxes.push_back(UID_JPEGProcess15TransferSyntax); |
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
|
482 transferSyntaxes.push_back(UID_JPEGProcess16_18TransferSyntax); |
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
|
483 transferSyntaxes.push_back(UID_JPEGProcess17_19TransferSyntax); |
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
|
484 transferSyntaxes.push_back(UID_JPEGProcess20_22TransferSyntax); |
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
|
485 transferSyntaxes.push_back(UID_JPEGProcess21_23TransferSyntax); |
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
|
486 transferSyntaxes.push_back(UID_JPEGProcess24_26TransferSyntax); |
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
|
487 transferSyntaxes.push_back(UID_JPEGProcess25_27TransferSyntax); |
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
|
488 transferSyntaxes.push_back(UID_JPEGProcess28TransferSyntax); |
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
|
489 transferSyntaxes.push_back(UID_JPEGProcess29TransferSyntax); |
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
|
490 transferSyntaxes.push_back(UID_JPEGProcess14SV1TransferSyntax); |
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
|
491 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); |
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
|
492 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); |
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
|
493 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
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
|
494 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
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
|
495 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); |
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
|
496 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); |
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
|
497 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); |
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
|
498 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); |
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
|
499 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); |
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
|
500 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); |
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
|
501 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); |
0 | 502 |
503 /* accept the Verification SOP Class if presented */ | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
504 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(assoc->params, &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 505 if (cond.bad()) |
506 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
507 LOG(INFO) << cond.text(); |
0 | 508 AssociationCleanup(assoc); |
509 return NULL; | |
510 } | |
511 | |
512 /* the array of Storage SOP Class UIDs comes from dcuid.h */ | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
513 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(assoc->params, orthancStorageSOPClassUIDs, orthancStorageSOPClassUIDsCount, &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 514 if (cond.bad()) |
515 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
516 LOG(INFO) << cond.text(); |
0 | 517 AssociationCleanup(assoc); |
518 return NULL; | |
519 } | |
520 | |
503 | 521 #if ORTHANC_PROMISCUOUS == 1 |
522 /* accept everything not known not to be a storage SOP class */ | |
523 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( | |
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
|
524 assoc->params, &transferSyntaxes[0], transferSyntaxes.size()); |
503 | 525 if (cond.bad()) |
526 { | |
527 LOG(INFO) << cond.text(); | |
528 AssociationCleanup(assoc); | |
529 return NULL; | |
530 } | |
531 #endif | |
532 | |
0 | 533 /* set our app title */ |
534 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str()); | |
535 | |
536 /* acknowledge or reject this association */ | |
537 cond = ASC_getApplicationContextName(assoc->params, buf); | |
538 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0) | |
539 { | |
540 /* reject: the application context name is not supported */ | |
541 T_ASC_RejectParameters rej = | |
542 { | |
543 ASC_RESULT_REJECTEDPERMANENT, | |
544 ASC_SOURCE_SERVICEUSER, | |
545 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED | |
546 }; | |
547 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
548 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf; |
0 | 549 cond = ASC_rejectAssociation(assoc, &rej); |
550 if (cond.bad()) | |
551 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
552 LOG(INFO) << cond.text(); |
0 | 553 } |
554 AssociationCleanup(assoc); | |
555 return NULL; | |
556 } | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
557 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
558 std::string callingIP; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
559 std::string callingTitle; |
0 | 560 |
561 /* check the AETs */ | |
562 { | |
563 DIC_AE callingTitle_C; | |
564 DIC_AE calledTitle_C; | |
565 DIC_AE callingIP_C; | |
566 DIC_AE calledIP_C; | |
567 if (ASC_getAPTitles(assoc->params, callingTitle_C, calledTitle_C, NULL).bad() || | |
568 ASC_getPresentationAddresses(assoc->params, callingIP_C, calledIP_C).bad()) | |
569 { | |
570 T_ASC_RejectParameters rej = | |
571 { | |
572 ASC_RESULT_REJECTEDPERMANENT, | |
573 ASC_SOURCE_SERVICEUSER, | |
574 ASC_REASON_SU_NOREASON | |
575 }; | |
576 ASC_rejectAssociation(assoc, &rej); | |
577 AssociationCleanup(assoc); | |
578 return NULL; | |
579 } | |
580 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
581 callingIP = std::string(/*OFSTRING_GUARD*/(callingIP_C)); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
582 callingTitle = std::string(/*OFSTRING_GUARD*/(callingTitle_C)); |
101 | 583 std::string calledTitle(/*OFSTRING_GUARD*/(calledTitle_C)); |
0 | 584 |
690
2e67366aab83
case-insensitive matching of Application Entity Titles
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
585 if (!server.IsMyAETitle(calledTitle)) |
0 | 586 { |
587 T_ASC_RejectParameters rej = | |
588 { | |
589 ASC_RESULT_REJECTEDPERMANENT, | |
590 ASC_SOURCE_SERVICEUSER, | |
591 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED | |
592 }; | |
593 ASC_rejectAssociation(assoc, &rej); | |
594 AssociationCleanup(assoc); | |
595 return NULL; | |
596 } | |
597 | |
598 if (server.HasApplicationEntityFilter() && | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
599 !server.GetApplicationEntityFilter().IsAllowedConnection(callingIP, callingTitle)) |
0 | 600 { |
601 T_ASC_RejectParameters rej = | |
602 { | |
603 ASC_RESULT_REJECTEDPERMANENT, | |
604 ASC_SOURCE_SERVICEUSER, | |
605 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED | |
606 }; | |
607 ASC_rejectAssociation(assoc, &rej); | |
608 AssociationCleanup(assoc); | |
609 return NULL; | |
610 } | |
611 } | |
612 | |
613 if (opt_rejectWithoutImplementationUID && strlen(assoc->params->theirImplementationClassUID) == 0) | |
614 { | |
615 /* reject: the no implementation Class UID provided */ | |
616 T_ASC_RejectParameters rej = | |
617 { | |
618 ASC_RESULT_REJECTEDPERMANENT, | |
619 ASC_SOURCE_SERVICEUSER, | |
620 ASC_REASON_SU_NOREASON | |
621 }; | |
622 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
623 LOG(INFO) << "Association Rejected: No Implementation Class UID provided"; |
0 | 624 cond = ASC_rejectAssociation(assoc, &rej); |
625 if (cond.bad()) | |
626 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
627 LOG(INFO) << cond.text(); |
0 | 628 } |
629 AssociationCleanup(assoc); | |
630 return NULL; | |
631 } | |
632 | |
633 { | |
634 cond = ASC_acknowledgeAssociation(assoc); | |
635 if (cond.bad()) | |
636 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
637 LOG(ERROR) << cond.text(); |
0 | 638 AssociationCleanup(assoc); |
639 return NULL; | |
640 } | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
641 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")"; |
0 | 642 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
643 LOG(INFO) << " (but no valid presentation contexts)"; |
0 | 644 } |
645 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
646 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
647 return new CommandDispatcher(server, assoc, callingIP, callingTitle, filter); |
0 | 648 } |
649 | |
650 bool CommandDispatcher::Step() | |
651 /* | |
652 * This function receives DIMSE commmands over the network connection | |
653 * and handles these commands correspondingly. Note that in case of | |
654 * storscp only C-ECHO-RQ and C-STORE-RQ commands can be processed. | |
655 */ | |
656 { | |
657 bool finished = false; | |
658 | |
659 // receive a DIMSE command over the network, with a timeout of 1 second | |
660 DcmDataset *statusDetail = NULL; | |
661 T_ASC_PresentationContextID presID = 0; | |
662 T_DIMSE_Message msg; | |
663 | |
664 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail); | |
665 elapsedTimeSinceLastCommand_++; | |
666 | |
667 // if the command which was received has extra status | |
668 // detail information, dump this information | |
669 if (statusDetail != NULL) | |
670 { | |
101 | 671 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail)); |
0 | 672 delete statusDetail; |
673 } | |
674 | |
675 if (cond == DIMSE_OUTOFRESOURCES) | |
676 { | |
677 finished = true; | |
678 } | |
679 else if (cond == DIMSE_NODATAAVAILABLE) | |
680 { | |
681 // Timeout due to DIMSE_NONBLOCKING | |
682 if (clientTimeout_ != 0 && | |
683 elapsedTimeSinceLastCommand_ >= clientTimeout_) | |
684 { | |
685 // This timeout is actually a client timeout | |
686 finished = true; | |
687 } | |
688 } | |
689 else if (cond == EC_Normal) | |
690 { | |
691 // Reset the client timeout counter | |
692 elapsedTimeSinceLastCommand_ = 0; | |
693 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
694 // 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
|
695 bool supported = false; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
696 DicomRequestType request; |
0 | 697 switch (msg.CommandField) |
698 { | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
699 case DIMSE_C_ECHO_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
700 request = DicomRequestType_Echo; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
701 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
702 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
703 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
704 case DIMSE_C_STORE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
705 request = DicomRequestType_Store; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
706 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
707 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
708 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
709 case DIMSE_C_MOVE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
710 request = DicomRequestType_Move; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
711 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
712 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
713 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
714 case DIMSE_C_FIND_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
715 request = DicomRequestType_Find; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
716 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
717 break; |
0 | 718 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
719 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
720 // we cannot handle this kind of message |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
721 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
722 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
|
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 |
0 | 726 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
727 // 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
|
728 if (supported && |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
729 request != DicomRequestType_Echo && // Always allow incoming ECHO requests |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
730 filter_ != NULL && |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
731 !filter_->IsAllowedRequest(callingIP_, callingAETitle_, request)) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
732 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
733 LOG(ERROR) << EnumerationToString(request) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
734 << " requests are disallowed for the AET \"" |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
735 << callingAETitle_ << "\""; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
736 cond = DIMSE_ILLEGALASSOCIATION; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
737 supported = false; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
738 finished = true; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
739 } |
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 // 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
|
742 if (supported) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
743 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
744 // 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
|
745 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
746 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
747 switch (request) |
0 | 748 { |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
749 case DicomRequestType_Echo: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
750 cond = EchoScp(assoc_, &msg, presID); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
751 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
752 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
753 case DicomRequestType_Store: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
754 if (server_.HasStoreRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
755 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
756 std::auto_ptr<IStoreRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
757 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler()); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
758 cond = Internals::storeScp(assoc_, &msg, presID, *handler); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
759 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
760 break; |
0 | 761 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
762 case DicomRequestType_Move: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
763 if (server_.HasMoveRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
764 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
765 std::auto_ptr<IMoveRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
766 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
767 cond = Internals::moveScp(assoc_, &msg, presID, *handler); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
768 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
769 break; |
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 case DicomRequestType_Find: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
772 if (server_.HasFindRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
773 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
774 std::auto_ptr<IFindRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
775 (server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler()); |
665 | 776 cond = Internals::findScp(assoc_, &msg, presID, *handler, callingAETitle_); |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
777 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
778 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
779 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
780 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
781 // Should never happen |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
782 break; |
0 | 783 } |
784 } | |
785 } | |
786 else | |
787 { | |
788 // Bad status, which indicates the closing of the connection by | |
789 // the peer or a network error | |
790 finished = true; | |
665 | 791 |
667
aa2ab67d913d
log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
665
diff
changeset
|
792 LOG(INFO) << cond.text(); |
0 | 793 } |
794 | |
795 if (finished) | |
796 { | |
797 if (cond == DUL_PEERREQUESTEDRELEASE) | |
798 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
799 LOG(INFO) << "Association Release"; |
0 | 800 ASC_acknowledgeRelease(assoc_); |
801 } | |
802 else if (cond == DUL_PEERABORTEDASSOCIATION) | |
803 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
804 LOG(INFO) << "Association Aborted"; |
0 | 805 } |
806 else | |
807 { | |
808 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
809 LOG(ERROR) << "DIMSE failure (aborting association): " << cond.text(); |
0 | 810 /* some kind of error so abort the association */ |
811 ASC_abortAssociation(assoc_); | |
812 } | |
813 } | |
814 | |
815 return !finished; | |
816 } | |
817 | |
818 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
819 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) |
0 | 820 { |
821 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
822 LOG(INFO) << "Received Echo Request"; |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
823 //LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID)); |
0 | 824 |
825 /* the echo succeeded !! */ | |
826 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); | |
827 if (cond.bad()) | |
828 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
829 LOG(ERROR) << "Echo SCP Failed: " << cond.text(); |
0 | 830 } |
831 return cond; | |
832 } | |
833 } | |
834 } |