Mercurial > hg > orthanc
annotate OrthancServer/Internals/CommandDispatcher.cpp @ 681:3bdb5db8e839 query-retrieve
generalization of query/retrieve
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 24 Jan 2014 17:40:45 +0100 |
parents | aa2ab67d913d |
children | 2d0a347e8cfc |
rev | line source |
---|---|
0 | 1 /** |
62 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
399 | 3 * Copyright (C) 2012-2013 Medical Physics Department, CHU of Liege, |
0 | 4 * Belgium |
5 * | |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #include "CommandDispatcher.h" | |
34 | |
35 #include "FindScp.h" | |
36 #include "StoreScp.h" | |
37 #include "MoveScp.h" | |
38 #include "../../Core/Toolbox.h" | |
39 | |
40 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */ | |
101 | 41 #include <boost/lexical_cast.hpp> |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
42 #include <glog/logging.h> |
0 | 43 |
503 | 44 #define ORTHANC_PROMISCUOUS 1 |
45 | |
0 | 46 static OFBool opt_rejectWithoutImplementationUID = OFFalse; |
47 | |
48 | |
503 | 49 |
50 #if ORTHANC_PROMISCUOUS == 1 | |
51 static | |
52 DUL_PRESENTATIONCONTEXT * | |
53 findPresentationContextID(LST_HEAD * head, | |
54 T_ASC_PresentationContextID presentationContextID) | |
55 { | |
56 DUL_PRESENTATIONCONTEXT *pc; | |
57 LST_HEAD **l; | |
58 OFBool found = OFFalse; | |
59 | |
60 if (head == NULL) | |
61 return NULL; | |
62 | |
63 l = &head; | |
64 if (*l == NULL) | |
65 return NULL; | |
66 | |
67 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l)); | |
68 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc)); | |
69 | |
70 while (pc && !found) { | |
71 if (pc->presentationContextID == presentationContextID) { | |
72 found = OFTrue; | |
73 } else { | |
74 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l)); | |
75 } | |
76 } | |
77 return pc; | |
78 } | |
79 | |
80 | |
81 /** accept all presenstation contexts for unknown SOP classes, | |
82 * i.e. UIDs appearing in the list of abstract syntaxes | |
83 * where no corresponding name is defined in the UID dictionary. | |
84 * @param params pointer to association parameters structure | |
85 * @param transferSyntax transfer syntax to accept | |
86 * @param acceptedRole SCU/SCP role to accept | |
87 */ | |
88 static OFCondition acceptUnknownContextsWithTransferSyntax( | |
89 T_ASC_Parameters * params, | |
90 const char* transferSyntax, | |
91 T_ASC_SC_ROLE acceptedRole) | |
92 { | |
93 OFCondition cond = EC_Normal; | |
94 int n, i, k; | |
95 DUL_PRESENTATIONCONTEXT *dpc; | |
96 T_ASC_PresentationContext pc; | |
97 OFBool accepted = OFFalse; | |
98 OFBool abstractOK = OFFalse; | |
99 | |
100 n = ASC_countPresentationContexts(params); | |
101 for (i = 0; i < n; i++) | |
102 { | |
103 cond = ASC_getPresentationContext(params, i, &pc); | |
104 if (cond.bad()) return cond; | |
105 abstractOK = OFFalse; | |
106 accepted = OFFalse; | |
107 | |
108 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL) | |
109 { | |
110 abstractOK = OFTrue; | |
111 | |
112 /* check the transfer syntax */ | |
113 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++) | |
114 { | |
115 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0) | |
116 { | |
117 accepted = OFTrue; | |
118 } | |
119 } | |
120 } | |
121 | |
122 if (accepted) | |
123 { | |
124 cond = ASC_acceptPresentationContext( | |
125 params, pc.presentationContextID, | |
126 transferSyntax, acceptedRole); | |
127 if (cond.bad()) return cond; | |
128 } else { | |
129 T_ASC_P_ResultReason reason; | |
130 | |
131 /* do not refuse if already accepted */ | |
132 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext, | |
133 pc.presentationContextID); | |
134 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE))) | |
135 { | |
136 | |
137 if (abstractOK) { | |
138 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
139 } else { | |
140 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED; | |
141 } | |
142 /* | |
143 * If previously this presentation context was refused | |
144 * because of bad transfer syntax let it stay that way. | |
145 */ | |
146 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED)) | |
147 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED; | |
148 | |
149 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason); | |
150 if (cond.bad()) return cond; | |
151 } | |
152 } | |
153 } | |
154 return EC_Normal; | |
155 } | |
156 | |
157 | |
158 /** accept all presenstation contexts for unknown SOP classes, | |
159 * i.e. UIDs appearing in the list of abstract syntaxes | |
160 * where no corresponding name is defined in the UID dictionary. | |
161 * This method is passed a list of "preferred" transfer syntaxes. | |
162 * @param params pointer to association parameters structure | |
163 * @param transferSyntax transfer syntax to accept | |
164 * @param acceptedRole SCU/SCP role to accept | |
165 */ | |
166 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes( | |
167 T_ASC_Parameters * params, | |
168 const char* transferSyntaxes[], int transferSyntaxCount, | |
169 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT) | |
170 { | |
171 OFCondition cond = EC_Normal; | |
172 /* | |
173 ** Accept in the order "least wanted" to "most wanted" transfer | |
174 ** syntax. Accepting a transfer syntax will override previously | |
175 ** accepted transfer syntaxes. | |
176 */ | |
177 for (int i = transferSyntaxCount - 1; i >= 0; i--) | |
178 { | |
179 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole); | |
180 if (cond.bad()) return cond; | |
181 } | |
182 return cond; | |
183 } | |
184 #endif | |
185 | |
186 | |
62 | 187 namespace Orthanc |
0 | 188 { |
189 namespace Internals | |
190 { | |
191 OFCondition AssociationCleanup(T_ASC_Association *assoc) | |
192 { | |
193 OFString temp_str; | |
194 OFCondition cond = ASC_dropSCPAssociation(assoc); | |
195 if (cond.bad()) | |
196 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
197 LOG(FATAL) << cond.text(); |
0 | 198 return cond; |
199 } | |
200 | |
201 cond = ASC_destroyAssociation(&assoc); | |
202 if (cond.bad()) | |
203 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
204 LOG(FATAL) << cond.text(); |
0 | 205 return cond; |
206 } | |
207 | |
208 return cond; | |
209 } | |
210 | |
211 | |
212 | |
213 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net) | |
214 { | |
215 DcmAssociationConfiguration asccfg; | |
216 char buf[BUFSIZ]; | |
217 T_ASC_Association *assoc; | |
218 OFCondition cond; | |
219 OFString sprofile; | |
220 OFString temp_str; | |
221 | |
222 std::vector<const char*> knownAbstractSyntaxes; | |
223 | |
224 // For C-STORE | |
225 if (server.HasStoreRequestHandlerFactory()) | |
226 { | |
227 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass); | |
228 } | |
229 | |
230 // For C-FIND | |
231 if (server.HasFindRequestHandlerFactory()) | |
232 { | |
233 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel); | |
234 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel); | |
235 } | |
236 | |
237 // For C-MOVE | |
238 if (server.HasMoveRequestHandlerFactory()) | |
239 { | |
240 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); | |
665 | 241 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel); |
0 | 242 } |
243 | |
244 cond = ASC_receiveAssociation(net, &assoc, | |
245 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU, | |
246 NULL, NULL, | |
247 /*opt_secureConnection*/ OFFalse, | |
248 DUL_NOBLOCK, 1); | |
249 | |
250 if (cond == DUL_NOASSOCIATIONREQUEST) | |
251 { | |
252 // Timeout | |
253 AssociationCleanup(assoc); | |
254 return NULL; | |
255 } | |
256 | |
257 // if some kind of error occured, take care of it | |
258 if (cond.bad()) | |
259 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
260 LOG(ERROR) << "Receiving Association failed: " << cond.text(); |
0 | 261 // no matter what kind of error occurred, we need to do a cleanup |
262 AssociationCleanup(assoc); | |
263 return NULL; | |
264 } | |
265 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
266 LOG(INFO) << "Association Received"; |
0 | 267 |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
268 std::vector<const char*> transferSyntaxes; |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
269 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
270 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1 |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
271 transferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
272 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
273 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); |
665 | 274 |
275 // New transfer syntaxes supported since Orthanc 0.7.2 | |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
276 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
277 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
278 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
279 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
280 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
281 transferSyntaxes.push_back(UID_JPEGProcess7_9TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
282 transferSyntaxes.push_back(UID_JPEGProcess10_12TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
283 transferSyntaxes.push_back(UID_JPEGProcess11_13TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
284 transferSyntaxes.push_back(UID_JPEGProcess14TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
285 transferSyntaxes.push_back(UID_JPEGProcess15TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
286 transferSyntaxes.push_back(UID_JPEGProcess16_18TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
287 transferSyntaxes.push_back(UID_JPEGProcess17_19TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
288 transferSyntaxes.push_back(UID_JPEGProcess20_22TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
289 transferSyntaxes.push_back(UID_JPEGProcess21_23TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
290 transferSyntaxes.push_back(UID_JPEGProcess24_26TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
291 transferSyntaxes.push_back(UID_JPEGProcess25_27TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
292 transferSyntaxes.push_back(UID_JPEGProcess28TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
293 transferSyntaxes.push_back(UID_JPEGProcess29TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
294 transferSyntaxes.push_back(UID_JPEGProcess14SV1TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
295 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
296 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
297 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
298 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
299 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
300 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
301 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
302 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
303 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
304 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); |
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
305 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); |
0 | 306 |
307 /* accept the Verification SOP Class if presented */ | |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
308 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( assoc->params, &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 309 if (cond.bad()) |
310 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
311 LOG(INFO) << cond.text(); |
0 | 312 AssociationCleanup(assoc); |
313 return NULL; | |
314 } | |
315 | |
316 /* the array of Storage SOP Class UIDs comes from dcuid.h */ | |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
317 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( assoc->params, dcmAllStorageSOPClassUIDs, numberOfAllDcmStorageSOPClassUIDs, &transferSyntaxes[0], transferSyntaxes.size()); |
0 | 318 if (cond.bad()) |
319 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
320 LOG(INFO) << cond.text(); |
0 | 321 AssociationCleanup(assoc); |
322 return NULL; | |
323 } | |
324 | |
503 | 325 #if ORTHANC_PROMISCUOUS == 1 |
326 /* accept everything not known not to be a storage SOP class */ | |
327 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( | |
661
d233b5090105
accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
620
diff
changeset
|
328 assoc->params, &transferSyntaxes[0], transferSyntaxes.size()); |
503 | 329 if (cond.bad()) |
330 { | |
331 LOG(INFO) << cond.text(); | |
332 AssociationCleanup(assoc); | |
333 return NULL; | |
334 } | |
335 #endif | |
336 | |
0 | 337 /* set our app title */ |
338 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str()); | |
339 | |
340 /* acknowledge or reject this association */ | |
341 cond = ASC_getApplicationContextName(assoc->params, buf); | |
342 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0) | |
343 { | |
344 /* reject: the application context name is not supported */ | |
345 T_ASC_RejectParameters rej = | |
346 { | |
347 ASC_RESULT_REJECTEDPERMANENT, | |
348 ASC_SOURCE_SERVICEUSER, | |
349 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED | |
350 }; | |
351 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
352 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf; |
0 | 353 cond = ASC_rejectAssociation(assoc, &rej); |
354 if (cond.bad()) | |
355 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
356 LOG(INFO) << cond.text(); |
0 | 357 } |
358 AssociationCleanup(assoc); | |
359 return NULL; | |
360 } | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
361 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
362 std::string callingIP; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
363 std::string callingTitle; |
0 | 364 |
365 /* check the AETs */ | |
366 { | |
367 DIC_AE callingTitle_C; | |
368 DIC_AE calledTitle_C; | |
369 DIC_AE callingIP_C; | |
370 DIC_AE calledIP_C; | |
371 if (ASC_getAPTitles(assoc->params, callingTitle_C, calledTitle_C, NULL).bad() || | |
372 ASC_getPresentationAddresses(assoc->params, callingIP_C, calledIP_C).bad()) | |
373 { | |
374 T_ASC_RejectParameters rej = | |
375 { | |
376 ASC_RESULT_REJECTEDPERMANENT, | |
377 ASC_SOURCE_SERVICEUSER, | |
378 ASC_REASON_SU_NOREASON | |
379 }; | |
380 ASC_rejectAssociation(assoc, &rej); | |
381 AssociationCleanup(assoc); | |
382 return NULL; | |
383 } | |
384 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
385 callingIP = std::string(/*OFSTRING_GUARD*/(callingIP_C)); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
386 callingTitle = std::string(/*OFSTRING_GUARD*/(callingTitle_C)); |
101 | 387 std::string calledTitle(/*OFSTRING_GUARD*/(calledTitle_C)); |
0 | 388 Toolbox::ToUpperCase(callingIP); |
389 Toolbox::ToUpperCase(callingTitle); | |
390 Toolbox::ToUpperCase(calledTitle); | |
391 | |
392 if (server.HasCalledApplicationEntityTitleCheck() && | |
393 calledTitle != server.GetApplicationEntityTitle()) | |
394 { | |
395 T_ASC_RejectParameters rej = | |
396 { | |
397 ASC_RESULT_REJECTEDPERMANENT, | |
398 ASC_SOURCE_SERVICEUSER, | |
399 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED | |
400 }; | |
401 ASC_rejectAssociation(assoc, &rej); | |
402 AssociationCleanup(assoc); | |
403 return NULL; | |
404 } | |
405 | |
406 if (server.HasApplicationEntityFilter() && | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
407 !server.GetApplicationEntityFilter().IsAllowedConnection(callingIP, callingTitle)) |
0 | 408 { |
409 T_ASC_RejectParameters rej = | |
410 { | |
411 ASC_RESULT_REJECTEDPERMANENT, | |
412 ASC_SOURCE_SERVICEUSER, | |
413 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED | |
414 }; | |
415 ASC_rejectAssociation(assoc, &rej); | |
416 AssociationCleanup(assoc); | |
417 return NULL; | |
418 } | |
419 } | |
420 | |
421 if (opt_rejectWithoutImplementationUID && strlen(assoc->params->theirImplementationClassUID) == 0) | |
422 { | |
423 /* reject: the no implementation Class UID provided */ | |
424 T_ASC_RejectParameters rej = | |
425 { | |
426 ASC_RESULT_REJECTEDPERMANENT, | |
427 ASC_SOURCE_SERVICEUSER, | |
428 ASC_REASON_SU_NOREASON | |
429 }; | |
430 | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
431 LOG(INFO) << "Association Rejected: No Implementation Class UID provided"; |
0 | 432 cond = ASC_rejectAssociation(assoc, &rej); |
433 if (cond.bad()) | |
434 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
435 LOG(INFO) << cond.text(); |
0 | 436 } |
437 AssociationCleanup(assoc); | |
438 return NULL; | |
439 } | |
440 | |
441 { | |
442 cond = ASC_acknowledgeAssociation(assoc); | |
443 if (cond.bad()) | |
444 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
445 LOG(ERROR) << cond.text(); |
0 | 446 AssociationCleanup(assoc); |
447 return NULL; | |
448 } | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
449 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")"; |
0 | 450 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
451 LOG(INFO) << " (but no valid presentation contexts)"; |
0 | 452 } |
453 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
454 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
455 return new CommandDispatcher(server, assoc, callingIP, callingTitle, filter); |
0 | 456 } |
457 | |
458 bool CommandDispatcher::Step() | |
459 /* | |
460 * This function receives DIMSE commmands over the network connection | |
461 * and handles these commands correspondingly. Note that in case of | |
462 * storscp only C-ECHO-RQ and C-STORE-RQ commands can be processed. | |
463 */ | |
464 { | |
465 bool finished = false; | |
466 | |
467 // receive a DIMSE command over the network, with a timeout of 1 second | |
468 DcmDataset *statusDetail = NULL; | |
469 T_ASC_PresentationContextID presID = 0; | |
470 T_DIMSE_Message msg; | |
471 | |
472 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail); | |
473 elapsedTimeSinceLastCommand_++; | |
474 | |
475 // if the command which was received has extra status | |
476 // detail information, dump this information | |
477 if (statusDetail != NULL) | |
478 { | |
101 | 479 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail)); |
0 | 480 delete statusDetail; |
481 } | |
482 | |
483 if (cond == DIMSE_OUTOFRESOURCES) | |
484 { | |
485 finished = true; | |
486 } | |
487 else if (cond == DIMSE_NODATAAVAILABLE) | |
488 { | |
489 // Timeout due to DIMSE_NONBLOCKING | |
490 if (clientTimeout_ != 0 && | |
491 elapsedTimeSinceLastCommand_ >= clientTimeout_) | |
492 { | |
493 // This timeout is actually a client timeout | |
494 finished = true; | |
495 } | |
496 } | |
497 else if (cond == EC_Normal) | |
498 { | |
499 // Reset the client timeout counter | |
500 elapsedTimeSinceLastCommand_ = 0; | |
501 | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
502 // 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
|
503 bool supported = false; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
504 DicomRequestType request; |
0 | 505 switch (msg.CommandField) |
506 { | |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
507 case DIMSE_C_ECHO_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
508 request = DicomRequestType_Echo; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
509 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
510 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
511 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
512 case DIMSE_C_STORE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
513 request = DicomRequestType_Store; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
514 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
515 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
516 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
517 case DIMSE_C_MOVE_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
518 request = DicomRequestType_Move; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
519 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
520 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
521 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
522 case DIMSE_C_FIND_RQ: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
523 request = DicomRequestType_Find; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
524 supported = true; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
525 break; |
0 | 526 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
527 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
528 // we cannot handle this kind of message |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
529 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
530 LOG(ERROR) << "cannot handle command: 0x" << std::hex << msg.CommandField; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
531 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
532 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
533 |
0 | 534 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
535 // 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
|
536 if (supported && |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
537 filter_ != NULL && |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
538 !filter_->IsAllowedRequest(callingIP_, callingAETitle_, request)) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
539 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
540 LOG(ERROR) << EnumerationToString(request) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
541 << " requests are disallowed for the AET \"" |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
542 << callingAETitle_ << "\""; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
543 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
544 supported = false; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
545 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
546 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
547 // 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
|
548 if (supported) |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
549 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
550 // 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
|
551 cond = DIMSE_BADCOMMANDTYPE; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
552 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
553 switch (request) |
0 | 554 { |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
555 case DicomRequestType_Echo: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
556 cond = EchoScp(assoc_, &msg, presID); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
557 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
558 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
559 case DicomRequestType_Store: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
560 if (server_.HasStoreRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
561 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
562 std::auto_ptr<IStoreRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
563 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler()); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
564 cond = Internals::storeScp(assoc_, &msg, presID, *handler); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
565 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
566 break; |
0 | 567 |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
568 case DicomRequestType_Move: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
569 if (server_.HasMoveRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
570 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
571 std::auto_ptr<IMoveRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
572 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
573 cond = Internals::moveScp(assoc_, &msg, presID, *handler); |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
574 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
575 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
576 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
577 case DicomRequestType_Find: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
578 if (server_.HasFindRequestHandlerFactory()) // Should always be true |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
579 { |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
580 std::auto_ptr<IFindRequestHandler> handler |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
581 (server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler()); |
665 | 582 cond = Internals::findScp(assoc_, &msg, presID, *handler, callingAETitle_); |
620
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
583 } |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
584 break; |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
585 |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
586 default: |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
587 // Should never happen |
4aa6f0d79947
security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
503
diff
changeset
|
588 break; |
0 | 589 } |
590 } | |
591 } | |
592 else | |
593 { | |
594 // Bad status, which indicates the closing of the connection by | |
595 // the peer or a network error | |
596 finished = true; | |
665 | 597 |
667
aa2ab67d913d
log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
665
diff
changeset
|
598 LOG(INFO) << cond.text(); |
0 | 599 } |
600 | |
601 if (finished) | |
602 { | |
603 if (cond == DUL_PEERREQUESTEDRELEASE) | |
604 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
605 LOG(INFO) << "Association Release"; |
0 | 606 ASC_acknowledgeRelease(assoc_); |
607 } | |
608 else if (cond == DUL_PEERABORTEDASSOCIATION) | |
609 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
610 LOG(INFO) << "Association Aborted"; |
0 | 611 } |
612 else | |
613 { | |
614 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
615 LOG(ERROR) << "DIMSE failure (aborting association): " << cond.text(); |
0 | 616 /* some kind of error so abort the association */ |
617 ASC_abortAssociation(assoc_); | |
618 } | |
619 } | |
620 | |
621 return !finished; | |
622 } | |
623 | |
624 | |
625 OFCondition EchoScp( T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) | |
626 { | |
627 OFString temp_str; | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
628 LOG(INFO) << "Received Echo Request"; |
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
629 //LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID)); |
0 | 630 |
631 /* the echo succeeded !! */ | |
632 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); | |
633 if (cond.bad()) | |
634 { | |
102
7593b57dc1bf
switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
101
diff
changeset
|
635 LOG(ERROR) << "Echo SCP Failed: " << cond.text(); |
0 | 636 } |
637 return cond; | |
638 } | |
639 } | |
640 } |