diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/client_context.h | 8 | ||||
-rw-r--r-- | include/grpc++/dynamic_thread_pool.h | 1 | ||||
-rw-r--r-- | include/grpc++/impl/sync_no_cxx11.h | 2 | ||||
-rw-r--r-- | include/grpc++/server_context.h | 7 | ||||
-rw-r--r-- | include/grpc++/server_credentials.h | 3 | ||||
-rw-r--r-- | include/grpc/census.h | 32 | ||||
-rw-r--r-- | include/grpc/grpc.h | 21 | ||||
-rw-r--r-- | include/grpc/grpc_security.h | 9 |
8 files changed, 57 insertions, 26 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 9df76699d2..5cf4d3328a 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -110,7 +110,7 @@ class ClientContext { creds_ = creds; } - grpc_compression_algorithm get_compression_algorithm() const { + grpc_compression_algorithm compression_algorithm() const { return compression_algorithm_; } @@ -119,8 +119,8 @@ class ClientContext { std::shared_ptr<const AuthContext> auth_context() const; // Get and set census context - void set_census_context(census_context* ccp) { census_context_ = ccp; } - census_context* get_census_context() const { return census_context_; } + void set_census_context(struct census_context* ccp) { census_context_ = ccp; } + struct census_context* census_context() const { return census_context_; } void TryCancel(); @@ -170,7 +170,7 @@ class ClientContext { grpc::string authority_; std::shared_ptr<Credentials> creds_; mutable std::shared_ptr<const AuthContext> auth_context_; - census_context* census_context_; + struct census_context* census_context_; std::multimap<grpc::string, grpc::string> send_initial_metadata_; std::multimap<grpc::string, grpc::string> recv_initial_metadata_; std::multimap<grpc::string, grpc::string> trailing_metadata_; diff --git a/include/grpc++/dynamic_thread_pool.h b/include/grpc++/dynamic_thread_pool.h index bc4e2d4d74..f0cd35940f 100644 --- a/include/grpc++/dynamic_thread_pool.h +++ b/include/grpc++/dynamic_thread_pool.h @@ -41,6 +41,7 @@ #include <grpc++/thread_pool_interface.h> #include <list> +#include <memory> #include <queue> namespace grpc { diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h index fda668957e..5869b04c76 100644 --- a/include/grpc++/impl/sync_no_cxx11.h +++ b/include/grpc++/impl/sync_no_cxx11.h @@ -87,7 +87,7 @@ class condition_variable { ~condition_variable() { gpr_cv_destroy(&cv_); } void wait(lock_guard<mutex> &mu) { mu.locked = false; - gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME); + gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME)); mu.locked = true; } void notify_one() { gpr_cv_signal(&cv_); } diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index 3bfa48fbb6..e204d66456 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -46,6 +46,7 @@ struct gpr_timespec; struct grpc_metadata; struct grpc_call; +struct census_context; namespace grpc { @@ -104,18 +105,20 @@ class ServerContext { return client_metadata_; } - grpc_compression_level get_compression_level() const { + grpc_compression_level compression_level() const { return compression_level_; } void set_compression_level(grpc_compression_level level); - grpc_compression_algorithm get_compression_algorithm() const { + grpc_compression_algorithm compression_algorithm() const { return compression_algorithm_; } void set_compression_algorithm(grpc_compression_algorithm algorithm); std::shared_ptr<const AuthContext> auth_context() const; + const struct census_context* census_context() const; + private: friend class ::grpc::testing::InteropContextInspector; friend class ::grpc::Server; diff --git a/include/grpc++/server_credentials.h b/include/grpc++/server_credentials.h index 83ae9fd1eb..11acd67e8a 100644 --- a/include/grpc++/server_credentials.h +++ b/include/grpc++/server_credentials.h @@ -58,12 +58,15 @@ class ServerCredentials { // Options to create ServerCredentials with SSL struct SslServerCredentialsOptions { + SslServerCredentialsOptions() : force_client_auth(false) {} + struct PemKeyCertPair { grpc::string private_key; grpc::string cert_chain; }; grpc::string pem_root_certs; std::vector<PemKeyCertPair> pem_key_cert_pairs; + bool force_client_auth; }; // Builds SSL ServerCredentials given SSL specific options diff --git a/include/grpc/census.h b/include/grpc/census.h index 379783905a..7603dfdce1 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -44,26 +44,30 @@ extern "C" { #endif -/* Identify census functionality that can be enabled via census_initialize(). */ -enum census_functions { - CENSUS_NONE = 0, /* Do not enable census. */ - CENSUS_TRACING = 1, /* Enable census tracing. */ - CENSUS_STATS = 2, /* Enable Census stats collection. */ - CENSUS_CPU = 4, /* Enable Census CPU usage collection. */ - CENSUS_ALL = CENSUS_TRACING | CENSUS_STATS | CENSUS_CPU +/* Identify census features that can be enabled via census_initialize(). */ +enum census_features { + CENSUS_FEATURE_NONE = 0, /* Do not enable census. */ + CENSUS_FEATURE_TRACING = 1, /* Enable census tracing. */ + CENSUS_FEATURE_STATS = 2, /* Enable Census stats collection. */ + CENSUS_FEATURE_CPU = 4, /* Enable Census CPU usage collection. */ + CENSUS_FEATURE_ALL = + CENSUS_FEATURE_TRACING | CENSUS_FEATURE_STATS | CENSUS_FEATURE_CPU }; -/* Shutdown and startup census subsystem. The 'functions' argument should be - * the OR (|) of census_functions values. If census fails to initialize, then +/** Shutdown and startup census subsystem. The 'features' argument should be + * the OR (|) of census_features values. If census fails to initialize, then * census_initialize() will return a non-zero value. It is an error to call * census_initialize() more than once (without an intervening * census_shutdown()). */ -int census_initialize(int functions); -void census_shutdown(); +int census_initialize(int features); +void census_shutdown(void); -/* If any census feature has been initialized, this funtion will return a - * non-zero value. */ -int census_available(); +/** Return the features supported by the current census implementation (not all + * features will be available on all platforms). */ +int census_supported(void); + +/** Return the census features currently enabled. */ +int census_enabled(void); /* Internally, Census relies on a context, which should be propagated across * RPC's. From the RPC subsystems viewpoint, this is an opaque data structure. diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 9d397225ce..b33d2cd68c 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -406,6 +406,23 @@ void grpc_completion_queue_shutdown(grpc_completion_queue *cq); drained and no threads are executing grpc_completion_queue_next */ void grpc_completion_queue_destroy(grpc_completion_queue *cq); +/** Check the connectivity state of a channel. */ +grpc_connectivity_state grpc_channel_check_connectivity_state( + grpc_channel *channel, int try_to_connect); + +/** Watch for a change in connectivity state. + Once the channel connectivity state is different from last_observed_state, + tag will be enqueued on cq with success=1. + If deadline expires BEFORE the state is changed, tag will be enqueued on cq + with success=0. + If optional_new_state is non-NULL, it will be set to the newly observed + connectivity state of the channel at the same point as tag is enqueued onto + the completion queue. */ +void grpc_channel_watch_connectivity_state( + grpc_channel *channel, grpc_connectivity_state last_observed_state, + grpc_connectivity_state *optional_new_state, gpr_timespec deadline, + grpc_completion_queue *cq, void *tag); + /** Create a call given a grpc_channel, in order to call 'method'. All completions are sent to 'completion_queue'. 'method' and 'host' need only live through the invocation of this function. */ @@ -466,8 +483,8 @@ char *grpc_channel_get_target(grpc_channel *channel); clients will want to simply pass NULL. See grpc_channel_args definition for more on this. The data in 'args' need only live through the invocation of this function. */ -grpc_channel *grpc_channel_create(const char *target, - const grpc_channel_args *args); +grpc_channel *grpc_insecure_channel_create(const char *target, + const grpc_channel_args *args); /** Create a lame client: this client fails every operation attempted on it. */ grpc_channel *grpc_lame_client_channel_create(const char *target); diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 29eddc57a8..ff84050c6d 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -87,7 +87,7 @@ typedef struct { directory). - pem_key_cert_pair is a pointer on the object containing client's private key and certificate chain. This parameter can be NULL if the client does - not have such a key/cert pair. */ + not have such a key/cert pair. */ grpc_credentials *grpc_ssl_credentials_create( const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair); @@ -174,10 +174,13 @@ void grpc_server_credentials_release(grpc_server_credentials *creds); - pem_key_cert_pairs is an array private key / certificate chains of the server. This parameter cannot be NULL. - num_key_cert_pairs indicates the number of items in the private_key_files - and cert_chain_files parameters. It should be at least 1. */ + and cert_chain_files parameters. It should be at least 1. + - force_client_auth, if set to non-zero will force the client to authenticate + with an SSL cert. Note that this option is ignored if pem_root_certs is + NULL. */ grpc_server_credentials *grpc_ssl_server_credentials_create( const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, - size_t num_key_cert_pairs); + size_t num_key_cert_pairs, int force_client_auth); /* --- Server-side secure ports. --- */ |