comparison Core/DicomNetworking/RemoteModalityParameters.cpp @ 3761:3b5feb2bbd4b transcoding

integration mainline->transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 16 Mar 2020 12:17:43 +0100
parents f6a73611ec5c
children 3801435e34a1 8f7ad4989fec
comparison
equal deleted inserted replaced
3748:ca36e3f1112c 3761:3b5feb2bbd4b
46 static const char* KEY_ALLOW_ECHO = "AllowEcho"; 46 static const char* KEY_ALLOW_ECHO = "AllowEcho";
47 static const char* KEY_ALLOW_FIND = "AllowFind"; 47 static const char* KEY_ALLOW_FIND = "AllowFind";
48 static const char* KEY_ALLOW_GET = "AllowGet"; 48 static const char* KEY_ALLOW_GET = "AllowGet";
49 static const char* KEY_ALLOW_MOVE = "AllowMove"; 49 static const char* KEY_ALLOW_MOVE = "AllowMove";
50 static const char* KEY_ALLOW_STORE = "AllowStore"; 50 static const char* KEY_ALLOW_STORE = "AllowStore";
51 static const char* KEY_ALLOW_N_ACTION = "AllowNAction";
52 static const char* KEY_ALLOW_N_EVENT_REPORT = "AllowEventReport";
53 static const char* KEY_ALLOW_STORAGE_COMMITMENT = "AllowStorageCommitment";
51 static const char* KEY_HOST = "Host"; 54 static const char* KEY_HOST = "Host";
52 static const char* KEY_MANUFACTURER = "Manufacturer"; 55 static const char* KEY_MANUFACTURER = "Manufacturer";
53 static const char* KEY_PORT = "Port"; 56 static const char* KEY_PORT = "Port";
54 57
55 58
64 allowEcho_ = true; 67 allowEcho_ = true;
65 allowStore_ = true; 68 allowStore_ = true;
66 allowFind_ = true; 69 allowFind_ = true;
67 allowMove_ = true; 70 allowMove_ = true;
68 allowGet_ = true; 71 allowGet_ = true;
72 allowNAction_ = true; // For storage commitment
73 allowNEventReport_ = true; // For storage commitment
69 } 74 }
70 75
71 76
72 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet, 77 RemoteModalityParameters::RemoteModalityParameters(const std::string& aet,
73 const std::string& host, 78 const std::string& host,
209 214
210 if (serialized.isMember(KEY_ALLOW_MOVE)) 215 if (serialized.isMember(KEY_ALLOW_MOVE))
211 { 216 {
212 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE); 217 allowMove_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_MOVE);
213 } 218 }
219
220 if (serialized.isMember(KEY_ALLOW_N_ACTION))
221 {
222 allowNAction_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_ACTION);
223 }
224
225 if (serialized.isMember(KEY_ALLOW_N_EVENT_REPORT))
226 {
227 allowNEventReport_ = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_N_EVENT_REPORT);
228 }
229
230 if (serialized.isMember(KEY_ALLOW_STORAGE_COMMITMENT))
231 {
232 bool allow = SerializationToolbox::ReadBoolean(serialized, KEY_ALLOW_STORAGE_COMMITMENT);
233 allowNAction_ = allow;
234 allowNEventReport_ = allow;
235 }
214 } 236 }
215 237
216 238
217 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const 239 bool RemoteModalityParameters::IsRequestAllowed(DicomRequestType type) const
218 { 240 {
231 return allowMove_; 253 return allowMove_;
232 254
233 case DicomRequestType_Store: 255 case DicomRequestType_Store:
234 return allowStore_; 256 return allowStore_;
235 257
258 case DicomRequestType_NAction:
259 return allowNAction_;
260
261 case DicomRequestType_NEventReport:
262 return allowNEventReport_;
263
236 default: 264 default:
237 throw OrthancException(ErrorCode_ParameterOutOfRange); 265 throw OrthancException(ErrorCode_ParameterOutOfRange);
238 } 266 }
239 } 267 }
240 268
260 allowMove_ = allowed; 288 allowMove_ = allowed;
261 break; 289 break;
262 290
263 case DicomRequestType_Store: 291 case DicomRequestType_Store:
264 allowStore_ = allowed; 292 allowStore_ = allowed;
293 break;
294
295 case DicomRequestType_NAction:
296 allowNAction_ = allowed;
297 break;
298
299 case DicomRequestType_NEventReport:
300 allowNEventReport_ = allowed;
265 break; 301 break;
266 302
267 default: 303 default:
268 throw OrthancException(ErrorCode_ParameterOutOfRange); 304 throw OrthancException(ErrorCode_ParameterOutOfRange);
269 } 305 }
274 { 310 {
275 return (!allowEcho_ || 311 return (!allowEcho_ ||
276 !allowStore_ || 312 !allowStore_ ||
277 !allowFind_ || 313 !allowFind_ ||
278 !allowGet_ || 314 !allowGet_ ||
279 !allowMove_); 315 !allowMove_ ||
316 !allowNAction_ ||
317 !allowNEventReport_);
280 } 318 }
281 319
282 320
283 void RemoteModalityParameters::Serialize(Json::Value& target, 321 void RemoteModalityParameters::Serialize(Json::Value& target,
284 bool forceAdvancedFormat) const 322 bool forceAdvancedFormat) const
294 target[KEY_ALLOW_ECHO] = allowEcho_; 332 target[KEY_ALLOW_ECHO] = allowEcho_;
295 target[KEY_ALLOW_STORE] = allowStore_; 333 target[KEY_ALLOW_STORE] = allowStore_;
296 target[KEY_ALLOW_FIND] = allowFind_; 334 target[KEY_ALLOW_FIND] = allowFind_;
297 target[KEY_ALLOW_GET] = allowGet_; 335 target[KEY_ALLOW_GET] = allowGet_;
298 target[KEY_ALLOW_MOVE] = allowMove_; 336 target[KEY_ALLOW_MOVE] = allowMove_;
337 target[KEY_ALLOW_N_ACTION] = allowNAction_;
338 target[KEY_ALLOW_N_EVENT_REPORT] = allowNEventReport_;
299 } 339 }
300 else 340 else
301 { 341 {
302 target = Json::arrayValue; 342 target = Json::arrayValue;
303 target.append(GetApplicationEntityTitle()); 343 target.append(GetApplicationEntityTitle());