comparison Core/DicomNetworking/DicomUserConnection.cpp @ 3611:0ce9c1c6474f storage-commitment

test route in REST API for storage commitment
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 Jan 2020 12:53:03 +0100
parents c85808adf04a
children c1e2b91c2ab4
comparison
equal deleted inserted replaced
3610:c85808adf04a 3611:0ce9c1c6474f
1539 } 1539 }
1540 1540
1541 1541
1542 1542
1543 void DicomUserConnection::RequestStorageCommitment( 1543 void DicomUserConnection::RequestStorageCommitment(
1544 std::string& transactionUid, 1544 const std::string& transactionUid,
1545 const std::vector<std::string>& sopClassUids, 1545 const std::vector<std::string>& sopClassUids,
1546 const std::vector<std::string>& sopInstanceUids) 1546 const std::vector<std::string>& sopInstanceUids)
1547 { 1547 {
1548 if (sopClassUids.size() != sopInstanceUids.size()) 1548 if (sopClassUids.size() != sopInstanceUids.size())
1549 { 1549 {
1550 throw OrthancException(ErrorCode_ParameterOutOfRange); 1550 throw OrthancException(ErrorCode_ParameterOutOfRange);
1551 } 1551 }
1552 1552
1553 if (transactionUid.size() < 5 ||
1554 transactionUid.substr(0, 5) != "2.25.")
1555 {
1556 throw OrthancException(ErrorCode_ParameterOutOfRange);
1557 }
1558
1553 if (IsOpen()) 1559 if (IsOpen())
1554 { 1560 {
1555 Close(); 1561 Close();
1556 } 1562 }
1557 1563
1558 try 1564 try
1559 { 1565 {
1560 OpenInternal(Mode_RequestStorageCommitment); 1566 OpenInternal(Mode_RequestStorageCommitment);
1561
1562 transactionUid = Toolbox::GenerateDicomPrivateUniqueIdentifier();
1563 1567
1564 /** 1568 /**
1565 * N-ACTION 1569 * N-ACTION
1566 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html 1570 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html
1567 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-4 1571 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-4
1573 /** 1577 /**
1574 * Send the "N_ACTION_RQ" request 1578 * Send the "N_ACTION_RQ" request
1575 **/ 1579 **/
1576 1580
1577 LOG(INFO) << "Request to modality \"" << remoteAet_ 1581 LOG(INFO) << "Request to modality \"" << remoteAet_
1578 << "\" about storage commitment for " << sopClassUids.size() << " instances"; 1582 << "\" about storage commitment for " << sopClassUids.size()
1583 << " instances, with transaction UID: " << transactionUid;
1579 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; 1584 const DIC_US messageId = pimpl_->assoc_->nextMsgID++;
1580 1585
1581 { 1586 {
1582 T_DIMSE_Message message; 1587 T_DIMSE_Message message;
1583 memset(&message, 0, sizeof(message)); 1588 memset(&message, 0, sizeof(message));