# HG changeset patch # User Sebastien Jodogne # Date 1590129206 -7200 # Node ID 7f296ae25039f20e4b5e462ccfa45e36ceeafc42 # Parent 821715370890cc0f31bef001b107f3e96f85faf3 reviewed CommandDispatcher.cpp diff -r 821715370890 -r 7f296ae25039 Core/DicomNetworking/DicomServer.cpp --- a/Core/DicomNetworking/DicomServer.cpp Thu May 21 11:49:53 2020 +0200 +++ b/Core/DicomNetworking/DicomServer.cpp Fri May 22 08:33:26 2020 +0200 @@ -34,10 +34,10 @@ #include "../PrecompiledHeaders.h" #include "DicomServer.h" -#include "../../Core/Logging.h" -#include "../../Core/MultiThreading/RunnableWorkersPool.h" -#include "../../Core/OrthancException.h" -#include "../../Core/Toolbox.h" +#include "../Logging.h" +#include "../MultiThreading/RunnableWorkersPool.h" +#include "../OrthancException.h" +#include "../Toolbox.h" #include "Internals/CommandDispatcher.h" #include diff -r 821715370890 -r 7f296ae25039 Core/DicomNetworking/IGetRequestHandler.h --- a/Core/DicomNetworking/IGetRequestHandler.h Thu May 21 11:49:53 2020 +0200 +++ b/Core/DicomNetworking/IGetRequestHandler.h Fri May 22 08:33:26 2020 +0200 @@ -35,9 +35,8 @@ #include -#include "../../Core/DicomFormat/DicomMap.h" +#include "../DicomFormat/DicomMap.h" -#include #include diff -r 821715370890 -r 7f296ae25039 Core/DicomNetworking/IMoveRequestHandler.h --- a/Core/DicomNetworking/IMoveRequestHandler.h Thu May 21 11:49:53 2020 +0200 +++ b/Core/DicomNetworking/IMoveRequestHandler.h Fri May 22 08:33:26 2020 +0200 @@ -33,7 +33,7 @@ #pragma once -#include "../../Core/DicomFormat/DicomMap.h" +#include "../DicomFormat/DicomMap.h" #include #include diff -r 821715370890 -r 7f296ae25039 Core/DicomNetworking/IStoreRequestHandler.h --- a/Core/DicomNetworking/IStoreRequestHandler.h Thu May 21 11:49:53 2020 +0200 +++ b/Core/DicomNetworking/IStoreRequestHandler.h Fri May 22 08:33:26 2020 +0200 @@ -33,7 +33,7 @@ #pragma once -#include "../../Core/DicomFormat/DicomMap.h" +#include "../DicomFormat/DicomMap.h" #include #include diff -r 821715370890 -r 7f296ae25039 Core/DicomNetworking/Internals/CommandDispatcher.cpp --- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp Thu May 21 11:49:53 2020 +0200 +++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp Fri May 22 08:33:26 2020 +0200 @@ -103,7 +103,7 @@ #include -static OFBool opt_rejectWithoutImplementationUID = OFFalse; + static OFBool opt_rejectWithoutImplementationUID = OFFalse; @@ -276,8 +276,6 @@ OFString sprofile; OFString temp_str; - - cond = ASC_receiveAssociation(net, &assoc, /*opt_maxPDU*/ ASC_DEFAULTMAXPDU, NULL, NULL, @@ -313,13 +311,13 @@ if ( #if DCMTK_VERSION_NUMBER >= 364 - ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() || - ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad() + ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() || + ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad() #else - ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || - ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad() + ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() || + ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad() #endif - ) + ) { T_ASC_RejectParameters rej = { @@ -374,7 +372,7 @@ knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel); knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel); } - + // For C-GET if (server.HasGetRequestHandlerFactory()) { @@ -382,7 +380,6 @@ knownAbstractSyntaxes.push_back(UID_GETPatientRootQueryRetrieveInformationModel); } - cond = ASC_acceptContextsWithPreferredTransferSyntaxes( assoc->params, &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), @@ -522,69 +519,67 @@ assert(static_cast(count) == numberOfDcmAllStorageSOPClassUIDs); #endif - // now that C-GET SCP is always enabled, the first branch of this if is useless - // TO BE ANALYZED by SJ - if (!server.HasGetRequestHandlerFactory()) // dcmqrsrv.cc line 828 - { - cond = ASC_acceptContextsWithPreferredTransferSyntaxes( - assoc->params, - dcmAllStorageSOPClassUIDs, count, - &storageTransferSyntaxes[0], storageTransferSyntaxes.size()); - if (cond.bad()) + if (!server.HasGetRequestHandlerFactory()) // dcmqrsrv.cc line 828 { - LOG(INFO) << cond.text(); - AssociationCleanup(assoc); - return NULL; + // This branch exactly corresponds to Orthanc <= 1.6.1 (in + // which C-GET SCP was not supported) + cond = ASC_acceptContextsWithPreferredTransferSyntaxes( + assoc->params, dcmAllStorageSOPClassUIDs, count, + &storageTransferSyntaxes[0], storageTransferSyntaxes.size()); + if (cond.bad()) + { + LOG(INFO) << cond.text(); + AssociationCleanup(assoc); + return NULL; + } } - } - else // see dcmqrsrv.cc lines 839 - 876 - { - /* accept storage syntaxes with proposed role */ - T_ASC_PresentationContext pc; - T_ASC_SC_ROLE role; - int npc = ASC_countPresentationContexts(assoc->params); - for (int i = 0; i < npc; i++) + else // see dcmqrsrv.cc lines 839 - 876 { - ASC_getPresentationContext(assoc->params, i, &pc); - if (dcmIsaStorageSOPClassUID(pc.abstractSyntax)) + /* accept storage syntaxes with proposed role */ + int npc = ASC_countPresentationContexts(assoc->params); + for (int i = 0; i < npc; i++) { - /* - ** We are prepared to accept whatever role the caller proposes. - ** Normally we can be the SCP of the Storage Service Class. - ** When processing the C-GET operation we can be the SCU of the Storage Service Class. - */ - role = pc.proposedRole; - - /* - ** Accept in the order "least wanted" to "most wanted" transfer - ** syntax. Accepting a transfer syntax will override previously - ** accepted transfer syntaxes. - */ - for (int k = (int) storageTransferSyntaxes.size() - 1; k >= 0; k--) + T_ASC_PresentationContext pc; + ASC_getPresentationContext(assoc->params, i, &pc); + if (dcmIsaStorageSOPClassUID(pc.abstractSyntax)) { - for (int j = 0; j < (int)pc.transferSyntaxCount; j++) + /** + * We are prepared to accept whatever role the caller + * proposes. Normally we can be the SCP of the Storage + * Service Class. When processing the C-GET operation + * we can be the SCU of the Storage Service Class. + **/ + const T_ASC_SC_ROLE role = pc.proposedRole; + + /** + * Accept in the order "least wanted" to "most wanted" + * transfer syntax. Accepting a transfer syntax will + * override previously accepted transfer syntaxes. + **/ + for (int k = static_cast(storageTransferSyntaxes.size()) - 1; k >= 0; k--) { - /* if the transfer syntax was proposed then we can accept it - * appears in our supported list of transfer syntaxes - */ - if (strcmp(pc.proposedTransferSyntaxes[j], storageTransferSyntaxes[k]) == 0) + for (int j = 0; j < static_cast(pc.transferSyntaxCount); j++) { - cond = ASC_acceptPresentationContext( - assoc->params, pc.presentationContextID, storageTransferSyntaxes[k], role); - if (cond.bad()) + /** + * If the transfer syntax was proposed then we can accept it + * appears in our supported list of transfer syntaxes + **/ + if (strcmp(pc.proposedTransferSyntaxes[j], storageTransferSyntaxes[k]) == 0) { - LOG(INFO) << cond.text(); - AssociationCleanup(assoc); - return NULL; + cond = ASC_acceptPresentationContext( + assoc->params, pc.presentationContextID, storageTransferSyntaxes[k], role); + if (cond.bad()) + { + LOG(INFO) << cond.text(); + AssociationCleanup(assoc); + return NULL; + } } } } } - } - } /* for */ - - } - + } /* for */ + } if (!server.HasApplicationEntityFilter() || server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet))