Mercurial > hg > orthanc
comparison OrthancServer/Sources/ServerContext.h @ 4819:70d2a97ca8cb openssl-3.x
integration mainline->openssl-3.x
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Nov 2021 13:12:32 +0100 |
parents | f0038043fb97 7afbb54bd028 |
children | 2e71a08eea15 |
comparison
equal
deleted
inserted
replaced
4785:61da49321754 | 4819:70d2a97ca8cb |
---|---|
29 | 29 |
30 #include "../../OrthancFramework/Sources/DicomFormat/DicomElement.h" | 30 #include "../../OrthancFramework/Sources/DicomFormat/DicomElement.h" |
31 #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h" | 31 #include "../../OrthancFramework/Sources/DicomParsing/DicomModification.h" |
32 #include "../../OrthancFramework/Sources/DicomParsing/IDicomTranscoder.h" | 32 #include "../../OrthancFramework/Sources/DicomParsing/IDicomTranscoder.h" |
33 #include "../../OrthancFramework/Sources/DicomParsing/ParsedDicomCache.h" | 33 #include "../../OrthancFramework/Sources/DicomParsing/ParsedDicomCache.h" |
34 #include "../../OrthancFramework/Sources/FileStorage/StorageCache.h" | |
34 #include "../../OrthancFramework/Sources/MultiThreading/Semaphore.h" | 35 #include "../../OrthancFramework/Sources/MultiThreading/Semaphore.h" |
35 | 36 |
36 | 37 |
37 namespace Orthanc | 38 namespace Orthanc |
38 { | 39 { |
79 const std::string& instanceId, | 80 const std::string& instanceId, |
80 const DicomMap& mainDicomTags, | 81 const DicomMap& mainDicomTags, |
81 const Json::Value* dicomAsJson) = 0; | 82 const Json::Value* dicomAsJson) = 0; |
82 }; | 83 }; |
83 | 84 |
85 struct StoreResult | |
86 { | |
87 private: | |
88 StoreStatus status_; | |
89 uint16_t cstoreStatusCode_; | |
90 // uint16_t httpStatusCode_; // for future use | |
91 | |
92 public: | |
93 StoreResult(); | |
94 | |
95 void SetStatus(StoreStatus status) | |
96 { | |
97 status_ = status; | |
98 } | |
99 | |
100 StoreStatus GetStatus() | |
101 { | |
102 return status_; | |
103 } | |
104 | |
105 void SetCStoreStatusCode(uint16_t statusCode) | |
106 { | |
107 cstoreStatusCode_ = statusCode; | |
108 } | |
109 | |
110 uint16_t GetCStoreStatusCode() | |
111 { | |
112 return cstoreStatusCode_; | |
113 } | |
114 }; | |
84 | 115 |
85 private: | 116 private: |
86 class LuaServerListener : public IServerListener | 117 class LuaServerListener : public IServerListener |
87 { | 118 { |
88 private: | 119 private: |
108 | 139 |
109 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance, | 140 virtual bool FilterIncomingInstance(const DicomInstanceToStore& instance, |
110 const Json::Value& simplified) ORTHANC_OVERRIDE | 141 const Json::Value& simplified) ORTHANC_OVERRIDE |
111 { | 142 { |
112 return context_.filterLua_.FilterIncomingInstance(instance, simplified); | 143 return context_.filterLua_.FilterIncomingInstance(instance, simplified); |
144 } | |
145 | |
146 virtual uint16_t FilterIncomingCStoreInstance(const DicomInstanceToStore& instance, | |
147 const Json::Value& simplified) ORTHANC_OVERRIDE | |
148 { | |
149 return context_.filterLua_.FilterIncomingCStoreInstance(instance, simplified); | |
113 } | 150 } |
114 }; | 151 }; |
115 | 152 |
116 class ServerListener | 153 class ServerListener |
117 { | 154 { |
155 | 192 |
156 virtual void SignalJobFailure(const std::string& jobId) ORTHANC_OVERRIDE; | 193 virtual void SignalJobFailure(const std::string& jobId) ORTHANC_OVERRIDE; |
157 | 194 |
158 ServerIndex index_; | 195 ServerIndex index_; |
159 IStorageArea& area_; | 196 IStorageArea& area_; |
197 StorageCache storageCache_; | |
160 | 198 |
161 bool compressionEnabled_; | 199 bool compressionEnabled_; |
162 bool storeMD5_; | 200 bool storeMD5_; |
163 | 201 |
164 Semaphore largeDicomThrottler_; // New in Orthanc 1.9.0 (notably for very large DICOM files in WSI) | 202 Semaphore largeDicomThrottler_; // New in Orthanc 1.9.0 (notably for very large DICOM files in WSI) |
217 DicomTransferSyntax preferredTransferSyntax_; | 255 DicomTransferSyntax preferredTransferSyntax_; |
218 boost::mutex dynamicOptionsMutex_; | 256 boost::mutex dynamicOptionsMutex_; |
219 bool isUnknownSopClassAccepted_; | 257 bool isUnknownSopClassAccepted_; |
220 std::set<DicomTransferSyntax> acceptedTransferSyntaxes_; | 258 std::set<DicomTransferSyntax> acceptedTransferSyntaxes_; |
221 | 259 |
222 StoreStatus StoreAfterTranscoding(std::string& resultPublicId, | 260 StoreResult StoreAfterTranscoding(std::string& resultPublicId, |
223 DicomInstanceToStore& dicom, | 261 DicomInstanceToStore& dicom, |
224 StoreInstanceMode mode); | 262 StoreInstanceMode mode); |
225 | 263 |
226 void ApplyInternal(ILookupVisitor& visitor, | 264 void ApplyInternal(ILookupVisitor& visitor, |
227 const DatabaseLookup& lookup, | 265 const DatabaseLookup& lookup, |
272 bool loadJobsFromDatabase); | 310 bool loadJobsFromDatabase); |
273 | 311 |
274 ServerIndex& GetIndex() | 312 ServerIndex& GetIndex() |
275 { | 313 { |
276 return index_; | 314 return index_; |
315 } | |
316 | |
317 void SetMaximumStorageCacheSize(size_t size) | |
318 { | |
319 return storageCache_.SetMaximumSize(size); | |
277 } | 320 } |
278 | 321 |
279 void SetCompressionEnabled(bool enabled); | 322 void SetCompressionEnabled(bool enabled); |
280 | 323 |
281 bool IsCompressionEnabled() const | 324 bool IsCompressionEnabled() const |
290 size_t size, | 333 size_t size, |
291 bool hasOldRevision, | 334 bool hasOldRevision, |
292 int64_t oldRevision, | 335 int64_t oldRevision, |
293 const std::string& oldMD5); | 336 const std::string& oldMD5); |
294 | 337 |
295 StoreStatus Store(std::string& resultPublicId, | 338 StoreResult Store(std::string& resultPublicId, |
296 DicomInstanceToStore& dicom, | 339 DicomInstanceToStore& dicom, |
297 StoreInstanceMode mode); | 340 StoreInstanceMode mode); |
298 | 341 |
299 void AnswerAttachment(RestApiOutput& output, | 342 void AnswerAttachment(RestApiOutput& output, |
300 const std::string& resourceId, | 343 const std::string& resourceId, |
311 void ReadDicomAsJson(Json::Value& result, | 354 void ReadDicomAsJson(Json::Value& result, |
312 const std::string& instancePublicId); | 355 const std::string& instancePublicId); |
313 | 356 |
314 void ReadDicom(std::string& dicom, | 357 void ReadDicom(std::string& dicom, |
315 const std::string& instancePublicId); | 358 const std::string& instancePublicId); |
316 | 359 |
360 void ReadDicomForHeader(std::string& dicom, | |
361 const std::string& instancePublicId); | |
362 | |
317 bool ReadDicomUntilPixelData(std::string& dicom, | 363 bool ReadDicomUntilPixelData(std::string& dicom, |
318 const std::string& instancePublicId); | 364 const std::string& instancePublicId); |
319 | 365 |
320 // This method is for low-level operations on "/instances/.../attachments/..." | 366 // This method is for low-level operations on "/instances/.../attachments/..." |
321 void ReadAttachment(std::string& result, | 367 void ReadAttachment(std::string& result, |