comparison Core/DicomNetworking/DicomUserConnection.cpp @ 3609:f7ade98d8229 storage-commitment

done RequestStorageCommitment()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 20 Jan 2020 18:55:28 +0100
parents 7ae553d9c366
children c85808adf04a
comparison
equal deleted inserted replaced
3608:7ae553d9c366 3609:f7ade98d8229
1511 1511
1512 const T_DIMSE_N_EventReportRSP& content = message.msg.NEventReportRSP; 1512 const T_DIMSE_N_EventReportRSP& content = message.msg.NEventReportRSP;
1513 if (content.MessageIDBeingRespondedTo != messageId || 1513 if (content.MessageIDBeingRespondedTo != messageId ||
1514 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPCLASSUID) || 1514 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPCLASSUID) ||
1515 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID) || 1515 !(content.opts & O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID) ||
1516 //(content.opts & O_NEVENTREPORT_EVENTTYPEID) || // Pedantic test - The "content.EventTypeID" has no sense here 1516 //(content.opts & O_NEVENTREPORT_EVENTTYPEID) || // Pedantic test - The "content.EventTypeID" is not used by Orthanc
1517 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass || 1517 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass ||
1518 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance || 1518 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance ||
1519 content.DataSetType != DIMSE_DATASET_NULL) 1519 content.DataSetType != DIMSE_DATASET_NULL)
1520 { 1520 {
1521 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " 1521 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - "
1570 1570
1571 /** 1571 /**
1572 * Send the "N_ACTION_RQ" request 1572 * Send the "N_ACTION_RQ" request
1573 **/ 1573 **/
1574 1574
1575 printf("ICI\n");
1576
1577 LOG(INFO) << "Request to modality \"" << remoteAet_ 1575 LOG(INFO) << "Request to modality \"" << remoteAet_
1578 << "\" about storage commitment for " << sopClassUids.size() << " instances"; 1576 << "\" about storage commitment for " << sopClassUids.size() << " instances";
1579 const DIC_US messageId = pimpl_->assoc_->nextMsgID++; 1577 const DIC_US messageId = pimpl_->assoc_->nextMsgID++;
1580 1578
1581 { 1579 {
1601 int presID = ASC_findAcceptedPresentationContextID( 1599 int presID = ASC_findAcceptedPresentationContextID(
1602 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass); 1600 pimpl_->assoc_, UID_StorageCommitmentPushModelSOPClass);
1603 if (presID == 0) 1601 if (presID == 0)
1604 { 1602 {
1605 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " 1603 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - "
1606 "Unable to send N-EVENT-REPORT request to AET: " + remoteAet_); 1604 "Unable to send N-ACTION request to AET: " + remoteAet_);
1607 } 1605 }
1608 1606
1609 if (!DIMSE_sendMessageUsingMemoryData( 1607 if (!DIMSE_sendMessageUsingMemoryData(
1610 pimpl_->assoc_, presID, &message, NULL /* status detail */, 1608 pimpl_->assoc_, presID, &message, NULL /* status detail */,
1611 &dataset, NULL /* callback */, NULL /* callback context */, 1609 &dataset, NULL /* callback */, NULL /* callback context */,
1617 1615
1618 /** 1616 /**
1619 * Read the "N_ACTION_RSP" response 1617 * Read the "N_ACTION_RSP" response
1620 **/ 1618 **/
1621 1619
1622 // TODO 1620 {
1621 T_ASC_PresentationContextID presID = 0;
1622 T_DIMSE_Message message;
1623
1624 if (!DIMSE_receiveCommand(pimpl_->assoc_, DIMSE_NONBLOCKING, 1, &presID,
1625 &message, NULL /* no statusDetail */).good() ||
1626 message.CommandField != DIMSE_N_ACTION_RSP)
1627 {
1628 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - "
1629 "Unable to read N-ACTION response from AET: " + remoteAet_);
1630 }
1631
1632 const T_DIMSE_N_ActionRSP& content = message.msg.NActionRSP;
1633 if (content.MessageIDBeingRespondedTo != messageId ||
1634 !(content.opts & O_NACTION_AFFECTEDSOPCLASSUID) ||
1635 !(content.opts & O_NACTION_AFFECTEDSOPINSTANCEUID) ||
1636 //(content.opts & O_NACTION_ACTIONTYPEID) || // Pedantic test - The "content.ActionTypeID" is not used by Orthanc
1637 std::string(content.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass ||
1638 std::string(content.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance ||
1639 content.DataSetType != DIMSE_DATASET_NULL)
1640 {
1641 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - "
1642 "Badly formatted N-ACTION response from AET: " + remoteAet_);
1643 }
1644
1645 if (content.DimseStatus != 0 /* success */)
1646 {
1647 throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - "
1648 "The request cannot be handled by remote AET: " + remoteAet_);
1649 }
1650 }
1623 1651
1624 Close(); 1652 Close();
1625 } 1653 }
1626 catch (OrthancException&) 1654 catch (OrthancException&)
1627 { 1655 {