Mercurial > hg > orthanc
comparison OrthancServer/main.cpp @ 1172:059391d3f8df db-changes
integration mainline->db-changes
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 22 Sep 2014 13:44:08 +0200 |
parents | fd3128b2cf45 |
children | e95e7f9eba96 |
comparison
equal
deleted
inserted
replaced
1162:1ea4094d077c | 1172:059391d3f8df |
---|---|
148 }; | 148 }; |
149 | 149 |
150 | 150 |
151 class OrthancApplicationEntityFilter : public IApplicationEntityFilter | 151 class OrthancApplicationEntityFilter : public IApplicationEntityFilter |
152 { | 152 { |
153 private: | |
154 ServerContext& context_; | |
155 | |
153 public: | 156 public: |
157 OrthancApplicationEntityFilter(ServerContext& context) : context_(context) | |
158 { | |
159 } | |
160 | |
154 virtual bool IsAllowedConnection(const std::string& /*callingIp*/, | 161 virtual bool IsAllowedConnection(const std::string& /*callingIp*/, |
155 const std::string& /*callingAet*/) | 162 const std::string& /*callingAet*/) |
156 { | 163 { |
157 return true; | 164 return true; |
158 } | 165 } |
174 } | 181 } |
175 else | 182 else |
176 { | 183 { |
177 return true; | 184 return true; |
178 } | 185 } |
186 } | |
187 | |
188 virtual bool IsAllowedTransferSyntax(const std::string& callingIp, | |
189 const std::string& callingAet, | |
190 TransferSyntax syntax) | |
191 { | |
192 std::string configuration; | |
193 | |
194 switch (syntax) | |
195 { | |
196 case TransferSyntax_Deflated: | |
197 configuration = "DeflatedTransferSyntaxAccepted"; | |
198 break; | |
199 | |
200 case TransferSyntax_Jpeg: | |
201 configuration = "JpegTransferSyntaxAccepted"; | |
202 break; | |
203 | |
204 case TransferSyntax_Jpeg2000: | |
205 configuration = "Jpeg2000TransferSyntaxAccepted"; | |
206 break; | |
207 | |
208 case TransferSyntax_JpegLossless: | |
209 configuration = "JpegLosslessTransferSyntaxAccepted"; | |
210 break; | |
211 | |
212 case TransferSyntax_Jpip: | |
213 configuration = "JpipTransferSyntaxAccepted"; | |
214 break; | |
215 | |
216 case TransferSyntax_Mpeg2: | |
217 configuration = "Mpeg2TransferSyntaxAccepted"; | |
218 break; | |
219 | |
220 case TransferSyntax_Rle: | |
221 configuration = "RleTransferSyntaxAccepted"; | |
222 break; | |
223 | |
224 default: | |
225 throw OrthancException(ErrorCode_ParameterOutOfRange); | |
226 } | |
227 | |
228 { | |
229 std::string lua = "Is" + configuration; | |
230 | |
231 ServerContext::LuaContextLocker locker(context_); | |
232 | |
233 if (locker.GetLua().IsExistingFunction(lua.c_str())) | |
234 { | |
235 LuaFunctionCall call(locker.GetLua(), lua.c_str()); | |
236 call.PushString(callingAet); | |
237 call.PushString(callingIp); | |
238 return call.ExecutePredicate(); | |
239 } | |
240 } | |
241 | |
242 return Configuration::GetGlobalBoolParameter(configuration, true); | |
179 } | 243 } |
180 }; | 244 }; |
181 | 245 |
182 | 246 |
183 class MyIncomingHttpRequestFilter : public IIncomingHttpRequestFilter | 247 class MyIncomingHttpRequestFilter : public IIncomingHttpRequestFilter |
403 bool isReset = false; | 467 bool isReset = false; |
404 | 468 |
405 { | 469 { |
406 // DICOM server | 470 // DICOM server |
407 DicomServer dicomServer; | 471 DicomServer dicomServer; |
408 OrthancApplicationEntityFilter dicomFilter; | 472 OrthancApplicationEntityFilter dicomFilter(context); |
409 dicomServer.SetCalledApplicationEntityTitleCheck(Configuration::GetGlobalBoolParameter("DicomCheckCalledAet", false)); | 473 dicomServer.SetCalledApplicationEntityTitleCheck(Configuration::GetGlobalBoolParameter("DicomCheckCalledAet", false)); |
410 dicomServer.SetStoreRequestHandlerFactory(serverFactory); | 474 dicomServer.SetStoreRequestHandlerFactory(serverFactory); |
411 dicomServer.SetMoveRequestHandlerFactory(serverFactory); | 475 dicomServer.SetMoveRequestHandlerFactory(serverFactory); |
412 dicomServer.SetFindRequestHandlerFactory(serverFactory); | 476 dicomServer.SetFindRequestHandlerFactory(serverFactory); |
413 dicomServer.SetPortNumber(Configuration::GetGlobalIntegerParameter("DicomPort", 4242)); | 477 dicomServer.SetPortNumber(Configuration::GetGlobalIntegerParameter("DicomPort", 4242)); |
592 { | 656 { |
593 configurationFile = argv[i]; | 657 configurationFile = argv[i]; |
594 } | 658 } |
595 } | 659 } |
596 | 660 |
661 LOG(WARNING) << "Orthanc version: " << ORTHANC_VERSION; | |
597 | 662 |
598 int status = 0; | 663 int status = 0; |
599 try | 664 try |
600 { | 665 { |
601 for (;;) | 666 for (;;) |