comparison OrthancServer/Sources/OrthancGetRequestHandler.cpp @ 4482:8efeaba1b7f9

new configuration options: "DicomAlwaysAllowFind" and "DicomAlwaysAllowGet"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2021 15:54:30 +0100
parents d9473bd5ed43
children b14989f9ff8b
comparison
equal deleted inserted replaced
4481:fe7c2be5bce2 4482:8efeaba1b7f9
238 "C-GET SCP: Unknown transfer syntax: (" + 238 "C-GET SCP: Unknown transfer syntax: (" +
239 std::string(dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT")) + 239 std::string(dcmSOPClassUIDToModality(sopClassUid.c_str(), "OT")) +
240 ") " + sopClassUid); 240 ") " + sopClassUid);
241 } 241 }
242 242
243 bool allowTranscoding = (context_.IsTranscodeDicomProtocol() &&
244 remote_.IsTranscodingAllowed());
245
246 T_ASC_PresentationContextID presId = 0; // Unnecessary initialization, makes code clearer 243 T_ASC_PresentationContextID presId = 0; // Unnecessary initialization, makes code clearer
247 DicomTransferSyntax selectedSyntax; 244 DicomTransferSyntax selectedSyntax;
248 if (!SelectPresentationContext(presId, selectedSyntax, assoc, sopClassUid, 245 if (!SelectPresentationContext(presId, selectedSyntax, assoc, sopClassUid,
249 sourceSyntax, allowTranscoding) || 246 sourceSyntax, allowTranscoding_) ||
250 presId == 0) 247 presId == 0)
251 { 248 {
252 failedCount_++; 249 failedCount_++;
253 AddFailedUIDInstance(sopInstanceUid); 250 AddFailedUIDInstance(sopInstanceUid);
254 throw OrthancException(ErrorCode_NetworkProtocol, 251 throw OrthancException(ErrorCode_NetworkProtocol,
477 } 474 }
478 } 475 }
479 476
480 477
481 OrthancGetRequestHandler::OrthancGetRequestHandler(ServerContext& context) : 478 OrthancGetRequestHandler::OrthancGetRequestHandler(ServerContext& context) :
482 context_(context) 479 context_(context),
483 { 480 position_(0),
484 position_ = 0; 481 completedCount_ (0),
485 completedCount_ = 0; 482 warningCount_(0),
486 warningCount_ = 0; 483 failedCount_(0),
487 failedCount_ = 0; 484 timeout_(0),
488 timeout_ = 0; 485 allowTranscoding_(false)
486 {
489 } 487 }
490 488
491 489
492 bool OrthancGetRequestHandler::Handle(const DicomMap& input, 490 bool OrthancGetRequestHandler::Handle(const DicomMap& input,
493 const std::string& originatorIp, 491 const std::string& originatorIp,
544 position_ = 0; 542 position_ = 0;
545 originatorAet_ = originatorAet; 543 originatorAet_ = originatorAet;
546 544
547 { 545 {
548 OrthancConfiguration::ReaderLock lock; 546 OrthancConfiguration::ReaderLock lock;
549 remote_ = lock.GetConfiguration().GetModalityUsingAet(originatorAet); 547
548 RemoteModalityParameters remote;
549
550 if (lock.GetConfiguration().LookupDicomModalityUsingAETitle(remote, originatorAet))
551 {
552 allowTranscoding_ = (context_.IsTranscodeDicomProtocol() &&
553 remote.IsTranscodingAllowed());
554 }
555 else if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowGet", false))
556 {
557 CLOG(INFO, DICOM) << "C-GET: Allowing SCU request from unknown modality with AET: " << originatorAet;
558 allowTranscoding_ = context_.IsTranscodeDicomProtocol();
559 }
560 else
561 {
562 // This should never happen, given the test at bottom of
563 // "OrthancApplicationEntityFilter::IsAllowedRequest()"
564 throw OrthancException(ErrorCode_InexistentItem,
565 "C-GET: Rejecting SCU request from unknown modality with AET: " + originatorAet);
566 }
550 } 567 }
551 568
552 for (std::list<std::string>::const_iterator 569 for (std::list<std::string>::const_iterator
553 resource = publicIds.begin(); resource != publicIds.end(); ++resource) 570 resource = publicIds.begin(); resource != publicIds.end(); ++resource)
554 { 571 {