Classes | Namespaces | Typedefs | Functions | Variables
alts_tsi_handshaker.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/tsi/alts/handshaker/alts_tsi_handshaker.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "upb/upb.hpp"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd_id.h>
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/tsi/alts/frame_protector/alts_frame_protector.h"
#include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_utils.h"
#include "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h"
Include dependency graph for alts_tsi_handshaker.cc:

Go to the source code of this file.

Classes

struct  alts_tsi_handshaker
 
struct  alts_tsi_handshaker_continue_handshaker_next_args
 
struct  alts_tsi_handshaker_result
 

Namespaces

 grpc_core
 
 grpc_core::internal
 

Typedefs

typedef struct alts_tsi_handshaker_result alts_tsi_handshaker_result
 

Functions

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)
 
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)
 
static void alts_tsi_handshaker_create_channel (void *arg, grpc_error_handle)
 
alts_handshaker_clientgrpc_core::internal::alts_tsi_handshaker_get_client_for_testing (alts_tsi_handshaker *handshaker)
 
bool grpc_core::internal::alts_tsi_handshaker_get_has_sent_start_message_for_testing (alts_tsi_handshaker *handshaker)
 
bool grpc_core::internal::alts_tsi_handshaker_get_is_client_for_testing (alts_tsi_handshaker *handshaker)
 
bool alts_tsi_handshaker_has_shutdown (alts_tsi_handshaker *handshaker)
 
tsi_result alts_tsi_handshaker_result_create (grpc_gcp_HandshakerResp *resp, bool is_client, tsi_handshaker_result **result)
 
void alts_tsi_handshaker_result_set_unused_bytes (tsi_handshaker_result *result, grpc_slice *recv_bytes, size_t bytes_consumed)
 
void grpc_core::internal::alts_tsi_handshaker_set_client_vtable_for_testing (alts_tsi_handshaker *handshaker, alts_handshaker_client_vtable *vtable)
 
static void handshaker_destroy (tsi_handshaker *self)
 
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)
 
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)
 
static tsi_result handshaker_result_create_frame_protector (const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_frame_protector **protector)
 
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)
 
static void handshaker_result_destroy (tsi_handshaker_result *self)
 
static tsi_result handshaker_result_extract_peer (const tsi_handshaker_result *self, tsi_peer *peer)
 
static tsi_result handshaker_result_get_frame_protector_type (const tsi_handshaker_result *, tsi_frame_protector_type *frame_protector_type)
 
static tsi_result handshaker_result_get_unused_bytes (const tsi_handshaker_result *self, const unsigned char **bytes, size_t *bytes_size)
 
static void handshaker_shutdown (tsi_handshaker *self)
 
static void on_handshaker_service_resp_recv (void *arg, grpc_error_handle error)
 
static void on_handshaker_service_resp_recv_dedicated (void *arg, grpc_error_handle)
 

Variables

static const tsi_handshaker_vtable handshaker_vtable
 
static const tsi_handshaker_vtable handshaker_vtable_dedicated
 
static const tsi_handshaker_result_vtable result_vtable
 

Typedef Documentation

◆ alts_tsi_handshaker_result

Function Documentation

◆ alts_tsi_handshaker_continue_handshaker_next()

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

Definition at line 416 of file alts_tsi_handshaker.cc.

◆ alts_tsi_handshaker_create()

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 
)

This method creates a ALTS TSI handshaker instance.

  • options: ALTS credentials options containing information passed from TSI caller (e.g., rpc protocol versions).
  • target_name: the name of the endpoint that the channel is connecting to, and will be used for secure naming check.
  • handshaker_service_url: address of ALTS handshaker service in the format of "host:port".
  • is_client: boolean value indicating if the handshaker is used at the client (is_client = true) or server (is_client = false) side.
  • interested_parties: set of pollsets interested in this connection.
  • self: address of ALTS TSI handshaker instance to be returned from the method.
  • user_specified_max_frame_size: Determines the maximum frame size used by frame protector that is specified via user. If unspecified, the value is 0.

It returns TSI_OK on success and an error status code on failure. Note that if interested_parties is nullptr, a dedicated TSI thread will be created and used.

Definition at line 639 of file alts_tsi_handshaker.cc.

◆ alts_tsi_handshaker_create_channel()

static void alts_tsi_handshaker_create_channel ( void *  arg,
grpc_error_handle   
)
static

Definition at line 495 of file alts_tsi_handshaker.cc.

◆ alts_tsi_handshaker_has_shutdown()

bool alts_tsi_handshaker_has_shutdown ( alts_tsi_handshaker handshaker)

This method returns a boolean value indicating if an ALTS TSI handshaker has been shutdown or not.

Definition at line 633 of file alts_tsi_handshaker.cc.

◆ alts_tsi_handshaker_result_create()

tsi_result alts_tsi_handshaker_result_create ( grpc_gcp_HandshakerResp resp,
bool  is_client,
tsi_handshaker_result **  result 
)

This method creates an ALTS TSI handshaker result instance.

  • resp: data received from the handshaker service.
  • is_client: a boolean value indicating if the result belongs to a client or not.
  • result: address of ALTS TSI handshaker result instance.

Definition at line 265 of file alts_tsi_handshaker.cc.

◆ alts_tsi_handshaker_result_set_unused_bytes()

void alts_tsi_handshaker_result_set_unused_bytes ( tsi_handshaker_result result,
grpc_slice recv_bytes,
size_t  bytes_consumed 
)

This method sets unused bytes of ALTS TSI handshaker result instance.

  • result: an ALTS TSI handshaker result instance.
  • recv_bytes: data received from the handshaker service.
  • bytes_consumed: size of data consumed by the handshaker service.

Definition at line 669 of file alts_tsi_handshaker.cc.

◆ handshaker_destroy()

static void handshaker_destroy ( tsi_handshaker self)
static

Definition at line 601 of file alts_tsi_handshaker.cc.

◆ handshaker_next()

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 
)
static

Definition at line 521 of file alts_tsi_handshaker.cc.

◆ handshaker_next_dedicated()

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 
)
static

Definition at line 576 of file alts_tsi_handshaker.cc.

◆ handshaker_result_create_frame_protector()

static tsi_result handshaker_result_create_frame_protector ( const tsi_handshaker_result self,
size_t *  max_output_protected_frame_size,
tsi_frame_protector **  protector 
)
static

Definition at line 205 of file alts_tsi_handshaker.cc.

◆ handshaker_result_create_zero_copy_grpc_protector()

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 
)
static

Definition at line 163 of file alts_tsi_handshaker.cc.

◆ handshaker_result_destroy()

static void handshaker_result_destroy ( tsi_handshaker_result self)
static

Definition at line 242 of file alts_tsi_handshaker.cc.

◆ handshaker_result_extract_peer()

static tsi_result handshaker_result_extract_peer ( const tsi_handshaker_result self,
tsi_peer peer 
)
static

Definition at line 88 of file alts_tsi_handshaker.cc.

◆ handshaker_result_get_frame_protector_type()

static tsi_result handshaker_result_get_frame_protector_type ( const tsi_handshaker_result ,
tsi_frame_protector_type frame_protector_type 
)
static

Definition at line 156 of file alts_tsi_handshaker.cc.

◆ handshaker_result_get_unused_bytes()

static tsi_result handshaker_result_get_unused_bytes ( const tsi_handshaker_result self,
const unsigned char **  bytes,
size_t *  bytes_size 
)
static

Definition at line 226 of file alts_tsi_handshaker.cc.

◆ handshaker_shutdown()

static void handshaker_shutdown ( tsi_handshaker self)
static

Definition at line 587 of file alts_tsi_handshaker.cc.

◆ on_handshaker_service_resp_recv()

static void on_handshaker_service_resp_recv ( void *  arg,
grpc_error_handle  error 
)
static

Definition at line 386 of file alts_tsi_handshaker.cc.

◆ on_handshaker_service_resp_recv_dedicated()

static void on_handshaker_service_resp_recv_dedicated ( void *  arg,
grpc_error_handle   
)
static

Definition at line 405 of file alts_tsi_handshaker.cc.

Variable Documentation

◆ handshaker_vtable

const tsi_handshaker_vtable handshaker_vtable
static
Initial value:
= {
nullptr, nullptr,
nullptr, nullptr,

Definition at line 617 of file alts_tsi_handshaker.cc.

◆ handshaker_vtable_dedicated

const tsi_handshaker_vtable handshaker_vtable_dedicated
static
Initial value:
= {
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,

Definition at line 623 of file alts_tsi_handshaker.cc.

◆ result_vtable

const tsi_handshaker_result_vtable result_vtable
static
handshaker_next
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)
Definition: alts_tsi_handshaker.cc:521
handshaker_result_destroy
static void handshaker_result_destroy(tsi_handshaker_result *self)
Definition: alts_tsi_handshaker.cc:242
handshaker_shutdown
static void handshaker_shutdown(tsi_handshaker *self)
Definition: alts_tsi_handshaker.cc:587
handshaker_destroy
static void handshaker_destroy(tsi_handshaker *self)
Definition: alts_tsi_handshaker.cc:601
handshaker_result_get_frame_protector_type
static tsi_result handshaker_result_get_frame_protector_type(const tsi_handshaker_result *, tsi_frame_protector_type *frame_protector_type)
Definition: alts_tsi_handshaker.cc:156
handshaker_next_dedicated
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)
Definition: alts_tsi_handshaker.cc:576
handshaker_result_create_frame_protector
static tsi_result handshaker_result_create_frame_protector(const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_frame_protector **protector)
Definition: alts_tsi_handshaker.cc:205
handshaker_result_create_zero_copy_grpc_protector
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)
Definition: alts_tsi_handshaker.cc:163
handshaker_result_extract_peer
static tsi_result handshaker_result_extract_peer(const tsi_handshaker_result *self, tsi_peer *peer)
Definition: alts_tsi_handshaker.cc:88
handshaker_result_get_unused_bytes
static tsi_result handshaker_result_get_unused_bytes(const tsi_handshaker_result *self, const unsigned char **bytes, size_t *bytes_size)
Definition: alts_tsi_handshaker.cc:226


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:02