|
|
|
@ -54,21 +54,21 @@ typedef struct local_tsi_handshaker { |
|
|
|
|
|
|
|
|
|
/* --- tsi_handshaker_result methods implementation. --- */ |
|
|
|
|
|
|
|
|
|
static tsi_result handshaker_result_extract_peer( |
|
|
|
|
const tsi_handshaker_result* /*self*/, tsi_peer* /*peer*/) { |
|
|
|
|
tsi_result handshaker_result_extract_peer(const tsi_handshaker_result* /*self*/, |
|
|
|
|
tsi_peer* /*peer*/) { |
|
|
|
|
return TSI_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static tsi_result handshaker_result_get_frame_protector_type( |
|
|
|
|
tsi_result handshaker_result_get_frame_protector_type( |
|
|
|
|
const tsi_handshaker_result* /*self*/, |
|
|
|
|
tsi_frame_protector_type* frame_protector_type) { |
|
|
|
|
*frame_protector_type = TSI_FRAME_PROTECTOR_NONE; |
|
|
|
|
return TSI_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static tsi_result handshaker_result_get_unused_bytes( |
|
|
|
|
const tsi_handshaker_result* self, const unsigned char** bytes, |
|
|
|
|
size_t* bytes_size) { |
|
|
|
|
tsi_result handshaker_result_get_unused_bytes(const tsi_handshaker_result* self, |
|
|
|
|
const unsigned char** bytes, |
|
|
|
|
size_t* bytes_size) { |
|
|
|
|
if (self == nullptr || bytes == nullptr || bytes_size == nullptr) { |
|
|
|
|
gpr_log(GPR_ERROR, "Invalid arguments to get_unused_bytes()"); |
|
|
|
|
return TSI_INVALID_ARGUMENT; |
|
|
|
@ -80,7 +80,7 @@ static tsi_result handshaker_result_get_unused_bytes( |
|
|
|
|
return TSI_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void handshaker_result_destroy(tsi_handshaker_result* self) { |
|
|
|
|
void handshaker_result_destroy(tsi_handshaker_result* self) { |
|
|
|
|
if (self == nullptr) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -91,7 +91,7 @@ static void handshaker_result_destroy(tsi_handshaker_result* self) { |
|
|
|
|
gpr_free(result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const tsi_handshaker_result_vtable result_vtable = { |
|
|
|
|
const tsi_handshaker_result_vtable result_vtable = { |
|
|
|
|
handshaker_result_extract_peer, |
|
|
|
|
handshaker_result_get_frame_protector_type, |
|
|
|
|
nullptr, /* handshaker_result_create_zero_copy_grpc_protector */ |
|
|
|
@ -99,10 +99,10 @@ static const tsi_handshaker_result_vtable result_vtable = { |
|
|
|
|
handshaker_result_get_unused_bytes, |
|
|
|
|
handshaker_result_destroy}; |
|
|
|
|
|
|
|
|
|
static tsi_result create_handshaker_result(bool is_client, |
|
|
|
|
const unsigned char* received_bytes, |
|
|
|
|
size_t received_bytes_size, |
|
|
|
|
tsi_handshaker_result** self) { |
|
|
|
|
tsi_result create_handshaker_result(bool is_client, |
|
|
|
|
const unsigned char* received_bytes, |
|
|
|
|
size_t received_bytes_size, |
|
|
|
|
tsi_handshaker_result** self) { |
|
|
|
|
if (self == nullptr) { |
|
|
|
|
gpr_log(GPR_ERROR, "Invalid arguments to create_handshaker_result()"); |
|
|
|
|
return TSI_INVALID_ARGUMENT; |
|
|
|
@ -123,7 +123,7 @@ static tsi_result create_handshaker_result(bool is_client, |
|
|
|
|
|
|
|
|
|
/* --- tsi_handshaker methods implementation. --- */ |
|
|
|
|
|
|
|
|
|
static tsi_result handshaker_next( |
|
|
|
|
tsi_result 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** result, |
|
|
|
@ -143,7 +143,7 @@ static tsi_result handshaker_next( |
|
|
|
|
return TSI_OK; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void handshaker_destroy(tsi_handshaker* self) { |
|
|
|
|
void handshaker_destroy(tsi_handshaker* self) { |
|
|
|
|
if (self == nullptr) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -152,7 +152,7 @@ static void handshaker_destroy(tsi_handshaker* self) { |
|
|
|
|
gpr_free(handshaker); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const tsi_handshaker_vtable handshaker_vtable = { |
|
|
|
|
const tsi_handshaker_vtable handshaker_vtable = { |
|
|
|
|
nullptr, /* get_bytes_to_send_to_peer -- deprecated */ |
|
|
|
|
nullptr, /* process_bytes_from_peer -- deprecated */ |
|
|
|
|
nullptr, /* get_result -- deprecated */ |
|
|
|
|