// // // Copyright 2015 gRPC authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // /// A ClientContext allows the person implementing a service client to: /// /// - Add custom metadata key-value pairs that will propagated to the server /// side. /// - Control call settings such as compression and authentication. /// - Initial and trailing metadata coming from the server. /// - Get performance metrics (ie, census). /// /// Context settings are only relevant to the call they are invoked with, that /// is to say, they aren't sticky. Some of these settings, such as the /// compression options, can be made persistent at channel construction time /// (see \a grpc::CreateCustomChannel). /// /// \warning ClientContext instances should \em not be reused across rpcs. #ifndef GRPCPP_CLIENT_CONTEXT_H #define GRPCPP_CLIENT_CONTEXT_H #include <map> #include <memory> #include <string> #include <grpc/impl/compression_types.h> #include <grpc/impl/propagation_bits.h> #include <grpc/support/log.h> #include <grpcpp/impl/create_auth_context.h> #include <grpcpp/impl/metadata_map.h> #include <grpcpp/impl/rpc_method.h> #include <grpcpp/impl/sync.h> #include <grpcpp/security/auth_context.h> #include <grpcpp/support/client_interceptor.h> #include <grpcpp/support/config.h> #include <grpcpp/support/slice.h> #include <grpcpp/support/status.h> #include <grpcpp/support/string_ref.h> #include <grpcpp/support/time.h> struct census_context; struct grpc_call; namespace grpc { class ServerContext; class ServerContextBase; class CallbackServerContext; namespace internal { template <class InputMessage, class OutputMessage> class CallbackUnaryCallImpl; template <class Request, class Response> class ClientCallbackReaderWriterImpl; template <class Response> class ClientCallbackReaderImpl; template <class Request> class ClientCallbackWriterImpl; class ClientCallbackUnaryImpl; class ClientContextAccessor; class ClientAsyncResponseReaderHelper; } // namespace internal template <class R> class ClientReader; template <class W> class ClientWriter; template <class W, class R> class ClientReaderWriter; template <class R> class ClientAsyncReader; template <class W> class ClientAsyncWriter; template <class W, class R> class ClientAsyncReaderWriter; template <class R> class ClientAsyncResponseReader; namespace testing { class InteropClientContextInspector; class ClientContextTestPeer; } // namespace testing namespace internal { class RpcMethod; template <class InputMessage, class OutputMessage> class BlockingUnaryCallImpl; class CallOpClientRecvStatus; class CallOpRecvInitialMetadata; class ServerContextImpl; template <class InputMessage, class OutputMessage> class CallbackUnaryCallImpl; template <class Request, class Response> class ClientCallbackReaderWriterImpl; template <class Response> class ClientCallbackReaderImpl; template <class Request> class ClientCallbackWriterImpl; class ClientCallbackUnaryImpl; class ClientContextAccessor; } // namespace internal class CallCredentials; class Channel; class ChannelInterface; class CompletionQueue; /// Options for \a ClientContext::FromServerContext specifying which traits from /// the \a ServerContext to propagate (copy) from it into a new \a /// ClientContext. /// /// \see ClientContext::FromServerContext class PropagationOptions { … }; /// A ClientContext allows the person implementing a service client to: /// /// - Add custom metadata key-value pairs that will propagated to the server /// side. /// - Control call settings such as compression and authentication. /// - Initial and trailing metadata coming from the server. /// - Get performance metrics (ie, census). /// /// Context settings are only relevant to the call they are invoked with, that /// is to say, they aren't sticky. Some of these settings, such as the /// compression options, can be made persistent at channel construction time /// (see \a grpc::CreateCustomChannel). /// /// \warning ClientContext instances should \em not be reused across rpcs. /// \warning The ClientContext instance used for creating an rpc must remain /// alive and valid for the lifetime of the rpc. class ClientContext { … }; } // namespace grpc #endif // GRPCPP_CLIENT_CONTEXT_H