GRPC Core  9.0.0
Data Structures | Namespaces | Macros | Typedefs | Functions | Variables
alts_handshaker_client.cc File Reference
#include <grpc/support/port_platform.h>
#include <list>
#include "src/core/tsi/alts/handshaker/alts_handshaker_client.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/tsi/alts/handshaker/alts_shared_resource.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h"
#include "src/core/tsi/alts/handshaker/alts_tsi_utils.h"

Data Structures

struct  alts_handshaker_client
 
struct  recv_message_result
 
struct  alts_grpc_handshaker_client
 

Namespaces

 grpc_core
 Round Robin Policy.
 
 grpc_core::internal
 

Macros

#define TSI_ALTS_INITIAL_BUFFER_SIZE   256
 

Typedefs

typedef struct alts_grpc_handshaker_client alts_grpc_handshaker_client
 

Functions

void alts_handshaker_client_handle_response (alts_handshaker_client *c, bool is_ok)
 This method handles handshaker response returned from ALTS handshaker service. More...
 
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)
 This method creates an ALTS handshaker client. More...
 
void grpc_core::internal::alts_handshaker_client_set_grpc_caller_for_testing (alts_handshaker_client *c, alts_grpc_caller caller)
 
grpc_byte_buffer * grpc_core::internal::alts_handshaker_client_get_send_buffer_for_testing (alts_handshaker_client *c)
 
grpc_byte_buffer ** grpc_core::internal::alts_handshaker_client_get_recv_buffer_addr_for_testing (alts_handshaker_client *c)
 
grpc_metadata_array * grpc_core::internal::alts_handshaker_client_get_initial_metadata_for_testing (alts_handshaker_client *c)
 
void grpc_core::internal::alts_handshaker_client_set_recv_bytes_for_testing (alts_handshaker_client *c, grpc_slice *recv_bytes)
 
void grpc_core::internal::alts_handshaker_client_set_fields_for_testing (alts_handshaker_client *c, alts_tsi_handshaker *handshaker, tsi_handshaker_on_next_done_cb cb, void *user_data, grpc_byte_buffer *recv_buffer, grpc_status_code status)
 
void grpc_core::internal::alts_handshaker_client_check_fields_for_testing (alts_handshaker_client *c, tsi_handshaker_on_next_done_cb cb, void *user_data, bool has_sent_start_message, grpc_slice *recv_bytes)
 
void grpc_core::internal::alts_handshaker_client_set_vtable_for_testing (alts_handshaker_client *c, alts_handshaker_client_vtable *vtable)
 
alts_tsi_handshaker * grpc_core::internal::alts_handshaker_client_get_handshaker_for_testing (alts_handshaker_client *c)
 
void grpc_core::internal::alts_handshaker_client_set_cb_for_testing (alts_handshaker_client *c, tsi_handshaker_on_next_done_cb cb)
 
grpc_closure * grpc_core::internal::alts_handshaker_client_get_closure_for_testing (alts_handshaker_client *c)
 
void grpc_core::internal::alts_handshaker_client_ref_for_testing (alts_handshaker_client *c)
 
void grpc_core::internal::alts_handshaker_client_on_status_received_for_testing (alts_handshaker_client *c, grpc_status_code status, grpc_error *error)
 
tsi_result alts_handshaker_client_start_client (alts_handshaker_client *client)
 This method schedules a client_start handshaker request to ALTS handshaker service. More...
 
tsi_result alts_handshaker_client_start_server (alts_handshaker_client *client, grpc_slice *bytes_received)
 This method schedules a server_start handshaker request to ALTS handshaker service. More...
 
tsi_result alts_handshaker_client_next (alts_handshaker_client *client, grpc_slice *bytes_received)
 This method schedules a next handshaker request to ALTS handshaker service. More...
 
void alts_handshaker_client_shutdown (alts_handshaker_client *client)
 This method cancels previously scheduled, but yet executed handshaker requests to ALTS handshaker service. More...
 
void alts_handshaker_client_destroy (alts_handshaker_client *c)
 This method destroys an ALTS handshaker client. More...
 

Variables

const int kHandshakerClientOpNum = 4
 

Macro Definition Documentation

◆ TSI_ALTS_INITIAL_BUFFER_SIZE

#define TSI_ALTS_INITIAL_BUFFER_SIZE   256

Typedef Documentation

◆ alts_grpc_handshaker_client

Function Documentation

◆ alts_grpc_handshaker_client_create()

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 
)

This method creates an ALTS handshaker client.

  • handshaker: ALTS TSI handshaker to which the created handshaker client belongs to.
  • channel: grpc channel to ALTS handshaker service.
  • handshaker_service_url: address of ALTS handshaker service in the format of "host:port".
  • interested_parties: set of pollsets interested in this connection.
  • 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
  • grpc_cb: gRPC provided callbacks passed from TSI handshaker.
  • cb: callback to be executed when tsi_handshaker_next API compltes.
  • user_data: argument passed to cb.
  • vtable_for_testing: ALTS handshaker client vtable instance used for testing purpose.
  • is_client: a boolean value indicating if the created handshaker client is used at the client (is_client = true) or server (is_client = false) side. It returns the created ALTS handshaker client on success, and NULL on failure.

◆ alts_handshaker_client_destroy()

void alts_handshaker_client_destroy ( alts_handshaker_client *  client)

This method destroys an ALTS handshaker client.

  • client: an ALTS handshaker client instance.

◆ alts_handshaker_client_handle_response()

void alts_handshaker_client_handle_response ( alts_handshaker_client *  client,
bool  is_ok 
)

This method handles handshaker response returned from ALTS handshaker service.

Note that the only reason the API is exposed is that it is used in alts_shared_resources.cc.

  • client: an ALTS handshaker client instance.
  • is_ok: a boolean value indicating if the handshaker response is ok to read.

◆ alts_handshaker_client_next()

tsi_result alts_handshaker_client_next ( alts_handshaker_client *  client,
grpc_slice *  bytes_received 
)

This method schedules a next handshaker request to ALTS handshaker service.

  • client: ALTS handshaker client instance.
  • bytes_received: bytes in out_frames returned from the peer's handshaker response.

It returns TSI_OK on success and an error status code on failure.

◆ alts_handshaker_client_shutdown()

void alts_handshaker_client_shutdown ( alts_handshaker_client *  client)

This method cancels previously scheduled, but yet executed handshaker requests to ALTS handshaker service.

After this operation, the handshake will be shutdown, and no more handshaker requests will get scheduled.

  • client: ALTS handshaker client instance.

◆ alts_handshaker_client_start_client()

tsi_result alts_handshaker_client_start_client ( alts_handshaker_client *  client)

This method schedules a client_start handshaker request to ALTS handshaker service.

  • client: ALTS handshaker client instance.

It returns TSI_OK on success and an error status code on failure.

◆ alts_handshaker_client_start_server()

tsi_result alts_handshaker_client_start_server ( alts_handshaker_client *  client,
grpc_slice *  bytes_received 
)

This method schedules a server_start handshaker request to ALTS handshaker service.

  • client: ALTS handshaker client instance.
  • bytes_received: bytes in out_frames returned from the peer's handshaker response.

It returns TSI_OK on success and an error status code on failure.

Variable Documentation

◆ kHandshakerClientOpNum

const int kHandshakerClientOpNum = 4