Go to the documentation of this file.
38 #define ALTS_TSI_HANDSHAKER_TEST_RECV_BYTES "Hello World"
39 #define ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME "Hello Google"
40 #define ALTS_TSI_HANDSHAKER_TEST_CONSUMED_BYTES "Hello "
41 #define ALTS_TSI_HANDSHAKER_TEST_REMAIN_BYTES "Google"
42 #define ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY "chapi@service.google.com"
43 #define ALTS_TSI_HANDSHAKER_TEST_SECURITY_LEVEL "TSI_PRIVACY_AND_INTEGRITY"
44 #define ALTS_TSI_HANDSHAKER_TEST_KEY_DATA \
45 "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKL"
46 #define ALTS_TSI_HANDSHAKER_TEST_BUFFER_SIZE 100
47 #define ALTS_TSI_HANDSHAKER_TEST_SLEEP_TIME_IN_SECONDS 2
48 #define ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR 3
49 #define ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MINOR 2
50 #define ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MAJOR 2
51 #define ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MINOR 1
52 #define ALTS_TSI_HANDSHAKER_TEST_LOCAL_IDENTITY "chapilocal@service.google.com"
53 #define ALTS_TSI_HANDSHAKER_TEST_APPLICATION_PROTOCOL \
54 "test application protocol"
55 #define ALTS_TSI_HANDSHAKER_TEST_RECORD_PROTOCOL "test record protocol"
56 #define ALTS_TSI_HANDSHAKER_TEST_MAX_FRAME_SIZE (2 * 1024 * 1024)
57 #define ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY "peer"
58 #define ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE "attributes"
116 while (!
n->notified) {
240 const unsigned char* ,
247 const unsigned char* bytes_to_send,
248 size_t bytes_to_send_size,
254 bytes_to_send_size) == 0);
265 const unsigned char* unused_bytes =
nullptr;
266 size_t unused_bytes_size = 0;
268 &unused_bytes_size) ==
274 const unsigned char* bytes_to_send,
275 size_t bytes_to_send_size,
281 bytes_to_send_size) == 0);
292 const unsigned char* unused_bytes =
nullptr;
293 size_t unused_bytes_size = 0;
295 &unused_bytes_size) ==
301 const unsigned char* bytes_to_send,
302 size_t bytes_to_send_size,
308 bytes_to_send_size) == 0);
316 size_t actual_max_frame_size;
318 &actual_max_frame_size);
334 context_arena.
ptr());
343 application_protocol.
data, application_protocol.
size) == 0);
345 record_protocol.
data, record_protocol.
size) == 0);
347 peer_account.
size) == 0);
349 local_account.
size) == 0);
354 while (peer_attributes_entry !=
nullptr) {
357 peer_attributes_entry));
360 peer_attributes_entry));
367 peer_attributes_entry =
376 const unsigned char*
bytes =
nullptr;
377 size_t bytes_size = 0;
394 const unsigned char* bytes_to_send,
395 size_t bytes_to_send_size,
406 size_t user_specified_max_frame_size =
409 result, &user_specified_max_frame_size,
410 &zero_copy_protector) ==
TSI_OK);
411 size_t actual_max_frame_size;
413 &actual_max_frame_size);
429 context_arena.
ptr());
438 application_protocol.
data, application_protocol.
size) == 0);
440 record_protocol.
data, record_protocol.
size) == 0);
442 peer_account.
size) == 0);
444 local_account.
size) == 0);
449 while (peer_attributes_entry !=
nullptr) {
452 peer_attributes_entry));
455 peer_attributes_entry));
462 peer_attributes_entry =
472 const unsigned char*
bytes =
nullptr;
473 size_t bytes_size = 0;
572 nullptr, &handshaker, 0);
707 const unsigned char* bytes_to_send,
708 size_t bytes_to_send_size,
718 const unsigned char* bytes_to_send,
719 size_t bytes_to_send_size,
871 const unsigned char* bytes_to_send,
872 size_t bytes_to_send_size,
942 const unsigned char* bytes_to_send,
943 size_t bytes_to_send_size,
986 const unsigned char* bytes_to_send,
987 size_t bytes_to_send_size,
#define ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MINOR
GPRAPI void gpr_cv_signal(gpr_cv *cv)
GPRAPI void grpc_slice_unref(grpc_slice s)
#define ALTS_TSI_HANDSHAKER_TEST_RECORD_PROTOCOL
GRPCAPI void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
static void check_handle_response_nullptr_handshaker()
void alts_handshaker_client_set_cb_for_testing(alts_handshaker_client *c, tsi_handshaker_on_next_done_cb cb)
struct grpc_gcp_HandshakerStatus grpc_gcp_HandshakerStatus
GPRAPI void gpr_mu_unlock(gpr_mu *mu)
static void notification_destroy(notification *n)
void alts_handshaker_client_ref_for_testing(alts_handshaker_client *c)
tsi_peer_property * properties
UPB_INLINE void grpc_gcp_HandshakerResp_set_bytes_consumed(grpc_gcp_HandshakerResp *msg, uint32_t value)
struct tsi_peer_property::@48 value
static void on_server_next_success_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create(grpc_slice *slices, size_t nslices)
void check_handshaker_success()
static void check_handle_response_success(void *)
void tsi_zero_copy_grpc_protector_destroy(tsi_zero_copy_grpc_protector *self)
#define ALTS_TSI_HANDSHAKER_TEST_KEY_DATA
static void on_client_next_success_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
UPB_INLINE void grpc_gcp_HandshakerResult_set_max_frame_size(grpc_gcp_HandshakerResult *msg, uint32_t value)
UPB_INLINE struct grpc_gcp_Identity * grpc_gcp_HandshakerResult_mutable_peer_identity(grpc_gcp_HandshakerResult *msg, upb_Arena *arena)
#define ALTS_TSI_HANDSHAKER_TEST_PEER_IDENTITY
void tsi_handshaker_destroy(tsi_handshaker *self)
grpc_byte_buffer ** alts_handshaker_client_get_recv_buffer_addr_for_testing(alts_handshaker_client *c)
static void on_invalid_input_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
static notification caller_to_tsi_notification
tsi_result tsi_handshaker_result_get_unused_bytes(const tsi_handshaker_result *self, const unsigned char **bytes, size_t *bytes_size)
static tsi_result mock_client_start(alts_handshaker_client *client)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_local_service_account(const grpc_gcp_AltsContext *msg)
void grpc_alts_shared_resource_dedicated_init()
GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b)
#define ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MINOR
static void mock_destruct(alts_handshaker_client *)
static int bytes_received
#define ALTS_TSI_HANDSHAKER_TEST_MAX_FRAME_SIZE
UPB_INLINE grpc_gcp_HandshakerResp * grpc_gcp_HandshakerResp_new(upb_Arena *arena)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_PeerAttributesEntry_key(const grpc_gcp_AltsContext_PeerAttributesEntry *msg)
const size_t kTsiAltsNumOfPeerProperties
#define ALTS_TSI_HANDSHAKER_TEST_REMAIN_BYTES
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
#define ALTS_TSI_HANDSHAKER_TEST_CONSUMED_BYTES
void grpc_alts_shared_resource_dedicated_shutdown()
static void check_handshaker_next_success()
int main(int argc, char **argv)
static void mock_shutdown(alts_handshaker_client *)
#define ALTS_TSI_HANDSHAKER_TEST_APPLICATION_PROTOCOL
void alts_handshaker_client_handle_response(alts_handshaker_client *c, bool is_ok)
grpc_core::ScopedArenaPtr arena
static tsi_result mock_next(alts_handshaker_client *client, grpc_slice *bytes_received)
#define ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_VALUE
static notification tsi_to_caller_notification
#define ALTS_HANDSHAKER_SERVICE_URL_FOR_TESTING
UPB_INLINE void grpc_gcp_Identity_set_service_account(grpc_gcp_Identity *msg, upb_StringView value)
GPRAPI void gpr_mu_destroy(gpr_mu *mu)
UPB_INLINE void grpc_gcp_HandshakerStatus_set_code(grpc_gcp_HandshakerStatus *msg, uint32_t value)
UPB_INLINE bool grpc_gcp_Identity_attributes_set(grpc_gcp_Identity *msg, upb_StringView key, upb_StringView val, upb_Arena *a)
UPB_INLINE void grpc_gcp_HandshakerResult_set_application_protocol(grpc_gcp_HandshakerResult *msg, upb_StringView value)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_PeerAttributesEntry_value(const grpc_gcp_AltsContext_PeerAttributesEntry *msg)
GRPCAPI grpc_alts_credentials_options * grpc_alts_credentials_client_options_create(void)
UPB_INLINE struct grpc_gcp_HandshakerStatus * grpc_gcp_HandshakerResp_mutable_status(grpc_gcp_HandshakerResp *msg, upb_Arena *arena)
struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp
#define ALTS_TSI_HANDSHAKER_TEST_PEER_ATTRIBUTES_KEY
static tsi_result mock_server_start(alts_handshaker_client *client, grpc_slice *bytes_received)
GPRAPI void gpr_cv_destroy(gpr_cv *cv)
static void signal(notification *n)
void 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)
#define ALTS_TSI_HANDSHAKER_TEST_LOCAL_IDENTITY
#define ALTS_TSI_HANDSHAKER_TEST_OUT_FRAME
GPRAPI void gpr_mu_init(gpr_mu *mu)
bool grpc_gcp_handshaker_resp_set_peer_rpc_versions(grpc_gcp_HandshakerResp *resp, upb_Arena *arena, uint32_t max_major, uint32_t max_minor, uint32_t min_major, uint32_t min_minor)
static tsi_handshaker * create_test_handshaker(bool is_client)
static bool should_handshaker_client_api_succeed
static void check_handshaker_next_with_shutdown()
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)
tsi_result tsi_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 on_server_start_success_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
#define GRPC_SLICE_START_PTR(slice)
static void check_handshaker_shutdown_invalid_input()
static void on_invalid_resp_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
#define ALTS_TSI_HANDSHAKER_TEST_MAX_RPC_VERSION_MAJOR
static void on_shutdown_resp_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
GPRAPI int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline)
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
struct grpc_gcp_AltsContext grpc_gcp_AltsContext
GPRAPI grpc_slice grpc_empty_slice(void)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_peer_service_account(const grpc_gcp_AltsContext *msg)
bool alts_tsi_handshaker_get_is_client_for_testing(alts_tsi_handshaker *handshaker)
GPRAPI void gpr_mu_lock(gpr_mu *mu)
#define ALTS_TSI_HANDSHAKER_TEST_MIN_RPC_VERSION_MAJOR
alts_tsi_handshaker * alts_handshaker_client_get_handshaker_for_testing(alts_handshaker_client *c)
static void check_handle_response_after_shutdown()
static void check_handshaker_next_failure()
UPB_INLINE bool upb_StringView_IsEqual(upb_StringView a, upb_StringView b)
#define TSI_ALTS_CERTIFICATE_TYPE
static void on_failed_grpc_call_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
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)
tsi_result tsi_handshaker_result_extract_peer(const tsi_handshaker_result *self, tsi_peer *peer)
static alts_handshaker_client_vtable vtable
static void check_must_not_be_called(tsi_result, void *, const unsigned char *, size_t, tsi_handshaker_result *)
UPB_INLINE char * grpc_gcp_HandshakerResp_serialize(const grpc_gcp_HandshakerResp *msg, upb_Arena *arena, size_t *len)
#define GRPC_SLICE_LENGTH(slice)
void tsi_handshaker_shutdown(tsi_handshaker *self)
UPB_INLINE void grpc_gcp_HandshakerResult_set_record_protocol(grpc_gcp_HandshakerResult *msg, upb_StringView value)
UPB_INLINE grpc_gcp_AltsContext_PeerAttributesEntry * grpc_gcp_AltsContext_peer_attributes_nextmutable(grpc_gcp_AltsContext *msg, size_t *iter)
const size_t kTsiAltsMinFrameSize
tsi_result tsi_handshaker_next(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 **handshaker_result, tsi_handshaker_on_next_done_cb cb, void *user_data)
UPB_INLINE struct grpc_gcp_Identity * grpc_gcp_HandshakerResult_mutable_local_identity(grpc_gcp_HandshakerResult *msg, upb_Arena *arena)
void alts_handshaker_client_set_recv_bytes_for_testing(alts_handshaker_client *c, grpc_slice *recv_bytes)
static grpc_byte_buffer * generate_handshaker_response(alts_handshaker_response_type type)
struct grpc_gcp_Identity grpc_gcp_Identity
void tsi_handshaker_result_destroy(tsi_handshaker_result *self)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_record_protocol(const grpc_gcp_AltsContext *msg)
const size_t kTsiAltsMaxFrameSize
#define gpr_slice_from_copied_buffer
struct notification notification
grpc_core::ExecCtx exec_ctx
#define ALTS_TSI_HANDSHAKER_TEST_RECV_BYTES
static void check_handle_response_failed_recv_message_from_handshaker_service()
static void on_client_start_success_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
UPB_INLINE upb_StringView grpc_gcp_AltsContext_application_protocol(const grpc_gcp_AltsContext *msg)
struct grpc_gcp_HandshakerResult grpc_gcp_HandshakerResult
struct grpc_gcp_AltsContext_PeerAttributesEntry grpc_gcp_AltsContext_PeerAttributesEntry
UPB_INLINE grpc_gcp_AltsContext * grpc_gcp_AltsContext_parse(const char *buf, size_t size, upb_Arena *arena)
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)
static void check_handshaker_next_invalid_input()
void 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)
static void run_tsi_handshaker_destroy_with_exec_ctx(tsi_handshaker *handshaker)
static void wait(notification *n)
GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split)
void check_handshaker_next_fails_after_shutdown()
UPB_INLINE upb_StringView upb_StringView_FromString(const char *data)
tsi_result tsi_handshaker_result_create_frame_protector(const tsi_handshaker_result *self, size_t *max_output_protected_frame_size, tsi_frame_protector **protector)
static alts_handshaker_client * cb_event
static void check_handle_response_with_shutdown(void *)
void alts_tsi_handshaker_set_client_vtable_for_testing(alts_tsi_handshaker *handshaker, alts_handshaker_client_vtable *vtable)
static void check_handle_response_invalid_resp()
tsi_result tsi_zero_copy_grpc_protector_max_frame_size(tsi_zero_copy_grpc_protector *self, size_t *max_frame_size)
void alts_handshaker_client_on_status_received_for_testing(alts_handshaker_client *c, grpc_status_code status, grpc_error_handle error)
UPB_INLINE void grpc_gcp_HandshakerResult_set_key_data(grpc_gcp_HandshakerResult *msg, upb_StringView value)
static void check_handle_response_failed_grpc_call_to_handshaker_service()
static void check_handle_response_failure()
void tsi_frame_protector_destroy(tsi_frame_protector *self)
alts_handshaker_response_type
alts_handshaker_client * alts_tsi_handshaker_get_client_for_testing(alts_tsi_handshaker *handshaker)
UPB_INLINE struct grpc_gcp_HandshakerResult * grpc_gcp_HandshakerResp_mutable_result(grpc_gcp_HandshakerResp *msg, upb_Arena *arena)
GRPCAPI void grpc_init(void)
UPB_INLINE void grpc_gcp_HandshakerResp_set_out_frames(grpc_gcp_HandshakerResp *msg, upb_StringView value)
static void check_handle_response_nullptr_recv_bytes()
static void notification_init(notification *n)
static void on_failed_resp_cb(tsi_result status, void *user_data, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
void tsi_peer_destruct(tsi_peer *self)
GRPCAPI void grpc_shutdown(void)
OPENSSL_EXPORT pem_password_cb * cb
GPRAPI void gpr_cv_init(gpr_cv *cv)
#define ALTS_TSI_HANDSHAKER_TEST_SECURITY_LEVEL
GPRAPI grpc_slice grpc_slice_ref(grpc_slice s)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:41