Go to the documentation of this file.
90 if (
self ==
nullptr || peer ==
nullptr) {
166 if (
self ==
nullptr || protector ==
nullptr) {
168 "Invalid arguments to create_zero_copy_grpc_protector()");
181 if (
result->max_frame_size) {
182 size_t peer_max_frame_size =
result->max_frame_size;
183 max_frame_size = std::min<size_t>(peer_max_frame_size,
184 max_output_protected_frame_size ==
nullptr
186 : *max_output_protected_frame_size);
189 max_output_protected_frame_size = &max_frame_size;
191 "After Frame Size Negotiation, maximum frame size used by frame "
192 "protector equals %zu",
193 *max_output_protected_frame_size);
198 max_output_protected_frame_size, protector);
208 if (
self ==
nullptr || protector ==
nullptr) {
210 "Invalid arguments to handshaker_result_create_frame_protector()");
219 max_output_protected_frame_size, protector);
228 size_t* bytes_size) {
229 if (
self ==
nullptr ||
bytes ==
nullptr || bytes_size ==
nullptr) {
231 "Invalid arguments to handshaker_result_get_unused_bytes()");
238 *bytes_size =
result->unused_bytes_size;
243 if (
self ==
nullptr) {
276 if (identity ==
nullptr) {
282 if (peer_service_account.
size == 0) {
293 if (peer_rpc_version ==
nullptr) {
299 if (application_protocol.
size == 0) {
305 if (record_protocol.
size == 0) {
311 if (local_identity ==
nullptr) {
320 grpc_core::Zalloc<alts_tsi_handshaker_result>();
327 peer_service_account.
size);
345 local_service_account);
349 if (peer_identity ==
nullptr) {
357 while (peer_attributes_entry !=
nullptr) {
360 peer_attributes_entry));
363 peer_attributes_entry));
365 context_arena.
ptr());
366 peer_attributes_entry =
370 size_t serialized_ctx_length;
372 context, context_arena.
ptr(), &serialized_ctx_length);
373 if (serialized_ctx ==
nullptr) {
396 "ALTS handshaker on_handshaker_service_resp_recv error: %s",
421 if (handshaker->
channel ==
nullptr) {
456 if (handshaker->
channel ==
nullptr &&
461 grpc_slice slice = (received_bytes ==
nullptr || received_bytes_size == 0)
464 reinterpret_cast<const char*
>(received_bytes),
465 received_bytes_size);
514 if (continue_next_result !=
TSI_OK) {
515 next_args->
cb(continue_next_result, next_args->
user_data,
nullptr, 0,
523 size_t received_bytes_size,
const unsigned char** ,
526 if (
self ==
nullptr ||
cb ==
nullptr) {
542 args->handshaker = handshaker;
543 args->received_bytes =
nullptr;
544 args->received_bytes_size = received_bytes_size;
545 if (received_bytes_size > 0) {
546 args->received_bytes = std::unique_ptr<unsigned char>(
547 static_cast<unsigned char*
>(
gpr_zalloc(received_bytes_size)));
548 memcpy(
args->received_bytes.get(), received_bytes, received_bytes_size);
551 args->user_data = user_data;
553 grpc_schedule_on_exec_ctx);
562 handshaker, received_bytes, received_bytes_size,
cb, user_data);
578 size_t received_bytes_size,
const unsigned char** bytes_to_send,
583 bytes_to_send, bytes_to_send_size,
result,
cb,
595 if (handshaker->
client !=
nullptr) {
602 if (
self ==
nullptr) {
610 if (handshaker->
channel !=
nullptr) {
641 const char* handshaker_service_url,
bool is_client,
643 size_t user_specified_max_frame_size) {
644 if (handshaker_service_url ==
nullptr ||
self ==
nullptr ||
645 options ==
nullptr || (is_client && target_name ==
nullptr)) {
649 bool use_dedicated_cq = interested_parties ==
nullptr;
663 ? user_specified_max_frame_size
665 *
self = &handshaker->
base;
671 size_t bytes_consumed) {
709 return handshaker->
client;
const UPB_INLINE grpc_gcp_HandshakerResult * grpc_gcp_HandshakerResp_result(const grpc_gcp_HandshakerResp *msg)
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
const char * tsi_security_level_to_string(tsi_security_level security_level)
char * handshaker_service_url
tsi_result alts_handshaker_client_start_server(alts_handshaker_client *client, grpc_slice *bytes_received)
alts_shared_resource_dedicated * grpc_alts_get_shared_resource_dedicated(void)
GRPCAPI void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
const tsi_handshaker_vtable * vtable
UPB_INLINE upb_StringView grpc_gcp_Identity_service_account(const grpc_gcp_Identity *msg)
alts_handshaker_client * client
static const grpc_transport_vtable vtable
static void on_handshaker_service_resp_recv(void *arg, grpc_error_handle error)
tsi_peer_property * properties
static void on_handshaker_service_resp_recv_dedicated(void *arg, grpc_error_handle)
UPB_INLINE void grpc_gcp_AltsContext_set_security_level(grpc_gcp_AltsContext *msg, int32_t value)
struct grpc_gcp_Identity_AttributesEntry grpc_gcp_Identity_AttributesEntry
tsi_result alts_create_frame_protector(const uint8_t *key, size_t key_size, bool is_client, bool is_rekey, size_t *max_protected_frame_size, tsi_frame_protector **self)
return memset(p, 0, total)
UPB_INLINE upb_StringView grpc_gcp_Identity_AttributesEntry_key(const grpc_gcp_Identity_AttributesEntry *msg)
UPB_INLINE upb_StringView grpc_gcp_HandshakerResult_key_data(const grpc_gcp_HandshakerResult *msg)
#define TSI_SECURITY_LEVEL_PEER_PROPERTY
struct grpc_pollset_set grpc_pollset_set
bool has_created_handshaker_client
UPB_INLINE upb_StringView grpc_gcp_HandshakerResult_record_protocol(const grpc_gcp_HandshakerResult *msg)
GPRAPI void gpr_free(void *ptr)
const UPB_INLINE grpc_gcp_Identity * grpc_gcp_HandshakerResult_peer_identity(const grpc_gcp_HandshakerResult *msg)
UPB_INLINE grpc_gcp_AltsContext * grpc_gcp_AltsContext_new(upb_Arena *arena)
const size_t kTsiAltsNumOfPeerProperties
UPB_INLINE upb_StringView grpc_gcp_HandshakerResult_application_protocol(const grpc_gcp_HandshakerResult *msg)
void grpc_cq_end_op(grpc_completion_queue *cq, void *tag, grpc_error_handle error, void(*done)(void *done_arg, grpc_cq_completion *storage), void *done_arg, grpc_cq_completion *storage, bool internal)
UPB_INLINE uint32_t grpc_gcp_HandshakerResult_max_frame_size(const grpc_gcp_HandshakerResult *msg)
unsigned char * unused_bytes
@ TSI_FAILED_PRECONDITION
UPB_INLINE upb_StringView grpc_gcp_Identity_AttributesEntry_value(const grpc_gcp_Identity_AttributesEntry *msg)
static tsi_result alts_tsi_handshaker_continue_handshaker_next(alts_tsi_handshaker *handshaker, const unsigned char *received_bytes, size_t received_bytes_size, tsi_handshaker_on_next_done_cb cb, void *user_data)
static const tsi_handshaker_vtable handshaker_vtable
alts_handshaker_client * alts_grpc_handshaker_client_create(alts_tsi_handshaker *handshaker, grpc_channel *channel, const char *handshaker_service_url, grpc_pollset_set *interested_parties, grpc_alts_credentials_options *options, const grpc_slice &target_name, grpc_iomgr_cb_func grpc_cb, tsi_handshaker_on_next_done_cb cb, void *user_data, alts_handshaker_client_vtable *vtable_for_testing, bool is_client, size_t max_frame_size)
void alts_handshaker_client_handle_response(alts_handshaker_client *c, bool is_ok)
void grpc_channel_destroy_internal(grpc_channel *c_channel)
bool grpc_gcp_rpc_protocol_versions_encode(const grpc_gcp_rpc_protocol_versions *versions, grpc_slice *slice)
UPB_INLINE grpc_gcp_Identity_AttributesEntry * grpc_gcp_Identity_attributes_nextmutable(grpc_gcp_Identity *msg, size_t *iter)
GPRAPI void * gpr_zalloc(size_t size)
struct alts_tsi_handshaker_result alts_tsi_handshaker_result
grpc_cq_completion storage
void alts_handshaker_client_shutdown(alts_handshaker_client *client)
UPB_INLINE bool grpc_gcp_Identity_has_attributes(const grpc_gcp_Identity *msg)
#define GRPC_ARG_ENABLE_RETRIES
bool has_sent_start_message
static tsi_result handshaker_next(tsi_handshaker *self, const unsigned char *received_bytes, size_t received_bytes_size, const unsigned char **, size_t *, tsi_handshaker_result **, tsi_handshaker_on_next_done_cb cb, void *user_data)
const tsi_handshaker_result_vtable * vtable
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
grpc_pollset_set * interested_parties
static void handshaker_result_destroy(tsi_handshaker_result *self)
wrapped_grpc_channel * channel
struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp
const size_t kAltsAes128GcmRekeyKeyLength
def c_str(s, encoding='ascii')
static void handshaker_shutdown(tsi_handshaker *self)
#define TSI_ALTS_SERVICE_ACCOUNT_PEER_PROPERTY
void grpc_alts_shared_resource_dedicated_start(const char *handshaker_service_url)
grpc_pollset_set * interested_parties
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
tsi_result alts_handshaker_client_start_client(alts_handshaker_client *client)
static void handshaker_destroy(tsi_handshaker *self)
#define TSI_ALTS_RPC_VERSIONS
void(* tsi_handshaker_on_next_done_cb)(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *handshaker_result)
UPB_INLINE const struct grpc_gcp_RpcProtocolVersions * grpc_gcp_HandshakerResult_peer_rpc_versions(const grpc_gcp_HandshakerResult *msg)
GRPCAPI grpc_channel_credentials * grpc_insecure_credentials_create()
void alts_tsi_handshaker_result_set_unused_bytes(tsi_handshaker_result *result, grpc_slice *recv_bytes, size_t bytes_consumed)
#define GRPC_SLICE_START_PTR(slice)
grpc_slice serialized_context
UPB_INLINE void grpc_gcp_AltsContext_set_peer_rpc_versions(grpc_gcp_AltsContext *msg, struct grpc_gcp_RpcProtocolVersions *value)
std::unique_ptr< unsigned char > received_bytes
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
struct grpc_gcp_AltsContext grpc_gcp_AltsContext
static void alts_tsi_handshaker_create_channel(void *arg, grpc_error_handle)
tsi_result alts_zero_copy_grpc_protector_create(const uint8_t *key, size_t key_size, bool is_rekey, bool is_client, bool is_integrity_only, bool enable_extra_copy, size_t *max_protected_frame_size, tsi_zero_copy_grpc_protector **protector)
GPRAPI grpc_slice grpc_empty_slice(void)
bool alts_tsi_handshaker_get_is_client_for_testing(alts_tsi_handshaker *handshaker)
tsi_result alts_handshaker_client_next(alts_handshaker_client *client, grpc_slice *bytes_received)
UPB_INLINE bool grpc_gcp_AltsContext_peer_attributes_set(grpc_gcp_AltsContext *msg, upb_StringView key, upb_StringView val, upb_Arena *a)
tsi_handshaker_on_next_done_cb cb
alts_handshaker_client_vtable * client_vtable_for_testing
struct grpc_gcp_RpcProtocolVersions grpc_gcp_RpcProtocolVersions
#define TSI_ALTS_CERTIFICATE_TYPE
bool alts_tsi_handshaker_get_has_sent_start_message_for_testing(alts_tsi_handshaker *handshaker)
tsi_result alts_tsi_handshaker_create(const grpc_alts_credentials_options *options, const char *target_name, const char *handshaker_service_url, bool is_client, grpc_pollset_set *interested_parties, tsi_handshaker **self, size_t user_specified_max_frame_size)
#define GRPC_SLICE_LENGTH(slice)
UPB_INLINE char * grpc_gcp_AltsContext_serialize(const grpc_gcp_AltsContext *msg, upb_Arena *arena, size_t *len)
tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp *resp, bool is_client, tsi_handshaker_result **result)
UPB_INLINE void grpc_gcp_AltsContext_set_peer_service_account(grpc_gcp_AltsContext *msg, upb_StringView value)
const size_t kTsiAltsMinFrameSize
GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds)
static tsi_result handshaker_result_get_frame_protector_type(const tsi_handshaker_result *, tsi_frame_protector_type *frame_protector_type)
static const tsi_handshaker_vtable handshaker_vtable_dedicated
bool grpc_cq_begin_op(grpc_completion_queue *cq, void *tag)
GRPCAPI grpc_channel * grpc_channel_create(const char *target, grpc_channel_credentials *creds, const grpc_channel_args *args)
struct grpc_gcp_Identity grpc_gcp_Identity
grpc_alts_credentials_options * grpc_alts_credentials_options_copy(const grpc_alts_credentials_options *options)
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
static tsi_result handshaker_next_dedicated(tsi_handshaker *self, const unsigned char *received_bytes, size_t received_bytes_size, const unsigned char **bytes_to_send, size_t *bytes_to_send_size, tsi_handshaker_result **result, tsi_handshaker_on_next_done_cb cb, void *user_data)
grpc_arg grpc_channel_arg_integer_create(char *name, int value)
const size_t kTsiAltsMaxFrameSize
void alts_handshaker_client_destroy(alts_handshaker_client *c)
grpc_core::ExecCtx exec_ctx
std::string grpc_error_std_string(grpc_error_handle error)
UPB_INLINE void grpc_gcp_AltsContext_set_local_service_account(grpc_gcp_AltsContext *msg, upb_StringView value)
alts_tsi_handshaker * handshaker
bool alts_tsi_handshaker_has_shutdown(alts_tsi_handshaker *handshaker)
static tsi_result handshaker_result_create_frame_protector(const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_frame_protector **protector)
void(* grpc_iomgr_cb_func)(void *arg, grpc_error_handle error)
struct grpc_gcp_HandshakerResult grpc_gcp_HandshakerResult
grpc_alts_credentials_options * options
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
struct grpc_channel grpc_channel
grpc_completion_queue * cq
static tsi_result handshaker_result_create_zero_copy_grpc_protector(const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_zero_copy_grpc_protector **protector)
tsi_handshaker_result base
void alts_tsi_handshaker_set_client_vtable_for_testing(alts_tsi_handshaker *handshaker, alts_handshaker_client_vtable *vtable)
GPRAPI char * gpr_strdup(const char *src)
static tsi_result handshaker_result_extract_peer(const tsi_handshaker_result *self, tsi_peer *peer)
size_t received_bytes_size
static tsi_result handshaker_result_get_unused_bytes(const tsi_handshaker_result *self, const unsigned char **bytes, size_t *bytes_size)
@ TSI_PRIVACY_AND_INTEGRITY
grpc::ClientContext context
@ TSI_FRAME_PROTECTOR_NORMAL_OR_ZERO_COPY
alts_handshaker_client * alts_tsi_handshaker_get_client_for_testing(alts_tsi_handshaker *handshaker)
#define TSI_CERTIFICATE_TYPE_PEER_PROPERTY
const UPB_INLINE grpc_gcp_Identity * grpc_gcp_HandshakerResult_local_identity(const grpc_gcp_HandshakerResult *msg)
static const tsi_handshaker_result_vtable result_vtable
UPB_INLINE void grpc_gcp_AltsContext_set_application_protocol(grpc_gcp_AltsContext *msg, upb_StringView value)
UPB_INLINE void grpc_gcp_AltsContext_set_record_protocol(grpc_gcp_AltsContext *msg, upb_StringView value)
struct alts_tsi_handshaker alts_tsi_handshaker
void tsi_peer_destruct(tsi_peer *self)
static grpc_completion_queue * cq
tsi_result tsi_construct_string_peer_property(const char *name, const char *value, size_t value_length, tsi_peer_property *property)
OPENSSL_EXPORT pem_password_cb * cb
tsi_result tsi_construct_string_peer_property_from_cstring(const char *name, const char *value, tsi_peer_property *property)
void grpc_slice_unref_internal(const grpc_slice &slice)
tsi_result tsi_construct_peer(size_t property_count, tsi_peer *peer)
#define GRPC_ERROR_IS_NONE(err)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:41