aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Vizerai <jsking@google.com>2018-05-29 10:45:32 -0700
committerGravatar Vizerai <jsking@google.com>2018-05-29 10:45:32 -0700
commite501a3d3fdd63a4e8c184ff2bcb1e643dbfe4401 (patch)
treef83b87e440fe49217353e7daff913e7e6629e3e5 /include
parente1d7deeb5396691ae8ea515b0db6e778a2c0a59d (diff)
parent1bd0debdc7f57f2d51716789660b895a6c229350 (diff)
Merge branch 'master' of https://github.com/Vizerai/grpc into filter_port
Diffstat (limited to 'include')
-rw-r--r--include/grpc/grpc_security.h70
-rw-r--r--include/grpc/impl/codegen/fork.h8
-rw-r--r--include/grpc/support/log.h6
-rw-r--r--include/grpcpp/security/credentials.h16
-rw-r--r--include/grpcpp/security/server_credentials.h12
-rw-r--r--include/grpcpp/support/channel_arguments.h8
6 files changed, 115 insertions, 5 deletions
diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h
index 7c069b39d5..e1975a8e09 100644
--- a/include/grpc/grpc_security.h
+++ b/include/grpc/grpc_security.h
@@ -488,6 +488,76 @@ typedef struct {
GRPCAPI void grpc_server_credentials_set_auth_metadata_processor(
grpc_server_credentials* creds, grpc_auth_metadata_processor processor);
+/** --- ALTS channel/server credentials --- **/
+
+/**
+ * Main interface for ALTS credentials options. The options will contain
+ * information that will be passed from grpc to TSI layer such as RPC protocol
+ * versions. ALTS client (channel) and server credentials will have their own
+ * implementation of this interface. The APIs listed in this header are
+ * thread-compatible. It is used for experimental purpose for now and subject
+ * to change.
+ */
+typedef struct grpc_alts_credentials_options grpc_alts_credentials_options;
+
+/**
+ * This method creates a grpc ALTS credentials client options instance.
+ * It is used for experimental purpose for now and subject to change.
+ */
+GRPCAPI grpc_alts_credentials_options*
+grpc_alts_credentials_client_options_create();
+
+/**
+ * This method creates a grpc ALTS credentials server options instance.
+ * It is used for experimental purpose for now and subject to change.
+ */
+GRPCAPI grpc_alts_credentials_options*
+grpc_alts_credentials_server_options_create();
+
+/**
+ * This method adds a target service account to grpc client's ALTS credentials
+ * options instance. It is used for experimental purpose for now and subject
+ * to change.
+ *
+ * - options: grpc ALTS credentials options instance.
+ * - service_account: service account of target endpoint.
+ */
+GRPCAPI void grpc_alts_credentials_client_options_add_target_service_account(
+ grpc_alts_credentials_options* options, const char* service_account);
+
+/**
+ * This method destroys a grpc_alts_credentials_options instance by
+ * de-allocating all of its occupied memory. It is used for experimental purpose
+ * for now and subject to change.
+ *
+ * - options: a grpc_alts_credentials_options instance that needs to be
+ * destroyed.
+ */
+GRPCAPI void grpc_alts_credentials_options_destroy(
+ grpc_alts_credentials_options* options);
+
+/**
+ * This method creates an ALTS channel credential object. It is used for
+ * experimental purpose for now and subject to change.
+ *
+ * - options: grpc ALTS credentials options instance for client.
+ *
+ * It returns the created ALTS channel credential object.
+ */
+GRPCAPI grpc_channel_credentials* grpc_alts_credentials_create(
+ const grpc_alts_credentials_options* options);
+
+/**
+ * This method creates an ALTS server credential object. It is used for
+ * experimental purpose for now and subject to change.
+ *
+ * - options: grpc ALTS credentials options instance for server.
+ *
+ * It returns the created ALTS server credential object.
+ */
+GRPCAPI grpc_server_credentials* grpc_alts_server_credentials_create(
+ const grpc_alts_credentials_options* options);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/grpc/impl/codegen/fork.h b/include/grpc/impl/codegen/fork.h
index baec7a2f10..555df3490f 100644
--- a/include/grpc/impl/codegen/fork.h
+++ b/include/grpc/impl/codegen/fork.h
@@ -37,12 +37,12 @@
* }
*/
-void grpc_prefork();
+void grpc_prefork(void);
-void grpc_postfork_parent();
+void grpc_postfork_parent(void);
-void grpc_postfork_child();
+void grpc_postfork_child(void);
-void grpc_fork_handlers_auto_register();
+void grpc_fork_handlers_auto_register(void);
#endif /* GRPC_IMPL_CODEGEN_FORK_H */
diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h
index b6fbbde23c..1837d4bd22 100644
--- a/include/grpc/support/log.h
+++ b/include/grpc/support/log.h
@@ -99,6 +99,12 @@ GPRAPI void gpr_set_log_function(gpr_log_func func);
} \
} while (0)
+#ifndef NDEBUG
+#define GPR_DEBUG_ASSERT(x) GPR_ASSERT(x)
+#else
+#define GPR_DEBUG_ASSERT(x)
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/include/grpcpp/security/credentials.h b/include/grpcpp/security/credentials.h
index 837a0e43ed..36d95d1b42 100644
--- a/include/grpcpp/security/credentials.h
+++ b/include/grpcpp/security/credentials.h
@@ -21,6 +21,7 @@
#include <map>
#include <memory>
+#include <vector>
#include <grpcpp/impl/codegen/grpc_library.h>
#include <grpcpp/security/auth_context.h>
@@ -219,6 +220,21 @@ class MetadataCredentialsPlugin {
std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin);
+namespace experimental {
+
+/// Options used to build AltsCredentials.
+struct AltsCredentialsOptions {
+ /// service accounts of target endpoint that will be acceptable
+ /// by the client. If service accounts are provided and none of them matches
+ /// that of the server, authentication will fail.
+ std::vector<grpc::string> target_service_accounts;
+};
+
+/// Builds ALTS Credentials given ALTS specific options
+std::shared_ptr<ChannelCredentials> AltsCredentials(
+ const AltsCredentialsOptions& options);
+
+} // namespace experimental
} // namespace grpc
#endif // GRPCPP_SECURITY_CREDENTIALS_H
diff --git a/include/grpcpp/security/server_credentials.h b/include/grpcpp/security/server_credentials.h
index 892863ef54..cf57e275f5 100644
--- a/include/grpcpp/security/server_credentials.h
+++ b/include/grpcpp/security/server_credentials.h
@@ -86,6 +86,18 @@ std::shared_ptr<ServerCredentials> SslServerCredentials(
/// Builds insecure server credentials.
std::shared_ptr<ServerCredentials> InsecureServerCredentials();
+namespace experimental {
+
+/// Options to create ServerCredentials with ALTS
+struct AltsServerCredentialsOptions {
+ /// Add fields if needed.
+};
+
+/// Builds ALTS ServerCredentials given ALTS specific options
+std::shared_ptr<ServerCredentials> AltsServerCredentials(
+ const AltsServerCredentialsOptions& options);
+
+} // namespace experimental
} // namespace grpc
#endif // GRPCPP_SECURITY_SERVER_CREDENTIALS_H
diff --git a/include/grpcpp/support/channel_arguments.h b/include/grpcpp/support/channel_arguments.h
index 1eead4e1a4..217929d4ac 100644
--- a/include/grpcpp/support/channel_arguments.h
+++ b/include/grpcpp/support/channel_arguments.h
@@ -70,7 +70,13 @@ class ChannelArguments {
/// the resolver.
void SetGrpclbFallbackTimeout(int fallback_timeout);
- /// Set the socket mutator for the channel.
+ /// For client channel's, the socket mutator operates on
+ /// "channel" sockets. For server's, the socket mutator operates
+ /// only on "listen" sockets.
+ /// TODO(apolcyn): allow socket mutators to also operate
+ /// on server "channel" sockets, and adjust the socket mutator
+ /// object to be more speficic about which type of socket
+ /// it should operate on.
void SetSocketMutator(grpc_socket_mutator* mutator);
/// Set the string to prepend to the user agent.