diff options
author | unril <unril@yandex-team.ru> | 2022-02-10 16:46:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:05 +0300 |
commit | 11ae9eca250d0188b7962459cbc6706719e7dca9 (patch) | |
tree | 4b7d6755091980d33210de19b2eb35a401a761ea /contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws | |
parent | 9c914f41ba5e9f9365f404e892197553ac23809e (diff) | |
download | ydb-11ae9eca250d0188b7962459cbc6706719e7dca9.tar.gz |
Restoring authorship annotation for <unril@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws')
23 files changed, 1207 insertions, 1207 deletions
diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSAuthSigner.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSAuthSigner.h index 8061ee1e25..7e9f6c5bac 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSAuthSigner.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSAuthSigner.h @@ -13,8 +13,8 @@ #include <aws/core/utils/DateTime.h> #include <aws/core/utils/Array.h> #include <aws/core/utils/threading/ReaderWriterLock.h> -#include <aws/core/utils/crypto/Sha256.h> -#include <aws/core/utils/crypto/Sha256HMAC.h> +#include <aws/core/utils/crypto/Sha256.h> +#include <aws/core/utils/crypto/Sha256HMAC.h> #include <memory> #include <atomic> @@ -30,10 +30,10 @@ namespace Aws namespace Utils { - namespace Event - { - class Message; - } + namespace Event + { + class Message; + } } // namespace Utils namespace Auth @@ -41,8 +41,8 @@ namespace Aws class AWSCredentials; class AWSCredentialsProvider; AWS_CORE_API extern const char SIGV4_SIGNER[]; - AWS_CORE_API extern const char EVENTSTREAM_SIGV4_SIGNER[]; - AWS_CORE_API extern const char SIGNATURE[]; + AWS_CORE_API extern const char EVENTSTREAM_SIGV4_SIGNER[]; + AWS_CORE_API extern const char SIGNATURE[]; AWS_CORE_API extern const char NULL_SIGNER[]; } // namespace Auth @@ -104,20 +104,20 @@ namespace Aws } /** - * Signs a single event message in an event stream. - * The input message buffer is copied and signed. The message's input buffer will be deallocated and a new - * buffer will be assigned. The new buffer encodes the original message with its headers as the payload of - * the new message. The signature of the original message will be added as a header to the new message. - * - * A Hex encoded signature of the previous event (or of the HTTP request headers in case of the first event) - * is provided as the 'priorSignature' parameter. 'priorSignature' will contain the value of the new - * signature after this call returns successfully. - * - * The function returns true if the message is successfully signed. - */ - virtual bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const { return false; } - - /** + * Signs a single event message in an event stream. + * The input message buffer is copied and signed. The message's input buffer will be deallocated and a new + * buffer will be assigned. The new buffer encodes the original message with its headers as the payload of + * the new message. The signature of the original message will be added as a header to the new message. + * + * A Hex encoded signature of the previous event (or of the HTTP request headers in case of the first event) + * is provided as the 'priorSignature' parameter. 'priorSignature' will contain the value of the new + * signature after this call returns successfully. + * + * The function returns true if the message is successfully signed. + */ + virtual bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const { return false; } + + /** * Takes a request and signs the URI based on the HttpMethod, URI and other info from the request. * The URI can then be used in a normal HTTP call until expiration. */ @@ -271,12 +271,12 @@ namespace Aws */ bool PresignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, long long expirationInSeconds = 0) const override; - Aws::String GetServiceName() const { return m_serviceName; } - Aws::String GetRegion() const { return m_region; } - Aws::String GenerateSignature(const Aws::Auth::AWSCredentials& credentials, - const Aws::String& stringToSign, const Aws::String& simpleDate) const; - bool ShouldSignHeader(const Aws::String& header) const; - + Aws::String GetServiceName() const { return m_serviceName; } + Aws::String GetRegion() const { return m_region; } + Aws::String GenerateSignature(const Aws::Auth::AWSCredentials& credentials, + const Aws::String& stringToSign, const Aws::String& simpleDate) const; + bool ShouldSignHeader(const Aws::String& header) const; + protected: bool m_includeSha256HashHeader; @@ -316,26 +316,26 @@ namespace Aws bool m_urlEscapePath; }; - class AWS_CORE_API AWSAuthEventStreamV4Signer : public AWSAuthSigner - { - public: - AWSAuthEventStreamV4Signer(const std::shared_ptr<Auth::AWSCredentialsProvider>& credentialsProvider, - const char* serviceName, const Aws::String& region); - - const char* GetName() const override { return Aws::Auth::EVENTSTREAM_SIGV4_SIGNER; } - - bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& priorSignature) const override; + class AWS_CORE_API AWSAuthEventStreamV4Signer : public AWSAuthSigner + { + public: + AWSAuthEventStreamV4Signer(const std::shared_ptr<Auth::AWSCredentialsProvider>& credentialsProvider, + const char* serviceName, const Aws::String& region); + const char* GetName() const override { return Aws::Auth::EVENTSTREAM_SIGV4_SIGNER; } + + bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& priorSignature) const override; + bool SignRequest(Aws::Http::HttpRequest& request) const override - { + { return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), true); - } - + } + bool SignRequest(Aws::Http::HttpRequest& request, bool signBody) const override { return SignRequest(request, m_region.c_str(), m_serviceName.c_str(), signBody); } - + bool SignRequest(Aws::Http::HttpRequest& request, const char* region, bool signBody) const override { return SignRequest(request, region, m_serviceName.c_str(), signBody); @@ -343,45 +343,45 @@ namespace Aws bool SignRequest(Aws::Http::HttpRequest& request, const char* region, const char* serviceName, bool signBody) const override; - /** - * Do nothing - */ - bool PresignRequest(Aws::Http::HttpRequest&, long long) const override { return false; } - - /** - * Do nothing - */ - bool PresignRequest(Aws::Http::HttpRequest&, const char*, long long) const override { return false; } - - /** - * Do nothing - */ - bool PresignRequest(Aws::Http::HttpRequest&, const char*, const char*, long long) const override { return false; } - - bool ShouldSignHeader(const Aws::String& header) const; - private: - Utils::ByteBuffer GenerateSignature(const Aws::Auth::AWSCredentials& credentials, + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, long long) const override { return false; } + + /** + * Do nothing + */ + bool PresignRequest(Aws::Http::HttpRequest&, const char*, const char*, long long) const override { return false; } + + bool ShouldSignHeader(const Aws::String& header) const; + private: + Utils::ByteBuffer GenerateSignature(const Aws::Auth::AWSCredentials& credentials, const Aws::String& stringToSign, const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; - Utils::ByteBuffer GenerateSignature(const Aws::String& stringToSign, const Aws::Utils::ByteBuffer& key) const; - Aws::String GenerateStringToSign(const Aws::String& dateValue, const Aws::String& simpleDate, - const Aws::String& canonicalRequestHash, const Aws::String& region, - const Aws::String& serviceName) const; - Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, const Aws::String& simpleDate) const; - Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, - const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; - const Aws::String m_serviceName; - const Aws::String m_region; - mutable Aws::Utils::Crypto::Sha256 m_hash; - mutable Aws::Utils::Crypto::Sha256HMAC m_HMAC; - mutable Utils::Threading::ReaderWriterLock m_derivedKeyLock; - mutable Aws::Utils::ByteBuffer m_derivedKey; - mutable Aws::String m_currentDateStr; - mutable Aws::String m_currentSecretKey; - Aws::Vector<Aws::String> m_unsignedHeaders; - std::shared_ptr<Auth::AWSCredentialsProvider> m_credentialsProvider; - }; - - + Utils::ByteBuffer GenerateSignature(const Aws::String& stringToSign, const Aws::Utils::ByteBuffer& key) const; + Aws::String GenerateStringToSign(const Aws::String& dateValue, const Aws::String& simpleDate, + const Aws::String& canonicalRequestHash, const Aws::String& region, + const Aws::String& serviceName) const; + Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, const Aws::String& simpleDate) const; + Aws::Utils::ByteBuffer ComputeHash(const Aws::String& secretKey, + const Aws::String& simpleDate, const Aws::String& region, const Aws::String& serviceName) const; + const Aws::String m_serviceName; + const Aws::String m_region; + mutable Aws::Utils::Crypto::Sha256 m_hash; + mutable Aws::Utils::Crypto::Sha256HMAC m_HMAC; + mutable Utils::Threading::ReaderWriterLock m_derivedKeyLock; + mutable Aws::Utils::ByteBuffer m_derivedKey; + mutable Aws::String m_currentDateStr; + mutable Aws::String m_currentSecretKey; + Aws::Vector<Aws::String> m_unsignedHeaders; + std::shared_ptr<Auth::AWSCredentialsProvider> m_credentialsProvider; + }; + + /** * A no-op implementation of the AWSAuthSigner interface */ @@ -402,11 +402,11 @@ namespace Aws /** * Do nothing */ - bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const override { return true; } - - /** - * Do nothing - */ + bool SignEventMessage(Aws::Utils::Event::Message&, Aws::String& /* priorSignature */) const override { return true; } + + /** + * Do nothing + */ bool PresignRequest(Aws::Http::HttpRequest&, long long) const override { return false; } /** diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentials.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentials.h index 1c14b955fc..ce51a3c886 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentials.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentials.h @@ -2,22 +2,22 @@ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ - - #pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/utils/memory/stl/AWSString.h> + + #pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/DateTime.h> -namespace Aws -{ - namespace Auth - { - /** - * Simple data object around aws credentials - */ - class AWS_CORE_API AWSCredentials - { - public: +namespace Aws +{ + namespace Auth + { + /** + * Simple data object around aws credentials + */ + class AWS_CORE_API AWSCredentials + { + public: /** * Initializes an empty credentials set. * Empty credentials are not expired by default. @@ -26,17 +26,17 @@ namespace Aws AWSCredentials() : m_expiration((std::chrono::time_point<std::chrono::system_clock>::max)()) { } - - /** + + /** * Initializes object with accessKeyId, secretKey. * SessionToken defaults to empty string. * Expiration date is set to "never expire". - */ + */ AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey) : m_accessKeyId(accessKeyId), m_secretKey(secretKey), m_expiration((std::chrono::time_point<std::chrono::system_clock>::max)()) - { - } - + { + } + /** * Initializes object with accessKeyId, secretKey, and sessionToken. * Expiration date is set to "never expire". @@ -45,8 +45,8 @@ namespace Aws m_accessKeyId(accessKeyId), m_secretKey(secretKey), m_sessionToken(sessionToken), m_expiration((std::chrono::time_point<std::chrono::system_clock>::max)()) { } - - /** + + /** * Initializes object with accessKeyId, secretKey, sessionToken and expiration date. */ AWSCredentials(const Aws::String& accessKeyId, const Aws::String& secretKey, const Aws::String& sessionToken, Aws::Utils::DateTime expiration) : @@ -68,40 +68,40 @@ namespace Aws } /** - * If credentials haven't been initialized or been initialized to emtpy values. + * If credentials haven't been initialized or been initialized to emtpy values. * Expiration date does not affect the result of this function. - */ - inline bool IsEmpty() const { return m_accessKeyId.empty() && m_secretKey.empty(); } - + */ + inline bool IsEmpty() const { return m_accessKeyId.empty() && m_secretKey.empty(); } + inline bool IsExpired() const { return m_expiration <= Aws::Utils::DateTime::Now(); } inline bool IsExpiredOrEmpty() const { return IsEmpty() || IsExpired(); } - /** - * Gets the underlying access key credential - */ - inline const Aws::String& GetAWSAccessKeyId() const - { - return m_accessKeyId; - } - - /** - * Gets the underlying secret key credential - */ - inline const Aws::String& GetAWSSecretKey() const - { - return m_secretKey; - } - - /** - * Gets the underlying session token - */ - inline const Aws::String& GetSessionToken() const - { - return m_sessionToken; - } - - /** + /** + * Gets the underlying access key credential + */ + inline const Aws::String& GetAWSAccessKeyId() const + { + return m_accessKeyId; + } + + /** + * Gets the underlying secret key credential + */ + inline const Aws::String& GetAWSSecretKey() const + { + return m_secretKey; + } + + /** + * Gets the underlying session token + */ + inline const Aws::String& GetSessionToken() const + { + return m_sessionToken; + } + + /** * Gets the expiration date of the credential */ inline Aws::Utils::DateTime GetExpiration() const @@ -110,54 +110,54 @@ namespace Aws } /** - * Sets the underlying access key credential. Copies from parameter accessKeyId. - */ - inline void SetAWSAccessKeyId(const Aws::String& accessKeyId) - { - m_accessKeyId = accessKeyId; - } - - /** - * Sets the underlying secret key credential. Copies from parameter secretKey - */ - inline void SetAWSSecretKey(const Aws::String& secretKey) - { - m_secretKey = secretKey; - } - - /** + * Sets the underlying access key credential. Copies from parameter accessKeyId. + */ + inline void SetAWSAccessKeyId(const Aws::String& accessKeyId) + { + m_accessKeyId = accessKeyId; + } + + /** + * Sets the underlying secret key credential. Copies from parameter secretKey + */ + inline void SetAWSSecretKey(const Aws::String& secretKey) + { + m_secretKey = secretKey; + } + + /** * Sets the underlying session token. Copies from parameter sessionToken - */ - inline void SetSessionToken(const Aws::String& sessionToken) - { - m_sessionToken = sessionToken; - } - - - /** + */ + inline void SetSessionToken(const Aws::String& sessionToken) + { + m_sessionToken = sessionToken; + } + + + /** * Sets the underlying access key credential. Copies from parameter accessKeyId. */ - inline void SetAWSAccessKeyId(const char* accessKeyId) - { - m_accessKeyId = accessKeyId; - } - - /** + inline void SetAWSAccessKeyId(const char* accessKeyId) + { + m_accessKeyId = accessKeyId; + } + + /** * Sets the underlying secret key credential. Copies from parameter secretKey */ - inline void SetAWSSecretKey(const char* secretKey) - { - m_secretKey = secretKey; - } - - /** + inline void SetAWSSecretKey(const char* secretKey) + { + m_secretKey = secretKey; + } + + /** * Sets the underlying secret key credential. Copies from parameter secretKey */ - inline void SetSessionToken(const char* sessionToken) - { - m_sessionToken = sessionToken; - } - + inline void SetSessionToken(const char* sessionToken) + { + m_sessionToken = sessionToken; + } + /** * Sets the expiration date of the credential */ @@ -166,11 +166,11 @@ namespace Aws m_expiration = expiration; } - private: - Aws::String m_accessKeyId; - Aws::String m_secretKey; - Aws::String m_sessionToken; + private: + Aws::String m_accessKeyId; + Aws::String m_secretKey; + Aws::String m_sessionToken; Aws::Utils::DateTime m_expiration; - }; - } -} + }; + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h index a3a46964e8..ab98fc5ff1 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/auth/AWSCredentialsProvider.h @@ -13,8 +13,8 @@ #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/threading/ReaderWriterLock.h> #include <aws/core/internal/AWSHttpResourceClient.h> -#include <aws/core/auth/AWSCredentials.h> -#include <aws/core/config/AWSProfileConfigLoader.h> +#include <aws/core/auth/AWSCredentials.h> +#include <aws/core/config/AWSProfileConfigLoader.h> #include <aws/core/client/RetryStrategy.h> #include <memory> @@ -185,7 +185,7 @@ namespace Aws void RefreshIfExpired(); Aws::String m_profileToUse; - Aws::Config::AWSConfigFileProfileConfigLoader m_credentialsFileLoader; + Aws::Config::AWSConfigFileProfileConfigLoader m_credentialsFileLoader; long m_loadFrequencyMs; }; @@ -271,46 +271,46 @@ namespace Aws Aws::Auth::AWSCredentials m_credentials; }; - /** - * Process credentials provider that loads credentials by running another command (or program) configured in config file - * The configuration format is as following: - * credential_process = command_path <arguments_list> - * Each time the credentials needs to be refreshed, this command will be executed with configured arguments. - * The default profile name to look up this configuration is "default", same as normal aws credentials configuration and other configurations. - * The expected valid output of the command is a Json doc output to stdout: - * {"Version": 1, "AccessKeyId": "AccessKey123", "SecretAccessKey": "SecretKey321", "SessionToken": "Token123", "Expiration": "1970-01-01T00:00:01Z"} + /** + * Process credentials provider that loads credentials by running another command (or program) configured in config file + * The configuration format is as following: + * credential_process = command_path <arguments_list> + * Each time the credentials needs to be refreshed, this command will be executed with configured arguments. + * The default profile name to look up this configuration is "default", same as normal aws credentials configuration and other configurations. + * The expected valid output of the command is a Json doc output to stdout: + * {"Version": 1, "AccessKeyId": "AccessKey123", "SecretAccessKey": "SecretKey321", "SessionToken": "Token123", "Expiration": "1970-01-01T00:00:01Z"} * The Version key specifies the version of the JSON payload and must be set to 1 for now (as an integer type). - * If the Version key is bumped to 2, SDKs would support both versions of the returned payload. - * Value of Expiration field should be an valid ISO8601 formatted date string as above example. - * The expected error message of the command is a string to output to stderr. - */ - class AWS_CORE_API ProcessCredentialsProvider : public AWSCredentialsProvider - { - public: - /** - * Initializes the provider by checking default profile - */ - ProcessCredentialsProvider(); - - /** - * Initializes the provider by checking specified profile - * @param profile which profile in config file to use. - */ - ProcessCredentialsProvider(const Aws::String& profile); - - /** - * Retrieves the credentials if found, otherwise returns empty credential set. - */ - AWSCredentials GetAWSCredentials() override; - - protected: - void Reload() override; - private: - void RefreshIfExpired(); - - private: - Aws::String m_profileToUse; - Aws::Auth::AWSCredentials m_credentials; - }; + * If the Version key is bumped to 2, SDKs would support both versions of the returned payload. + * Value of Expiration field should be an valid ISO8601 formatted date string as above example. + * The expected error message of the command is a string to output to stderr. + */ + class AWS_CORE_API ProcessCredentialsProvider : public AWSCredentialsProvider + { + public: + /** + * Initializes the provider by checking default profile + */ + ProcessCredentialsProvider(); + + /** + * Initializes the provider by checking specified profile + * @param profile which profile in config file to use. + */ + ProcessCredentialsProvider(const Aws::String& profile); + + /** + * Retrieves the credentials if found, otherwise returns empty credential set. + */ + AWSCredentials GetAWSCredentials() override; + + protected: + void Reload() override; + private: + void RefreshIfExpired(); + + private: + Aws::String m_profileToUse; + Aws::Auth::AWSCredentials m_credentials; + }; } // namespace Auth } // namespace Aws diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h index 186206a66e..241bc83e06 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/AWSClient.h @@ -15,8 +15,8 @@ #include <memory> #include <atomic> -struct aws_array_list; - +struct aws_array_list; + namespace Aws { namespace Utils @@ -146,7 +146,7 @@ namespace Aws Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const char* serviceName, const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0) const; - + Aws::String GeneratePresignedUrl(const Aws::AmazonWebServiceRequest& request, Aws::Http::URI& uri, Aws::Http::HttpMethod method, const char* region, const Aws::Http::QueryStringParameterCollection& extraParams = Aws::Http::QueryStringParameterCollection(), long long expirationInSeconds = 0) const; @@ -266,23 +266,23 @@ namespace Aws * Gets the corresponding signer from the signers map by name. */ Aws::Client::AWSAuthSigner* GetSignerByName(const char* name) const; - protected: - - /** - * Creates an HttpRequest instance with the given URI and sets the proper headers from the - * AmazonWebRequest, and finally signs that request with the given the signer. - * The similar member function BuildHttpRequest() does not sign the request. - * This member function is used internally only by clients that perform requests (input operations) using - * event-streams. - */ - std::shared_ptr<Aws::Http::HttpRequest> BuildAndSignHttpRequest(const Aws::Http::URI& uri, - const Aws::AmazonWebServiceRequest& request, - Http::HttpMethod method, const char* signerName) const; - - /** - * Performs the HTTP request via the HTTP client while enforcing rate limiters - */ - std::shared_ptr<Aws::Http::HttpResponse> MakeHttpRequest(std::shared_ptr<Aws::Http::HttpRequest>& request) const; + protected: + + /** + * Creates an HttpRequest instance with the given URI and sets the proper headers from the + * AmazonWebRequest, and finally signs that request with the given the signer. + * The similar member function BuildHttpRequest() does not sign the request. + * This member function is used internally only by clients that perform requests (input operations) using + * event-streams. + */ + std::shared_ptr<Aws::Http::HttpRequest> BuildAndSignHttpRequest(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method, const char* signerName) const; + + /** + * Performs the HTTP request via the HTTP client while enforcing rate limiters + */ + std::shared_ptr<Aws::Http::HttpResponse> MakeHttpRequest(std::shared_ptr<Aws::Http::HttpRequest>& request) const; Aws::String m_region; private: /** @@ -374,8 +374,8 @@ namespace Aws const char* requestName = "", const char* signerRegionOverride = nullptr, const char* signerServiceNameOverride = nullptr) const; - - JsonOutcome MakeEventStreamRequest(std::shared_ptr<Aws::Http::HttpRequest>& request) const; + + JsonOutcome MakeEventStreamRequest(std::shared_ptr<Aws::Http::HttpRequest>& request) const; }; typedef Utils::Outcome<AmazonWebServiceResult<Utils::Xml::XmlDocument>, AWSError<CoreErrors>> XmlOutcome; @@ -435,25 +435,25 @@ namespace Aws const char* requestName = "", const char* signerRegionOverride = nullptr, const char* signerServiceNameOverride = nullptr) const; - - /** - * This is used for event stream response. - */ - XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, - const Aws::AmazonWebServiceRequest& request, - Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + + /** + * This is used for event stream response. + */ + XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, + const Aws::AmazonWebServiceRequest& request, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, const char* singerName = Aws::Auth::SIGV4_SIGNER, const char* signerRegionOverride = nullptr, const char* signerServiceNameOverride = nullptr) const; - - /** - * This is used for event stream response. + + /** + * This is used for event stream response. * requestName is used for metrics and defaults to empty string, to avoid empty names in metrics provide a valid * name. - */ - XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, - Http::HttpMethod method = Http::HttpMethod::HTTP_POST, - const char* signerName = Aws::Auth::SIGV4_SIGNER, + */ + XmlOutcome MakeRequestWithEventStream(const Aws::Http::URI& uri, + Http::HttpMethod method = Http::HttpMethod::HTTP_POST, + const char* signerName = Aws::Auth::SIGV4_SIGNER, const char* requestName = "", const char* signerRegionOverride = nullptr, const char* signerServiceNameOverride = nullptr) const; diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h index ba54baaa83..fa7337fd59 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/ClientConfiguration.h @@ -187,7 +187,7 @@ namespace Aws /** * If you certificate file is different from the default, you can tell clients that * aren't using the default trust store where to find your ca file. - * If you are on windows or apple, you likely don't want this. + * If you are on windows or apple, you likely don't want this. */ Aws::String caFile; /** @@ -218,7 +218,7 @@ namespace Aws * payload to wire if server respond error immediately after receiving the header. * Set this option to true will tell Curl to send http request header and body together. * This can save one round-trip time and especially useful when the payload is small and network latency is more important. - * But be careful when Http request has large payload such S3 PutObject. You don't want to spend long time sending a large payload just getting a error response for server. + * But be careful when Http request has large payload such S3 PutObject. You don't want to spend long time sending a large payload just getting a error response for server. * The default value will be false. */ bool disableExpectHeader; @@ -227,22 +227,22 @@ namespace Aws * If set to true clock skew will be adjusted after each http attempt, default to true. */ bool enableClockSkewAdjustment; - - /** + + /** * Enable host prefix injection. - * For services whose endpoint is injectable. e.g. servicediscovery, you can modify the http host's prefix so as to add "data-" prefix for DiscoverInstances request. + * For services whose endpoint is injectable. e.g. servicediscovery, you can modify the http host's prefix so as to add "data-" prefix for DiscoverInstances request. * Default to true, enabled. You can disable it for testing purpose. - */ - bool enableHostPrefixInjection; - - /** + */ + bool enableHostPrefixInjection; + + /** * Enable endpoint discovery * For some services to dynamically set up their endpoints for different requests. - * Defaults to false, it's an opt-in feature. - * If disabled, regional or overriden endpoint will be used instead. - * If a request requires endpoint discovery but you disabled it. The request will never succeed. - */ - bool enableEndpointDiscovery; + * Defaults to false, it's an opt-in feature. + * If disabled, regional or overriden endpoint will be used instead. + * If a request requires endpoint discovery but you disabled it. The request will never succeed. + */ + bool enableEndpointDiscovery; /** * profileName in config file that will be used by this object to reslove more configurations. diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/CoreErrors.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/CoreErrors.h index 52ebe51c82..f56bd6c7ba 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/CoreErrors.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/client/CoreErrors.h @@ -60,17 +60,17 @@ namespace Aws * Finds a CoreErrors member if possible. Otherwise, returns UNKNOWN */ AWS_CORE_API AWSError<CoreErrors> GetErrorForName(const char* errorName); - - /** - * Build the mapping between predefined exception names and Aws CoreErrors using Aws::Map. - */ - AWS_CORE_API void InitCoreErrorsMapper(); - - /** - * Cleanup memory allocated for Aws::Map used by AWS CoreError Mapper. - */ - AWS_CORE_API void CleanupCoreErrorsMapper(); + /** + * Build the mapping between predefined exception names and Aws CoreErrors using Aws::Map. + */ + AWS_CORE_API void InitCoreErrorsMapper(); + + /** + * Cleanup memory allocated for Aws::Map used by AWS CoreError Mapper. + */ + AWS_CORE_API void CleanupCoreErrorsMapper(); + /** * Finds a CoreErrors member if possible by HTTP response code */ AWS_CORE_API AWSError<CoreErrors> GetErrorForHttpResponseCode(Aws::Http::HttpResponseCode code); diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/config/AWSProfileConfigLoader.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/config/AWSProfileConfigLoader.h index 84c62713da..1ada728197 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/config/AWSProfileConfigLoader.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/config/AWSProfileConfigLoader.h @@ -6,8 +6,8 @@ #pragma once #include <aws/core/utils/memory/stl/AWSString.h> -#include <aws/core/utils/memory/stl/AWSMap.h> -#include <aws/core/auth/AWSCredentials.h> +#include <aws/core/utils/memory/stl/AWSMap.h> +#include <aws/core/auth/AWSCredentials.h> #include <aws/core/utils/DateTime.h> #include <aws/core/utils/threading/ReaderWriterLock.h> @@ -38,13 +38,13 @@ namespace Aws inline void SetExternalId(const Aws::String& value) { m_externalId = value; } inline const Aws::String& GetSourceProfile() const { return m_sourceProfile; } inline void SetSourceProfile(const Aws::String& value ) { m_sourceProfile = value; } - inline const Aws::String& GetCredentialProcess() const { return m_credentialProcess; } - inline void SetCredentialProcess(const Aws::String& value ) { m_credentialProcess = value; } + inline const Aws::String& GetCredentialProcess() const { return m_credentialProcess; } + inline void SetCredentialProcess(const Aws::String& value ) { m_credentialProcess = value; } inline void SetAllKeyValPairs(const Aws::Map<Aws::String, Aws::String>& map) { m_allKeyValPairs = map; } inline const Aws::String GetValue(const Aws::String& key) const { auto iter = m_allKeyValPairs.find(key); - if (iter == m_allKeyValPairs.end()) return {}; + if (iter == m_allKeyValPairs.end()) return {}; return iter->second; } @@ -55,7 +55,7 @@ namespace Aws Aws::String m_roleArn; Aws::String m_externalId; Aws::String m_sourceProfile; - Aws::String m_credentialProcess; + Aws::String m_credentialProcess; Aws::Map<Aws::String, Aws::String> m_allKeyValPairs; }; diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h index 9a010a67db..3645a45923 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/external/cjson/cJSON.h @@ -103,17 +103,17 @@ then using the CJSON_API_VISIBILITY flag to "export" the same symbols the way CJ */ -/* Decide calling convention based on the cmake parameters defined in C++ SDK. */ -#ifdef USE_IMPORT_EXPORT -#ifdef AWS_CORE_EXPORTS -#define CJSON_EXPORT_SYMBOLS -#else -#define CJSON_IMPORT_SYMBOLS -#endif // AWS_CORE_EXPORTS -#else -#define CJSON_HIDE_SYMBOLS -#endif // USE_IMPORT_EXPORT - +/* Decide calling convention based on the cmake parameters defined in C++ SDK. */ +#ifdef USE_IMPORT_EXPORT +#ifdef AWS_CORE_EXPORTS +#define CJSON_EXPORT_SYMBOLS +#else +#define CJSON_IMPORT_SYMBOLS +#endif // AWS_CORE_EXPORTS +#else +#define CJSON_HIDE_SYMBOLS +#endif // USE_IMPORT_EXPORT + /* export symbols by default, this is necessary for copy pasting the C and header file */ #if !defined(CJSON_HIDE_SYMBOLS) && !defined(CJSON_IMPORT_SYMBOLS) && !defined(CJSON_EXPORT_SYMBOLS) #define CJSON_EXPORT_SYMBOLS diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/HttpRequest.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/HttpRequest.h index ab71a3a29b..0859042937 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/HttpRequest.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/http/HttpRequest.h @@ -419,31 +419,31 @@ namespace Aws { SetHeaderValue(VIA_HEADER, value); } - - /** - * Has Api version header x-amz-api-version - */ - inline bool HasApiVersion() const - { - return HasHeader(API_VERSION_HEADER); - } - - /** - * Gets Api version header x-amz-api-version. - */ - inline const Aws::String& GetApiVersion() const - { - return GetHeaderValue(API_VERSION_HEADER); - } - /** - * Sets Api version header x-amz-api-version. - */ - inline void SetApiVersion(const Aws::String& value) - { - SetHeaderValue(API_VERSION_HEADER, value); - } - - /** + + /** + * Has Api version header x-amz-api-version + */ + inline bool HasApiVersion() const + { + return HasHeader(API_VERSION_HEADER); + } + + /** + * Gets Api version header x-amz-api-version. + */ + inline const Aws::String& GetApiVersion() const + { + return GetHeaderValue(API_VERSION_HEADER); + } + /** + * Sets Api version header x-amz-api-version. + */ + inline void SetApiVersion(const Aws::String& value) + { + SetHeaderValue(API_VERSION_HEADER, value); + } + + /** * Sets the closure for receiving events when data is received from the server. */ inline void SetDataReceivedEventHandler(const DataReceivedEventHandler& dataReceivedEventHandler) { m_onDataReceived = dataReceivedEventHandler; } @@ -514,15 +514,15 @@ namespace Aws */ virtual const Aws::Monitoring::HttpClientMetricsCollection& GetRequestMetrics() const { return m_httpRequestMetrics; } - /** - * Returns the IP address of the remote host the request was made out to. - * This value is populated after the request is made and when the HTTP client supports retrieving such - * information. - * If the information is not available, an empty string is returned. - */ - Aws::String GetResolvedRemoteHost() const { return m_resolvedRemoteHost; } - void SetResolvedRemoteHost(const Aws::String& ip) { m_resolvedRemoteHost = ip; } - + /** + * Returns the IP address of the remote host the request was made out to. + * This value is populated after the request is made and when the HTTP client supports retrieving such + * information. + * If the information is not available, an empty string is returned. + */ + Aws::String GetResolvedRemoteHost() const { return m_resolvedRemoteHost; } + void SetResolvedRemoteHost(const Aws::String& ip) { m_resolvedRemoteHost = ip; } + bool IsEventStreamRequest() { return m_isEvenStreamRequest; } void SetEventStreamRequest(bool eventStreamRequest) { m_isEvenStreamRequest = eventStreamRequest; } private: @@ -534,7 +534,7 @@ namespace Aws ContinueRequestHandler m_continueRequest; Aws::String m_signingRegion; Aws::String m_signingAccessKey; - Aws::String m_resolvedRemoteHost; + Aws::String m_resolvedRemoteHost; Aws::Monitoring::HttpClientMetricsCollection m_httpRequestMetrics; }; diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/DNS.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/DNS.h index 7472a386c0..51589ecacd 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/DNS.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/DNS.h @@ -12,7 +12,7 @@ namespace Aws namespace Utils { AWS_CORE_API bool IsValidDnsLabel(const Aws::String& label); - - AWS_CORE_API bool IsValidHost(const Aws::String& host); + + AWS_CORE_API bool IsValidHost(const Aws::String& host); } } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/StringUtils.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/StringUtils.h index 312342b86a..f41dccac9d 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/StringUtils.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/StringUtils.h @@ -181,13 +181,13 @@ namespace Aws return os.str(); } - /** - * locale agnostic implementation of std::isalnum - */ - static bool IsAlnum(char c) - { - return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); - } + /** + * locale agnostic implementation of std::isalnum + */ + static bool IsAlnum(char c) + { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9'); + } /** * Convert an unsigned integer to its hex string in upper case. diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h index c60dda0435..762b1aa686 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventHeader.h @@ -1,311 +1,311 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/utils/memory/stl/AWSString.h> -#include <aws/core/utils/Array.h> -#include <aws/core/utils/memory/stl/AWSMap.h> -#include <aws/core/utils/UUID.h> -#include <aws/core/utils/logging/LogMacros.h> -#include <aws/event-stream/event_stream.h> -#include <cassert> - -namespace Aws -{ - namespace Utils - { - namespace Event - { - static const char CLASS_TAG[] = "EventHeader"; - /** - * Interface of the header value of a message in event stream. - * Each type of header value should have it's own associated derived class based on this class. - */ - class AWS_CORE_API EventHeaderValue - { - public: - enum class EventHeaderType - { - BOOL_TRUE = 0, - BOOL_FALSE, - BYTE, - INT16, - INT32, - INT64, - BYTE_BUF, - STRING, - /* 64 bit integer (millis since epoch) */ - TIMESTAMP, - UUID, - UNKNOWN - }; - - EventHeaderValue() = default; - - EventHeaderValue(aws_event_stream_header_value_pair* header) : - m_eventHeaderType(static_cast<EventHeaderType>(header->header_value_type)) - { - switch (m_eventHeaderType) - { - case EventHeaderType::BOOL_TRUE: - case EventHeaderType::BOOL_FALSE: - m_eventHeaderStaticValue.boolValue = aws_event_stream_header_value_as_bool(header) != 0; - break; - case EventHeaderType::BYTE: - m_eventHeaderStaticValue.byteValue = aws_event_stream_header_value_as_byte(header); - break; - case EventHeaderType::INT16: - m_eventHeaderStaticValue.int16Value = aws_event_stream_header_value_as_int16(header); - break; - case EventHeaderType::INT32: - m_eventHeaderStaticValue.int32Value = aws_event_stream_header_value_as_int32(header); - break; - case EventHeaderType::INT64: - m_eventHeaderStaticValue.int64Value = aws_event_stream_header_value_as_int64(header); - break; - case EventHeaderType::BYTE_BUF: - m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_bytebuf(header).buffer), header->header_value_len); - break; - case EventHeaderType::STRING: - m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_string(header).buffer), header->header_value_len); - break; - case EventHeaderType::TIMESTAMP: - m_eventHeaderStaticValue.timestampValue = aws_event_stream_header_value_as_timestamp(header); - break; - case EventHeaderType::UUID: - assert(header->header_value_len == 16u); - m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_uuid(header).buffer), header->header_value_len); - break; - default: - AWS_LOG_ERROR(CLASS_TAG, "Encountered unknown type of header."); - break; - } - }; - - EventHeaderValue(const Aws::String& s) : - m_eventHeaderType(EventHeaderType::STRING), - m_eventHeaderVariableLengthValue(reinterpret_cast<const uint8_t*>(s.data()), s.length()) - { - } - - EventHeaderValue(const ByteBuffer& bb) : - m_eventHeaderType(EventHeaderType::BYTE_BUF), - m_eventHeaderVariableLengthValue(bb) - { - } - - EventHeaderValue(ByteBuffer&& bb) : - m_eventHeaderType(EventHeaderType::BYTE_BUF), - m_eventHeaderVariableLengthValue(std::move(bb)) - { - } - - - explicit EventHeaderValue(unsigned char byte) : - m_eventHeaderType(EventHeaderType::BYTE) - { - m_eventHeaderStaticValue.byteValue = byte; - } - - explicit EventHeaderValue(bool b) : - m_eventHeaderType(b ? EventHeaderType::BOOL_TRUE : EventHeaderType::BOOL_FALSE) - { - m_eventHeaderStaticValue.boolValue = b; - } - - explicit EventHeaderValue(int16_t n) : - m_eventHeaderType(EventHeaderType::INT16) - { - m_eventHeaderStaticValue.int16Value = n; - } - - explicit EventHeaderValue(int32_t n) : - m_eventHeaderType(EventHeaderType::INT32) - { - m_eventHeaderStaticValue.int32Value = n; - } - - explicit EventHeaderValue(int64_t n, EventHeaderType type = EventHeaderType::INT64) : - m_eventHeaderType(type) - { - if (type == EventHeaderType::TIMESTAMP) - { - m_eventHeaderStaticValue.timestampValue = n; - } - else - { - m_eventHeaderStaticValue.int64Value = n; - } - } - - EventHeaderType GetType() const { return m_eventHeaderType; } - - - static EventHeaderType GetEventHeaderTypeForName(const Aws::String& name); - static Aws::String GetNameForEventHeaderType(EventHeaderType value); - - /** - * Get header value as boolean. - * Log error if derived class doesn't override this function. - */ - inline bool GetEventHeaderValueAsBoolean() const - { - assert(m_eventHeaderType == EventHeaderType::BOOL_TRUE || m_eventHeaderType == EventHeaderType::BOOL_FALSE); - if (m_eventHeaderType != EventHeaderType::BOOL_TRUE && m_eventHeaderType != EventHeaderType::BOOL_FALSE) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TRUE or FALSE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return false; - } - return m_eventHeaderStaticValue.boolValue; - } - - /** - * Get header value as byte. - * Log error if derived class doesn't override this function. - */ - inline uint8_t GetEventHeaderValueAsByte() const - { - assert(m_eventHeaderType == EventHeaderType::BYTE); - if (m_eventHeaderType != EventHeaderType::BYTE) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return static_cast<uint8_t>(0); - } - return m_eventHeaderStaticValue.byteValue; - } - - /** - * Get header value as 16 bit integer. - * Log error if derived class doesn't override this function. - */ - inline int16_t GetEventHeaderValueAsInt16() const - { - assert(m_eventHeaderType == EventHeaderType::INT16); - if (m_eventHeaderType != EventHeaderType::INT16) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT16, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return static_cast<int16_t>(0); - } - return m_eventHeaderStaticValue.int16Value; - } - - /** - * Get header value as 32 bit integer. - * Log error if derived class doesn't override this function. - */ - inline int32_t GetEventHeaderValueAsInt32() const - { - assert(m_eventHeaderType == EventHeaderType::INT32); - if (m_eventHeaderType != EventHeaderType::INT32) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT32, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return static_cast<int32_t>(0); - } - return m_eventHeaderStaticValue.int32Value; - } - - /** - * Get header value as 64 bit integer. - * Log error if derived class doesn't override this function. - */ - inline int64_t GetEventHeaderValueAsInt64() const - { - assert(m_eventHeaderType == EventHeaderType::INT64); - if (m_eventHeaderType != EventHeaderType::INT64) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT64, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return static_cast<uint64_t>(0); - } - return m_eventHeaderStaticValue.int64Value; - } - - /** - * Get header value as ByteBuffer. - * Log error if derived class doesn't override this function. - */ - inline ByteBuffer GetEventHeaderValueAsBytebuf() const - { - assert(m_eventHeaderType == EventHeaderType::BYTE_BUF); - if (m_eventHeaderType != EventHeaderType::BYTE_BUF) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE_BUF, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return ByteBuffer(); - } - return m_eventHeaderVariableLengthValue; - } - - /** - * Get header value as String. - * Log error if derived class doesn't override this function. - */ - inline Aws::String GetEventHeaderValueAsString() const - { - assert(m_eventHeaderType == EventHeaderType::STRING); - if (m_eventHeaderType != EventHeaderType::STRING) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is STRING, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return {}; - } - return Aws::String(reinterpret_cast<char*>(m_eventHeaderVariableLengthValue.GetUnderlyingData()), m_eventHeaderVariableLengthValue.GetLength()); - } - - /** - * Get header value as timestamp in 64 bit integer. - * Log error if derived class doesn't override this function. - */ - inline int64_t GetEventHeaderValueAsTimestamp() const - { - assert(m_eventHeaderType == EventHeaderType::TIMESTAMP); - if (m_eventHeaderType != EventHeaderType::TIMESTAMP) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TIMESTAMP, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - return static_cast<int64_t>(0); - } - return m_eventHeaderStaticValue.timestampValue; - } - - /** - * Get header value as UUID. - * Log error if derived class doesn't override this function. - */ - inline Aws::Utils::UUID GetEventHeaderValueAsUuid() const - { - assert(m_eventHeaderType == EventHeaderType::UUID); - assert(m_eventHeaderVariableLengthValue.GetLength() == 16u); - if (m_eventHeaderType != EventHeaderType::UUID) - { - AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is UUID, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); - char uuid[32] = {0}; - return Aws::Utils::UUID(uuid); - } - return Aws::Utils::UUID(m_eventHeaderVariableLengthValue.GetUnderlyingData()); - } - - inline const ByteBuffer& GetUnderlyingBuffer() const - { - return m_eventHeaderVariableLengthValue; - } - - private: - EventHeaderType m_eventHeaderType; - ByteBuffer m_eventHeaderVariableLengthValue; - union - { - bool boolValue; - uint8_t byteValue; - int16_t int16Value; - int32_t int32Value; - int64_t int64Value; - int64_t timestampValue; - } m_eventHeaderStaticValue; - }; - - typedef std::pair<Aws::String, EventHeaderValue> EventHeaderValuePair; - typedef Aws::Map<Aws::String, EventHeaderValue> EventHeaderValueCollection; - } - } -} + */ + +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/utils/memory/stl/AWSString.h> +#include <aws/core/utils/Array.h> +#include <aws/core/utils/memory/stl/AWSMap.h> +#include <aws/core/utils/UUID.h> +#include <aws/core/utils/logging/LogMacros.h> +#include <aws/event-stream/event_stream.h> +#include <cassert> + +namespace Aws +{ + namespace Utils + { + namespace Event + { + static const char CLASS_TAG[] = "EventHeader"; + /** + * Interface of the header value of a message in event stream. + * Each type of header value should have it's own associated derived class based on this class. + */ + class AWS_CORE_API EventHeaderValue + { + public: + enum class EventHeaderType + { + BOOL_TRUE = 0, + BOOL_FALSE, + BYTE, + INT16, + INT32, + INT64, + BYTE_BUF, + STRING, + /* 64 bit integer (millis since epoch) */ + TIMESTAMP, + UUID, + UNKNOWN + }; + + EventHeaderValue() = default; + + EventHeaderValue(aws_event_stream_header_value_pair* header) : + m_eventHeaderType(static_cast<EventHeaderType>(header->header_value_type)) + { + switch (m_eventHeaderType) + { + case EventHeaderType::BOOL_TRUE: + case EventHeaderType::BOOL_FALSE: + m_eventHeaderStaticValue.boolValue = aws_event_stream_header_value_as_bool(header) != 0; + break; + case EventHeaderType::BYTE: + m_eventHeaderStaticValue.byteValue = aws_event_stream_header_value_as_byte(header); + break; + case EventHeaderType::INT16: + m_eventHeaderStaticValue.int16Value = aws_event_stream_header_value_as_int16(header); + break; + case EventHeaderType::INT32: + m_eventHeaderStaticValue.int32Value = aws_event_stream_header_value_as_int32(header); + break; + case EventHeaderType::INT64: + m_eventHeaderStaticValue.int64Value = aws_event_stream_header_value_as_int64(header); + break; + case EventHeaderType::BYTE_BUF: + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_bytebuf(header).buffer), header->header_value_len); + break; + case EventHeaderType::STRING: + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_string(header).buffer), header->header_value_len); + break; + case EventHeaderType::TIMESTAMP: + m_eventHeaderStaticValue.timestampValue = aws_event_stream_header_value_as_timestamp(header); + break; + case EventHeaderType::UUID: + assert(header->header_value_len == 16u); + m_eventHeaderVariableLengthValue = ByteBuffer(static_cast<uint8_t*>(aws_event_stream_header_value_as_uuid(header).buffer), header->header_value_len); + break; + default: + AWS_LOG_ERROR(CLASS_TAG, "Encountered unknown type of header."); + break; + } + }; + + EventHeaderValue(const Aws::String& s) : + m_eventHeaderType(EventHeaderType::STRING), + m_eventHeaderVariableLengthValue(reinterpret_cast<const uint8_t*>(s.data()), s.length()) + { + } + + EventHeaderValue(const ByteBuffer& bb) : + m_eventHeaderType(EventHeaderType::BYTE_BUF), + m_eventHeaderVariableLengthValue(bb) + { + } + + EventHeaderValue(ByteBuffer&& bb) : + m_eventHeaderType(EventHeaderType::BYTE_BUF), + m_eventHeaderVariableLengthValue(std::move(bb)) + { + } + + + explicit EventHeaderValue(unsigned char byte) : + m_eventHeaderType(EventHeaderType::BYTE) + { + m_eventHeaderStaticValue.byteValue = byte; + } + + explicit EventHeaderValue(bool b) : + m_eventHeaderType(b ? EventHeaderType::BOOL_TRUE : EventHeaderType::BOOL_FALSE) + { + m_eventHeaderStaticValue.boolValue = b; + } + + explicit EventHeaderValue(int16_t n) : + m_eventHeaderType(EventHeaderType::INT16) + { + m_eventHeaderStaticValue.int16Value = n; + } + + explicit EventHeaderValue(int32_t n) : + m_eventHeaderType(EventHeaderType::INT32) + { + m_eventHeaderStaticValue.int32Value = n; + } + + explicit EventHeaderValue(int64_t n, EventHeaderType type = EventHeaderType::INT64) : + m_eventHeaderType(type) + { + if (type == EventHeaderType::TIMESTAMP) + { + m_eventHeaderStaticValue.timestampValue = n; + } + else + { + m_eventHeaderStaticValue.int64Value = n; + } + } + + EventHeaderType GetType() const { return m_eventHeaderType; } + + + static EventHeaderType GetEventHeaderTypeForName(const Aws::String& name); + static Aws::String GetNameForEventHeaderType(EventHeaderType value); + + /** + * Get header value as boolean. + * Log error if derived class doesn't override this function. + */ + inline bool GetEventHeaderValueAsBoolean() const + { + assert(m_eventHeaderType == EventHeaderType::BOOL_TRUE || m_eventHeaderType == EventHeaderType::BOOL_FALSE); + if (m_eventHeaderType != EventHeaderType::BOOL_TRUE && m_eventHeaderType != EventHeaderType::BOOL_FALSE) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TRUE or FALSE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return false; + } + return m_eventHeaderStaticValue.boolValue; + } + + /** + * Get header value as byte. + * Log error if derived class doesn't override this function. + */ + inline uint8_t GetEventHeaderValueAsByte() const + { + assert(m_eventHeaderType == EventHeaderType::BYTE); + if (m_eventHeaderType != EventHeaderType::BYTE) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast<uint8_t>(0); + } + return m_eventHeaderStaticValue.byteValue; + } + + /** + * Get header value as 16 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int16_t GetEventHeaderValueAsInt16() const + { + assert(m_eventHeaderType == EventHeaderType::INT16); + if (m_eventHeaderType != EventHeaderType::INT16) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT16, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast<int16_t>(0); + } + return m_eventHeaderStaticValue.int16Value; + } + + /** + * Get header value as 32 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int32_t GetEventHeaderValueAsInt32() const + { + assert(m_eventHeaderType == EventHeaderType::INT32); + if (m_eventHeaderType != EventHeaderType::INT32) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT32, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast<int32_t>(0); + } + return m_eventHeaderStaticValue.int32Value; + } + + /** + * Get header value as 64 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int64_t GetEventHeaderValueAsInt64() const + { + assert(m_eventHeaderType == EventHeaderType::INT64); + if (m_eventHeaderType != EventHeaderType::INT64) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is INT64, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast<uint64_t>(0); + } + return m_eventHeaderStaticValue.int64Value; + } + + /** + * Get header value as ByteBuffer. + * Log error if derived class doesn't override this function. + */ + inline ByteBuffer GetEventHeaderValueAsBytebuf() const + { + assert(m_eventHeaderType == EventHeaderType::BYTE_BUF); + if (m_eventHeaderType != EventHeaderType::BYTE_BUF) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is BYTE_BUF, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return ByteBuffer(); + } + return m_eventHeaderVariableLengthValue; + } + + /** + * Get header value as String. + * Log error if derived class doesn't override this function. + */ + inline Aws::String GetEventHeaderValueAsString() const + { + assert(m_eventHeaderType == EventHeaderType::STRING); + if (m_eventHeaderType != EventHeaderType::STRING) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is STRING, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return {}; + } + return Aws::String(reinterpret_cast<char*>(m_eventHeaderVariableLengthValue.GetUnderlyingData()), m_eventHeaderVariableLengthValue.GetLength()); + } + + /** + * Get header value as timestamp in 64 bit integer. + * Log error if derived class doesn't override this function. + */ + inline int64_t GetEventHeaderValueAsTimestamp() const + { + assert(m_eventHeaderType == EventHeaderType::TIMESTAMP); + if (m_eventHeaderType != EventHeaderType::TIMESTAMP) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is TIMESTAMP, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + return static_cast<int64_t>(0); + } + return m_eventHeaderStaticValue.timestampValue; + } + + /** + * Get header value as UUID. + * Log error if derived class doesn't override this function. + */ + inline Aws::Utils::UUID GetEventHeaderValueAsUuid() const + { + assert(m_eventHeaderType == EventHeaderType::UUID); + assert(m_eventHeaderVariableLengthValue.GetLength() == 16u); + if (m_eventHeaderType != EventHeaderType::UUID) + { + AWS_LOGSTREAM_ERROR(CLASS_TAG, "Expected event header type is UUID, but encountered " << GetNameForEventHeaderType(m_eventHeaderType)); + char uuid[32] = {0}; + return Aws::Utils::UUID(uuid); + } + return Aws::Utils::UUID(m_eventHeaderVariableLengthValue.GetUnderlyingData()); + } + + inline const ByteBuffer& GetUnderlyingBuffer() const + { + return m_eventHeaderVariableLengthValue; + } + + private: + EventHeaderType m_eventHeaderType; + ByteBuffer m_eventHeaderVariableLengthValue; + union + { + bool boolValue; + uint8_t byteValue; + int16_t int16Value; + int32_t int32Value; + int64_t int64Value; + int64_t timestampValue; + } m_eventHeaderStaticValue; + }; + + typedef std::pair<Aws::String, EventHeaderValue> EventHeaderValuePair; + typedef Aws::Map<Aws::String, EventHeaderValue> EventHeaderValueCollection; + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventMessage.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventMessage.h index 4540fbe79c..7d8ef59914 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventMessage.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventMessage.h @@ -1,42 +1,42 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/utils/event/EventHeader.h> - -namespace Aws -{ - namespace Utils - { - namespace Event - { - extern AWS_CORE_API const char EVENT_TYPE_HEADER[]; - extern AWS_CORE_API const char CONTENT_TYPE_HEADER[]; - extern AWS_CORE_API const char MESSAGE_TYPE_HEADER[]; - extern AWS_CORE_API const char ERROR_CODE_HEADER[]; - extern AWS_CORE_API const char ERROR_MESSAGE_HEADER[]; + */ + +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/utils/event/EventHeader.h> + +namespace Aws +{ + namespace Utils + { + namespace Event + { + extern AWS_CORE_API const char EVENT_TYPE_HEADER[]; + extern AWS_CORE_API const char CONTENT_TYPE_HEADER[]; + extern AWS_CORE_API const char MESSAGE_TYPE_HEADER[]; + extern AWS_CORE_API const char ERROR_CODE_HEADER[]; + extern AWS_CORE_API const char ERROR_MESSAGE_HEADER[]; extern AWS_CORE_API const char EXCEPTION_TYPE_HEADER[]; - - /** - * A typical message in event stream consists of two parts: Prelude and Data, as well as the prelude CRC and message CRC. - * Prelude consists of total byte length and headers byte length. - * Data consists of headers and payload. - */ - class AWS_CORE_API Message - { - public: - enum class MessageType - { - UNKNOWN, - EVENT, + + /** + * A typical message in event stream consists of two parts: Prelude and Data, as well as the prelude CRC and message CRC. + * Prelude consists of total byte length and headers byte length. + * Data consists of headers and payload. + */ + class AWS_CORE_API Message + { + public: + enum class MessageType + { + UNKNOWN, + EVENT, REQUEST_LEVEL_ERROR, REQUEST_LEVEL_EXCEPTION - }; - + }; + enum class ContentType { UNKNOWN, @@ -45,78 +45,78 @@ namespace Aws TEXT_PLAIN }; - static MessageType GetMessageTypeForName(const Aws::String& name); - static Aws::String GetNameForMessageType(MessageType value); - + static MessageType GetMessageTypeForName(const Aws::String& name); + static Aws::String GetNameForMessageType(MessageType value); + static ContentType GetContentTypeForName(const Aws::String& name); static Aws::String GetNameForContentType(ContentType value); - /** - * Clean up the message, including the metadata, headers and payload received. - */ - void Reset(); - - /** - * Get/set the total length of this message: prelude(8 bytes) + prelude CRC(4 bytes) + Data(headers length + payload length) + message CRC(4 bytes). - */ - inline void SetTotalLength(size_t length) - { - m_totalLength = length; - m_eventPayload.reserve(length); - } - - inline size_t GetTotalLength() const { return m_totalLength; } - - /** - * Get/set the length of the headers. - * Each header consists of: header name byte-length(1 byte) + header name + header value type(1 byte) + header value. - */ - inline void SetHeadersLength(size_t length) { m_headersLength = length; } - inline size_t GetHeadersLength() const { return m_headersLength; } - - /** - * Get/set the length of payload. - */ - inline void SetPayloadLength(size_t length) { m_payloadLength = length; } - inline size_t GetPayloadLength() const { return m_payloadLength; } - - /** - * Set/get event headers. - */ - inline void InsertEventHeader(const Aws::String& headerName, const EventHeaderValue& eventHeaderValue) - { - m_eventHeaders.emplace(Aws::Utils::Event::EventHeaderValuePair(headerName, eventHeaderValue)); - } - - inline const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() const { return m_eventHeaders; } - - /** - * Set event payload. - */ + /** + * Clean up the message, including the metadata, headers and payload received. + */ + void Reset(); + + /** + * Get/set the total length of this message: prelude(8 bytes) + prelude CRC(4 bytes) + Data(headers length + payload length) + message CRC(4 bytes). + */ + inline void SetTotalLength(size_t length) + { + m_totalLength = length; + m_eventPayload.reserve(length); + } + + inline size_t GetTotalLength() const { return m_totalLength; } + + /** + * Get/set the length of the headers. + * Each header consists of: header name byte-length(1 byte) + header name + header value type(1 byte) + header value. + */ + inline void SetHeadersLength(size_t length) { m_headersLength = length; } + inline size_t GetHeadersLength() const { return m_headersLength; } + + /** + * Get/set the length of payload. + */ + inline void SetPayloadLength(size_t length) { m_payloadLength = length; } + inline size_t GetPayloadLength() const { return m_payloadLength; } + + /** + * Set/get event headers. + */ + inline void InsertEventHeader(const Aws::String& headerName, const EventHeaderValue& eventHeaderValue) + { + m_eventHeaders.emplace(Aws::Utils::Event::EventHeaderValuePair(headerName, eventHeaderValue)); + } + + inline const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() const { return m_eventHeaders; } + + /** + * Set event payload. + */ void WriteEventPayload(const unsigned char* data, size_t length); - void WriteEventPayload(const Aws::Vector<unsigned char>& bits); + void WriteEventPayload(const Aws::Vector<unsigned char>& bits); void WriteEventPayload(const Aws::String& bits); - /** - * Get the byte array of the payload with transferring ownership. - */ - Aws::Vector<unsigned char>&& GetEventPayloadWithOwnership() { return std::move(m_eventPayload); } - const Aws::Vector<unsigned char>& GetEventPayload() const { return m_eventPayload; } - Aws::Vector<unsigned char>& GetEventPayload() { return m_eventPayload; } - /** - * Convert byte array of the payload to string without transferring ownership. - */ - inline Aws::String GetEventPayloadAsString() { return Aws::String(m_eventPayload.begin(), m_eventPayload.end()); } - - private: - size_t m_totalLength; - size_t m_headersLength; - size_t m_payloadLength; - - Aws::Utils::Event::EventHeaderValueCollection m_eventHeaders; - Aws::Vector<unsigned char> m_eventPayload; - }; - - } - } -} + /** + * Get the byte array of the payload with transferring ownership. + */ + Aws::Vector<unsigned char>&& GetEventPayloadWithOwnership() { return std::move(m_eventPayload); } + const Aws::Vector<unsigned char>& GetEventPayload() const { return m_eventPayload; } + Aws::Vector<unsigned char>& GetEventPayload() { return m_eventPayload; } + /** + * Convert byte array of the payload to string without transferring ownership. + */ + inline Aws::String GetEventPayloadAsString() { return Aws::String(m_eventPayload.begin(), m_eventPayload.end()); } + + private: + size_t m_totalLength; + size_t m_headersLength; + size_t m_payloadLength; + + Aws::Utils::Event::EventHeaderValueCollection m_eventHeaders; + Aws::Vector<unsigned char> m_eventPayload; + }; + + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStream.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStream.h index daa9cbf57d..08f1e051be 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStream.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStream.h @@ -1,8 +1,8 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once - + */ +#pragma once + #include <aws/core/utils/event/EventDecoderStream.h> #include <aws/core/utils/event/EventEncoderStream.h> diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamBuf.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamBuf.h index ad5c440323..a22a578955 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamBuf.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamBuf.h @@ -1,52 +1,52 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <ios> -#include <aws/core/utils/event/EventStreamDecoder.h> -#include <aws/core/utils/memory/stl/AWSStringStream.h> - -namespace Aws -{ - namespace Utils - { - namespace Event - { + */ +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <ios> +#include <aws/core/utils/event/EventStreamDecoder.h> +#include <aws/core/utils/memory/stl/AWSStringStream.h> + +namespace Aws +{ + namespace Utils + { + namespace Event + { extern AWS_CORE_API const size_t DEFAULT_BUF_SIZE; - - /** - * Derived from std::streambuf, used as the underlying buffer for EventStream. - * Handle the payload from server side and pass data to underlying decoder. - */ - class AWS_CORE_API EventStreamBuf : public std::streambuf - { - public: - /** - * @param decoder decodes the stream from server side, so as to invoke related callback functions. + + /** + * Derived from std::streambuf, used as the underlying buffer for EventStream. + * Handle the payload from server side and pass data to underlying decoder. + */ + class AWS_CORE_API EventStreamBuf : public std::streambuf + { + public: + /** + * @param decoder decodes the stream from server side, so as to invoke related callback functions. * @param bufferSize The length of buffer, will be 1024 bytes by default. - */ - EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength = DEFAULT_BUF_SIZE); - virtual ~EventStreamBuf(); - - protected: - std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; - std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; - - int underflow() override; - int overflow(int ch) override; - int sync() override; - - private: - void writeToDecoder(); - - ByteBuffer m_byteBuffer; - size_t m_bufferLength; - Aws::StringStream m_err; - EventStreamDecoder& m_decoder; - }; - } - } -} + */ + EventStreamBuf(EventStreamDecoder& decoder, size_t bufferLength = DEFAULT_BUF_SIZE); + virtual ~EventStreamBuf(); + + protected: + std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + int underflow() override; + int overflow(int ch) override; + int sync() override; + + private: + void writeToDecoder(); + + ByteBuffer m_byteBuffer; + size_t m_bufferLength; + Aws::StringStream m_err; + EventStreamDecoder& m_decoder; + }; + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamDecoder.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamDecoder.h index 8f737e7bc7..f1ce3fbfbf 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamDecoder.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamDecoder.h @@ -1,109 +1,109 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/utils/Array.h> -#include <aws/core/utils/event/EventStreamHandler.h> -#include <aws/event-stream/event_stream.h> - -namespace Aws -{ - namespace Utils - { - namespace Event - { - class AWS_CORE_API EventStreamDecoder - { - public: - EventStreamDecoder(EventStreamHandler* handler); - ~EventStreamDecoder(); - - /** - * Whether or not the decoder is in good state. Return false if the decoder encounters errors. - */ + */ + +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/utils/Array.h> +#include <aws/core/utils/event/EventStreamHandler.h> +#include <aws/event-stream/event_stream.h> + +namespace Aws +{ + namespace Utils + { + namespace Event + { + class AWS_CORE_API EventStreamDecoder + { + public: + EventStreamDecoder(EventStreamHandler* handler); + ~EventStreamDecoder(); + + /** + * Whether or not the decoder is in good state. Return false if the decoder encounters errors. + */ inline explicit operator bool() const { return *m_eventStreamHandler; } - - /** - * A wrapper of aws_event_stream_streaming_decoder_pump in aws-c-event-stream. - * Pass data to the underlying decoder. - */ - void Pump(const ByteBuffer& data); - void Pump(const ByteBuffer& data, size_t length); - - /** - * Reset decoder and it's handler. - */ - void Reset(); - - /** - * Reset event stream handler of the decoder - */ - void ResetEventStreamHandler(EventStreamHandler* handler); - - protected: - /** - * Callback function invoked when payload data has been received. - * @param decoder The underlying decoder defined in the aws-c-event-stream. - * @param payload The payload data received, it doesn't belong to you, make a copy if necessary. - * @param isFinalSegment A flag indicates the current data is the last payload buffer for that message if it equals to 1. - * @param context A context pointer, will cast it to a pointer of flow handler. - */ - static void onPayloadSegment( - aws_event_stream_streaming_decoder* decoder, - aws_byte_buf* payload, - int8_t isFinalSegment, - void* context); - - /** - * Callback function invoked when a new message has arrived. - * @param decoder The underlying decoder defined in the aws-c-event-stream. - * @param prelude The metadata of the message, including total message length and header length. - * @param context A context pointer, will cast it to a pointer of flow handler. - */ - static void onPreludeReceived( - aws_event_stream_streaming_decoder* decoder, - aws_event_stream_message_prelude* prelude, - void* context); - - /** - * Callback function invoked when a header is encountered. - * @param decoder The underlying decoder defined in the aws-c-event-stream. - * @param prelude The metadata of the message, including total message length and header length. - * @param header A header of the message. - * @param context A context pointer, will cast it to a pointer of flow handler. - */ - static void onHeaderReceived( - aws_event_stream_streaming_decoder* decoder, - aws_event_stream_message_prelude* prelude, - aws_event_stream_header_value_pair* header, - void* context); - - /** - * Callback function invoked when an error is encountered. - * @param decoder The underlying decoder defined in aws-c-event-stream. - * @param prelude The metadata of the message, including total message length and header length. - * @param errorCode Error code indicates the type of the error encountered. - * @param message Error message indicates the details of the error encountered. - * @param context A context pointer, will cast it to a pointer of flow handler. - */ - static void onError( - aws_event_stream_streaming_decoder* decoder, - aws_event_stream_message_prelude* prelude, - int errorCode, - const char* message, - void* context); - - /** - * The underlying decoder defined in aws-c-event-stream. + + /** + * A wrapper of aws_event_stream_streaming_decoder_pump in aws-c-event-stream. + * Pass data to the underlying decoder. + */ + void Pump(const ByteBuffer& data); + void Pump(const ByteBuffer& data, size_t length); + + /** + * Reset decoder and it's handler. + */ + void Reset(); + + /** + * Reset event stream handler of the decoder + */ + void ResetEventStreamHandler(EventStreamHandler* handler); + + protected: + /** + * Callback function invoked when payload data has been received. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param payload The payload data received, it doesn't belong to you, make a copy if necessary. + * @param isFinalSegment A flag indicates the current data is the last payload buffer for that message if it equals to 1. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onPayloadSegment( + aws_event_stream_streaming_decoder* decoder, + aws_byte_buf* payload, + int8_t isFinalSegment, + void* context); + + /** + * Callback function invoked when a new message has arrived. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onPreludeReceived( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + void* context); + + /** + * Callback function invoked when a header is encountered. + * @param decoder The underlying decoder defined in the aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param header A header of the message. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onHeaderReceived( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + aws_event_stream_header_value_pair* header, + void* context); + + /** + * Callback function invoked when an error is encountered. + * @param decoder The underlying decoder defined in aws-c-event-stream. + * @param prelude The metadata of the message, including total message length and header length. + * @param errorCode Error code indicates the type of the error encountered. + * @param message Error message indicates the details of the error encountered. + * @param context A context pointer, will cast it to a pointer of flow handler. + */ + static void onError( + aws_event_stream_streaming_decoder* decoder, + aws_event_stream_message_prelude* prelude, + int errorCode, + const char* message, + void* context); + + /** + * The underlying decoder defined in aws-c-event-stream. * The decoder will invoke callback functions when the streaming messages received. - */ - aws_event_stream_streaming_decoder m_decoder; - EventStreamHandler* m_eventStreamHandler; - }; - } - } -} + */ + aws_event_stream_streaming_decoder m_decoder; + EventStreamHandler* m_eventStreamHandler; + }; + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamEncoder.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamEncoder.h index 3cd06a9df2..0fd7851824 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamEncoder.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamEncoder.h @@ -1,51 +1,51 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/utils/memory/stl/AWSVector.h> -#include <aws/event-stream/event_stream.h> - -namespace Aws -{ - namespace Client - { - class AWSAuthSigner; - } - - namespace Utils - { - namespace Event - { - /** - * Utility class that wraps the logic of translating event messages to their binary format according to the - * AWS streaming specification. - * This class is _not_ thread-safe. - */ - class AWS_CORE_API EventStreamEncoder - { - public: - EventStreamEncoder(Aws::Client::AWSAuthSigner* signer = nullptr); - - - void SetSignatureSeed(const Aws::String& seed) { m_signatureSeed = seed; } - - void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_signer = signer; } - - /** - * Encodes the input message in the event-stream binary format and signs the resulting bits. - * The signing is done via the signer member. - */ - Aws::Vector<unsigned char> EncodeAndSign(const Aws::Utils::Event::Message& msg); - private: - aws_event_stream_message Encode(const Aws::Utils::Event::Message& msg); - aws_event_stream_message Sign(aws_event_stream_message* msg); - Aws::Client::AWSAuthSigner* m_signer; - Aws::String m_signatureSeed; - }; - } - } -} + */ + +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/utils/memory/stl/AWSVector.h> +#include <aws/event-stream/event_stream.h> + +namespace Aws +{ + namespace Client + { + class AWSAuthSigner; + } + + namespace Utils + { + namespace Event + { + /** + * Utility class that wraps the logic of translating event messages to their binary format according to the + * AWS streaming specification. + * This class is _not_ thread-safe. + */ + class AWS_CORE_API EventStreamEncoder + { + public: + EventStreamEncoder(Aws::Client::AWSAuthSigner* signer = nullptr); + + + void SetSignatureSeed(const Aws::String& seed) { m_signatureSeed = seed; } + + void SetSigner(Aws::Client::AWSAuthSigner* signer) { m_signer = signer; } + + /** + * Encodes the input message in the event-stream binary format and signs the resulting bits. + * The signing is done via the signer member. + */ + Aws::Vector<unsigned char> EncodeAndSign(const Aws::Utils::Event::Message& msg); + private: + aws_event_stream_message Encode(const Aws::Utils::Event::Message& msg); + aws_event_stream_message Sign(aws_event_stream_message* msg); + Aws::Client::AWSAuthSigner* m_signer; + Aws::String m_signatureSeed; + }; + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamErrors.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamErrors.h index d85e4fdd1f..08789eb1a3 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamErrors.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamErrors.h @@ -1,47 +1,47 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once - -#include <aws/core/client/CoreErrors.h> -#include <aws/core/Core_EXPORTS.h> - -namespace Aws -{ - namespace Utils - { - namespace Event - { - /** - * Errors encountered in event stream. - * These errors are associated with those in aws-c-event-stream library. - */ - enum class EventStreamErrors - { - EVENT_STREAM_NO_ERROR = 0, - EVENT_STREAM_BUFFER_LENGTH_MISMATCH = 0x1000, - EVENT_STREAM_INSUFFICIENT_BUFFER_LEN, - EVENT_STREAM_MESSAGE_FIELD_SIZE_EXCEEDED, - EVENT_STREAM_PRELUDE_CHECKSUM_FAILURE, - EVENT_STREAM_MESSAGE_CHECKSUM_FAILURE, - EVENT_STREAM_MESSAGE_INVALID_HEADERS_LEN, - EVENT_STREAM_MESSAGE_UNKNOWN_HEADER_TYPE, - EVENT_STREAM_MESSAGE_PARSER_ILLEGAL_STATE, - EVENT_STREAM_UNKNOWN_ERROR - }; - - namespace EventStreamErrorsMapper - { - /** - * Get name by its error type in event stream. - */ - AWS_CORE_API const char* GetNameForError(Event::EventStreamErrors error); - /** - * Get AWSError by EventStreamError. The Error type will always be CoreErrors::UNKNOWN as an internal error in Event Stream, and it's always not retryable. - */ - AWS_CORE_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetAwsErrorForEventStreamError(Event::EventStreamErrors error); - } // namespace EventStreamErrorsMapper - } // namespace Event - } // namespace Utils -} // namespace Aws
\ No newline at end of file + */ +#pragma once + +#include <aws/core/client/CoreErrors.h> +#include <aws/core/Core_EXPORTS.h> + +namespace Aws +{ + namespace Utils + { + namespace Event + { + /** + * Errors encountered in event stream. + * These errors are associated with those in aws-c-event-stream library. + */ + enum class EventStreamErrors + { + EVENT_STREAM_NO_ERROR = 0, + EVENT_STREAM_BUFFER_LENGTH_MISMATCH = 0x1000, + EVENT_STREAM_INSUFFICIENT_BUFFER_LEN, + EVENT_STREAM_MESSAGE_FIELD_SIZE_EXCEEDED, + EVENT_STREAM_PRELUDE_CHECKSUM_FAILURE, + EVENT_STREAM_MESSAGE_CHECKSUM_FAILURE, + EVENT_STREAM_MESSAGE_INVALID_HEADERS_LEN, + EVENT_STREAM_MESSAGE_UNKNOWN_HEADER_TYPE, + EVENT_STREAM_MESSAGE_PARSER_ILLEGAL_STATE, + EVENT_STREAM_UNKNOWN_ERROR + }; + + namespace EventStreamErrorsMapper + { + /** + * Get name by its error type in event stream. + */ + AWS_CORE_API const char* GetNameForError(Event::EventStreamErrors error); + /** + * Get AWSError by EventStreamError. The Error type will always be CoreErrors::UNKNOWN as an internal error in Event Stream, and it's always not retryable. + */ + AWS_CORE_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetAwsErrorForEventStreamError(Event::EventStreamErrors error); + } // namespace EventStreamErrorsMapper + } // namespace Event + } // namespace Utils +} // namespace Aws
\ No newline at end of file diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamHandler.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamHandler.h index 257bfd8288..5b86329c18 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamHandler.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/event/EventStreamHandler.h @@ -1,147 +1,147 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ - -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/http/HttpTypes.h> -#include <aws/core/utils/event/EventHeader.h> -#include <aws/core/utils/event/EventMessage.h> -#include <aws/core/utils/event/EventStreamErrors.h> -#include <aws/core/utils/memory/stl/AWSString.h> -#include <aws/core/utils/memory/stl/AWSStreamFwd.h> -#include <aws/core/utils/memory/stl/AWSStringStream.h> -#include <cassert> - -namespace Aws -{ - namespace Utils - { - namespace Event - { - /** - * Handler of event stream. - * Includes context and callback function while scanning the event stream. - */ - class AWS_CORE_API EventStreamHandler - { - public: - EventStreamHandler() : - m_failure(false), m_internalError(EventStreamErrors::EVENT_STREAM_NO_ERROR), m_headersBytesReceived(0), m_payloadBytesReceived(0) - {} - - virtual ~EventStreamHandler() = default; - - /** - * Whether or not flow handler is in a good state. Return false if handler encounters errors. - */ - inline operator bool() const { return !m_failure; } - - /** - * Fail the handler from outside. - */ - inline void SetFailure() { m_failure = true; } - - /** - * Clean up current bytes of data received, as well as the latest message. - */ - inline virtual void Reset() - { - m_failure = false; - m_internalError = EventStreamErrors::EVENT_STREAM_NO_ERROR; - m_headersBytesReceived = 0; - m_payloadBytesReceived = 0; - - m_message.Reset(); - } - - /** - * Set internal Event Stream Errors, which is associated with errors in aws-c-event-stream library. - */ - inline void SetInternalError(int errorCode = 0) - { - m_internalError = static_cast<EventStreamErrors>(errorCode); - } - - /** - * Get internal Event Stream Errors. - */ - inline EventStreamErrors GetInternalError() - { - return m_internalError; - } - - /** - * The message is considered to completed with the following scenarios: - * 1. Message doesn't have headers or payloads. Or - * 2. Message has headers but doesn't have payloads. Or - * 3. Message has both headers and payloads. - */ - inline virtual bool IsMessageCompleted() - { - return m_message.GetHeadersLength() == m_headersBytesReceived && m_message.GetPayloadLength() == m_payloadBytesReceived; - } - - /** - * Set message metadata, including total message length, headers length and payload length. - */ - inline virtual void SetMessageMetadata(size_t totalLength, size_t headersLength, size_t payloadLength) - { - m_message.SetTotalLength(totalLength); - m_message.SetHeadersLength(headersLength); - m_message.SetPayloadLength(payloadLength); - assert(totalLength == 12/*prelude length*/ + headersLength + payloadLength + 4/*message crc length*/); - if (totalLength != headersLength + payloadLength + 16) - { - AWS_LOG_WARN("EventStreamHandler", "Message total length mismatch."); - } - } - - /** - * Write data to underlying stream, and update payload bytes received. - */ - inline virtual void WriteMessageEventPayload(const unsigned char* data, size_t dataLength) - { - m_message.WriteEventPayload(data, dataLength); - m_payloadBytesReceived += dataLength; - } - - /** - * Get underlying byte array of the message just received. - */ - inline virtual Aws::Vector<unsigned char>&& GetEventPayloadWithOwnership() { return m_message.GetEventPayloadWithOwnership(); } - - /** - * Convert underlying byte array to string without transferring ownership. - */ - inline virtual Aws::String GetEventPayloadAsString() { return m_message.GetEventPayloadAsString(); } - - /** - * Insert event header to a underlying event header value map, and update headers bytes received. - */ - inline virtual void InsertMessageEventHeader(const String& eventHeaderName, size_t eventHeaderLength, const Aws::Utils::Event::EventHeaderValue& eventHeaderValue) - { - m_message.InsertEventHeader(eventHeaderName, eventHeaderValue); - m_headersBytesReceived += eventHeaderLength; - } - - inline virtual const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() { return m_message.GetEventHeaders(); } - - /** - * Entry point of all callback functions. - * Will trigger associated functions based on m_message. + */ + +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/http/HttpTypes.h> +#include <aws/core/utils/event/EventHeader.h> +#include <aws/core/utils/event/EventMessage.h> +#include <aws/core/utils/event/EventStreamErrors.h> +#include <aws/core/utils/memory/stl/AWSString.h> +#include <aws/core/utils/memory/stl/AWSStreamFwd.h> +#include <aws/core/utils/memory/stl/AWSStringStream.h> +#include <cassert> + +namespace Aws +{ + namespace Utils + { + namespace Event + { + /** + * Handler of event stream. + * Includes context and callback function while scanning the event stream. + */ + class AWS_CORE_API EventStreamHandler + { + public: + EventStreamHandler() : + m_failure(false), m_internalError(EventStreamErrors::EVENT_STREAM_NO_ERROR), m_headersBytesReceived(0), m_payloadBytesReceived(0) + {} + + virtual ~EventStreamHandler() = default; + + /** + * Whether or not flow handler is in a good state. Return false if handler encounters errors. */ - virtual void OnEvent() = 0; - - private: - bool m_failure; - EventStreamErrors m_internalError; - size_t m_headersBytesReceived; - size_t m_payloadBytesReceived; - Aws::Utils::Event::Message m_message; - }; - } - } + inline operator bool() const { return !m_failure; } + + /** + * Fail the handler from outside. + */ + inline void SetFailure() { m_failure = true; } + + /** + * Clean up current bytes of data received, as well as the latest message. + */ + inline virtual void Reset() + { + m_failure = false; + m_internalError = EventStreamErrors::EVENT_STREAM_NO_ERROR; + m_headersBytesReceived = 0; + m_payloadBytesReceived = 0; + + m_message.Reset(); + } + + /** + * Set internal Event Stream Errors, which is associated with errors in aws-c-event-stream library. + */ + inline void SetInternalError(int errorCode = 0) + { + m_internalError = static_cast<EventStreamErrors>(errorCode); + } + + /** + * Get internal Event Stream Errors. + */ + inline EventStreamErrors GetInternalError() + { + return m_internalError; + } + + /** + * The message is considered to completed with the following scenarios: + * 1. Message doesn't have headers or payloads. Or + * 2. Message has headers but doesn't have payloads. Or + * 3. Message has both headers and payloads. + */ + inline virtual bool IsMessageCompleted() + { + return m_message.GetHeadersLength() == m_headersBytesReceived && m_message.GetPayloadLength() == m_payloadBytesReceived; + } + + /** + * Set message metadata, including total message length, headers length and payload length. + */ + inline virtual void SetMessageMetadata(size_t totalLength, size_t headersLength, size_t payloadLength) + { + m_message.SetTotalLength(totalLength); + m_message.SetHeadersLength(headersLength); + m_message.SetPayloadLength(payloadLength); + assert(totalLength == 12/*prelude length*/ + headersLength + payloadLength + 4/*message crc length*/); + if (totalLength != headersLength + payloadLength + 16) + { + AWS_LOG_WARN("EventStreamHandler", "Message total length mismatch."); + } + } + + /** + * Write data to underlying stream, and update payload bytes received. + */ + inline virtual void WriteMessageEventPayload(const unsigned char* data, size_t dataLength) + { + m_message.WriteEventPayload(data, dataLength); + m_payloadBytesReceived += dataLength; + } + + /** + * Get underlying byte array of the message just received. + */ + inline virtual Aws::Vector<unsigned char>&& GetEventPayloadWithOwnership() { return m_message.GetEventPayloadWithOwnership(); } + + /** + * Convert underlying byte array to string without transferring ownership. + */ + inline virtual Aws::String GetEventPayloadAsString() { return m_message.GetEventPayloadAsString(); } + + /** + * Insert event header to a underlying event header value map, and update headers bytes received. + */ + inline virtual void InsertMessageEventHeader(const String& eventHeaderName, size_t eventHeaderLength, const Aws::Utils::Event::EventHeaderValue& eventHeaderValue) + { + m_message.InsertEventHeader(eventHeaderName, eventHeaderValue); + m_headersBytesReceived += eventHeaderLength; + } + + inline virtual const Aws::Utils::Event::EventHeaderValueCollection& GetEventHeaders() { return m_message.GetEventHeaders(); } + + /** + * Entry point of all callback functions. + * Will trigger associated functions based on m_message. + */ + virtual void OnEvent() = 0; + + private: + bool m_failure; + EventStreamErrors m_internalError; + size_t m_headersBytesReceived; + size_t m_payloadBytesReceived; + Aws::Utils::Event::Message m_message; + }; + } + } } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/SimpleStringStream.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/SimpleStringStream.h index 45c4d0a448..867fe67d0a 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/SimpleStringStream.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/stl/SimpleStringStream.h @@ -42,7 +42,7 @@ class AWS_CORE_API SimpleStringStream : public std::iostream Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast<Aws::Utils::Stream::SimpleStreamBuf*>(&m_streamBuffer); } - Aws::String str() const { return m_streamBuffer.str(); } + Aws::String str() const { return m_streamBuffer.str(); } void str(const Aws::String& value); private: @@ -78,7 +78,7 @@ class AWS_CORE_API SimpleIStringStream : public std::istream Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast<Aws::Utils::Stream::SimpleStreamBuf*>(&m_streamBuffer); } - Aws::String str() const { return m_streamBuffer.str(); } + Aws::String str() const { return m_streamBuffer.str(); } void str(const Aws::String& value); private: @@ -114,7 +114,7 @@ class AWS_CORE_API SimpleOStringStream : public std::ostream Aws::Utils::Stream::SimpleStreamBuf* rdbuf() const { return const_cast<Aws::Utils::Stream::SimpleStreamBuf*>(&m_streamBuffer); } - Aws::String str() const { return m_streamBuffer.str(); } + Aws::String str() const { return m_streamBuffer.str(); } void str(const Aws::String& value); private: diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/ConcurrentStreamBuf.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/ConcurrentStreamBuf.h index 9ef7d9763e..d30ca478a9 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/ConcurrentStreamBuf.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/ConcurrentStreamBuf.h @@ -1,58 +1,58 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once - -#include <aws/core/Core_EXPORTS.h> -#include <aws/core/auth/AWSAuthSigner.h> -#include <aws/common/array_list.h> - -#include <mutex> -#include <condition_variable> -#include <streambuf> -#include <ios> -#include <cassert> - -namespace Aws -{ - namespace Utils - { - namespace Stream - { - /** - * A thread-safe streambuf implementation that allows simultaneous reading and writing. - * NOTE: iostreams maintain state for readers and writers. This means that you can have at most two - * concurrent threads, one for reading and one for writing. Multiple readers or multiple writers are not - * thread-safe and will result in race-conditions. - */ - class AWS_CORE_API ConcurrentStreamBuf : public std::streambuf - { - public: - - explicit ConcurrentStreamBuf(size_t bufferLength = 4 * 1024); - - void SetEof(); - - protected: - std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; - std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; - - int underflow() override; - int overflow(int ch) override; - int sync() override; - std::streamsize showmanyc() override; - - void FlushPutArea(); - - private: - Aws::Vector<unsigned char> m_getArea; - Aws::Vector<unsigned char> m_putArea; - Aws::Vector<unsigned char> m_backbuf; // used to shuttle data from the put area to the get area - std::mutex m_lock; // synchronize access to the common backbuffer - std::condition_variable m_signal; - bool m_eof; - }; - } - } -} + */ +#pragma once + +#include <aws/core/Core_EXPORTS.h> +#include <aws/core/auth/AWSAuthSigner.h> +#include <aws/common/array_list.h> + +#include <mutex> +#include <condition_variable> +#include <streambuf> +#include <ios> +#include <cassert> + +namespace Aws +{ + namespace Utils + { + namespace Stream + { + /** + * A thread-safe streambuf implementation that allows simultaneous reading and writing. + * NOTE: iostreams maintain state for readers and writers. This means that you can have at most two + * concurrent threads, one for reading and one for writing. Multiple readers or multiple writers are not + * thread-safe and will result in race-conditions. + */ + class AWS_CORE_API ConcurrentStreamBuf : public std::streambuf + { + public: + + explicit ConcurrentStreamBuf(size_t bufferLength = 4 * 1024); + + void SetEof(); + + protected: + std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + std::streampos seekpos(std::streampos pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; + + int underflow() override; + int overflow(int ch) override; + int sync() override; + std::streamsize showmanyc() override; + + void FlushPutArea(); + + private: + Aws::Vector<unsigned char> m_getArea; + Aws::Vector<unsigned char> m_putArea; + Aws::Vector<unsigned char> m_backbuf; // used to shuttle data from the put area to the get area + std::mutex m_lock; // synchronize access to the common backbuffer + std::condition_variable m_signal; + bool m_eof; + }; + } + } +} diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/PreallocatedStreamBuf.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/PreallocatedStreamBuf.h index ad9dc2a929..4e5bc0f6df 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/PreallocatedStreamBuf.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/PreallocatedStreamBuf.h @@ -41,14 +41,14 @@ namespace Aws * Get the buffer that is being used by the stream buffer. * @return Pointer to the underlying buffer (probably for a Aws::Delete() call). */ - unsigned char* GetBuffer() { return m_underlyingBuffer; } + unsigned char* GetBuffer() { return m_underlyingBuffer; } protected: pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; pos_type seekpos(pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out) override; private: - unsigned char* m_underlyingBuffer; + unsigned char* m_underlyingBuffer; const uint64_t m_lengthToRead; }; } diff --git a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/SimpleStreamBuf.h b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/SimpleStreamBuf.h index ef12c60ba3..ce0458b719 100644 --- a/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/SimpleStreamBuf.h +++ b/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/stream/SimpleStreamBuf.h @@ -37,7 +37,7 @@ namespace Stream virtual ~SimpleStreamBuf(); - Aws::String str() const; + Aws::String str() const; void str(const Aws::String& value); void swap(SimpleStreamBuf& rhs); |