comparison OrthancServer/Internals/CommandDispatcher.cpp @ 1164:0a55d8eb194e

Configuration/Lua to select the accepted C-Store SCP transfer syntaxes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 18 Sep 2014 17:18:26 +0200
parents 3db41779d8f9
children 6e7e5ed91c2d
comparison
equal deleted inserted replaced
1163:3db41779d8f9 1164:0a55d8eb194e
459 return NULL; 459 return NULL;
460 } 460 }
461 461
462 // Retrieve the AET and the IP address of the remote modality 462 // Retrieve the AET and the IP address of the remote modality
463 std::string callingAet; 463 std::string callingAet;
464 std::string callingIP; 464 std::string callingIp;
465 std::string calledAet; 465 std::string calledAet;
466 466
467 { 467 {
468 DIC_AE callingAet_C; 468 DIC_AE callingAet_C;
469 DIC_AE calledAet_C; 469 DIC_AE calledAet_C;
470 DIC_AE callingIP_C; 470 DIC_AE callingIp_C;
471 DIC_AE calledIP_C; 471 DIC_AE calledIP_C;
472 if (ASC_getAPTitles(assoc->params, callingAet_C, calledAet_C, NULL).bad() || 472 if (ASC_getAPTitles(assoc->params, callingAet_C, calledAet_C, NULL).bad() ||
473 ASC_getPresentationAddresses(assoc->params, callingIP_C, calledIP_C).bad()) 473 ASC_getPresentationAddresses(assoc->params, callingIp_C, calledIP_C).bad())
474 { 474 {
475 T_ASC_RejectParameters rej = 475 T_ASC_RejectParameters rej =
476 { 476 {
477 ASC_RESULT_REJECTEDPERMANENT, 477 ASC_RESULT_REJECTEDPERMANENT,
478 ASC_SOURCE_SERVICEUSER, 478 ASC_SOURCE_SERVICEUSER,
481 ASC_rejectAssociation(assoc, &rej); 481 ASC_rejectAssociation(assoc, &rej);
482 AssociationCleanup(assoc); 482 AssociationCleanup(assoc);
483 return NULL; 483 return NULL;
484 } 484 }
485 485
486 callingIP = std::string(/*OFSTRING_GUARD*/(callingIP_C)); 486 callingIp = std::string(/*OFSTRING_GUARD*/(callingIp_C));
487 callingAet = std::string(/*OFSTRING_GUARD*/(callingAet_C)); 487 callingAet = std::string(/*OFSTRING_GUARD*/(callingAet_C));
488 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); 488 calledAet = (/*OFSTRING_GUARD*/(calledAet_C));
489 } 489 }
490 490
491 LOG(INFO) << "Association Received from AET " << callingAet 491 LOG(INFO) << "Association Received from AET " << callingAet
492 << " on IP " << callingIP; 492 << " on IP " << callingIp;
493 493
494 494
495 std::vector<const char*> transferSyntaxes; 495 std::vector<const char*> transferSyntaxes;
496 496
497 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1 497 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1
499 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax); 499 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax);
500 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax); 500 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
501 501
502 // New transfer syntaxes supported since Orthanc 0.7.2 502 // New transfer syntaxes supported since Orthanc 0.7.2
503 if (!server.HasApplicationEntityFilter() || 503 if (!server.HasApplicationEntityFilter() ||
504 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Deflated)) 504 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Deflated))
505 { 505 {
506 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax); 506 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax);
507 } 507 }
508 508
509 if (!server.HasApplicationEntityFilter() || 509 if (!server.HasApplicationEntityFilter() ||
510 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Jpeg)) 510 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpeg))
511 { 511 {
512 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax); 512 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax);
513 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax); 513 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax);
514 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax); 514 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax);
515 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax); 515 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax);
530 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax); 530 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax);
531 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax); 531 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax);
532 } 532 }
533 533
534 if (!server.HasApplicationEntityFilter() || 534 if (!server.HasApplicationEntityFilter() ||
535 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Jpeg2000)) 535 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpeg2000))
536 { 536 {
537 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); 537 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
538 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); 538 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
539 } 539 }
540 540
541 if (!server.HasApplicationEntityFilter() || 541 if (!server.HasApplicationEntityFilter() ||
542 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_JpegLossless)) 542 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_JpegLossless))
543 { 543 {
544 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax); 544 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
545 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax); 545 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
546 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax); 546 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax);
547 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax); 547 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax);
548 } 548 }
549 549
550 if (!server.HasApplicationEntityFilter() || 550 if (!server.HasApplicationEntityFilter() ||
551 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Jpip)) 551 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Jpip))
552 { 552 {
553 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax); 553 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax);
554 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax); 554 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax);
555 } 555 }
556 556
557 if (!server.HasApplicationEntityFilter() || 557 if (!server.HasApplicationEntityFilter() ||
558 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Mpeg2)) 558 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Mpeg2))
559 { 559 {
560 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax); 560 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax);
561 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax); 561 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax);
562 } 562 }
563 563
564 if (!server.HasApplicationEntityFilter() || 564 if (!server.HasApplicationEntityFilter() ||
565 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingAet, TransferSyntax_Rle)) 565 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(callingIp, callingAet, TransferSyntax_Rle))
566 { 566 {
567 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax); 567 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax);
568 } 568 }
569 569
570 /* accept the Verification SOP Class if presented */ 570 /* accept the Verification SOP Class if presented */
636 AssociationCleanup(assoc); 636 AssociationCleanup(assoc);
637 return NULL; 637 return NULL;
638 } 638 }
639 639
640 if (server.HasApplicationEntityFilter() && 640 if (server.HasApplicationEntityFilter() &&
641 !server.GetApplicationEntityFilter().IsAllowedConnection(callingIP, callingAet)) 641 !server.GetApplicationEntityFilter().IsAllowedConnection(callingIp, callingAet))
642 { 642 {
643 LOG(WARNING) << "Rejected association for remote AET " << callingAet << " on IP " << callingIP; 643 LOG(WARNING) << "Rejected association for remote AET " << callingAet << " on IP " << callingIp;
644 T_ASC_RejectParameters rej = 644 T_ASC_RejectParameters rej =
645 { 645 {
646 ASC_RESULT_REJECTEDPERMANENT, 646 ASC_RESULT_REJECTEDPERMANENT,
647 ASC_SOURCE_SERVICEUSER, 647 ASC_SOURCE_SERVICEUSER,
648 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED 648 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED
685 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) 685 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0)
686 LOG(INFO) << " (but no valid presentation contexts)"; 686 LOG(INFO) << " (but no valid presentation contexts)";
687 } 687 }
688 688
689 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL; 689 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL;
690 return new CommandDispatcher(server, assoc, callingIP, callingAet, filter); 690 return new CommandDispatcher(server, assoc, callingIp, callingAet, filter);
691 } 691 }
692 692
693 bool CommandDispatcher::Step() 693 bool CommandDispatcher::Step()
694 /* 694 /*
695 * This function receives DIMSE commmands over the network connection 695 * This function receives DIMSE commmands over the network connection