Mercurial > hg > orthanc
annotate OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp @ 5765:247fc5368693 find-refactoring
un-sharing DatabaseConstraint and ISqlLookupFormatter with orthanc-databases
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Sep 2024 16:14:22 +0200 |
parents | f7adfb22e20e |
children |
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 |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5432
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
0 | 8 * |
9 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
12 * the License, or (at your option) any later version. |
136 | 13 * |
0 | 14 * This program is distributed in the hope that it will be useful, but |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
17 * Lesser General Public License for more details. |
0 | 18 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
21 * <http://www.gnu.org/licenses/>. |
0 | 22 **/ |
23 | |
24 | |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
25 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
26 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
27 /*========================================================================= |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
28 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
29 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
|
30 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
31 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
|
32 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
|
33 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
34 Copyright (C) 1994-2011, OFFIS e.V. |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
35 All rights reserved. |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
36 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
37 This software and supporting documentation were developed by |
766
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 OFFIS e.V. |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
40 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
|
41 Escherweg 2 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
42 26121 Oldenburg, Germany |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
43 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
44 Redistribution and use in source and binary forms, with or without |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
45 modification, are permitted provided that the following conditions |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
46 are met: |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
47 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
48 - Redistributions of source code must retain the above copyright |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
49 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
|
50 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
51 - Redistributions in binary form must reproduce the above copyright |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
52 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
|
53 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
|
54 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
55 - Neither the name of OFFIS nor the names of its contributors may be |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
56 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
|
57 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
|
58 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
59 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
60 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
61 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
62 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
63 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
64 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
65 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
66 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
67 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
68 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
69 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
70 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
71 =========================================================================*/ |
766
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
72 |
0a2f8c707c78
Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
690
diff
changeset
|
73 |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
74 #include "../../PrecompiledHeaders.h" |
0 | 75 #include "CommandDispatcher.h" |
76 | |
3118 | 77 #if !defined(DCMTK_VERSION_NUMBER) |
78 # error The macro DCMTK_VERSION_NUMBER must be defined | |
79 #endif | |
80 | |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
81 #include "../../Compatibility.h" |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
82 #include "../../DicomParsing/FromDcmtkBridge.h" |
2382
7284093111b0
big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2381
diff
changeset
|
83 #include "../../Logging.h" |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
84 #include "../../OrthancException.h" |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
85 #include "../../Toolbox.h" |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
86 #include "FindScp.h" |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
87 #include "GetScp.h" |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
88 #include "MoveScp.h" |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
89 #include "StoreScp.h" |
0 | 90 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
91 #include <dcmtk/dcmdata/dcdeftag.h> /* for storage commitment */ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
92 #include <dcmtk/dcmdata/dcsequen.h> /* for class DcmSequenceOfItems */ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
93 #include <dcmtk/dcmdata/dcuid.h> /* for variable dcmAllStorageSOPClassUIDs */ |
0 | 94 #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
|
95 |
101 | 96 #include <boost/lexical_cast.hpp> |
0 | 97 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
98 static OFBool opt_rejectWithoutImplementationUID = OFFalse; |
0 | 99 |
100 | |
503 | 101 |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
102 static DUL_PRESENTATIONCONTEXT * |
503 | 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 int n, i, k; | |
144 DUL_PRESENTATIONCONTEXT *dpc; | |
145 T_ASC_PresentationContext pc; | |
146 | |
147 n = ASC_countPresentationContexts(params); | |
148 for (i = 0; i < n; i++) | |
149 { | |
4199 | 150 OFCondition cond = ASC_getPresentationContext(params, i, &pc); |
503 | 151 if (cond.bad()) return cond; |
4199 | 152 OFBool abstractOK = OFFalse; |
153 OFBool accepted = OFFalse; | |
503 | 154 |
155 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL) | |
156 { | |
157 abstractOK = OFTrue; | |
158 | |
159 /* check the transfer syntax */ | |
160 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++) | |
161 { | |
162 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0) | |
163 { | |
164 accepted = OFTrue; | |
165 } | |
166 } | |
167 } | |
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
|
168 |
503 | 169 if (accepted) |
170 { | |
171 cond = ASC_acceptPresentationContext( | |
172 params, pc.presentationContextID, | |
173 transferSyntax, acceptedRole); | |
174 if (cond.bad()) return cond; | |
175 } else { | |
176 T_ASC_P_ResultReason reason; | |
177 | |
178 /* do not refuse if already accepted */ | |
179 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext, | |
180 pc.presentationContextID); | |
4199 | 181 if (dpc == NULL || dpc->result != ASC_P_ACCEPTANCE) |
503 | 182 { |
183 | |
184 if (abstractOK) { | |
185 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
186 } else { | |
187 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED; | |
188 } | |
189 /* | |
190 * If previously this presentation context was refused | |
191 * because of bad transfer syntax let it stay that way. | |
192 */ | |
193 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED)) | |
194 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
195 | |
196 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason); | |
197 if (cond.bad()) return cond; | |
198 } | |
199 } | |
200 } | |
201 return EC_Normal; | |
202 } | |
203 | |
204 | |
205 /** accept all presenstation contexts for unknown SOP classes, | |
206 * i.e. UIDs appearing in the list of abstract syntaxes | |
207 * where no corresponding name is defined in the UID dictionary. | |
208 * This method is passed a list of "preferred" transfer syntaxes. | |
209 * @param params pointer to association parameters structure | |
210 * @param transferSyntax transfer syntax to accept | |
211 * @param acceptedRole SCU/SCP role to accept | |
212 */ | |
213 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes( | |
214 T_ASC_Parameters * params, | |
215 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
|
216 T_ASC_SC_ROLE acceptedRole) |
503 | 217 { |
218 OFCondition cond = EC_Normal; | |
219 /* | |
220 ** Accept in the order "least wanted" to "most wanted" transfer | |
221 ** syntax. Accepting a transfer syntax will override previously | |
222 ** accepted transfer syntaxes. | |
223 */ | |
224 for (int i = transferSyntaxCount - 1; i >= 0; i--) | |
225 { | |
226 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole); | |
227 if (cond.bad()) return cond; | |
228 } | |
229 return cond; | |
230 } | |
231 | |
232 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
233 |
62 | 234 namespace Orthanc |
0 | 235 { |
236 namespace Internals | |
237 { | |
238 OFCondition AssociationCleanup(T_ASC_Association *assoc) | |
239 { | |
240 OFCondition cond = ASC_dropSCPAssociation(assoc); | |
241 if (cond.bad()) | |
242 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
243 CLOG(ERROR, DICOM) << cond.text(); |
0 | 244 return cond; |
245 } | |
246 | |
247 cond = ASC_destroyAssociation(&assoc); | |
248 if (cond.bad()) | |
249 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
250 CLOG(ERROR, DICOM) << cond.text(); |
0 | 251 return cond; |
252 } | |
253 | |
254 return cond; | |
255 } | |
256 | |
257 | |
258 | |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
259 CommandDispatcher* AcceptAssociation(const DicomServer& server, |
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
260 T_ASC_Network *net, |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
261 unsigned int maximumPduLength, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
262 bool useDicomTls) |
0 | 263 { |
264 DcmAssociationConfiguration asccfg; | |
265 char buf[BUFSIZ]; | |
266 T_ASC_Association *assoc; | |
267 OFCondition cond; | |
268 OFString sprofile; | |
269 OFString temp_str; | |
270 | |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
271 cond = ASC_receiveAssociation(net, &assoc, maximumPduLength, NULL, NULL, |
4430
f5d44e30b429
testing DICOM TLS in Orthanc SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4288
diff
changeset
|
272 useDicomTls /*opt_secureConnection*/, |
0 | 273 DUL_NOBLOCK, 1); |
274 | |
275 if (cond == DUL_NOASSOCIATIONREQUEST) | |
276 { | |
277 // Timeout | |
278 AssociationCleanup(assoc); | |
279 return NULL; | |
280 } | |
281 | |
282 // if some kind of error occured, take care of it | |
283 if (cond.bad()) | |
284 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
285 CLOG(ERROR, DICOM) << "Receiving Association failed: " << cond.text(); |
0 | 286 // no matter what kind of error occurred, we need to do a cleanup |
287 AssociationCleanup(assoc); | |
288 return NULL; | |
289 } | |
290 | |
4283
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
291 { |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
292 OFString str; |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
293 CLOG(TRACE, DICOM) << "Received Association Parameters:" << std::endl |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
294 << ASC_dumpParameters(str, assoc->params, ASC_ASSOC_RQ); |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
295 } |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
296 |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
297 // 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
|
298 std::string remoteAet; |
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
299 std::string remoteIp; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
300 std::string calledAet; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
301 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
302 { |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
303 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
|
304 DIC_AE calledAet_C; |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
305 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
|
306 DIC_AE calledIP_C; |
3118 | 307 |
308 if ( | |
309 #if DCMTK_VERSION_NUMBER >= 364 | |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
310 ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() || |
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
311 ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad() |
3118 | 312 #else |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
313 ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || |
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
314 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad() |
3118 | 315 #endif |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
316 ) |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
317 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
318 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
319 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
320 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
321 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
322 ASC_REASON_SU_NOREASON |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
323 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
324 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
325 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
326 return NULL; |
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 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
|
330 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
|
331 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
|
332 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
333 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
334 CLOG(INFO, DICOM) << "Association Received from AET " << remoteAet |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
335 << " on IP " << remoteIp; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
336 |
0 | 337 |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
338 { |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
339 /* accept the abstract syntaxes for C-ECHO, C-FIND, C-MOVE, |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
340 and storage commitment, if presented */ |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
341 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
342 std::vector<const char*> genericTransferSyntaxes; |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
343 genericTransferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
344 genericTransferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
345 genericTransferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
346 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
347 std::vector<const char*> knownAbstractSyntaxes; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
348 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
349 // For C-ECHO (always enabled since Orthanc 1.6.0; in earlier |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
350 // versions, only enabled if C-STORE was also enabled) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
351 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass); |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
352 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
353 // For C-FIND |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
354 if (server.HasFindRequestHandlerFactory()) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
355 { |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
356 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
357 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
358 } |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
359 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
360 if (server.HasWorklistRequestHandlerFactory()) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
361 { |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
362 knownAbstractSyntaxes.push_back(UID_FINDModalityWorklistInformationModel); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
363 } |
0 | 364 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
365 // For C-MOVE |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
366 if (server.HasMoveRequestHandlerFactory()) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
367 { |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
368 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
369 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
370 } |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
371 |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
372 // For C-GET |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
373 if (server.HasGetRequestHandlerFactory()) |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
374 { |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
375 knownAbstractSyntaxes.push_back(UID_GETStudyRootQueryRetrieveInformationModel); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
376 knownAbstractSyntaxes.push_back(UID_GETPatientRootQueryRetrieveInformationModel); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
377 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
378 |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
379 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
380 assoc->params, |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
381 &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
382 &genericTransferSyntaxes[0], genericTransferSyntaxes.size()); |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
383 if (cond.bad()) |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
384 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
385 CLOG(INFO, DICOM) << cond.text(); |
1806
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
386 AssociationCleanup(assoc); |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
387 return NULL; |
cd213ebcaefd
UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1800
diff
changeset
|
388 } |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
389 |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
390 |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
391 /* storage commitment support, new in Orthanc 1.6.0 */ |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
392 if (server.HasStorageCommitmentRequestHandlerFactory()) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
393 { |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
394 /** |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
395 * "ASC_SC_ROLE_SCUSCP": The "SCU" role is needed to accept |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
396 * remote storage commitment requests, and the "SCP" role is |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
397 * needed to receive storage commitments answers. |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
398 **/ |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
399 const char* as[1] = { UID_StorageCommitmentPushModelSOPClass }; |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
400 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
401 assoc->params, as, 1, |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
402 &genericTransferSyntaxes[0], genericTransferSyntaxes.size(), ASC_SC_ROLE_SCUSCP); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
403 if (cond.bad()) |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
404 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
405 CLOG(INFO, DICOM) << cond.text(); |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
406 AssociationCleanup(assoc); |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
407 return NULL; |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
408 } |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
409 } |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
410 } |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
411 |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
412 |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
413 { |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
414 /* accept the abstract syntaxes for C-STORE, if presented */ |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
415 |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
416 std::set<DicomTransferSyntax> storageTransferSyntaxes; |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
417 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
418 if (server.HasApplicationEntityFilter()) |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
419 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
420 server.GetApplicationEntityFilter().GetAcceptedTransferSyntaxes( |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
421 storageTransferSyntaxes, remoteIp, remoteAet, calledAet); |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
422 } |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
423 else |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
424 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
425 /** |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
426 * In the absence of filter, accept all the known transfer |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
427 * syntaxes. Note that this is different from Orthanc |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
428 * framework <= 1.8.2, where only the uncompressed transfer |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
429 * syntaxes are accepted by default. |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
430 **/ |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
431 GetAllDicomTransferSyntaxes(storageTransferSyntaxes); |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
432 } |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
433 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
434 if (storageTransferSyntaxes.empty()) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
435 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
436 LOG(WARNING) << "The DICOM server accepts no transfer syntax, thus C-STORE SCP is disabled"; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
437 } |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
438 else |
3646
5faf76511931
integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
diff
changeset
|
439 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
440 /** |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
441 * If accepted, put "Little Endian Explicit" at the first |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
442 * place in the accepted transfer syntaxes. This first place |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
443 * has an impact on the result of "getscu" (cf. integration |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
444 * test "test_getscu"). We choose "Little Endian Explicit", |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
445 * as this preserves the VR of the private tags, even if the |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
446 * remote modality doesn't have the dictionary of private tags. |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
447 * |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
448 * TODO - Should "PREFERRED_TRANSFER_SYNTAX" be an option of |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
449 * class "DicomServer"? |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
450 **/ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
451 const DicomTransferSyntax PREFERRED_TRANSFER_SYNTAX = DicomTransferSyntax_LittleEndianExplicit; |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
452 |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
453 E_TransferSyntax dummy; |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
454 assert(FromDcmtkBridge::LookupDcmtkTransferSyntax(dummy, PREFERRED_TRANSFER_SYNTAX)); |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
455 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
456 std::vector<const char*> storageTransferSyntaxesC; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
457 storageTransferSyntaxesC.reserve(storageTransferSyntaxes.size()); |
3646
5faf76511931
integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
diff
changeset
|
458 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
459 if (storageTransferSyntaxes.find(PREFERRED_TRANSFER_SYNTAX) != storageTransferSyntaxes.end()) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
460 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
461 storageTransferSyntaxesC.push_back(GetTransferSyntaxUid(PREFERRED_TRANSFER_SYNTAX)); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
462 } |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
463 |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
464 for (std::set<DicomTransferSyntax>::const_iterator |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
465 syntax = storageTransferSyntaxes.begin(); syntax != storageTransferSyntaxes.end(); ++syntax) |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
466 { |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
467 if (*syntax != PREFERRED_TRANSFER_SYNTAX && // Don't add the preferred transfer syntax twice |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
468 // Make sure that the current version of DCMTK knows this transfer syntax |
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
469 FromDcmtkBridge::LookupDcmtkTransferSyntax(dummy, *syntax)) |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
470 { |
4473
68f52897c119
new URIs: /tools/accepted-transfer-syntaxes and /tools/unknown-sop-class-accepted to replace Lua callbacks for transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4468
diff
changeset
|
471 storageTransferSyntaxesC.push_back(GetTransferSyntaxUid(*syntax)); |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
472 } |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
473 } |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
474 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
475 /* the array of Storage SOP Class UIDs that is defined within "dcmdata/libsrc/dcuid.cc" */ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
476 size_t count = 0; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
477 while (dcmAllStorageSOPClassUIDs[count] != NULL) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
478 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
479 count++; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
480 } |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
481 |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
482 #if DCMTK_VERSION_NUMBER >= 362 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
483 // The global variable "numberOfDcmAllStorageSOPClassUIDs" is |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
484 // only published if DCMTK >= 3.6.2: |
5432
59e3b6f8c5be
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
485 // https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=137 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
486 assert(static_cast<int>(count) == numberOfDcmAllStorageSOPClassUIDs); |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
487 #endif |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
488 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
489 if (!server.HasGetRequestHandlerFactory()) // dcmqrsrv.cc line 828 |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
490 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
491 // This branch exactly corresponds to Orthanc <= 1.6.1 (in |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
492 // which C-GET SCP was not supported) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
493 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
494 assoc->params, dcmAllStorageSOPClassUIDs, count, |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
495 &storageTransferSyntaxesC[0], storageTransferSyntaxesC.size()); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
496 if (cond.bad()) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
497 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
498 CLOG(INFO, DICOM) << cond.text(); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
499 AssociationCleanup(assoc); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
500 return NULL; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
501 } |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
502 } |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
503 else // see dcmqrsrv.cc lines 839 - 876 |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
504 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
505 /* accept storage syntaxes with proposed role */ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
506 int npc = ASC_countPresentationContexts(assoc->params); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
507 for (int i = 0; i < npc; i++) |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
508 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
509 T_ASC_PresentationContext pc; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
510 ASC_getPresentationContext(assoc->params, i, &pc); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
511 if (dcmIsaStorageSOPClassUID(pc.abstractSyntax)) |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
512 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
513 /** |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
514 * We are prepared to accept whatever role the caller |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
515 * proposes. Normally we can be the SCP of the Storage |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
516 * Service Class. When processing the C-GET operation |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
517 * we can be the SCU of the Storage Service Class. |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
518 **/ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
519 const T_ASC_SC_ROLE role = pc.proposedRole; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
520 |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
521 /** |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
522 * Accept in the order "least wanted" to "most wanted" |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
523 * transfer syntax. Accepting a transfer syntax will |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
524 * override previously accepted transfer syntaxes. |
5089
80ac0955e4e7
Store SCU now gives priority to the preferred TransferSyntax proposed by the receiving SCP instead of Orthanc own AcceptedTransferSyntaxes
Alain Mazy <am@osimis.io>
parents:
4912
diff
changeset
|
525 * Since Orthanc 1.11.2+, we give priority to the transfer |
80ac0955e4e7
Store SCU now gives priority to the preferred TransferSyntax proposed by the receiving SCP instead of Orthanc own AcceptedTransferSyntaxes
Alain Mazy <am@osimis.io>
parents:
4912
diff
changeset
|
526 * syntaxes proposed in the presentation context. |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
527 **/ |
5089
80ac0955e4e7
Store SCU now gives priority to the preferred TransferSyntax proposed by the receiving SCP instead of Orthanc own AcceptedTransferSyntaxes
Alain Mazy <am@osimis.io>
parents:
4912
diff
changeset
|
528 for (int j = static_cast<int>(pc.transferSyntaxCount)-1; j >=0; j--) |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
529 { |
5089
80ac0955e4e7
Store SCU now gives priority to the preferred TransferSyntax proposed by the receiving SCP instead of Orthanc own AcceptedTransferSyntaxes
Alain Mazy <am@osimis.io>
parents:
4912
diff
changeset
|
530 for (int k = static_cast<int>(storageTransferSyntaxesC.size()) - 1; k >= 0; k--) |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
531 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
532 /** |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
533 * If the transfer syntax was proposed then we can accept it |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
534 * appears in our supported list of transfer syntaxes |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
535 **/ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
536 if (strcmp(pc.proposedTransferSyntaxes[j], storageTransferSyntaxesC[k]) == 0) |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
537 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
538 cond = ASC_acceptPresentationContext( |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
539 assoc->params, pc.presentationContextID, storageTransferSyntaxesC[k], role); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
540 if (cond.bad()) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
541 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
542 CLOG(INFO, DICOM) << cond.text(); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
543 AssociationCleanup(assoc); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
544 return NULL; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
545 } |
3965
7f296ae25039
reviewed CommandDispatcher.cpp
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3964
diff
changeset
|
546 } |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
547 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
548 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
549 } |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
550 } /* for */ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
551 } |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
552 |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
553 if (!server.HasApplicationEntityFilter() || |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
554 server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet)) |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
555 { |
4468
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
556 /* |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
557 * Promiscous mode is enabled: Accept everything not known not |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
558 * to be a storage SOP class. |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
559 **/ |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
560 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
561 assoc->params, &storageTransferSyntaxesC[0], storageTransferSyntaxesC.size(), ASC_SC_ROLE_DEFAULT); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
562 if (cond.bad()) |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
563 { |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
564 CLOG(INFO, DICOM) << cond.text(); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
565 AssociationCleanup(assoc); |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
566 return NULL; |
9c070a34de18
IApplicationEntityFilter::GetAcceptedTransferSyntaxes()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4451
diff
changeset
|
567 } |
3612
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
568 } |
22eef03feed7
DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3604
diff
changeset
|
569 } |
503 | 570 } |
571 | |
0 | 572 /* set our app title */ |
573 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str()); | |
574 | |
575 /* acknowledge or reject this association */ | |
3118 | 576 #if DCMTK_VERSION_NUMBER >= 364 |
577 cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf)); | |
578 #else | |
0 | 579 cond = ASC_getApplicationContextName(assoc->params, buf); |
3118 | 580 #endif |
581 | |
0 | 582 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0) |
583 { | |
584 /* reject: the application context name is not supported */ | |
585 T_ASC_RejectParameters rej = | |
586 { | |
587 ASC_RESULT_REJECTEDPERMANENT, | |
588 ASC_SOURCE_SERVICEUSER, | |
589 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED | |
590 }; | |
591 | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
592 CLOG(INFO, DICOM) << "Association Rejected: Bad Application Context Name: " << buf; |
0 | 593 cond = ASC_rejectAssociation(assoc, &rej); |
594 if (cond.bad()) | |
595 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
596 CLOG(INFO, DICOM) << cond.text(); |
0 | 597 } |
598 AssociationCleanup(assoc); | |
599 return NULL; | |
600 } | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
601 |
0 | 602 /* check the AETs */ |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
603 if (!server.IsMyAETitle(calledAet)) |
0 | 604 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
605 CLOG(WARNING, DICOM) << "Rejected association, because of a bad called AET in the request (" << calledAet << ")"; |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
606 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
607 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
608 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
609 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
610 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
611 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
612 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
613 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
614 return NULL; |
0 | 615 } |
616 | |
1163
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
617 if (server.HasApplicationEntityFilter() && |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
618 !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
|
619 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
620 CLOG(WARNING, DICOM) << "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
|
621 T_ASC_RejectParameters rej = |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
622 { |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
623 ASC_RESULT_REJECTEDPERMANENT, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
624 ASC_SOURCE_SERVICEUSER, |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
625 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
626 }; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
627 ASC_rejectAssociation(assoc, &rej); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
628 AssociationCleanup(assoc); |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
629 return NULL; |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
630 } |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
631 |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
632 if (opt_rejectWithoutImplementationUID && |
3db41779d8f9
abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1085
diff
changeset
|
633 strlen(assoc->params->theirImplementationClassUID) == 0) |
0 | 634 { |
635 /* reject: the no implementation Class UID provided */ | |
636 T_ASC_RejectParameters rej = | |
637 { | |
638 ASC_RESULT_REJECTEDPERMANENT, | |
639 ASC_SOURCE_SERVICEUSER, | |
640 ASC_REASON_SU_NOREASON | |
641 }; | |
642 | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
643 CLOG(INFO, DICOM) << "Association Rejected: No Implementation Class UID provided"; |
0 | 644 cond = ASC_rejectAssociation(assoc, &rej); |
645 if (cond.bad()) | |
646 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
647 CLOG(INFO, DICOM) << cond.text(); |
0 | 648 } |
649 AssociationCleanup(assoc); | |
650 return NULL; | |
651 } | |
652 | |
653 { | |
654 cond = ASC_acknowledgeAssociation(assoc); | |
655 if (cond.bad()) | |
656 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
657 CLOG(ERROR, DICOM) << cond.text(); |
0 | 658 AssociationCleanup(assoc); |
659 return NULL; | |
660 } | |
4620
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
661 |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
662 { |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
663 std::string suffix; |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
664 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
665 suffix = " (but no valid presentation contexts)"; |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
666 |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
667 CLOG(INFO, DICOM) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
668 << ") to AET " << remoteAet << " on IP " << remoteIp << suffix; |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
669 } |
4283
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
670 |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
671 { |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
672 OFString str; |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
673 CLOG(TRACE, DICOM) << "Association Acknowledged Details:" << std::endl |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
674 << ASC_dumpParameters(str, assoc->params, ASC_ASSOC_AC); |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
675 } |
0 | 676 } |
677 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
678 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
679 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, maximumPduLength, filter); |
0 | 680 } |
681 | |
2134
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
682 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
683 CommandDispatcher::CommandDispatcher(const DicomServer& server, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
684 T_ASC_Association* assoc, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
685 const std::string& remoteIp, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
686 const std::string& remoteAet, |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
687 const std::string& calledAet, |
4451
f4dbdb2dcba6
new configuration option "MaximumPduLength" to tune the maximum PDU length
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
688 unsigned int maximumPduLength, |
2134
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
689 IApplicationEntityFilter* filter) : |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
690 server_(server), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
691 assoc_(assoc), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
692 remoteIp_(remoteIp), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
693 remoteAet_(remoteAet), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
694 calledAet_(calledAet), |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
695 filter_(filter) |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
696 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
697 associationTimeout_ = server.GetAssociationTimeout(); |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
698 elapsedTimeSinceLastCommand_ = 0; |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
699 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
700 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
701 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
702 CommandDispatcher::~CommandDispatcher() |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
703 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
704 try |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
705 { |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
706 AssociationCleanup(assoc_); |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
707 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
708 catch (...) |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
709 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
710 CLOG(ERROR, DICOM) << "Some association was not cleanly aborted"; |
2134
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
711 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
712 } |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
713 |
ddc75c6c712d
Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2068
diff
changeset
|
714 |
0 | 715 bool CommandDispatcher::Step() |
716 /* | |
717 * This function receives DIMSE commmands over the network connection | |
718 * and handles these commands correspondingly. Note that in case of | |
719 * storscp only C-ECHO-RQ and C-STORE-RQ commands can be processed. | |
720 */ | |
721 { | |
722 bool finished = false; | |
723 | |
724 // receive a DIMSE command over the network, with a timeout of 1 second | |
725 DcmDataset *statusDetail = NULL; | |
726 T_ASC_PresentationContextID presID = 0; | |
727 T_DIMSE_Message msg; | |
728 | |
729 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail); | |
730 elapsedTimeSinceLastCommand_++; | |
731 | |
732 // if the command which was received has extra status | |
733 // detail information, dump this information | |
734 if (statusDetail != NULL) | |
735 { | |
4288 | 736 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
737 statusDetail->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
738 CLOG(TRACE, DICOM) << "Status Detail:" << std::endl << s.str(); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
739 |
0 | 740 delete statusDetail; |
741 } | |
742 | |
743 if (cond == DIMSE_OUTOFRESOURCES) | |
744 { | |
745 finished = true; | |
746 } | |
747 else if (cond == DIMSE_NODATAAVAILABLE) | |
748 { | |
749 // Timeout due to DIMSE_NONBLOCKING | |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
750 if (associationTimeout_ != 0 && |
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
751 elapsedTimeSinceLastCommand_ >= associationTimeout_) |
0 | 752 { |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
753 // This timeout is actually a association timeout |
0 | 754 finished = true; |
755 } | |
756 } | |
757 else if (cond == EC_Normal) | |
758 { | |
4283
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
759 { |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
760 OFString str; |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
761 CLOG(TRACE, DICOM) << "Received Command:" << std::endl |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
762 << DIMSE_dumpMessage(str, msg, DIMSE_INCOMING, NULL, presID); |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
763 } |
6b58ceed959e
starting debug logs for SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4199
diff
changeset
|
764 |
2068
879f3be759ef
renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
765 // Reset the association timeout counter |
0 | 766 elapsedTimeSinceLastCommand_ = 0; |
767 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
768 // 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
|
769 bool supported = false; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
770 DicomRequestType request; |
0 | 771 switch (msg.CommandField) |
772 { | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
773 case DIMSE_C_ECHO_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
774 request = DicomRequestType_Echo; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
775 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
776 break; |
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 case DIMSE_C_STORE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
779 request = DicomRequestType_Store; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
780 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
781 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
782 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
783 case DIMSE_C_MOVE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
784 request = DicomRequestType_Move; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
785 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
786 break; |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
787 |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
788 case DIMSE_C_GET_RQ: |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
789 request = DicomRequestType_Get; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
790 supported = true; |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
791 break; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
792 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
793 case DIMSE_C_FIND_RQ: |
4912
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
794 { |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
795 std::string sopClassUid(msg.msg.CFindRQ.AffectedSOPClassUID); |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
796 if (sopClassUid == UID_FINDModalityWorklistInformationModel) |
4888
8523078f3f4b
added new configuration to authorize C-Find for worklist independently from other C-Find
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
797 { |
4912
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
798 request = DicomRequestType_FindWorklist; |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
799 } |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
800 else |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
801 { |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
802 request = DicomRequestType_Find; |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
803 } |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
804 supported = true; |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
805 break; |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
806 } |
45d6ce72a84e
fix linking of Sanitizer sample plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4888
diff
changeset
|
807 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
808 case DIMSE_N_ACTION_RQ: |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
809 request = DicomRequestType_NAction; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
810 supported = true; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
811 break; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
812 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
813 case DIMSE_N_EVENT_REPORT_RQ: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
814 request = DicomRequestType_NEventReport; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
815 supported = true; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
816 break; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
817 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
818 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
819 // we cannot handle this kind of message |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
820 cond = DIMSE_BADCOMMANDTYPE; |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
821 CLOG(ERROR, DICOM) << "cannot handle command: 0x" << std::hex << msg.CommandField; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
822 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
823 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
824 |
0 | 825 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
826 // 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
|
827 if (supported && |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
828 filter_ != NULL && |
1799
4f01c9d73f02
calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1786
diff
changeset
|
829 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request)) |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
830 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
831 CLOG(WARNING, DICOM) << "Rejected " << EnumerationToString(request) |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
832 << " request from remote DICOM modality with AET \"" |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
833 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\""; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
834 cond = DIMSE_ILLEGALASSOCIATION; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
835 supported = false; |
1085
b161593551db
Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1073
diff
changeset
|
836 finished = true; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
837 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
838 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
839 // 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
|
840 if (supported) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
841 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
842 // 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
|
843 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
844 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
845 switch (request) |
0 | 846 { |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
847 case DicomRequestType_Echo: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
848 cond = EchoScp(assoc_, &msg, presID); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
849 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
850 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
851 case DicomRequestType_Store: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
852 if (server_.HasStoreRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
853 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
854 std::unique_ptr<IStoreRequestHandler> handler |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
855 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler()); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
856 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
857 if (handler.get() != NULL) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
858 { |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
859 cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_, associationTimeout_); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
860 } |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
861 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
862 break; |
0 | 863 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
864 case DicomRequestType_Move: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
865 if (server_.HasMoveRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
866 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
867 std::unique_ptr<IMoveRequestHandler> handler |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
868 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
869 |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
870 if (handler.get() != NULL) |
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
871 { |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
872 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_, associationTimeout_); |
1800
30e97a1f4093
callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1799
diff
changeset
|
873 } |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
874 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
875 break; |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
876 |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
877 case DicomRequestType_Get: |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
878 if (server_.HasGetRequestHandlerFactory()) // Should always be true |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
879 { |
3964 | 880 std::unique_ptr<IGetRequestHandler> handler |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
881 (server_.GetGetRequestHandlerFactory().ConstructGetRequestHandler()); |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
882 |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
883 if (handler.get() != NULL) |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
884 { |
3953
620e87e9e816
c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3920
diff
changeset
|
885 cond = Internals::getScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_, associationTimeout_); |
3818
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
886 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
887 } |
4f78da5613a1
Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents:
3769
diff
changeset
|
888 break; |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
889 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
890 case DicomRequestType_Find: |
4888
8523078f3f4b
added new configuration to authorize C-Find for worklist independently from other C-Find
Alain Mazy <am@osimis.io>
parents:
4870
diff
changeset
|
891 case DicomRequestType_FindWorklist: |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
892 if (server_.HasFindRequestHandlerFactory() || // Should always be true |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
893 server_.HasWorklistRequestHandlerFactory()) |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
894 { |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
895 std::unique_ptr<IFindRequestHandler> findHandler; |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
896 if (server_.HasFindRequestHandlerFactory()) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
897 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
898 findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler()); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
899 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
900 |
3712
2a170a8f1faf
replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3704
diff
changeset
|
901 std::unique_ptr<IWorklistRequestHandler> worklistHandler; |
1786
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
902 if (server_.HasWorklistRequestHandlerFactory()) |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
903 { |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
904 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler()); |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
905 } |
164d78911382
primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1573
diff
changeset
|
906 |
4482
8efeaba1b7f9
new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4476
diff
changeset
|
907 cond = Internals::findScp(assoc_, &msg, presID, findHandler.get(), worklistHandler.get(), |
3704
58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3691
diff
changeset
|
908 remoteIp_, remoteAet_, calledAet_, associationTimeout_); |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
909 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
910 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
911 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
912 case DicomRequestType_NAction: |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
913 cond = NActionScp(&msg, presID); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
914 break; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
915 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
916 case DicomRequestType_NEventReport: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
917 cond = NEventReportScp(&msg, presID); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
918 break; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
919 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
920 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
921 // Should never happen |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
922 break; |
0 | 923 } |
924 } | |
925 } | |
926 else | |
927 { | |
928 // Bad status, which indicates the closing of the connection by | |
929 // the peer or a network error | |
930 finished = true; | |
665 | 931 |
4620
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
932 CLOG(INFO, DICOM) << "Finishing association with AET " << remoteAet_ |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
933 << " on IP " << remoteIp_ << ": " << cond.text(); |
0 | 934 } |
935 | |
936 if (finished) | |
937 { | |
938 if (cond == DUL_PEERREQUESTEDRELEASE) | |
939 { | |
4620
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
940 CLOG(INFO, DICOM) << "Association Release with AET " << remoteAet_ << " on IP " << remoteIp_; |
0 | 941 ASC_acknowledgeRelease(assoc_); |
942 } | |
943 else if (cond == DUL_PEERABORTEDASSOCIATION) | |
944 { | |
4620
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
945 CLOG(INFO, DICOM) << "Association Aborted with AET " << remoteAet_ << " on IP " << remoteIp_; |
0 | 946 } |
947 else | |
948 { | |
949 OFString temp_str; | |
4620
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
950 CLOG(INFO, DICOM) << "DIMSE failure (aborting association with AET " << remoteAet_ |
926fa5ef8b4f
added remote AET and IP in verbose logs about DICOM networking
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4482
diff
changeset
|
951 << " on IP " << remoteIp_ << "): " << cond.text(); |
0 | 952 /* some kind of error so abort the association */ |
953 ASC_abortAssociation(assoc_); | |
954 } | |
955 } | |
956 | |
957 return !finished; | |
958 } | |
959 | |
960 | |
1073
01414536c930
complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
831
diff
changeset
|
961 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) |
0 | 962 { |
963 OFString temp_str; | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
964 CLOG(INFO, DICOM) << "Received Echo Request"; |
0 | 965 |
966 /* the echo succeeded !! */ | |
967 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); | |
968 if (cond.bad()) | |
969 { | |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
970 CLOG(ERROR, DICOM) << "Echo SCP Failed: " << cond.text(); |
0 | 971 } |
972 return cond; | |
973 } | |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
974 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
975 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
976 static DcmDataset* ReadDataset(T_ASC_Association* assoc, |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
977 const char* errorMessage, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
978 int timeout) |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
979 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
980 DcmDataset *tmp = NULL; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
981 T_ASC_PresentationContextID presIdData; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
982 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
983 OFCondition cond = DIMSE_receiveDataSetInMemory( |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
984 assoc, (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, |
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
985 &presIdData, &tmp, NULL, NULL); |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
986 if (!cond.good() || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
987 tmp == NULL) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
988 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
989 throw OrthancException(ErrorCode_NetworkProtocol, errorMessage); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
990 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
991 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
992 return tmp; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
993 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
994 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
995 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
996 static std::string ReadString(DcmDataset& dataset, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
997 const DcmTagKey& tag) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
998 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
999 const char* s = NULL; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1000 if (!dataset.findAndGetString(tag, s).good() || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1001 s == NULL) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1002 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1003 char buf[64]; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1004 sprintf(buf, "Missing mandatory tag in dataset: (%04X,%04X)", |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1005 tag.getGroup(), tag.getElement()); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1006 throw OrthancException(ErrorCode_NetworkProtocol, buf); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1007 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1008 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1009 return std::string(s); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1010 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1011 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1012 |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1013 static void ReadSopSequence( |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1014 std::vector<std::string>& sopClassUids, |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1015 std::vector<std::string>& sopInstanceUids, |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1016 std::vector<StorageCommitmentFailureReason>* failureReasons, // Can be NULL |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1017 DcmDataset& dataset, |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1018 const DcmTagKey& tag, |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1019 bool mandatory) |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1020 { |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1021 sopClassUids.clear(); |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1022 sopInstanceUids.clear(); |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1023 |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1024 if (failureReasons) |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1025 { |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1026 failureReasons->clear(); |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1027 } |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1028 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1029 DcmSequenceOfItems* sequence = NULL; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1030 if (!dataset.findAndGetSequence(tag, sequence).good() || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1031 sequence == NULL) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1032 { |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1033 if (mandatory) |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1034 { |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1035 char buf[64]; |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1036 sprintf(buf, "Missing mandatory sequence in dataset: (%04X,%04X)", |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1037 tag.getGroup(), tag.getElement()); |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1038 throw OrthancException(ErrorCode_NetworkProtocol, buf); |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1039 } |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1040 else |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1041 { |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1042 return; |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1043 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1044 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1045 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1046 sopClassUids.reserve(sequence->card()); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1047 sopInstanceUids.reserve(sequence->card()); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1048 |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1049 if (failureReasons) |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1050 { |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1051 failureReasons->reserve(sequence->card()); |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1052 } |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1053 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1054 for (unsigned long i = 0; i < sequence->card(); i++) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1055 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1056 const char* a = NULL; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1057 const char* b = NULL; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1058 if (!sequence->getItem(i)->findAndGetString(DCM_ReferencedSOPClassUID, a).good() || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1059 !sequence->getItem(i)->findAndGetString(DCM_ReferencedSOPInstanceUID, b).good() || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1060 a == NULL || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1061 b == NULL) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1062 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1063 throw OrthancException(ErrorCode_NetworkProtocol, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1064 "Missing Referenced SOP Class/Instance UID " |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1065 "in storage commitment dataset"); |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1066 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1067 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1068 sopClassUids.push_back(a); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1069 sopInstanceUids.push_back(b); |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1070 |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1071 if (failureReasons != NULL) |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1072 { |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1073 Uint16 reason; |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1074 if (!sequence->getItem(i)->findAndGetUint16(DCM_FailureReason, reason).good()) |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1075 { |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1076 throw OrthancException(ErrorCode_NetworkProtocol, |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1077 "Missing Failure Reason (0008,1197) " |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1078 "in storage commitment dataset"); |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1079 } |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1080 |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1081 failureReasons->push_back(static_cast<StorageCommitmentFailureReason>(reason)); |
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1082 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1083 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1084 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1085 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1086 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1087 OFCondition CommandDispatcher::NActionScp(T_DIMSE_Message* msg, |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1088 T_ASC_PresentationContextID presID) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1089 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1090 /** |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1091 * Starting with Orthanc 1.6.0, only storage commitment is |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1092 * supported with DICOM N-ACTION. This corresponds to the case |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1093 * where "Action Type ID" equals "1". |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1094 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1095 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-4 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1096 **/ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1097 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1098 if (msg->CommandField != DIMSE_N_ACTION_RQ /* value == 304 == 0x0130 */ || |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1099 !server_.HasStorageCommitmentRequestHandlerFactory()) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1100 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1101 throw OrthancException(ErrorCode_InternalError); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1102 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1103 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1104 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1105 /** |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1106 * Check that the storage commitment request is correctly formatted. |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1107 **/ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1108 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1109 const T_DIMSE_N_ActionRQ& request = msg->msg.NActionRQ; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1110 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1111 if (request.ActionTypeID != 1) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1112 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1113 throw OrthancException(ErrorCode_NotImplemented, |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1114 "Only storage commitment is implemented for DICOM N-ACTION SCP"); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1115 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1116 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1117 if (std::string(request.RequestedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1118 std::string(request.RequestedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1119 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1120 throw OrthancException(ErrorCode_NetworkProtocol, |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1121 "Unexpected incoming SOP class or instance UID for storage commitment"); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1122 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1123 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1124 if (request.DataSetType != DIMSE_DATASET_PRESENT) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1125 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1126 throw OrthancException(ErrorCode_NetworkProtocol, |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1127 "Incoming storage commitment request without a dataset"); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1128 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1129 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1130 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1131 /** |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1132 * Extract the DICOM dataset that is associated with the DIMSE |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1133 * message. The content of this dataset is documented in "Table |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1134 * J.3-1. Storage Commitment Request - Action Information": |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1135 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html#table_J.3-1 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1136 **/ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1137 |
3767 | 1138 std::unique_ptr<DcmDataset> dataset( |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1139 ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP", associationTimeout_)); |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1140 assert(dataset.get() != NULL); |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1141 |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1142 { |
4288 | 1143 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
1144 dataset->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1145 CLOG(TRACE, DICOM) << "Received Storage Commitment Request:" << std::endl << s.str(); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1146 } |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1147 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1148 std::string transactionUid = ReadString(*dataset, DCM_TransactionUID); |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1149 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1150 std::vector<std::string> sopClassUid, sopInstanceUid; |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1151 ReadSopSequence(sopClassUid, sopInstanceUid, NULL, |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1152 *dataset, DCM_ReferencedSOPSequence, true /* mandatory */); |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1153 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1154 CLOG(INFO, DICOM) << "Incoming storage commitment request, with transaction UID: " << transactionUid; |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1155 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1156 for (size_t i = 0; i < sopClassUid.size(); i++) |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1157 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1158 CLOG(INFO, DICOM) << " (" << (i + 1) << "/" << sopClassUid.size() |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1159 << ") queried SOP Class/Instance UID: " |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1160 << sopClassUid[i] << " / " << sopInstanceUid[i]; |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1161 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1162 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1163 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1164 /** |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1165 * Call the Orthanc handler. The list of available DIMSE status |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1166 * codes can be found at: |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1167 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.4.1.10 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1168 **/ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1169 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1170 DIC_US dimseStatus; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1171 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1172 try |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1173 { |
3767 | 1174 std::unique_ptr<IStorageCommitmentRequestHandler> handler |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1175 (server_.GetStorageCommitmentRequestHandlerFactory(). |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1176 ConstructStorageCommitmentRequestHandler()); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1177 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1178 handler->HandleRequest(transactionUid, sopClassUid, sopInstanceUid, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1179 remoteIp_, remoteAet_, calledAet_); |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1180 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1181 dimseStatus = 0; // Success |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1182 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1183 catch (OrthancException& e) |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1184 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1185 CLOG(ERROR, DICOM) << "Error while processing an incoming storage commitment request: " << e.What(); |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1186 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1187 // Code 0x0110 - "General failure in processing the operation was encountered" |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1188 dimseStatus = STATUS_N_ProcessingFailure; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1189 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1190 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1191 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1192 /** |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1193 * Send the DIMSE status back to the SCU. |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1194 **/ |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1195 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1196 { |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1197 T_DIMSE_Message response; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1198 memset(&response, 0, sizeof(response)); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1199 response.CommandField = DIMSE_N_ACTION_RSP; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1200 |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1201 T_DIMSE_N_ActionRSP& content = response.msg.NActionRSP; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1202 content.MessageIDBeingRespondedTo = request.MessageID; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1203 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1204 content.DimseStatus = dimseStatus; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1205 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1206 content.ActionTypeID = 0; // Not present, as "O_NACTION_ACTIONTYPEID" not set in "opts" |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1207 content.DataSetType = DIMSE_DATASET_NULL; // Dataset is absent in storage commitment response |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1208 content.opts = O_NACTION_AFFECTEDSOPCLASSUID | O_NACTION_AFFECTEDSOPINSTANCEUID; |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1209 |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1210 { |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1211 OFString str; |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1212 CLOG(TRACE, DICOM) << "Sending Storage Commitment Request Response:" << std::endl |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1213 << DIMSE_dumpMessage(str, response, DIMSE_OUTGOING); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1214 } |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1215 |
3604
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1216 return DIMSE_sendMessageUsingMemoryData( |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1217 assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */, |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1218 NULL /* callback */, NULL /* callback context */, NULL /* commandSet */); |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1219 } |
e327b44780bb
abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3451
diff
changeset
|
1220 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1221 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1222 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1223 OFCondition CommandDispatcher::NEventReportScp(T_DIMSE_Message* msg, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1224 T_ASC_PresentationContextID presID) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1225 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1226 /** |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1227 * Starting with Orthanc 1.6.0, handling N-EVENT-REPORT for |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1228 * storage commitment. |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1229 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1230 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-1 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1231 **/ |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1232 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1233 if (msg->CommandField != DIMSE_N_EVENT_REPORT_RQ /* value == 256 == 0x0100 */ || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1234 !server_.HasStorageCommitmentRequestHandlerFactory()) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1235 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1236 throw OrthancException(ErrorCode_InternalError); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1237 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1238 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1239 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1240 /** |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1241 * Check that the storage commitment report is correctly formatted. |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1242 **/ |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1243 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1244 const T_DIMSE_N_EventReportRQ& report = msg->msg.NEventReportRQ; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1245 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1246 if (report.EventTypeID != 1 /* successful */ && |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1247 report.EventTypeID != 2 /* failures exist */) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1248 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1249 throw OrthancException(ErrorCode_NotImplemented, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1250 "Unknown event for DICOM N-EVENT-REPORT SCP"); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1251 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1252 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1253 if (std::string(report.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1254 std::string(report.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1255 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1256 throw OrthancException(ErrorCode_NetworkProtocol, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1257 "Unexpected incoming SOP class or instance UID for storage commitment"); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1258 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1259 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1260 if (report.DataSetType != DIMSE_DATASET_PRESENT) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1261 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1262 throw OrthancException(ErrorCode_NetworkProtocol, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1263 "Incoming storage commitment report without a dataset"); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1264 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1265 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1266 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1267 /** |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1268 * Extract the DICOM dataset that is associated with the DIMSE |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1269 * message. The content of this dataset is documented in "Table |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1270 * J.3-2. Storage Commitment Result - Event Information": |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1271 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html#table_J.3-2 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1272 **/ |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1273 |
3767 | 1274 std::unique_ptr<DcmDataset> dataset( |
3706
bd34b6ac5c08
timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3705
diff
changeset
|
1275 ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP", associationTimeout_)); |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1276 assert(dataset.get() != NULL); |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1277 |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1278 { |
4288 | 1279 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008 |
1280 dataset->print(s); | |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1281 CLOG(TRACE, DICOM) << "Received Storage Commitment Report:" << std::endl << s.str(); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1282 } |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1283 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1284 std::string transactionUid = ReadString(*dataset, DCM_TransactionUID); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1285 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1286 std::vector<std::string> successSopClassUid, successSopInstanceUid; |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1287 ReadSopSequence(successSopClassUid, successSopInstanceUid, NULL, |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1288 *dataset, DCM_ReferencedSOPSequence, |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1289 (report.EventTypeID == 1) /* mandatory in the case of success */); |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1290 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1291 std::vector<std::string> failedSopClassUid, failedSopInstanceUid; |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1292 std::vector<StorageCommitmentFailureReason> failureReasons; |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1293 |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1294 if (report.EventTypeID == 2 /* failures exist */) |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1295 { |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1296 ReadSopSequence(failedSopClassUid, failedSopInstanceUid, &failureReasons, |
3614
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1297 *dataset, DCM_FailedSOPSequence, true); |
4543ffad256d
storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3613
diff
changeset
|
1298 } |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1299 |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1300 CLOG(INFO, DICOM) << "Incoming storage commitment report, with transaction UID: " << transactionUid; |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1301 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1302 for (size_t i = 0; i < successSopClassUid.size(); i++) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1303 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1304 CLOG(INFO, DICOM) << " (success " << (i + 1) << "/" << successSopClassUid.size() |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1305 << ") SOP Class/Instance UID: " |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1306 << successSopClassUid[i] << " / " << successSopInstanceUid[i]; |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1307 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1308 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1309 for (size_t i = 0; i < failedSopClassUid.size(); i++) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1310 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1311 CLOG(INFO, DICOM) << " (failure " << (i + 1) << "/" << failedSopClassUid.size() |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1312 << ") SOP Class/Instance UID: " |
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1313 << failedSopClassUid[i] << " / " << failedSopInstanceUid[i]; |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1314 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1315 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1316 /** |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1317 * Call the Orthanc handler. The list of available DIMSE status |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1318 * codes can be found at: |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1319 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.4.1.10 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1320 **/ |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1321 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1322 DIC_US dimseStatus; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1323 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1324 try |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1325 { |
3767 | 1326 std::unique_ptr<IStorageCommitmentRequestHandler> handler |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1327 (server_.GetStorageCommitmentRequestHandlerFactory(). |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1328 ConstructStorageCommitmentRequestHandler()); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1329 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1330 handler->HandleReport(transactionUid, successSopClassUid, successSopInstanceUid, |
3736
0540b54324f1
StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3713
diff
changeset
|
1331 failedSopClassUid, failedSopInstanceUid, failureReasons, |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1332 remoteIp_, remoteAet_, calledAet_); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1333 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1334 dimseStatus = 0; // Success |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1335 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1336 catch (OrthancException& e) |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1337 { |
4284
756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4283
diff
changeset
|
1338 CLOG(ERROR, DICOM) << "Error while processing an incoming storage commitment report: " << e.What(); |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1339 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1340 // Code 0x0110 - "General failure in processing the operation was encountered" |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1341 dimseStatus = STATUS_N_ProcessingFailure; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1342 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1343 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1344 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1345 /** |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1346 * Send the DIMSE status back to the SCU. |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1347 **/ |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1348 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1349 { |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1350 T_DIMSE_Message response; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1351 memset(&response, 0, sizeof(response)); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1352 response.CommandField = DIMSE_N_EVENT_REPORT_RSP; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1353 |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1354 T_DIMSE_N_EventReportRSP& content = response.msg.NEventReportRSP; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1355 content.MessageIDBeingRespondedTo = report.MessageID; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1356 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1357 content.DimseStatus = dimseStatus; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1358 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1359 content.EventTypeID = 0; // Not present, as "O_NEVENTREPORT_EVENTTYPEID" not set in "opts" |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1360 content.DataSetType = DIMSE_DATASET_NULL; // Dataset is absent in storage commitment response |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1361 content.opts = O_NEVENTREPORT_AFFECTEDSOPCLASSUID | O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID; |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1362 |
4285
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1363 { |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1364 OFString str; |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1365 CLOG(TRACE, DICOM) << "Sending Storage Commitment Report Response:" << std::endl |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1366 << DIMSE_dumpMessage(str, response, DIMSE_OUTGOING); |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1367 } |
544120b34c09
fix for VS2008, debug logs for C-FIND SCP and for storage commitment SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4284
diff
changeset
|
1368 |
3613
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1369 return DIMSE_sendMessageUsingMemoryData( |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1370 assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */, |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1371 NULL /* callback */, NULL /* callback context */, NULL /* commandSet */); |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1372 } |
c1e2b91c2ab4
all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3612
diff
changeset
|
1373 } |
0 | 1374 } |
1375 } |