Moved k[Min/Max]FrameSize variables to header file.

pull/22292/head
Ashitha Santhosh 5 years ago
parent 53fc4e5c13
commit 3651424ea4
  1. 6
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
  2. 5
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.h
  3. 7
      test/core/tsi/alts/handshaker/alts_tsi_handshaker_test.cc

@ -41,10 +41,8 @@
#include "src/core/tsi/alts/handshaker/alts_tsi_utils.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 "src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h"
// Frame size negotiation extends send frame size range to const size_t kMinFrameSize = 16 * 1024;
// [kMinFrameSize, kMaxFrameSize] const size_t kMaxFrameSize = 128 * 1024;
constexpr size_t kMinFrameSize = 16 * 1024;
constexpr size_t kMaxFrameSize = 128 * 1024;
/* Main struct for ALTS TSI handshaker. */ /* Main struct for ALTS TSI handshaker. */
struct alts_tsi_handshaker { struct alts_tsi_handshaker {

@ -38,6 +38,11 @@
const size_t kTsiAltsNumOfPeerProperties = 5; const size_t kTsiAltsNumOfPeerProperties = 5;
// Frame size negotiation extends send frame size range to
// [kMinFrameSize, kMaxFrameSize]
ABSL_CONST_INIT extern const size_t kMinFrameSize;
ABSL_CONST_INIT extern const size_t kMaxFrameSize;
typedef struct alts_tsi_handshaker alts_tsi_handshaker; typedef struct alts_tsi_handshaker alts_tsi_handshaker;
/** /**

@ -50,9 +50,7 @@
#define ALTS_TSI_HANDSHAKER_TEST_APPLICATION_PROTOCOL \ #define ALTS_TSI_HANDSHAKER_TEST_APPLICATION_PROTOCOL \
"test application protocol" "test application protocol"
#define ALTS_TSI_HANDSHAKER_TEST_RECORD_PROTOCOL "test record protocol" #define ALTS_TSI_HANDSHAKER_TEST_RECORD_PROTOCOL "test record protocol"
#define ALTS_TSI_HANDSHAKER_TEST_MIN_FRAME_SIZE 16 * 1024
#define ALTS_TSI_HANDSHAKER_TEST_MAX_FRAME_SIZE 256 * 1024 #define ALTS_TSI_HANDSHAKER_TEST_MAX_FRAME_SIZE 256 * 1024
#define ALTS_TSI_HANDSHAKER_TEST_DEFAULT_MAX_FRAME_SIZE 128 * 1024
using grpc_core::internal::alts_handshaker_client_check_fields_for_testing; using grpc_core::internal::alts_handshaker_client_check_fields_for_testing;
using grpc_core::internal::alts_handshaker_client_get_handshaker_for_testing; using grpc_core::internal::alts_handshaker_client_get_handshaker_for_testing;
@ -298,8 +296,7 @@ static void on_client_next_success_cb(tsi_result status, void* user_data,
size_t actual_max_frame_size; size_t actual_max_frame_size;
tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector, tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector,
&actual_max_frame_size); &actual_max_frame_size);
GPR_ASSERT(actual_max_frame_size == GPR_ASSERT(actual_max_frame_size == kMaxFrameSize);
ALTS_TSI_HANDSHAKER_TEST_DEFAULT_MAX_FRAME_SIZE);
/* Validate peer identity. */ /* Validate peer identity. */
tsi_peer peer; tsi_peer peer;
GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK); GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK);
@ -372,7 +369,7 @@ static void on_server_next_success_cb(tsi_result status, void* user_data,
size_t actual_max_frame_size; size_t actual_max_frame_size;
tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector, tsi_zero_copy_grpc_protector_max_frame_size(zero_copy_protector,
&actual_max_frame_size); &actual_max_frame_size);
GPR_ASSERT(actual_max_frame_size == ALTS_TSI_HANDSHAKER_TEST_MIN_FRAME_SIZE); GPR_ASSERT(actual_max_frame_size == kMinFrameSize);
/* Validate peer identity. */ /* Validate peer identity. */
tsi_peer peer; tsi_peer peer;
GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK); GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK);

Loading…
Cancel
Save