Mercurial > hg > orthanc
comparison OrthancFramework/Sources/DicomNetworking/Internals/CommandDispatcher.cpp @ 4284:756126cd2219
moving all logs from DicomNetworking folder into the "dicom" category
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 04 Nov 2020 15:01:47 +0100 |
parents | 6b58ceed959e |
children | 544120b34c09 |
comparison
equal
deleted
inserted
replaced
4283:6b58ceed959e | 4284:756126cd2219 |
---|---|
27 This file is based on portions of the following project: | 27 This file is based on portions of the following project: |
28 | 28 |
29 Program: DCMTK 3.6.0 | 29 Program: DCMTK 3.6.0 |
30 Module: http://dicom.offis.de/dcmtk.php.en | 30 Module: http://dicom.offis.de/dcmtk.php.en |
31 | 31 |
32 Copyright (C) 1994-2011, OFFIS e.V. | 32 Copyright (C) 1994-2011, OFFIS e.V. |
33 All rights reserved. | 33 All rights reserved. |
34 | 34 |
35 This software and supporting documentation were developed by | 35 This software and supporting documentation were developed by |
36 | 36 |
37 OFFIS e.V. | 37 OFFIS e.V. |
38 R&D Division Health | 38 R&D Division Health |
39 Escherweg 2 | 39 Escherweg 2 |
40 26121 Oldenburg, Germany | 40 26121 Oldenburg, Germany |
41 | 41 |
42 Redistribution and use in source and binary forms, with or without | 42 Redistribution and use in source and binary forms, with or without |
43 modification, are permitted provided that the following conditions | 43 modification, are permitted provided that the following conditions |
44 are met: | 44 are met: |
45 | 45 |
46 - Redistributions of source code must retain the above copyright | 46 - Redistributions of source code must retain the above copyright |
47 notice, this list of conditions and the following disclaimer. | 47 notice, this list of conditions and the following disclaimer. |
48 | 48 |
49 - Redistributions in binary form must reproduce the above copyright | 49 - Redistributions in binary form must reproduce the above copyright |
50 notice, this list of conditions and the following disclaimer in the | 50 notice, this list of conditions and the following disclaimer in the |
51 documentation and/or other materials provided with the distribution. | 51 documentation and/or other materials provided with the distribution. |
52 | 52 |
53 - Neither the name of OFFIS nor the names of its contributors may be | 53 - Neither the name of OFFIS nor the names of its contributors may be |
54 used to endorse or promote products derived from this software | 54 used to endorse or promote products derived from this software |
55 without specific prior written permission. | 55 without specific prior written permission. |
56 | 56 |
57 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 57 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
58 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 58 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
59 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 59 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
60 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 60 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
61 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 61 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
62 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 62 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
63 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 63 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
64 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 64 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
65 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 65 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
66 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 66 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
67 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 67 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
68 | 68 |
69 =========================================================================*/ | 69 =========================================================================*/ |
70 | 70 |
71 | 71 |
72 #include "../../PrecompiledHeaders.h" | 72 #include "../../PrecompiledHeaders.h" |
73 #include "CommandDispatcher.h" | 73 #include "CommandDispatcher.h" |
74 | 74 |
90 #include <dcmtk/dcmdata/dcuid.h> /* for variable dcmAllStorageSOPClassUIDs */ | 90 #include <dcmtk/dcmdata/dcuid.h> /* for variable dcmAllStorageSOPClassUIDs */ |
91 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */ | 91 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */ |
92 | 92 |
93 #include <boost/lexical_cast.hpp> | 93 #include <boost/lexical_cast.hpp> |
94 | 94 |
95 static OFBool opt_rejectWithoutImplementationUID = OFFalse; | 95 static OFBool opt_rejectWithoutImplementationUID = OFFalse; |
96 | 96 |
97 | 97 |
98 | 98 |
99 static DUL_PRESENTATIONCONTEXT * | 99 static DUL_PRESENTATIONCONTEXT * |
100 findPresentationContextID(LST_HEAD * head, | 100 findPresentationContextID(LST_HEAD * head, |
235 OFCondition AssociationCleanup(T_ASC_Association *assoc) | 235 OFCondition AssociationCleanup(T_ASC_Association *assoc) |
236 { | 236 { |
237 OFCondition cond = ASC_dropSCPAssociation(assoc); | 237 OFCondition cond = ASC_dropSCPAssociation(assoc); |
238 if (cond.bad()) | 238 if (cond.bad()) |
239 { | 239 { |
240 LOG(ERROR) << cond.text(); | 240 CLOG(ERROR, DICOM) << cond.text(); |
241 return cond; | 241 return cond; |
242 } | 242 } |
243 | 243 |
244 cond = ASC_destroyAssociation(&assoc); | 244 cond = ASC_destroyAssociation(&assoc); |
245 if (cond.bad()) | 245 if (cond.bad()) |
246 { | 246 { |
247 LOG(ERROR) << cond.text(); | 247 CLOG(ERROR, DICOM) << cond.text(); |
248 return cond; | 248 return cond; |
249 } | 249 } |
250 | 250 |
251 return cond; | 251 return cond; |
252 } | 252 } |
276 } | 276 } |
277 | 277 |
278 // if some kind of error occured, take care of it | 278 // if some kind of error occured, take care of it |
279 if (cond.bad()) | 279 if (cond.bad()) |
280 { | 280 { |
281 LOG(ERROR) << "Receiving Association failed: " << cond.text(); | 281 CLOG(ERROR, DICOM) << "Receiving Association failed: " << cond.text(); |
282 // no matter what kind of error occurred, we need to do a cleanup | 282 // no matter what kind of error occurred, we need to do a cleanup |
283 AssociationCleanup(assoc); | 283 AssociationCleanup(assoc); |
284 return NULL; | 284 return NULL; |
285 } | 285 } |
286 | 286 |
325 remoteIp = std::string(/*OFSTRING_GUARD*/(remoteIp_C)); | 325 remoteIp = std::string(/*OFSTRING_GUARD*/(remoteIp_C)); |
326 remoteAet = std::string(/*OFSTRING_GUARD*/(remoteAet_C)); | 326 remoteAet = std::string(/*OFSTRING_GUARD*/(remoteAet_C)); |
327 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); | 327 calledAet = (/*OFSTRING_GUARD*/(calledAet_C)); |
328 } | 328 } |
329 | 329 |
330 LOG(INFO) << "Association Received from AET " << remoteAet | 330 CLOG(INFO, DICOM) << "Association Received from AET " << remoteAet |
331 << " on IP " << remoteIp; | 331 << " on IP " << remoteIp; |
332 | 332 |
333 | 333 |
334 { | 334 { |
335 /* accept the abstract syntaxes for C-ECHO, C-FIND, C-MOVE, | 335 /* accept the abstract syntaxes for C-ECHO, C-FIND, C-MOVE, |
336 and storage commitment, if presented */ | 336 and storage commitment, if presented */ |
376 assoc->params, | 376 assoc->params, |
377 &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), | 377 &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), |
378 &genericTransferSyntaxes[0], genericTransferSyntaxes.size()); | 378 &genericTransferSyntaxes[0], genericTransferSyntaxes.size()); |
379 if (cond.bad()) | 379 if (cond.bad()) |
380 { | 380 { |
381 LOG(INFO) << cond.text(); | 381 CLOG(INFO, DICOM) << cond.text(); |
382 AssociationCleanup(assoc); | 382 AssociationCleanup(assoc); |
383 return NULL; | 383 return NULL; |
384 } | 384 } |
385 | 385 |
386 | 386 |
396 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( | 396 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
397 assoc->params, as, 1, | 397 assoc->params, as, 1, |
398 &genericTransferSyntaxes[0], genericTransferSyntaxes.size(), ASC_SC_ROLE_SCUSCP); | 398 &genericTransferSyntaxes[0], genericTransferSyntaxes.size(), ASC_SC_ROLE_SCUSCP); |
399 if (cond.bad()) | 399 if (cond.bad()) |
400 { | 400 { |
401 LOG(INFO) << cond.text(); | 401 CLOG(INFO, DICOM) << cond.text(); |
402 AssociationCleanup(assoc); | 402 AssociationCleanup(assoc); |
403 return NULL; | 403 return NULL; |
404 } | 404 } |
405 } | 405 } |
406 } | 406 } |
518 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( | 518 cond = ASC_acceptContextsWithPreferredTransferSyntaxes( |
519 assoc->params, dcmAllStorageSOPClassUIDs, count, | 519 assoc->params, dcmAllStorageSOPClassUIDs, count, |
520 &storageTransferSyntaxes[0], storageTransferSyntaxes.size()); | 520 &storageTransferSyntaxes[0], storageTransferSyntaxes.size()); |
521 if (cond.bad()) | 521 if (cond.bad()) |
522 { | 522 { |
523 LOG(INFO) << cond.text(); | 523 CLOG(INFO, DICOM) << cond.text(); |
524 AssociationCleanup(assoc); | 524 AssociationCleanup(assoc); |
525 return NULL; | 525 return NULL; |
526 } | 526 } |
527 } | 527 } |
528 else // see dcmqrsrv.cc lines 839 - 876 | 528 else // see dcmqrsrv.cc lines 839 - 876 |
560 { | 560 { |
561 cond = ASC_acceptPresentationContext( | 561 cond = ASC_acceptPresentationContext( |
562 assoc->params, pc.presentationContextID, storageTransferSyntaxes[k], role); | 562 assoc->params, pc.presentationContextID, storageTransferSyntaxes[k], role); |
563 if (cond.bad()) | 563 if (cond.bad()) |
564 { | 564 { |
565 LOG(INFO) << cond.text(); | 565 CLOG(INFO, DICOM) << cond.text(); |
566 AssociationCleanup(assoc); | 566 AssociationCleanup(assoc); |
567 return NULL; | 567 return NULL; |
568 } | 568 } |
569 } | 569 } |
570 } | 570 } |
582 **/ | 582 **/ |
583 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( | 583 cond = acceptUnknownContextsWithPreferredTransferSyntaxes( |
584 assoc->params, &storageTransferSyntaxes[0], storageTransferSyntaxes.size(), ASC_SC_ROLE_DEFAULT); | 584 assoc->params, &storageTransferSyntaxes[0], storageTransferSyntaxes.size(), ASC_SC_ROLE_DEFAULT); |
585 if (cond.bad()) | 585 if (cond.bad()) |
586 { | 586 { |
587 LOG(INFO) << cond.text(); | 587 CLOG(INFO, DICOM) << cond.text(); |
588 AssociationCleanup(assoc); | 588 AssociationCleanup(assoc); |
589 return NULL; | 589 return NULL; |
590 } | 590 } |
591 } | 591 } |
592 } | 592 } |
609 ASC_RESULT_REJECTEDPERMANENT, | 609 ASC_RESULT_REJECTEDPERMANENT, |
610 ASC_SOURCE_SERVICEUSER, | 610 ASC_SOURCE_SERVICEUSER, |
611 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED | 611 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED |
612 }; | 612 }; |
613 | 613 |
614 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf; | 614 CLOG(INFO, DICOM) << "Association Rejected: Bad Application Context Name: " << buf; |
615 cond = ASC_rejectAssociation(assoc, &rej); | 615 cond = ASC_rejectAssociation(assoc, &rej); |
616 if (cond.bad()) | 616 if (cond.bad()) |
617 { | 617 { |
618 LOG(INFO) << cond.text(); | 618 CLOG(INFO, DICOM) << cond.text(); |
619 } | 619 } |
620 AssociationCleanup(assoc); | 620 AssociationCleanup(assoc); |
621 return NULL; | 621 return NULL; |
622 } | 622 } |
623 | 623 |
624 /* check the AETs */ | 624 /* check the AETs */ |
625 if (!server.IsMyAETitle(calledAet)) | 625 if (!server.IsMyAETitle(calledAet)) |
626 { | 626 { |
627 LOG(WARNING) << "Rejected association, because of a bad called AET in the request (" << calledAet << ")"; | 627 CLOG(WARNING, DICOM) << "Rejected association, because of a bad called AET in the request (" << calledAet << ")"; |
628 T_ASC_RejectParameters rej = | 628 T_ASC_RejectParameters rej = |
629 { | 629 { |
630 ASC_RESULT_REJECTEDPERMANENT, | 630 ASC_RESULT_REJECTEDPERMANENT, |
631 ASC_SOURCE_SERVICEUSER, | 631 ASC_SOURCE_SERVICEUSER, |
632 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED | 632 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED |
637 } | 637 } |
638 | 638 |
639 if (server.HasApplicationEntityFilter() && | 639 if (server.HasApplicationEntityFilter() && |
640 !server.GetApplicationEntityFilter().IsAllowedConnection(remoteIp, remoteAet, calledAet)) | 640 !server.GetApplicationEntityFilter().IsAllowedConnection(remoteIp, remoteAet, calledAet)) |
641 { | 641 { |
642 LOG(WARNING) << "Rejected association for remote AET " << remoteAet << " on IP " << remoteIp; | 642 CLOG(WARNING, DICOM) << "Rejected association for remote AET " << remoteAet << " on IP " << remoteIp; |
643 T_ASC_RejectParameters rej = | 643 T_ASC_RejectParameters rej = |
644 { | 644 { |
645 ASC_RESULT_REJECTEDPERMANENT, | 645 ASC_RESULT_REJECTEDPERMANENT, |
646 ASC_SOURCE_SERVICEUSER, | 646 ASC_SOURCE_SERVICEUSER, |
647 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED | 647 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED |
660 ASC_RESULT_REJECTEDPERMANENT, | 660 ASC_RESULT_REJECTEDPERMANENT, |
661 ASC_SOURCE_SERVICEUSER, | 661 ASC_SOURCE_SERVICEUSER, |
662 ASC_REASON_SU_NOREASON | 662 ASC_REASON_SU_NOREASON |
663 }; | 663 }; |
664 | 664 |
665 LOG(INFO) << "Association Rejected: No Implementation Class UID provided"; | 665 CLOG(INFO, DICOM) << "Association Rejected: No Implementation Class UID provided"; |
666 cond = ASC_rejectAssociation(assoc, &rej); | 666 cond = ASC_rejectAssociation(assoc, &rej); |
667 if (cond.bad()) | 667 if (cond.bad()) |
668 { | 668 { |
669 LOG(INFO) << cond.text(); | 669 CLOG(INFO, DICOM) << cond.text(); |
670 } | 670 } |
671 AssociationCleanup(assoc); | 671 AssociationCleanup(assoc); |
672 return NULL; | 672 return NULL; |
673 } | 673 } |
674 | 674 |
675 { | 675 { |
676 cond = ASC_acknowledgeAssociation(assoc); | 676 cond = ASC_acknowledgeAssociation(assoc); |
677 if (cond.bad()) | 677 if (cond.bad()) |
678 { | 678 { |
679 LOG(ERROR) << cond.text(); | 679 CLOG(ERROR, DICOM) << cond.text(); |
680 AssociationCleanup(assoc); | 680 AssociationCleanup(assoc); |
681 return NULL; | 681 return NULL; |
682 } | 682 } |
683 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")"; | 683 CLOG(INFO, DICOM) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")"; |
684 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) | 684 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0) |
685 LOG(INFO) << " (but no valid presentation contexts)"; | 685 CLOG(INFO, DICOM) << " (but no valid presentation contexts)"; |
686 | 686 |
687 { | 687 { |
688 OFString str; | 688 OFString str; |
689 CLOG(TRACE, DICOM) << "Association Acknowledged Details:" << std::endl | 689 CLOG(TRACE, DICOM) << "Association Acknowledged Details:" << std::endl |
690 << ASC_dumpParameters(str, assoc->params, ASC_ASSOC_AC); | 690 << ASC_dumpParameters(str, assoc->params, ASC_ASSOC_AC); |
720 { | 720 { |
721 AssociationCleanup(assoc_); | 721 AssociationCleanup(assoc_); |
722 } | 722 } |
723 catch (...) | 723 catch (...) |
724 { | 724 { |
725 LOG(ERROR) << "Some association was not cleanly aborted"; | 725 CLOG(ERROR, DICOM) << "Some association was not cleanly aborted"; |
726 } | 726 } |
727 } | 727 } |
728 | 728 |
729 | 729 |
730 bool CommandDispatcher::Step() | 730 bool CommandDispatcher::Step() |
818 break; | 818 break; |
819 | 819 |
820 default: | 820 default: |
821 // we cannot handle this kind of message | 821 // we cannot handle this kind of message |
822 cond = DIMSE_BADCOMMANDTYPE; | 822 cond = DIMSE_BADCOMMANDTYPE; |
823 LOG(ERROR) << "cannot handle command: 0x" << std::hex << msg.CommandField; | 823 CLOG(ERROR, DICOM) << "cannot handle command: 0x" << std::hex << msg.CommandField; |
824 break; | 824 break; |
825 } | 825 } |
826 | 826 |
827 | 827 |
828 // Check whether this request is allowed by the security filter | 828 // Check whether this request is allowed by the security filter |
829 if (supported && | 829 if (supported && |
830 filter_ != NULL && | 830 filter_ != NULL && |
831 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request)) | 831 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request)) |
832 { | 832 { |
833 LOG(WARNING) << "Rejected " << EnumerationToString(request) | 833 CLOG(WARNING, DICOM) << "Rejected " << EnumerationToString(request) |
834 << " request from remote DICOM modality with AET \"" | 834 << " request from remote DICOM modality with AET \"" |
835 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\""; | 835 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\""; |
836 cond = DIMSE_ILLEGALASSOCIATION; | 836 cond = DIMSE_ILLEGALASSOCIATION; |
837 supported = false; | 837 supported = false; |
838 finished = true; | 838 finished = true; |
839 } | 839 } |
840 | 840 |
929 { | 929 { |
930 // Bad status, which indicates the closing of the connection by | 930 // Bad status, which indicates the closing of the connection by |
931 // the peer or a network error | 931 // the peer or a network error |
932 finished = true; | 932 finished = true; |
933 | 933 |
934 LOG(INFO) << cond.text(); | 934 CLOG(INFO, DICOM) << cond.text(); |
935 } | 935 } |
936 | 936 |
937 if (finished) | 937 if (finished) |
938 { | 938 { |
939 if (cond == DUL_PEERREQUESTEDRELEASE) | 939 if (cond == DUL_PEERREQUESTEDRELEASE) |
940 { | 940 { |
941 LOG(INFO) << "Association Release"; | 941 CLOG(INFO, DICOM) << "Association Release"; |
942 ASC_acknowledgeRelease(assoc_); | 942 ASC_acknowledgeRelease(assoc_); |
943 } | 943 } |
944 else if (cond == DUL_PEERABORTEDASSOCIATION) | 944 else if (cond == DUL_PEERABORTEDASSOCIATION) |
945 { | 945 { |
946 LOG(INFO) << "Association Aborted"; | 946 CLOG(INFO, DICOM) << "Association Aborted"; |
947 } | 947 } |
948 else | 948 else |
949 { | 949 { |
950 OFString temp_str; | 950 OFString temp_str; |
951 LOG(INFO) << "DIMSE failure (aborting association): " << cond.text(); | 951 CLOG(INFO, DICOM) << "DIMSE failure (aborting association): " << cond.text(); |
952 /* some kind of error so abort the association */ | 952 /* some kind of error so abort the association */ |
953 ASC_abortAssociation(assoc_); | 953 ASC_abortAssociation(assoc_); |
954 } | 954 } |
955 } | 955 } |
956 | 956 |
959 | 959 |
960 | 960 |
961 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) | 961 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID) |
962 { | 962 { |
963 OFString temp_str; | 963 OFString temp_str; |
964 LOG(INFO) << "Received Echo Request"; | 964 CLOG(INFO, DICOM) << "Received Echo Request"; |
965 //LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID)); | |
966 | 965 |
967 /* the echo succeeded !! */ | 966 /* the echo succeeded !! */ |
968 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); | 967 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL); |
969 if (cond.bad()) | 968 if (cond.bad()) |
970 { | 969 { |
971 LOG(ERROR) << "Echo SCP Failed: " << cond.text(); | 970 CLOG(ERROR, DICOM) << "Echo SCP Failed: " << cond.text(); |
972 } | 971 } |
973 return cond; | 972 return cond; |
974 } | 973 } |
975 | 974 |
976 | 975 |
1143 | 1142 |
1144 std::vector<std::string> sopClassUid, sopInstanceUid; | 1143 std::vector<std::string> sopClassUid, sopInstanceUid; |
1145 ReadSopSequence(sopClassUid, sopInstanceUid, NULL, | 1144 ReadSopSequence(sopClassUid, sopInstanceUid, NULL, |
1146 *dataset, DCM_ReferencedSOPSequence, true /* mandatory */); | 1145 *dataset, DCM_ReferencedSOPSequence, true /* mandatory */); |
1147 | 1146 |
1148 LOG(INFO) << "Incoming storage commitment request, with transaction UID: " << transactionUid; | 1147 CLOG(INFO, DICOM) << "Incoming storage commitment request, with transaction UID: " << transactionUid; |
1149 | 1148 |
1150 for (size_t i = 0; i < sopClassUid.size(); i++) | 1149 for (size_t i = 0; i < sopClassUid.size(); i++) |
1151 { | 1150 { |
1152 LOG(INFO) << " (" << (i + 1) << "/" << sopClassUid.size() | 1151 CLOG(INFO, DICOM) << " (" << (i + 1) << "/" << sopClassUid.size() |
1153 << ") queried SOP Class/Instance UID: " | 1152 << ") queried SOP Class/Instance UID: " |
1154 << sopClassUid[i] << " / " << sopInstanceUid[i]; | 1153 << sopClassUid[i] << " / " << sopInstanceUid[i]; |
1155 } | 1154 } |
1156 | 1155 |
1157 | 1156 |
1158 /** | 1157 /** |
1159 * Call the Orthanc handler. The list of available DIMSE status | 1158 * Call the Orthanc handler. The list of available DIMSE status |
1174 | 1173 |
1175 dimseStatus = 0; // Success | 1174 dimseStatus = 0; // Success |
1176 } | 1175 } |
1177 catch (OrthancException& e) | 1176 catch (OrthancException& e) |
1178 { | 1177 { |
1179 LOG(ERROR) << "Error while processing an incoming storage commitment request: " << e.What(); | 1178 CLOG(ERROR, DICOM) << "Error while processing an incoming storage commitment request: " << e.What(); |
1180 | 1179 |
1181 // Code 0x0110 - "General failure in processing the operation was encountered" | 1180 // Code 0x0110 - "General failure in processing the operation was encountered" |
1182 dimseStatus = STATUS_N_ProcessingFailure; | 1181 dimseStatus = STATUS_N_ProcessingFailure; |
1183 } | 1182 } |
1184 | 1183 |
1276 { | 1275 { |
1277 ReadSopSequence(failedSopClassUid, failedSopInstanceUid, &failureReasons, | 1276 ReadSopSequence(failedSopClassUid, failedSopInstanceUid, &failureReasons, |
1278 *dataset, DCM_FailedSOPSequence, true); | 1277 *dataset, DCM_FailedSOPSequence, true); |
1279 } | 1278 } |
1280 | 1279 |
1281 LOG(INFO) << "Incoming storage commitment report, with transaction UID: " << transactionUid; | 1280 CLOG(INFO, DICOM) << "Incoming storage commitment report, with transaction UID: " << transactionUid; |
1282 | 1281 |
1283 for (size_t i = 0; i < successSopClassUid.size(); i++) | 1282 for (size_t i = 0; i < successSopClassUid.size(); i++) |
1284 { | 1283 { |
1285 LOG(INFO) << " (success " << (i + 1) << "/" << successSopClassUid.size() | 1284 CLOG(INFO, DICOM) << " (success " << (i + 1) << "/" << successSopClassUid.size() |
1286 << ") SOP Class/Instance UID: " | 1285 << ") SOP Class/Instance UID: " |
1287 << successSopClassUid[i] << " / " << successSopInstanceUid[i]; | 1286 << successSopClassUid[i] << " / " << successSopInstanceUid[i]; |
1288 } | 1287 } |
1289 | 1288 |
1290 for (size_t i = 0; i < failedSopClassUid.size(); i++) | 1289 for (size_t i = 0; i < failedSopClassUid.size(); i++) |
1291 { | 1290 { |
1292 LOG(INFO) << " (failure " << (i + 1) << "/" << failedSopClassUid.size() | 1291 CLOG(INFO, DICOM) << " (failure " << (i + 1) << "/" << failedSopClassUid.size() |
1293 << ") SOP Class/Instance UID: " | 1292 << ") SOP Class/Instance UID: " |
1294 << failedSopClassUid[i] << " / " << failedSopInstanceUid[i]; | 1293 << failedSopClassUid[i] << " / " << failedSopInstanceUid[i]; |
1295 } | 1294 } |
1296 | 1295 |
1297 /** | 1296 /** |
1298 * Call the Orthanc handler. The list of available DIMSE status | 1297 * Call the Orthanc handler. The list of available DIMSE status |
1299 * codes can be found at: | 1298 * codes can be found at: |
1314 | 1313 |
1315 dimseStatus = 0; // Success | 1314 dimseStatus = 0; // Success |
1316 } | 1315 } |
1317 catch (OrthancException& e) | 1316 catch (OrthancException& e) |
1318 { | 1317 { |
1319 LOG(ERROR) << "Error while processing an incoming storage commitment report: " << e.What(); | 1318 CLOG(ERROR, DICOM) << "Error while processing an incoming storage commitment report: " << e.What(); |
1320 | 1319 |
1321 // Code 0x0110 - "General failure in processing the operation was encountered" | 1320 // Code 0x0110 - "General failure in processing the operation was encountered" |
1322 dimseStatus = STATUS_N_ProcessingFailure; | 1321 dimseStatus = STATUS_N_ProcessingFailure; |
1323 } | 1322 } |
1324 | 1323 |