Mercurial > hg > orthanc
comparison OrthancServer/OrthancFindRequestHandler.cpp @ 2827:d4fd4614f275
IncomingWorklistRequestFilter() to filter incoming C-FIND worklist queries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 19 Sep 2018 21:10:49 +0200 |
parents | 912a767911b0 |
children | ae8e72009e64 |
comparison
equal
deleted
inserted
replaced
2826:c277e0421200 | 2827:d4fd4614f275 |
---|---|
480 | 480 |
481 bool OrthancFindRequestHandler::ApplyLuaFilter(DicomMap& target, | 481 bool OrthancFindRequestHandler::ApplyLuaFilter(DicomMap& target, |
482 const DicomMap& source, | 482 const DicomMap& source, |
483 const std::string& remoteIp, | 483 const std::string& remoteIp, |
484 const std::string& remoteAet, | 484 const std::string& remoteAet, |
485 const std::string& calledAet) | 485 const std::string& calledAet, |
486 ModalityManufacturer manufacturer) | |
486 { | 487 { |
487 static const char* LUA_CALLBACK = "IncomingFindRequestFilter"; | 488 static const char* LUA_CALLBACK = "IncomingFindRequestFilter"; |
488 | 489 |
489 LuaScripting::Lock lock(context_.GetLuaScripting()); | 490 LuaScripting::Lock lock(context_.GetLuaScripting()); |
490 | 491 |
492 { | 493 { |
493 return false; | 494 return false; |
494 } | 495 } |
495 else | 496 else |
496 { | 497 { |
497 Json::Value origin = Json::objectValue; | 498 Json::Value origin; |
498 origin["RemoteIp"] = remoteIp; | 499 FormatOrigin(origin, remoteIp, remoteAet, calledAet, manufacturer); |
499 origin["RemoteAet"] = remoteAet; | |
500 origin["CalledAet"] = calledAet; | |
501 | 500 |
502 LuaFunctionCall call(lock.GetLua(), LUA_CALLBACK); | 501 LuaFunctionCall call(lock.GetLua(), LUA_CALLBACK); |
503 call.PushDicom(source); | 502 call.PushDicom(source); |
504 call.PushJson(origin); | 503 call.PushJson(origin); |
505 FromDcmtkBridge::ExecuteToDicom(target, call); | 504 FromDcmtkBridge::ExecuteToDicom(target, call); |
530 **/ | 529 **/ |
531 | 530 |
532 DicomMap lua; | 531 DicomMap lua; |
533 const DicomMap* filteredInput = &input; | 532 const DicomMap* filteredInput = &input; |
534 | 533 |
535 if (ApplyLuaFilter(lua, input, remoteIp, remoteAet, calledAet)) | 534 if (ApplyLuaFilter(lua, input, remoteIp, remoteAet, calledAet, manufacturer)) |
536 { | 535 { |
537 filteredInput = &lua; | 536 filteredInput = &lua; |
538 } | 537 } |
539 | 538 |
540 | 539 |
673 | 672 |
674 LOG(INFO) << "Number of matching resources: " << answers.GetSize(); | 673 LOG(INFO) << "Number of matching resources: " << answers.GetSize(); |
675 | 674 |
676 answers.SetComplete(complete); | 675 answers.SetComplete(complete); |
677 } | 676 } |
677 | |
678 | |
679 void OrthancFindRequestHandler::FormatOrigin(Json::Value& origin, | |
680 const std::string& remoteIp, | |
681 const std::string& remoteAet, | |
682 const std::string& calledAet, | |
683 ModalityManufacturer manufacturer) | |
684 { | |
685 origin = Json::objectValue; | |
686 origin["RemoteIp"] = remoteIp; | |
687 origin["RemoteAet"] = remoteAet; | |
688 origin["CalledAet"] = calledAet; | |
689 origin["Manufacturer"] = EnumerationToString(manufacturer); | |
690 } | |
678 } | 691 } |