comparison Core/DicomNetworking/DicomUserConnection.cpp @ 3701:736907ecb626 storage-commitment

integration mainline->storage-commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Feb 2020 13:22:35 +0100
parents 115f82775c46 5cbbf14e516b
children d8b214a46b91
comparison
equal deleted inserted replaced
3695:898903022836 3701:736907ecb626
464 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t 464 request.MoveOriginatorID = moveOriginatorID; // The type DIC_US is an alias for uint16_t
465 request.opts |= O_STORE_MOVEORIGINATORID; 465 request.opts |= O_STORE_MOVEORIGINATORID;
466 } 466 }
467 467
468 // Finally conduct transmission of data 468 // Finally conduct transmission of data
469 T_DIMSE_C_StoreRSP rsp; 469 T_DIMSE_C_StoreRSP response;
470 DcmDataset* statusDetail = NULL; 470 DcmDataset* statusDetail = NULL;
471 Check(DIMSE_storeUser(assoc_, presID, &request, 471 Check(DIMSE_storeUser(assoc_, presID, &request,
472 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, 472 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL,
473 /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_, 473 /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_,
474 &rsp, &statusDetail, NULL), 474 &response, &statusDetail, NULL),
475 connection.remoteAet_, "C-STORE"); 475 connection.remoteAet_, "C-STORE");
476 476
477 if (statusDetail != NULL) 477 if (statusDetail != NULL)
478 { 478 {
479 delete statusDetail; 479 delete statusDetail;
480 }
481
482
483 /**
484 * New in Orthanc 1.6.0: Deal with failures during C-STORE.
485 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_B.2.3.html#table_B.2-1
486 **/
487
488 if (response.DimseStatus != 0x0000 && // Success
489 response.DimseStatus != 0xB000 && // Warning - Coercion of Data Elements
490 response.DimseStatus != 0xB007 && // Warning - Data Set does not match SOP Class
491 response.DimseStatus != 0xB006) // Warning - Elements Discarded
492 {
493 char buf[16];
494 sprintf(buf, "%04X", response.DimseStatus);
495 throw OrthancException(ErrorCode_NetworkProtocol,
496 "C-STORE SCU to AET \"" + connection.remoteAet_ +
497 "\" has failed with DIMSE status 0x" + buf);
480 } 498 }
481 } 499 }
482 500
483 501
484 namespace 502 namespace
694 { 712 {
695 delete statusDetail; 713 delete statusDetail;
696 } 714 }
697 715
698 Check(cond, remoteAet, "C-FIND"); 716 Check(cond, remoteAet, "C-FIND");
717
718
719 /**
720 * New in Orthanc 1.6.0: Deal with failures during C-FIND.
721 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.html#table_C.4-1
722 **/
723
724 if (response.DimseStatus != 0x0000 && // Success
725 response.DimseStatus != 0xFF00 && // Pending - Matches are continuing
726 response.DimseStatus != 0xFF01) // Pending - Matches are continuing
727 {
728 char buf[16];
729 sprintf(buf, "%04X", response.DimseStatus);
730 throw OrthancException(ErrorCode_NetworkProtocol,
731 "C-FIND SCU to AET \"" + remoteAet +
732 "\" has failed with DIMSE status 0x" + buf);
733 }
734
699 } 735 }
700 736
701 737
702 void DicomUserConnection::Find(DicomFindAnswers& result, 738 void DicomUserConnection::Find(DicomFindAnswers& result,
703 ResourceType level, 739 ResourceType level,
880 { 916 {
881 delete responseIdentifiers; 917 delete responseIdentifiers;
882 } 918 }
883 919
884 Check(cond, remoteAet_, "C-MOVE"); 920 Check(cond, remoteAet_, "C-MOVE");
921
922
923 /**
924 * New in Orthanc 1.6.0: Deal with failures during C-MOVE.
925 * http://dicom.nema.org/medical/dicom/current/output/chtml/part04/sect_C.4.2.html#table_C.4-2
926 **/
927
928 if (response.DimseStatus != 0x0000 && // Success
929 response.DimseStatus != 0xFF00) // Pending - Sub-operations are continuing
930 {
931 char buf[16];
932 sprintf(buf, "%04X", response.DimseStatus);
933 throw OrthancException(ErrorCode_NetworkProtocol,
934 "C-MOVE SCU to AET \"" + remoteAet_ +
935 "\" has failed with DIMSE status 0x" + buf);
936 }
885 } 937 }
886 938
887 939
888 void DicomUserConnection::ResetStorageSOPClasses() 940 void DicomUserConnection::ResetStorageSOPClasses()
889 { 941 {