comparison OrthancServer/Sources/main.cpp @ 4791:656784ac6759 proto-filter-instance-returning-error-code

wip: returning OutOfResources when an instance is filtered out by ReceivedInstanceFilter. Ideally, we should implement a ReceivedInstanceFilter2 that would return the C-Store error code
author Alain Mazy <am@osimis.io>
date Wed, 29 Sep 2021 10:32:23 +0200
parents ec8aef42a7db
children 3ab57510f6dd
comparison
equal deleted inserted replaced
4790:9754d5f2f38a 4791:656784ac6759
82 context_(context) 82 context_(context)
83 { 83 {
84 } 84 }
85 85
86 86
87 virtual void Handle(DcmDataset& dicom, 87 virtual int Handle(DcmDataset& dicom,
88 const std::string& remoteIp, 88 const std::string& remoteIp,
89 const std::string& remoteAet, 89 const std::string& remoteAet,
90 const std::string& calledAet) ORTHANC_OVERRIDE 90 const std::string& calledAet) ORTHANC_OVERRIDE
91 { 91 {
92 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromDcmDataset(dicom)); 92 std::unique_ptr<DicomInstanceToStore> toStore(DicomInstanceToStore::CreateFromDcmDataset(dicom));
95 { 95 {
96 toStore->SetOrigin(DicomInstanceOrigin::FromDicomProtocol 96 toStore->SetOrigin(DicomInstanceOrigin::FromDicomProtocol
97 (remoteIp.c_str(), remoteAet.c_str(), calledAet.c_str())); 97 (remoteIp.c_str(), remoteAet.c_str(), calledAet.c_str()));
98 98
99 std::string id; 99 std::string id;
100 context_.Store(id, *toStore, StoreInstanceMode_Default); 100 StoreStatus res = context_.Store(id, *toStore, StoreInstanceMode_Default);
101 } 101 if (res == StoreStatus_FilteredOut)
102 {
103 return 0xA700; // C-Store "Out of Resources" error code
104 }
105 return 0x0000;
106 }
107
108 return 0xC000; // C-Store "Cannot understand" error code
102 } 109 }
103 }; 110 };
104 111
105 112
106 113