Mercurial > hg > orthanc
comparison OrthancServer/Internals/CommandDispatcher.cpp @ 1799:4f01c9d73f02 worklists
calledAet made available to all the handlers
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 20 Nov 2015 12:57:14 +0100 |
parents | 164d78911382 |
children | 30e97a1f4093 |
comparison
equal
deleted
inserted
replaced
1798:e92cd8841a5f | 1799:4f01c9d73f02 |
---|---|
463 AssociationCleanup(assoc); | 463 AssociationCleanup(assoc); |
464 return NULL; | 464 return NULL; |
465 } | 465 } |
466 | 466 |
467 // Retrieve the AET and the IP address of the remote modality | 467 // Retrieve the AET and the IP address of the remote modality |
468 std::string callingAet; | 468 std::string remoteAet; |
469 std::string callingIp; | 469 std::string remoteIp; |
470 std::string calledAet; | 470 std::string calledAet; |
471 | 471 |
472 { | 472 { |
473 DIC_AE callingAet_C; | 473 DIC_AE remoteAet_C; |
474 DIC_AE calledAet_C; | 474 DIC_AE calledAet_C; |
475 DIC_AE callingIp_C; | 475 DIC_AE remoteIp_C; |
476 DIC_AE calledIP_C; | 476 DIC_AE calledIP_C; |
477 if (ASC_getAPTitles(assoc->params, callingAet_C, calledAet_C, NULL).bad() || | 477 if (ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || |
478 ASC_getPresentationAddresses(assoc->params, callingIp_C, calledIP_C).bad()) | 478 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad()) |
479 { | 479 { |
480 T_ASC_RejectParameters rej = | 480 T_ASC_RejectParameters rej = |
481 { | 481 { |
482 ASC_RESULT_REJECTEDPERMANENT, | 482 ASC_RESULT_REJECTEDPERMANENT, |
483 ASC_SOURCE_SERVICEUSER, | 483 ASC_SOURCE_SERVICEUSER, |
486 ASC_rejectAssociation(assoc, &rej); | 486 ASC_rejectAssociation(assoc, &rej); |
487 AssociationCleanup(assoc); | 487 AssociationCleanup(assoc); |
488 return NULL; | 488 return NULL; |
489 } | 489 } |
490 | 490 |
491 callingIp = std::string(/*OFSTRING_GUARD*/(callingIp_C)); | 491 remoteIp = std::string(/*OFSTRING_GUARD*/(remoteIp_C)); |
492 callingAet = std::string(/*OFSTRING_GUARD*/(callingAet_C)); | 492 remoteAet = std::string(/*OFSTRING_GUARD*/(remoteAet_C)); |
493 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); | 493 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); |
494 } | 494 } |
495 | 495 |
496 LOG(INFO) << "Association Received from AET " << callingAet | 496 LOG(INFO) << "Association Received from AET " << remoteAet |
497 << " on IP " << callingIp; | 497 << " on IP " << remoteIp; |
498 | 498 |
499 | 499 |
500 std::vector<const char*> transferSyntaxes; | 500 std::vector<const char*> transferSyntaxes; |
501 | 501 |
502 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1 | 502 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1 |
504 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); | 504 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); |
505 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); | 505 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); |
506 | 506 |
507 // New transfer syntaxes supported since Orthanc 0.7.2 | 507 // New transfer syntaxes supported since Orthanc 0.7.2 |
508 if (!server.HasApplicationEntityFilter() || | 508 if (!server.HasApplicationEntityFilter() || |
509 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Deflated)) | 509 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Deflated)) |
510 { | 510 { |
511 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); | 511 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); |
512 } | 512 } |
513 | 513 |
514 if (!server.HasApplicationEntityFilter() || | 514 if (!server.HasApplicationEntityFilter() || |
515 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpeg)) | 515 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg)) |
516 { | 516 { |
517 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); | 517 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); |
518 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); | 518 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); |
519 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); | 519 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); |
520 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); | 520 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); |
535 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); | 535 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); |
536 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); | 536 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); |
537 } | 537 } |
538 | 538 |
539 if (!server.HasApplicationEntityFilter() || | 539 if (!server.HasApplicationEntityFilter() || |
540 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpeg2000)) | 540 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg2000)) |
541 { | 541 { |
542 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); | 542 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
543 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); | 543 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
544 } | 544 } |
545 | 545 |
546 if (!server.HasApplicationEntityFilter() || | 546 if (!server.HasApplicationEntityFilter() || |
547 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_JpegLossless)) | 547 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_JpegLossless)) |
548 { | 548 { |
549 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); | 549 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); |
550 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); | 550 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); |
551 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); | 551 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); |
552 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); | 552 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); |
553 } | 553 } |
554 | 554 |
555 if (!server.HasApplicationEntityFilter() || | 555 if (!server.HasApplicationEntityFilter() || |
556 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpip)) | 556 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpip)) |
557 { | 557 { |
558 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); | 558 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); |
559 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); | 559 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); |
560 } | 560 } |
561 | 561 |
562 if (!server.HasApplicationEntityFilter() || | 562 if (!server.HasApplicationEntityFilter() || |
563 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Mpeg2)) | 563 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Mpeg2)) |
564 { | 564 { |
565 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); | 565 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); |
566 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); | 566 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); |
567 } | 567 } |
568 | 568 |
569 if (!server.HasApplicationEntityFilter() || | 569 if (!server.HasApplicationEntityFilter() || |
570 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Rle)) | 570 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Rle)) |
571 { | 571 { |
572 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); | 572 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); |
573 } | 573 } |
574 | 574 |
575 /* accept the Verification SOP Class if presented */ | 575 /* accept the Verification SOP Class if presented */ |
641 AssociationCleanup(assoc); | 641 AssociationCleanup(assoc); |
642 return NULL; | 642 return NULL; |
643 } | 643 } |
644 | 644 |
645 if (server.HasApplicationEntityFilter() && | 645 if (server.HasApplicationEntityFilter() && |
646 !server.GetApplicationEntityFilter().IsAllowedConnection(callingIp, callingAet)) | 646 !server.GetApplicationEntityFilter().IsAllowedConnection(remoteIp, remoteAet, calledAet)) |
647 { | 647 { |
648 LOG(WARNING) << "Rejected association for remote AET " << callingAet << " on IP " << callingIp; | 648 LOG(WARNING) << "Rejected association for remote AET " << remoteAet << " on IP " << remoteIp; |
649 T_ASC_RejectParameters rej = | 649 T_ASC_RejectParameters rej = |
650 { | 650 { |
651 ASC_RESULT_REJECTEDPERMANENT, | 651 ASC_RESULT_REJECTEDPERMANENT, |
652 ASC_SOURCE_SERVICEUSER, | 652 ASC_SOURCE_SERVICEUSER, |
653 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED | 653 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED |
690 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) | 690 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
691 LOG(INFO) << " (but no valid presentation contexts)"; | 691 LOG(INFO) << " (but no valid presentation contexts)"; |
692 } | 692 } |
693 | 693 |
694 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; | 694 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; |
695 return new CommandDispatcher(server, assoc, callingIp, callingAet, filter); | 695 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter); |
696 } | 696 } |
697 | 697 |
698 bool CommandDispatcher::Step() | 698 bool CommandDispatcher::Step() |
699 /* | 699 /* |
700 * This function receives DIMSE commmands over the network connection | 700 * This function receives DIMSE commmands over the network connection |
774 | 774 |
775 // Check whether this request is allowed by the security filter | 775 // Check whether this request is allowed by the security filter |
776 if (supported && | 776 if (supported && |
777 request != DicomRequestType_Echo && // Always allow incoming ECHO requests | 777 request != DicomRequestType_Echo && // Always allow incoming ECHO requests |
778 filter_ != NULL && | 778 filter_ != NULL && |
779 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, request)) | 779 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request)) |
780 { | 780 { |
781 LOG(ERROR) << EnumerationToString(request) | 781 LOG(ERROR) << EnumerationToString(request) |
782 << " requests are disallowed for the AET \"" | 782 << " requests are disallowed for the AET \"" |
783 << remoteAet_ << "\""; | 783 << remoteAet_ << "\""; |
784 cond = DIMSE_ILLEGALASSOCIATION; | 784 cond = DIMSE_ILLEGALASSOCIATION; |
810 case DicomRequestType_Move: | 810 case DicomRequestType_Move: |
811 if (server_.HasMoveRequestHandlerFactory()) // Should always be true | 811 if (server_.HasMoveRequestHandlerFactory()) // Should always be true |
812 { | 812 { |
813 std::auto_ptr<IMoveRequestHandler> handler | 813 std::auto_ptr<IMoveRequestHandler> handler |
814 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); | 814 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler()); |
815 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_); | 815 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_); |
816 } | 816 } |
817 break; | 817 break; |
818 | 818 |
819 case DicomRequestType_Find: | 819 case DicomRequestType_Find: |
820 if (server_.HasFindRequestHandlerFactory() || // Should always be true | 820 if (server_.HasFindRequestHandlerFactory() || // Should always be true |
831 { | 831 { |
832 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler()); | 832 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler()); |
833 } | 833 } |
834 | 834 |
835 cond = Internals::findScp(assoc_, &msg, presID, findHandler.get(), | 835 cond = Internals::findScp(assoc_, &msg, presID, findHandler.get(), |
836 worklistHandler.get(), remoteIp_, remoteAet_); | 836 worklistHandler.get(), remoteIp_, remoteAet_, calledAet_); |
837 } | 837 } |
838 break; | 838 break; |
839 | 839 |
840 default: | 840 default: |
841 // Should never happen | 841 // Should never happen |