Mercurial > hg > orthanc
changeset 3413:f09bfdea3fc3
rename
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Jun 2019 14:02:57 +0200 |
parents | 327bace7e98a |
children | b9cba6a91780 |
files | Plugins/Engine/OrthancPlugins.cpp Plugins/Engine/OrthancPlugins.h Plugins/Include/orthanc/OrthancCPlugin.h Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Plugins/Samples/Common/OrthancPluginCppWrapper.h |
diffstat | 5 files changed, 119 insertions(+), 119 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Sat Jun 08 20:49:39 2019 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Tue Jun 11 14:02:57 2019 +0200 @@ -1030,14 +1030,14 @@ - class OrthancPlugins::StreamingHttpRequest : public HttpClient::IRequestBody + class OrthancPlugins::ChunkedHttpRequest : public HttpClient::IRequestBody { private: - const _OrthancPluginStreamingHttpClient& params_; - PluginsErrorDictionary& errorDictionary_; + const _OrthancPluginChunkedHttpClient& params_; + PluginsErrorDictionary& errorDictionary_; public: - StreamingHttpRequest(const _OrthancPluginStreamingHttpClient& params, + ChunkedHttpRequest(const _OrthancPluginChunkedHttpClient& params, PluginsErrorDictionary& errorDictionary) : params_(params), errorDictionary_(errorDictionary) @@ -1078,14 +1078,14 @@ }; - class OrthancPlugins::StreamingHttpAnswer : public HttpClient::IAnswer + class OrthancPlugins::ChunkedHttpAnswer : public HttpClient::IAnswer { private: - const _OrthancPluginStreamingHttpClient& params_; - PluginsErrorDictionary& errorDictionary_; + const _OrthancPluginChunkedHttpClient& params_; + PluginsErrorDictionary& errorDictionary_; public: - StreamingHttpAnswer(const _OrthancPluginStreamingHttpClient& params, + ChunkedHttpAnswer(const _OrthancPluginChunkedHttpClient& params, PluginsErrorDictionary& errorDictionary) : params_(params), errorDictionary_(errorDictionary) @@ -2291,10 +2291,10 @@ } - static void ExecuteHttpClientWithoutStream(uint16_t& httpStatus, - OrthancPluginMemoryBuffer* answerBody, - OrthancPluginMemoryBuffer* answerHeaders, - HttpClient& client) + static void ExecuteHttpClientWithoutChunkedBody(uint16_t& httpStatus, + OrthancPluginMemoryBuffer* answerBody, + OrthancPluginMemoryBuffer* answerHeaders, + HttpClient& client) { if (answerBody == NULL) { @@ -2369,7 +2369,7 @@ } uint16_t status; - ExecuteHttpClientWithoutStream(status, p.target, NULL, client); + ExecuteHttpClientWithoutChunkedBody(status, p.target, NULL, client); } @@ -2391,14 +2391,14 @@ } SetupHttpClient(client, p); - ExecuteHttpClientWithoutStream(*p.httpStatus, p.answerBody, p.answerHeaders, client); + ExecuteHttpClientWithoutChunkedBody(*p.httpStatus, p.answerBody, p.answerHeaders, client); } - void OrthancPlugins::StreamingHttpClient(const void* parameters) + void OrthancPlugins::ChunkedHttpClient(const void* parameters) { - const _OrthancPluginStreamingHttpClient& p = - *reinterpret_cast<const _OrthancPluginStreamingHttpClient*>(parameters); + const _OrthancPluginChunkedHttpClient& p = + *reinterpret_cast<const _OrthancPluginChunkedHttpClient*>(parameters); if (p.httpStatus == NULL) { @@ -2432,10 +2432,10 @@ SetupHttpClient(client, converted); } - StreamingHttpRequest body(p, pimpl_->dictionary_); + ChunkedHttpRequest body(p, pimpl_->dictionary_); client.SetBody(body); - StreamingHttpAnswer answer(p, pimpl_->dictionary_); + ChunkedHttpAnswer answer(p, pimpl_->dictionary_); bool success = client.Apply(answer); @@ -3126,8 +3126,8 @@ CallHttpClient2(parameters); return true; - case _OrthancPluginService_StreamingHttpClient: - StreamingHttpClient(parameters); + case _OrthancPluginService_ChunkedHttpClient: + ChunkedHttpClient(parameters); return true; case _OrthancPluginService_ConvertPixelFormat:
--- a/Plugins/Engine/OrthancPlugins.h Sat Jun 08 20:49:39 2019 +0200 +++ b/Plugins/Engine/OrthancPlugins.h Tue Jun 11 14:02:57 2019 +0200 @@ -89,8 +89,8 @@ class WorklistHandler; class FindHandler; class MoveHandler; - class StreamingHttpRequest; - class StreamingHttpAnswer; + class ChunkedHttpRequest; + class ChunkedHttpAnswer; class MultipartStream; void RegisterRestCallback(const void* parameters, @@ -169,7 +169,7 @@ void CallHttpClient2(const void* parameters); - void StreamingHttpClient(const void* parameters); + void ChunkedHttpClient(const void* parameters); void CallPeerApi(const void* parameters);
--- a/Plugins/Include/orthanc/OrthancCPlugin.h Sat Jun 08 20:49:39 2019 +0200 +++ b/Plugins/Include/orthanc/OrthancCPlugin.h Tue Jun 11 14:02:57 2019 +0200 @@ -430,7 +430,7 @@ _OrthancPluginService_SetMetricsValue = 31, _OrthancPluginService_EncodeDicomWebJson = 32, _OrthancPluginService_EncodeDicomWebXml = 33, - _OrthancPluginService_StreamingHttpClient = 34, /* New in Orthanc 1.5.7 */ + _OrthancPluginService_ChunkedHttpClient = 34, /* New in Orthanc 1.5.7 */ /* Registration of callbacks */ _OrthancPluginService_RegisterRestCallback = 1000, @@ -6810,74 +6810,74 @@ - typedef OrthancPluginErrorCode (*OrthancPluginHttpAnswerStreamAddHeader) (void* answer, - const char* key, - const char* value); - - typedef OrthancPluginErrorCode (*OrthancPluginHttpAnswerStreamAddChunk) (void* answer, - const void* data, - uint32_t size); - - typedef uint8_t (*OrthancPluginHttpRequestStreamIsDone) (void* request); - - typedef OrthancPluginErrorCode (*OrthancPluginHttpRequestStreamNext) (void* request); - - typedef const void* (*OrthancPluginHttpRequestStreamGetChunkData) (void* request); - - typedef uint32_t (*OrthancPluginHttpRequestStreamGetChunkSize) (void* request); + typedef OrthancPluginErrorCode (*OrthancPluginChunkedHttpAnswerAddHeader) (void* answer, + const char* key, + const char* value); + + typedef OrthancPluginErrorCode (*OrthancPluginChunkedHttpAnswerAddChunk) (void* answer, + const void* data, + uint32_t size); + + typedef uint8_t (*OrthancPluginChunkedHttpRequestIsDone) (void* request); + + typedef OrthancPluginErrorCode (*OrthancPluginChunkedHttpRequestNext) (void* request); + + typedef const void* (*OrthancPluginChunkedHttpRequestGetChunkData) (void* request); + + typedef uint32_t (*OrthancPluginChunkedHttpRequestGetChunkSize) (void* request); typedef struct { - void* answer; - OrthancPluginHttpAnswerStreamAddChunk answerAddChunk; - OrthancPluginHttpAnswerStreamAddHeader answerAddHeader; - uint16_t* httpStatus; - OrthancPluginHttpMethod method; - const char* url; - uint32_t headersCount; - const char* const* headersKeys; - const char* const* headersValues; - void* request; - OrthancPluginHttpRequestStreamIsDone requestIsDone; - OrthancPluginHttpRequestStreamGetChunkData requestChunkData; - OrthancPluginHttpRequestStreamGetChunkSize requestChunkSize; - OrthancPluginHttpRequestStreamNext requestNext; - const char* username; - const char* password; - uint32_t timeout; - const char* certificateFile; - const char* certificateKeyFile; - const char* certificateKeyPassword; - uint8_t pkcs11; - } _OrthancPluginStreamingHttpClient; - - ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginStreamingHttpClient( - OrthancPluginContext* context, - void* answer, - OrthancPluginHttpAnswerStreamAddChunk answerAddChunk, - OrthancPluginHttpAnswerStreamAddHeader answerAddHeader, - uint16_t* httpStatus, - OrthancPluginHttpMethod method, - const char* url, - uint32_t headersCount, - const char* const* headersKeys, - const char* const* headersValues, - void* request, - OrthancPluginHttpRequestStreamIsDone requestIsDone, - OrthancPluginHttpRequestStreamGetChunkData requestChunkData, - OrthancPluginHttpRequestStreamGetChunkSize requestChunkSize, - OrthancPluginHttpRequestStreamNext requestNext, - const char* username, - const char* password, - uint32_t timeout, - const char* certificateFile, - const char* certificateKeyFile, - const char* certificateKeyPassword, - uint8_t pkcs11) - { - _OrthancPluginStreamingHttpClient params; + void* answer; + OrthancPluginChunkedHttpAnswerAddChunk answerAddChunk; + OrthancPluginChunkedHttpAnswerAddHeader answerAddHeader; + uint16_t* httpStatus; + OrthancPluginHttpMethod method; + const char* url; + uint32_t headersCount; + const char* const* headersKeys; + const char* const* headersValues; + void* request; + OrthancPluginChunkedHttpRequestIsDone requestIsDone; + OrthancPluginChunkedHttpRequestGetChunkData requestChunkData; + OrthancPluginChunkedHttpRequestGetChunkSize requestChunkSize; + OrthancPluginChunkedHttpRequestNext requestNext; + const char* username; + const char* password; + uint32_t timeout; + const char* certificateFile; + const char* certificateKeyFile; + const char* certificateKeyPassword; + uint8_t pkcs11; + } _OrthancPluginChunkedHttpClient; + + ORTHANC_PLUGIN_INLINE OrthancPluginErrorCode OrthancPluginChunkedHttpClient( + OrthancPluginContext* context, + void* answer, + OrthancPluginChunkedHttpAnswerAddChunk answerAddChunk, + OrthancPluginChunkedHttpAnswerAddHeader answerAddHeader, + uint16_t* httpStatus, + OrthancPluginHttpMethod method, + const char* url, + uint32_t headersCount, + const char* const* headersKeys, + const char* const* headersValues, + void* request, + OrthancPluginChunkedHttpRequestIsDone requestIsDone, + OrthancPluginChunkedHttpRequestGetChunkData requestChunkData, + OrthancPluginChunkedHttpRequestGetChunkSize requestChunkSize, + OrthancPluginChunkedHttpRequestNext requestNext, + const char* username, + const char* password, + uint32_t timeout, + const char* certificateFile, + const char* certificateKeyFile, + const char* certificateKeyPassword, + uint8_t pkcs11) + { + _OrthancPluginChunkedHttpClient params; memset(¶ms, 0, sizeof(params)); /* In common with OrthancPluginHttpClient() */ @@ -6895,7 +6895,7 @@ params.certificateKeyPassword = certificateKeyPassword; params.pkcs11 = pkcs11; - /* For streaming */ + /* For chunked body/answer */ params.answer = answer; params.answerAddChunk = answerAddChunk; params.answerAddHeader = answerAddHeader; @@ -6905,7 +6905,7 @@ params.requestChunkSize = requestChunkSize; params.requestNext = requestNext; - return context->InvokeService(context, _OrthancPluginService_StreamingHttpClient, ¶ms); + return context->InvokeService(context, _OrthancPluginService_ChunkedHttpClient, ¶ms); }
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Sat Jun 08 20:49:39 2019 +0200 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.cpp Tue Jun 11 14:02:57 2019 +0200 @@ -2157,7 +2157,7 @@ }; -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 static OrthancPluginErrorCode AnswerAddHeaderCallback(void* answer, const char* key, const char* value) @@ -2181,7 +2181,7 @@ #endif -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 static OrthancPluginErrorCode AnswerAddChunkCallback(void* answer, const void* data, uint32_t size) @@ -2210,7 +2210,7 @@ method_(OrthancPluginHttpMethod_Get), timeout_(0), pkcs11_(false), - streamingBody_(NULL) + chunkedBody_(NULL) { } @@ -2250,29 +2250,29 @@ void HttpClient::ClearBody() { - body_.clear(); - streamingBody_ = NULL; + fullBody_.clear(); + chunkedBody_ = NULL; } void HttpClient::SwapBody(std::string& body) { - body_.swap(body); - streamingBody_ = NULL; + fullBody_.swap(body); + chunkedBody_ = NULL; } void HttpClient::SetBody(const std::string& body) { - body_ = body; - streamingBody_ = NULL; + fullBody_ = body; + chunkedBody_ = NULL; } void HttpClient::SetBody(IRequestBody& body) { - body_.clear(); - streamingBody_ = &body; + fullBody_.clear(); + chunkedBody_ = &body; } @@ -2408,7 +2408,7 @@ }; -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 class MemoryAnswer : public HttpClient::IAnswer { private: @@ -2442,7 +2442,7 @@ } -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 void HttpClient::ExecuteWithStream(uint16_t& httpStatus, IAnswer& answer, IRequestBody& body) const @@ -2468,7 +2468,7 @@ RequestBodyWrapper request(body); - OrthancPluginErrorCode error = OrthancPluginStreamingHttpClient( + OrthancPluginErrorCode error = OrthancPluginChunkedHttpClient( GetGlobalContext(), &answer, AnswerAddChunkCallback, @@ -2562,16 +2562,16 @@ } -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 void HttpClient::Execute(IAnswer& answer) { - if (streamingBody_ != NULL) + if (chunkedBody_ != NULL) { - ExecuteWithStream(httpStatus_, answer, *streamingBody_); + ExecuteWithStream(httpStatus_, answer, *chunkedBody_); } else { - MemoryRequestBody wrapper(body_); + MemoryRequestBody wrapper(fullBody_); ExecuteWithStream(httpStatus_, answer, wrapper); } } @@ -2581,7 +2581,7 @@ void HttpClient::Execute(HttpHeaders& answerHeaders /* out */, std::string& answerBody /* out */) { -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 MemoryAnswer answer; Execute(answer); answerHeaders = answer.GetHeaders(); @@ -2592,12 +2592,12 @@ // higher memory usage (all chunks from the body request are sent // at once) - if (streamingBody_ != NULL) + if (chunkedBody_ != NULL) { ChunkedBuffer buffer; std::string chunk; - while (streamingBody_->ReadNextChunk(chunk)) + while (chunkedBody_->ReadNextChunk(chunk)) { buffer.AddChunk(chunk); } @@ -2609,7 +2609,7 @@ } else { - ExecuteWithoutStream(httpStatus_, answerHeaders, answerBody, body_); + ExecuteWithoutStream(httpStatus_, answerHeaders, answerBody, fullBody_); } #endif }
--- a/Plugins/Samples/Common/OrthancPluginCppWrapper.h Sat Jun 08 20:49:39 2019 +0200 +++ b/Plugins/Samples/Common/OrthancPluginCppWrapper.h Tue Jun 11 14:02:57 2019 +0200 @@ -107,9 +107,9 @@ #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7) -# define HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT 1 +# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 1 #else -# define HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT 0 +# define HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT 0 #endif #if ORTHANC_PLUGINS_VERSION_IS_ABOVE(1, 5, 7) @@ -822,7 +822,7 @@ virtual bool ReadNextChunk(std::string& chunk) = 0; }; -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 class IAnswer : public boost::noncopyable { public: @@ -853,10 +853,10 @@ std::string certificateKeyFile_; std::string certificateKeyPassword_; bool pkcs11_; - std::string body_; - IRequestBody* streamingBody_; + std::string fullBody_; + IRequestBody* chunkedBody_; -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 void ExecuteWithStream(uint16_t& httpStatus, // out IAnswer& answer, // out IRequestBody& body) const; @@ -925,7 +925,7 @@ void SetBody(IRequestBody& body); -#if HAS_ORTHANC_PLUGIN_STREAMING_HTTP_CLIENT == 1 +#if HAS_ORTHANC_PLUGIN_CHUNKED_HTTP_CLIENT == 1 void Execute(IAnswer& answer); #endif