diff options
Diffstat (limited to 'include/grpc++/server_context.h')
-rw-r--r-- | include/grpc++/server_context.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a4ee986df1..3bfa48fbb6 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -37,6 +37,7 @@ #include <map> #include <memory> +#include <grpc/compression.h> #include <grpc/support/time.h> #include <grpc++/auth_context.h> #include <grpc++/config.h> @@ -76,6 +77,10 @@ class CallOpBuffer; class CompletionQueue; class Server; +namespace testing { +class InteropContextInspector; +} // namespace testing + // Interface of server side rpc context. class ServerContext { public: @@ -93,17 +98,26 @@ class ServerContext { void AddInitialMetadata(const grpc::string& key, const grpc::string& value); void AddTrailingMetadata(const grpc::string& key, const grpc::string& value); - bool IsCancelled(); + bool IsCancelled() const; const std::multimap<grpc::string, grpc::string>& client_metadata() { return client_metadata_; } - std::shared_ptr<const AuthContext> auth_context() const { - return auth_context_; + grpc_compression_level get_compression_level() const { + return compression_level_; + } + void set_compression_level(grpc_compression_level level); + + grpc_compression_algorithm get_compression_algorithm() const { + return compression_algorithm_; } + void set_compression_algorithm(grpc_compression_algorithm algorithm); + + std::shared_ptr<const AuthContext> auth_context() const; private: + friend class ::grpc::testing::InteropContextInspector; friend class ::grpc::Server; template <class W, class R> friend class ::grpc::ServerAsyncReader; @@ -147,10 +161,13 @@ class ServerContext { grpc_call* call_; CompletionQueue* cq_; bool sent_initial_metadata_; - std::shared_ptr<const AuthContext> auth_context_; + mutable std::shared_ptr<const AuthContext> auth_context_; std::multimap<grpc::string, grpc::string> client_metadata_; std::multimap<grpc::string, grpc::string> initial_metadata_; std::multimap<grpc::string, grpc::string> trailing_metadata_; + + grpc_compression_level compression_level_; + grpc_compression_algorithm compression_algorithm_; }; } // namespace grpc |