Mercurial > hg > orthanc
comparison OrthancServer/Sources/main.cpp @ 4469:5ffa4e14e4bd
move old enum TransferSyntax from OrthancFramework to OrthancServer
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 25 Jan 2021 18:12:59 +0100 |
parents | 9c070a34de18 |
children | 28a4baadde17 |
comparison
equal
deleted
inserted
replaced
4468:9c070a34de18 | 4469:5ffa4e14e4bd |
---|---|
280 private: | 280 private: |
281 ServerContext& context_; | 281 ServerContext& context_; |
282 bool alwaysAllowEcho_; | 282 bool alwaysAllowEcho_; |
283 bool alwaysAllowStore_; | 283 bool alwaysAllowStore_; |
284 | 284 |
285 bool IsAllowedTransferSyntax(const std::string& remoteIp, | |
286 const std::string& remoteAet, | |
287 const std::string& calledAet, | |
288 TransferSyntax syntax) | |
289 { | |
290 std::string configuration; | |
291 | |
292 switch (syntax) | |
293 { | |
294 case TransferSyntax_Deflated: | |
295 configuration = "DeflatedTransferSyntaxAccepted"; | |
296 break; | |
297 | |
298 case TransferSyntax_Jpeg: | |
299 configuration = "JpegTransferSyntaxAccepted"; | |
300 break; | |
301 | |
302 case TransferSyntax_Jpeg2000: | |
303 configuration = "Jpeg2000TransferSyntaxAccepted"; | |
304 break; | |
305 | |
306 case TransferSyntax_JpegLossless: | |
307 configuration = "JpegLosslessTransferSyntaxAccepted"; | |
308 break; | |
309 | |
310 case TransferSyntax_Jpip: | |
311 configuration = "JpipTransferSyntaxAccepted"; | |
312 break; | |
313 | |
314 case TransferSyntax_Mpeg2: | |
315 configuration = "Mpeg2TransferSyntaxAccepted"; | |
316 break; | |
317 | |
318 case TransferSyntax_Mpeg4: | |
319 configuration = "Mpeg4TransferSyntaxAccepted"; | |
320 break; | |
321 | |
322 case TransferSyntax_Rle: | |
323 configuration = "RleTransferSyntaxAccepted"; | |
324 break; | |
325 | |
326 default: | |
327 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
328 } | |
329 | |
330 { | |
331 std::string name = "Is" + configuration; | |
332 | |
333 LuaScripting::Lock lock(context_.GetLuaScripting()); | |
334 | |
335 if (lock.GetLua().IsExistingFunction(name.c_str())) | |
336 { | |
337 LuaFunctionCall call(lock.GetLua(), name.c_str()); | |
338 call.PushString(remoteAet); | |
339 call.PushString(remoteIp); | |
340 call.PushString(calledAet); | |
341 return call.ExecutePredicate(); | |
342 } | |
343 } | |
344 | |
345 { | |
346 OrthancConfiguration::ReaderLock lock; | |
347 return lock.GetConfiguration().GetBooleanParameter(configuration, true); | |
348 } | |
349 } | |
350 | |
285 public: | 351 public: |
286 explicit OrthancApplicationEntityFilter(ServerContext& context) : | 352 explicit OrthancApplicationEntityFilter(ServerContext& context) : |
287 context_(context) | 353 context_(context) |
288 { | 354 { |
289 OrthancConfiguration::ReaderLock lock; | 355 OrthancConfiguration::ReaderLock lock; |
448 target.insert(DicomTransferSyntax_RLELossless); | 514 target.insert(DicomTransferSyntax_RLELossless); |
449 } | 515 } |
450 } | 516 } |
451 | 517 |
452 | 518 |
453 virtual bool IsAllowedTransferSyntax(const std::string& remoteIp, | |
454 const std::string& remoteAet, | |
455 const std::string& calledAet, | |
456 TransferSyntax syntax) ORTHANC_OVERRIDE | |
457 { | |
458 std::string configuration; | |
459 | |
460 switch (syntax) | |
461 { | |
462 case TransferSyntax_Deflated: | |
463 configuration = "DeflatedTransferSyntaxAccepted"; | |
464 break; | |
465 | |
466 case TransferSyntax_Jpeg: | |
467 configuration = "JpegTransferSyntaxAccepted"; | |
468 break; | |
469 | |
470 case TransferSyntax_Jpeg2000: | |
471 configuration = "Jpeg2000TransferSyntaxAccepted"; | |
472 break; | |
473 | |
474 case TransferSyntax_JpegLossless: | |
475 configuration = "JpegLosslessTransferSyntaxAccepted"; | |
476 break; | |
477 | |
478 case TransferSyntax_Jpip: | |
479 configuration = "JpipTransferSyntaxAccepted"; | |
480 break; | |
481 | |
482 case TransferSyntax_Mpeg2: | |
483 configuration = "Mpeg2TransferSyntaxAccepted"; | |
484 break; | |
485 | |
486 case TransferSyntax_Mpeg4: | |
487 configuration = "Mpeg4TransferSyntaxAccepted"; | |
488 break; | |
489 | |
490 case TransferSyntax_Rle: | |
491 configuration = "RleTransferSyntaxAccepted"; | |
492 break; | |
493 | |
494 default: | |
495 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
496 } | |
497 | |
498 { | |
499 std::string name = "Is" + configuration; | |
500 | |
501 LuaScripting::Lock lock(context_.GetLuaScripting()); | |
502 | |
503 if (lock.GetLua().IsExistingFunction(name.c_str())) | |
504 { | |
505 LuaFunctionCall call(lock.GetLua(), name.c_str()); | |
506 call.PushString(remoteAet); | |
507 call.PushString(remoteIp); | |
508 call.PushString(calledAet); | |
509 return call.ExecutePredicate(); | |
510 } | |
511 } | |
512 | |
513 { | |
514 OrthancConfiguration::ReaderLock lock; | |
515 return lock.GetConfiguration().GetBooleanParameter(configuration, true); | |
516 } | |
517 } | |
518 | |
519 | |
520 virtual bool IsUnknownSopClassAccepted(const std::string& remoteIp, | 519 virtual bool IsUnknownSopClassAccepted(const std::string& remoteIp, |
521 const std::string& remoteAet, | 520 const std::string& remoteAet, |
522 const std::string& calledAet) ORTHANC_OVERRIDE | 521 const std::string& calledAet) ORTHANC_OVERRIDE |
523 { | 522 { |
524 static const char* configuration = "UnknownSopClassAccepted"; | 523 static const char* configuration = "UnknownSopClassAccepted"; |