alts_handshaker_client.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
22 
23 #include <list>
24 
25 #include "upb/upb.hpp"
26 
27 #include <grpc/byte_buffer.h>
28 #include <grpc/support/alloc.h>
29 #include <grpc/support/log.h>
30 
38 
39 #define TSI_ALTS_INITIAL_BUFFER_SIZE 256
40 
41 const int kHandshakerClientOpNum = 4;
42 
45 };
46 
49  const unsigned char* bytes_to_send;
52 };
53 
56  /* One ref is held by the entity that created this handshaker_client, and
57  * another ref is held by the pending RECEIVE_STATUS_ON_CLIENT op. */
61  /* A pointer to a function handling the interaction with handshaker service.
62  * That is, it points to grpc_call_start_batch_and_execute when the handshaker
63  * client is used in a non-testing use case and points to a custom function
64  * that validates the data to be sent to handshaker service in a testing use
65  * case. */
67  /* A gRPC closure to be scheduled when the response from handshaker service
68  * is received. It will be initialized with the injected grpc RPC callback. */
70  /* Buffers containing information to be sent (or received) to (or from) the
71  * handshaker service. */
75  /* Initial metadata to be received from handshaker service. */
77  /* A callback function provided by an application to be invoked when response
78  * is received from handshaker service. */
80  void* user_data;
81  /* ALTS credential options passed in from the caller. */
83  /* target name information to be passed to handshaker service for server
84  * authorization check. */
86  /* boolean flag indicating if the handshaker client is used at client
87  * (is_client = true) or server (is_client = false) side. */
88  bool is_client;
89  /* a temporary store for data received from handshaker service used to extract
90  * unused data. */
92  /* a buffer containing data to be sent to the grpc client or server's peer. */
93  unsigned char* buffer;
94  size_t buffer_size;
101  /* mu synchronizes all fields below including their internal fields. */
103  /* indicates if the handshaker call's RECV_STATUS_ON_CLIENT op is done. */
105  /* if non-null, contains arguments to complete a TSI next callback. */
107  /* Maximum frame size used by frame protector. */
110 
113  GPR_ASSERT(client != nullptr);
114  grpc_byte_buffer_destroy(client->send_buffer);
115  client->send_buffer = nullptr;
116 }
117 
119  GPR_ASSERT(resp != nullptr);
120  return grpc_gcp_HandshakerResp_result(resp) != nullptr;
121 }
122 
125  if (gpr_unref(&client->refs)) {
126  if (client->base.vtable != nullptr &&
127  client->base.vtable->destruct != nullptr) {
128  client->base.vtable->destruct(&client->base);
129  }
130  grpc_byte_buffer_destroy(client->send_buffer);
131  grpc_byte_buffer_destroy(client->recv_buffer);
132  client->send_buffer = nullptr;
133  client->recv_buffer = nullptr;
134  grpc_metadata_array_destroy(&client->recv_initial_metadata);
135  grpc_slice_unref_internal(client->recv_bytes);
136  grpc_slice_unref_internal(client->target_name);
138  gpr_free(client->buffer);
139  grpc_slice_unref_internal(client->handshake_status_details);
140  delete client;
141  }
142 }
143 
145  alts_grpc_handshaker_client* client, bool receive_status_finished,
146  recv_message_result* pending_recv_message_result) {
148  {
149  grpc_core::MutexLock lock(&client->mu);
150  client->receive_status_finished |= receive_status_finished;
151  if (pending_recv_message_result != nullptr) {
152  GPR_ASSERT(client->pending_recv_message_result == nullptr);
153  client->pending_recv_message_result = pending_recv_message_result;
154  }
155  if (client->pending_recv_message_result == nullptr) {
156  return;
157  }
158  const bool have_final_result =
159  client->pending_recv_message_result->result != nullptr ||
160  client->pending_recv_message_result->status != TSI_OK;
161  if (have_final_result && !client->receive_status_finished) {
162  // If we've received the final message from the handshake
163  // server, or we're about to invoke the TSI next callback
164  // with a status other than TSI_OK (which terminates the
165  // handshake), then first wait for the RECV_STATUS op to complete.
166  return;
167  }
168  r = client->pending_recv_message_result;
169  client->pending_recv_message_result = nullptr;
170  }
171  client->cb(r->status, client->user_data, r->bytes_to_send,
172  r->bytes_to_send_size, r->result);
173  gpr_free(r);
174 }
175 
178  const unsigned char* bytes_to_send,
179  size_t bytes_to_send_size,
181  recv_message_result* p = grpc_core::Zalloc<recv_message_result>();
182  p->status = status;
183  p->bytes_to_send = bytes_to_send;
184  p->bytes_to_send_size = bytes_to_send_size;
185  p->result = result;
186  maybe_complete_tsi_next(client, false /* receive_status_finished */,
187  p /* pending_recv_message_result */);
188 }
189 
191  bool is_ok) {
192  GPR_ASSERT(c != nullptr);
194  reinterpret_cast<alts_grpc_handshaker_client*>(c);
195  grpc_byte_buffer* recv_buffer = client->recv_buffer;
196  grpc_status_code status = client->status;
197  alts_tsi_handshaker* handshaker = client->handshaker;
198  /* Invalid input check. */
199  if (client->cb == nullptr) {
201  "client->cb is nullptr in alts_tsi_handshaker_handle_response()");
202  return;
203  }
204  if (handshaker == nullptr) {
206  "handshaker is nullptr in alts_tsi_handshaker_handle_response()");
207  handle_response_done(client, TSI_INTERNAL_ERROR, nullptr, 0, nullptr);
208  return;
209  }
210  /* TSI handshake has been shutdown. */
211  if (alts_tsi_handshaker_has_shutdown(handshaker)) {
212  gpr_log(GPR_INFO, "TSI handshake shutdown");
213  handle_response_done(client, TSI_HANDSHAKE_SHUTDOWN, nullptr, 0, nullptr);
214  return;
215  }
216  /* Failed grpc call check. */
217  if (!is_ok || status != GRPC_STATUS_OK) {
218  gpr_log(GPR_INFO, "grpc call made to handshaker service failed");
219  handle_response_done(client, TSI_INTERNAL_ERROR, nullptr, 0, nullptr);
220  return;
221  }
222  if (recv_buffer == nullptr) {
224  "recv_buffer is nullptr in alts_tsi_handshaker_handle_response()");
225  handle_response_done(client, TSI_INTERNAL_ERROR, nullptr, 0, nullptr);
226  return;
227  }
230  alts_tsi_utils_deserialize_response(recv_buffer, arena.ptr());
231  grpc_byte_buffer_destroy(client->recv_buffer);
232  client->recv_buffer = nullptr;
233  /* Invalid handshaker response check. */
234  if (resp == nullptr) {
235  gpr_log(GPR_ERROR, "alts_tsi_utils_deserialize_response() failed");
236  handle_response_done(client, TSI_DATA_CORRUPTED, nullptr, 0, nullptr);
237  return;
238  }
239  const grpc_gcp_HandshakerStatus* resp_status =
241  if (resp_status == nullptr) {
242  gpr_log(GPR_ERROR, "No status in HandshakerResp");
243  handle_response_done(client, TSI_DATA_CORRUPTED, nullptr, 0, nullptr);
244  return;
245  }
247  unsigned char* bytes_to_send = nullptr;
248  size_t bytes_to_send_size = 0;
249  if (out_frames.size > 0) {
250  bytes_to_send_size = out_frames.size;
251  while (bytes_to_send_size > client->buffer_size) {
252  client->buffer_size *= 2;
253  client->buffer = static_cast<unsigned char*>(
254  gpr_realloc(client->buffer, client->buffer_size));
255  }
256  memcpy(client->buffer, out_frames.data, bytes_to_send_size);
257  bytes_to_send = client->buffer;
258  }
259  tsi_handshaker_result* result = nullptr;
263  if (status != TSI_OK) {
264  gpr_log(GPR_ERROR, "alts_tsi_handshaker_result_create() failed");
265  handle_response_done(client, status, nullptr, 0, nullptr);
266  return;
267  }
269  result, &client->recv_bytes,
271  }
272  grpc_status_code code = static_cast<grpc_status_code>(
273  grpc_gcp_HandshakerStatus_code(resp_status));
274  if (code != GRPC_STATUS_OK) {
276  if (details.size > 0) {
277  char* error_details = static_cast<char*>(gpr_zalloc(details.size + 1));
278  memcpy(error_details, details.data, details.size);
279  gpr_log(GPR_ERROR, "Error from handshaker service:%s", error_details);
280  gpr_free(error_details);
281  }
282  }
283  // TODO(apolcyn): consider short ciruiting handle_response_done and
284  // invoking the TSI callback directly if we aren't done yet, if
285  // handle_response_done's allocation per message received causes
286  // a performance issue.
288  bytes_to_send, bytes_to_send_size, result);
289 }
290 
292  bool is_start) {
293  GPR_ASSERT(client != nullptr);
295  memset(ops, 0, sizeof(ops));
296  grpc_op* op = ops;
297  if (is_start) {
300  op->data.recv_status_on_client.status = &client->handshake_status_code;
302  &client->handshake_status_details;
303  op->flags = 0;
304  op->reserved = nullptr;
305  op++;
307  gpr_ref(&client->refs);
308  grpc_call_error call_error =
309  client->grpc_caller(client->call, ops, static_cast<size_t>(op - ops),
310  &client->on_status_received);
311  // TODO(apolcyn): return the error here instead, as done for other ops?
312  GPR_ASSERT(call_error == GRPC_CALL_OK);
313  memset(ops, 0, sizeof(ops));
314  op = ops;
317  op++;
321  &client->recv_initial_metadata;
322  op++;
324  }
326  op->data.send_message.send_message = client->send_buffer;
327  op++;
330  op->data.recv_message.recv_message = &client->recv_buffer;
331  op++;
333  GPR_ASSERT(client->grpc_caller != nullptr);
334  if (client->grpc_caller(client->call, ops, static_cast<size_t>(op - ops),
335  &client->on_handshaker_service_resp_recv) !=
336  GRPC_CALL_OK) {
337  gpr_log(GPR_ERROR, "Start batch operation failed");
338  return TSI_INTERNAL_ERROR;
339  }
340  return TSI_OK;
341 }
342 
343 // TODO(apolcyn): remove this global queue when we can safely rely
344 // on a MAX_CONCURRENT_STREAMS setting in the ALTS handshake server to
345 // limit the number of concurrent handshakes.
346 namespace {
347 
348 class HandshakeQueue {
349  public:
350  explicit HandshakeQueue(size_t max_outstanding_handshakes)
351  : max_outstanding_handshakes_(max_outstanding_handshakes) {}
352 
353  void RequestHandshake(alts_grpc_handshaker_client* client) {
354  {
355  grpc_core::MutexLock lock(&mu_);
356  if (outstanding_handshakes_ == max_outstanding_handshakes_) {
357  // Max number already running, add to queue.
358  queued_handshakes_.push_back(client);
359  return;
360  }
361  // Start the handshake immediately.
362  ++outstanding_handshakes_;
363  }
364  continue_make_grpc_call(client, true /* is_start */);
365  }
366 
367  void HandshakeDone() {
369  {
370  grpc_core::MutexLock lock(&mu_);
371  if (queued_handshakes_.empty()) {
372  // Nothing more in queue. Decrement count and return immediately.
373  --outstanding_handshakes_;
374  return;
375  }
376  // Remove next entry from queue and start the handshake.
377  client = queued_handshakes_.front();
378  queued_handshakes_.pop_front();
379  }
380  continue_make_grpc_call(client, true /* is_start */);
381  }
382 
383  private:
385  std::list<alts_grpc_handshaker_client*> queued_handshakes_;
386  size_t outstanding_handshakes_ = 0;
387  const size_t max_outstanding_handshakes_;
388 };
389 
390 gpr_once g_queued_handshakes_init = GPR_ONCE_INIT;
391 /* Using separate queues for client and server handshakes is a
392  * hack that's mainly intended to satisfy the alts_concurrent_connectivity_test,
393  * which runs many concurrent handshakes where both endpoints
394  * are in the same process; this situation is problematic with a
395  * single queue because we have a high chance of using up all outstanding
396  * slots in the queue, such that there aren't any
397  * mutual client/server handshakes outstanding at the same time and
398  * able to make progress. */
399 HandshakeQueue* g_client_handshake_queue;
400 HandshakeQueue* g_server_handshake_queue;
401 
402 void DoHandshakeQueuesInit(void) {
403  const size_t per_queue_max_outstanding_handshakes = 40;
404  g_client_handshake_queue =
405  new HandshakeQueue(per_queue_max_outstanding_handshakes);
406  g_server_handshake_queue =
407  new HandshakeQueue(per_queue_max_outstanding_handshakes);
408 }
409 
410 void RequestHandshake(alts_grpc_handshaker_client* client, bool is_client) {
411  gpr_once_init(&g_queued_handshakes_init, DoHandshakeQueuesInit);
412  HandshakeQueue* queue =
413  is_client ? g_client_handshake_queue : g_server_handshake_queue;
414  queue->RequestHandshake(client);
415 }
416 
417 void HandshakeDone(bool is_client) {
418  HandshakeQueue* queue =
419  is_client ? g_client_handshake_queue : g_server_handshake_queue;
420  queue->HandshakeDone();
421 }
422 
423 }; // namespace
424 
430  GPR_ASSERT(c != nullptr);
432  reinterpret_cast<alts_grpc_handshaker_client*>(c);
433  if (is_start) {
434  RequestHandshake(client, client->is_client);
435  return TSI_OK;
436  } else {
437  return continue_make_grpc_call(client, is_start);
438  }
439 }
440 
443  static_cast<alts_grpc_handshaker_client*>(arg);
444  if (client->handshake_status_code != GRPC_STATUS_OK) {
445  // TODO(apolcyn): consider overriding the handshake result's
446  // status from the final ALTS message with the status here.
447  char* status_details =
448  grpc_slice_to_c_string(client->handshake_status_details);
450  "alts_grpc_handshaker_client:%p on_status_received "
451  "status:%d details:|%s| error:|%s|",
452  client, client->handshake_status_code, status_details,
454  gpr_free(status_details);
455  }
456  maybe_complete_tsi_next(client, true /* receive_status_finished */,
457  nullptr /* pending_recv_message_result */);
458  HandshakeDone(client->is_client);
460 }
461 
462 /* Serializes a grpc_gcp_HandshakerReq message into a buffer and returns newly
463  * grpc_byte_buffer holding it. */
466  size_t buf_length;
467  char* buf = grpc_gcp_HandshakerReq_serialize(req, arena, &buf_length);
468  if (buf == nullptr) {
469  return nullptr;
470  }
474  return byte_buffer;
475 }
476 
477 /* Create and populate a client_start handshaker request, then serialize it. */
480  GPR_ASSERT(c != nullptr);
482  reinterpret_cast<alts_grpc_handshaker_client*>(c);
491  arena.ptr());
494  arena.ptr());
495  grpc_gcp_RpcProtocolVersions* client_version =
497  arena.ptr());
499  client_version, arena.ptr(), &client->options->rpc_versions);
502  reinterpret_cast<const char*>(
503  GRPC_SLICE_START_PTR(client->target_name)),
504  GRPC_SLICE_LENGTH(client->target_name)));
506  (reinterpret_cast<grpc_alts_credentials_client_options*>(client->options))
507  ->target_account_list_head;
508  while (ptr != nullptr) {
509  grpc_gcp_Identity* target_identity =
511  arena.ptr());
514  ptr = ptr->next;
515  }
517  start_client, static_cast<uint32_t>(client->max_frame_size));
518  return get_serialized_handshaker_req(req, arena.ptr());
519 }
520 
522  if (c == nullptr) {
523  gpr_log(GPR_ERROR, "client is nullptr in handshaker_client_start_client()");
524  return TSI_INVALID_ARGUMENT;
525  }
528  reinterpret_cast<alts_grpc_handshaker_client*>(c);
529  if (buffer == nullptr) {
530  gpr_log(GPR_ERROR, "get_serialized_start_client() failed");
531  return TSI_INTERNAL_ERROR;
532  }
534  client->send_buffer = buffer;
535  tsi_result result = make_grpc_call(&client->base, true /* is_start */);
536  if (result != TSI_OK) {
537  gpr_log(GPR_ERROR, "make_grpc_call() failed");
538  }
539  return result;
540 }
541 
542 /* Create and populate a start_server handshaker request, then serialize it. */
545  GPR_ASSERT(c != nullptr);
546  GPR_ASSERT(bytes_received != nullptr);
548  reinterpret_cast<alts_grpc_handshaker_client*>(c);
549 
552 
557  arena.ptr());
565  start_server,
567  reinterpret_cast<const char*>(GRPC_SLICE_START_PTR(*bytes_received)),
569  grpc_gcp_RpcProtocolVersions* server_version =
571  arena.ptr());
573  server_version, arena.ptr(), &client->options->rpc_versions);
575  start_server, static_cast<uint32_t>(client->max_frame_size));
576  return get_serialized_handshaker_req(req, arena.ptr());
577 }
578 
581  if (c == nullptr || bytes_received == nullptr) {
582  gpr_log(GPR_ERROR, "Invalid arguments to handshaker_client_start_server()");
583  return TSI_INVALID_ARGUMENT;
584  }
586  reinterpret_cast<alts_grpc_handshaker_client*>(c);
588  if (buffer == nullptr) {
589  gpr_log(GPR_ERROR, "get_serialized_start_server() failed");
590  return TSI_INTERNAL_ERROR;
591  }
593  client->send_buffer = buffer;
594  tsi_result result = make_grpc_call(&client->base, true /* is_start */);
595  if (result != TSI_OK) {
596  gpr_log(GPR_ERROR, "make_grpc_call() failed");
597  }
598  return result;
599 }
600 
601 /* Create and populate a next handshaker request, then serialize it. */
603  GPR_ASSERT(bytes_received != nullptr);
609  next,
611  reinterpret_cast<const char*> GRPC_SLICE_START_PTR(*bytes_received),
613  return get_serialized_handshaker_req(req, arena.ptr());
614 }
615 
618  if (c == nullptr || bytes_received == nullptr) {
619  gpr_log(GPR_ERROR, "Invalid arguments to handshaker_client_next()");
620  return TSI_INVALID_ARGUMENT;
621  }
623  reinterpret_cast<alts_grpc_handshaker_client*>(c);
624  grpc_slice_unref_internal(client->recv_bytes);
627  if (buffer == nullptr) {
628  gpr_log(GPR_ERROR, "get_serialized_next() failed");
629  return TSI_INTERNAL_ERROR;
630  }
632  client->send_buffer = buffer;
633  tsi_result result = make_grpc_call(&client->base, false /* is_start */);
634  if (result != TSI_OK) {
635  gpr_log(GPR_ERROR, "make_grpc_call() failed");
636  }
637  return result;
638 }
639 
641  GPR_ASSERT(c != nullptr);
643  reinterpret_cast<alts_grpc_handshaker_client*>(c);
644  if (client->call != nullptr) {
646  }
647 }
648 
649 static void handshaker_call_unref(void* arg, grpc_error_handle /* error */) {
650  grpc_call* call = static_cast<grpc_call*>(arg);
652 }
653 
655  if (c == nullptr) {
656  return;
657  }
659  reinterpret_cast<alts_grpc_handshaker_client*>(c);
660  if (client->call != nullptr) {
661  // Throw this grpc_call_unref over to the ExecCtx so that
662  // we invoke it at the bottom of the call stack and
663  // prevent lock inversion problems due to nested ExecCtx flushing.
664  // TODO(apolcyn): we could remove this indirection and call
665  // grpc_call_unref inline if there was an internal variant of
666  // grpc_call_unref that didn't need to flush an ExecCtx.
667  if (grpc_core::ExecCtx::Get() == nullptr) {
668  // Unref handshaker call if there is no exec_ctx, e.g., in the case of
669  // Envoy ALTS transport socket.
670  grpc_call_unref(client->call);
671  } else {
672  // Using existing exec_ctx to unref handshaker call.
676  grpc_schedule_on_exec_ctx),
678  }
679  }
680 }
681 
686 
689  const char* handshaker_service_url, grpc_pollset_set* interested_parties,
690  grpc_alts_credentials_options* options, const grpc_slice& target_name,
692  void* user_data, alts_handshaker_client_vtable* vtable_for_testing,
693  bool is_client, size_t max_frame_size) {
694  if (channel == nullptr || handshaker_service_url == nullptr) {
695  gpr_log(GPR_ERROR, "Invalid arguments to alts_handshaker_client_create()");
696  return nullptr;
697  }
699  memset(&client->base, 0, sizeof(client->base));
700  client->base.vtable =
701  vtable_for_testing == nullptr ? &vtable : vtable_for_testing;
702  gpr_ref_init(&client->refs, 1);
703  client->handshaker = handshaker;
705  grpc_metadata_array_init(&client->recv_initial_metadata);
706  client->cb = cb;
707  client->user_data = user_data;
709  client->target_name = grpc_slice_copy(target_name);
710  client->is_client = is_client;
711  client->recv_bytes = grpc_empty_slice();
712  client->buffer_size = TSI_ALTS_INITIAL_BUFFER_SIZE;
713  client->buffer = static_cast<unsigned char*>(gpr_zalloc(client->buffer_size));
714  client->handshake_status_details = grpc_empty_slice();
715  client->max_frame_size = max_frame_size;
716  grpc_slice slice = grpc_slice_from_copied_string(handshaker_service_url);
717  client->call =
718  strcmp(handshaker_service_url, ALTS_HANDSHAKER_SERVICE_URL_FOR_TESTING) ==
719  0
720  ? nullptr
722  channel, nullptr, GRPC_PROPAGATE_DEFAULTS, interested_parties,
726  GRPC_CLOSURE_INIT(&client->on_handshaker_service_resp_recv, grpc_cb, client,
727  grpc_schedule_on_exec_ctx);
728  GRPC_CLOSURE_INIT(&client->on_status_received, on_status_received, client,
729  grpc_schedule_on_exec_ctx);
730  return &client->base;
731 }
732 
733 namespace grpc_core {
734 namespace internal {
735 
738  GPR_ASSERT(c != nullptr && caller != nullptr);
740  reinterpret_cast<alts_grpc_handshaker_client*>(c);
741  client->grpc_caller = caller;
742 }
743 
746  GPR_ASSERT(c != nullptr);
748  reinterpret_cast<alts_grpc_handshaker_client*>(c);
749  return client->send_buffer;
750 }
751 
754  GPR_ASSERT(c != nullptr);
756  reinterpret_cast<alts_grpc_handshaker_client*>(c);
757  return &client->recv_buffer;
758 }
759 
762  GPR_ASSERT(c != nullptr);
764  reinterpret_cast<alts_grpc_handshaker_client*>(c);
765  return &client->recv_initial_metadata;
766 }
767 
769  alts_handshaker_client* c, grpc_slice* recv_bytes) {
770  GPR_ASSERT(c != nullptr);
772  reinterpret_cast<alts_grpc_handshaker_client*>(c);
773  client->recv_bytes = grpc_slice_ref_internal(*recv_bytes);
774 }
775 
778  tsi_handshaker_on_next_done_cb cb, void* user_data,
779  grpc_byte_buffer* recv_buffer, grpc_status_code status) {
780  GPR_ASSERT(c != nullptr);
782  reinterpret_cast<alts_grpc_handshaker_client*>(c);
783  client->handshaker = handshaker;
784  client->cb = cb;
785  client->user_data = user_data;
786  client->recv_buffer = recv_buffer;
787  client->status = status;
788 }
789 
792  void* user_data, bool has_sent_start_message, grpc_slice* recv_bytes) {
793  GPR_ASSERT(c != nullptr);
795  reinterpret_cast<alts_grpc_handshaker_client*>(c);
796  GPR_ASSERT(client->cb == cb);
797  GPR_ASSERT(client->user_data == user_data);
798  if (recv_bytes != nullptr) {
799  GPR_ASSERT(grpc_slice_cmp(client->recv_bytes, *recv_bytes) == 0);
800  }
802  client->handshaker) == has_sent_start_message);
803 }
804 
807  GPR_ASSERT(c != nullptr);
808  GPR_ASSERT(vtable != nullptr);
810  reinterpret_cast<alts_grpc_handshaker_client*>(c);
811  client->base.vtable = vtable;
812 }
813 
816  GPR_ASSERT(c != nullptr);
818  reinterpret_cast<alts_grpc_handshaker_client*>(c);
819  return client->handshaker;
820 }
821 
824  GPR_ASSERT(c != nullptr);
826  reinterpret_cast<alts_grpc_handshaker_client*>(c);
827  client->cb = cb;
828 }
829 
832  GPR_ASSERT(c != nullptr);
834  reinterpret_cast<alts_grpc_handshaker_client*>(c);
835  return &client->on_handshaker_service_resp_recv;
836 }
837 
840  reinterpret_cast<alts_grpc_handshaker_client*>(c);
841  gpr_ref(&client->refs);
842 }
843 
847  // We first make sure that the handshake queue has been initialized
848  // here because there are tests that use this API that mock out
849  // other parts of the alts_handshaker_client in such a way that the
850  // code path that would normally ensure that the handshake queue
851  // has been initialized isn't taken.
852  gpr_once_init(&g_queued_handshakes_init, DoHandshakeQueuesInit);
854  reinterpret_cast<alts_grpc_handshaker_client*>(c);
855  client->handshake_status_code = status;
856  client->handshake_status_details = grpc_empty_slice();
857  Closure::Run(DEBUG_LOCATION, &client->on_status_received, error);
858 }
859 
860 } // namespace internal
861 } // namespace grpc_core
862 
864  if (client != nullptr && client->vtable != nullptr &&
865  client->vtable->client_start != nullptr) {
866  return client->vtable->client_start(client);
867  }
869  "client or client->vtable has not been initialized properly");
870  return TSI_INVALID_ARGUMENT;
871 }
872 
875  if (client != nullptr && client->vtable != nullptr &&
876  client->vtable->server_start != nullptr) {
877  return client->vtable->server_start(client, bytes_received);
878  }
880  "client or client->vtable has not been initialized properly");
881  return TSI_INVALID_ARGUMENT;
882 }
883 
886  if (client != nullptr && client->vtable != nullptr &&
887  client->vtable->next != nullptr) {
888  return client->vtable->next(client, bytes_received);
889  }
891  "client or client->vtable has not been initialized properly");
892  return TSI_INVALID_ARGUMENT;
893 }
894 
896  if (client != nullptr && client->vtable != nullptr &&
897  client->vtable->shutdown != nullptr) {
898  client->vtable->shutdown(client);
899  }
900 }
901 
903  if (c != nullptr) {
905  reinterpret_cast<alts_grpc_handshaker_client*>(c);
907  }
908 }
grpc_gcp_HandshakerResp_result
const UPB_INLINE grpc_gcp_HandshakerResult * grpc_gcp_HandshakerResp_result(const grpc_gcp_HandshakerResp *msg)
Definition: handshaker.upb.h:1079
GRPC_CLOSURE_INIT
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
Definition: closure.h:115
alts_grpc_caller
grpc_call_error(* alts_grpc_caller)(grpc_call *call, const grpc_op *ops, size_t nops, grpc_closure *tag)
Definition: alts_handshaker_client.h:50
alts_handshaker_client_start_server
tsi_result alts_handshaker_client_start_server(alts_handshaker_client *client, grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:873
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
grpc_gcp_NextHandshakeMessageReq
struct grpc_gcp_NextHandshakeMessageReq grpc_gcp_NextHandshakeMessageReq
Definition: handshaker.upb.h:42
grpc_alts_credentials_options_destroy
GRPCAPI void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options.cc:38
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
recv_message_result::bytes_to_send_size
size_t bytes_to_send_size
Definition: alts_handshaker_client.cc:50
grpc_core::internal::alts_handshaker_client_set_cb_for_testing
void alts_handshaker_client_set_cb_for_testing(alts_handshaker_client *c, tsi_handshaker_on_next_done_cb cb)
Definition: alts_handshaker_client.cc:822
recv_message_result::bytes_to_send
const unsigned char * bytes_to_send
Definition: alts_handshaker_client.cc:49
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
grpc_op::grpc_op_data::grpc_op_send_message::send_message
struct grpc_byte_buffer * send_message
Definition: grpc_types.h:668
grpc_op::flags
uint32_t flags
Definition: grpc_types.h:644
grpc_call_error
grpc_call_error
Definition: grpc_types.h:464
grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_handshake_security_protocol(grpc_gcp_StartClientHandshakeReq *msg, int32_t value)
Definition: handshaker.upb.h:350
grpc_gcp_HandshakerStatus
struct grpc_gcp_HandshakerStatus grpc_gcp_HandshakerStatus
Definition: handshaker.upb.h:45
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
grpc_op::grpc_op_data::grpc_op_recv_status_on_client::trailing_metadata
grpc_metadata_array * trailing_metadata
Definition: grpc_types.h:701
grpc_alts_credentials_client_options
Definition: grpc_alts_credentials_options.h:50
grpc_core::internal::alts_handshaker_client_ref_for_testing
void alts_handshaker_client_ref_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:838
log.h
handshaker_client_shutdown
static void handshaker_client_shutdown(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:640
grpc_op::grpc_op_data::grpc_op_recv_status_on_client::status
grpc_status_code * status
Definition: grpc_types.h:702
alts_grpc_handshaker_client::receive_status_finished
bool receive_status_finished
Definition: alts_handshaker_client.cc:104
grpc_raw_byte_buffer_create
GRPCAPI grpc_byte_buffer * grpc_raw_byte_buffer_create(grpc_slice *slices, size_t nslices)
Definition: byte_buffer.cc:34
grpc_slice_ref_internal
const grpc_slice & grpc_slice_ref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:32
get_serialized_start_server
static grpc_byte_buffer * get_serialized_start_server(alts_handshaker_client *c, grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:543
alts_tsi_handshaker_private.h
memset
return memset(p, 0, total)
alts_tsi_handshaker
Definition: alts_tsi_handshaker.cc:49
grpc_gcp_StartClientHandshakeReq_add_record_protocols
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_record_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_StringView val, upb_Arena *arena)
Definition: handshaker.upb.h:368
grpc_gcp_StartClientHandshakeReq_add_application_protocols
UPB_INLINE bool grpc_gcp_StartClientHandshakeReq_add_application_protocols(grpc_gcp_StartClientHandshakeReq *msg, upb_StringView val, upb_Arena *arena)
Definition: handshaker.upb.h:359
gpr_once
pthread_once_t gpr_once
Definition: impl/codegen/sync_posix.h:50
alts_grpc_handshaker_client::handshake_status_details
grpc_slice handshake_status_details
Definition: alts_handshaker_client.cc:100
grpc_slice_from_copied_string
GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source)
Definition: slice/slice.cc:177
grpc_op::grpc_op_data::send_initial_metadata
struct grpc_op::grpc_op_data::grpc_op_send_initial_metadata send_initial_metadata
TSI_INTERNAL_ERROR
@ TSI_INTERNAL_ERROR
Definition: transport_security_interface.h:39
alts_grpc_handshaker_client::recv_bytes
grpc_slice recv_bytes
Definition: alts_handshaker_client.cc:91
grpc_core::internal::alts_handshaker_client_get_recv_buffer_addr_for_testing
grpc_byte_buffer ** alts_handshaker_client_get_recv_buffer_addr_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:752
grpc_core
Definition: call_metric_recorder.h:31
upb_StringView::data
const char * data
Definition: upb/upb/upb.h:73
grpc_metadata_array
Definition: grpc_types.h:579
client
Definition: examples/python/async_streaming/client.py:1
grpc_core::MutexLock
Definition: src/core/lib/gprpp/sync.h:88
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
grpc_op::reserved
void * reserved
Definition: grpc_types.h:646
options
double_dict options[]
Definition: capstone_test.c:55
handshaker_client_destruct
static void handshaker_client_destruct(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:654
alts_grpc_handshaker_client_unref
static void alts_grpc_handshaker_client_unref(alts_grpc_handshaker_client *client)
Definition: alts_handshaker_client.cc:123
buf
voidpf void * buf
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
grpc_gcp_RpcProtocolVersions_assign_from_struct
void grpc_gcp_RpcProtocolVersions_assign_from_struct(grpc_gcp_RpcProtocolVersions *versions, upb_Arena *arena, const grpc_gcp_rpc_protocol_versions *value)
Definition: transport_security_common_api.cc:137
target_service_account
Definition: grpc_alts_credentials_options.h:40
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
grpc_slice_cmp
GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b)
Definition: slice/slice.cc:419
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
bytes_received
static int bytes_received
Definition: test-callback-stack.c:44
alts_handshaker_client_vtable
Definition: alts_handshaker_client.h:54
get_serialized_next
static grpc_byte_buffer * get_serialized_next(grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:602
start_server
static void start_server(void)
Definition: test-delayed-accept.c:100
GRPC_CALL_OK
@ GRPC_CALL_OK
Definition: grpc_types.h:466
status
absl::Status status
Definition: rls.cc:251
GPR_ONCE_INIT
#define GPR_ONCE_INIT
Definition: impl/codegen/sync_posix.h:52
alts_grpc_handshaker_client::target_name
grpc_slice target_name
Definition: alts_handshaker_client.cc:85
grpc_gcp_HandshakerResp_bytes_consumed
UPB_INLINE uint32_t grpc_gcp_HandshakerResp_bytes_consumed(const grpc_gcp_HandshakerResp *msg)
Definition: handshaker.upb.h:1070
get_serialized_handshaker_req
static grpc_byte_buffer * get_serialized_handshaker_req(grpc_gcp_HandshakerReq *req, upb_Arena *arena)
Definition: alts_handshaker_client.cc:464
vtable
static const alts_handshaker_client_vtable vtable
Definition: alts_handshaker_client.cc:682
xds_manager.p
p
Definition: xds_manager.py:60
GRPC_CLOSURE_CREATE
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)
Definition: closure.h:160
grpc_gcp_StartClientHandshakeReq_set_max_frame_size
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_max_frame_size(grpc_gcp_StartClientHandshakeReq *msg, uint32_t value)
Definition: handshaker.upb.h:438
TSI_HANDSHAKE_SHUTDOWN
@ TSI_HANDSHAKE_SHUTDOWN
Definition: transport_security_interface.h:46
on_status_received
static void on_status_received(void *arg, grpc_error_handle error)
Definition: alts_handshaker_client.cc:441
grpc_gcp_StartClientHandshakeReq_add_target_identities
UPB_INLINE struct grpc_gcp_Identity * grpc_gcp_StartClientHandshakeReq_add_target_identities(grpc_gcp_StartClientHandshakeReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:377
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, size_t max_frame_size)
Definition: alts_handshaker_client.cc:687
alts_grpc_handshaker_client::handshaker
alts_tsi_handshaker * handshaker
Definition: alts_handshaker_client.cc:59
gpr_refcount
Definition: impl/codegen/sync_generic.h:39
get_serialized_start_client
static grpc_byte_buffer * get_serialized_start_client(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:478
alts_grpc_handshaker_client::recv_buffer
grpc_byte_buffer * recv_buffer
Definition: alts_handshaker_client.cc:73
alts_grpc_handshaker_client::options
grpc_alts_credentials_options * options
Definition: alts_handshaker_client.cc:82
alts_handshaker_client_handle_response
void alts_handshaker_client_handle_response(alts_handshaker_client *c, bool is_ok)
Definition: alts_handshaker_client.cc:190
grpc_op::grpc_op_data::recv_message
struct grpc_op::grpc_op_data::grpc_op_recv_message recv_message
mu_
Mutex mu_
Definition: oob_backend_metric.cc:115
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
call
FilterStackCall * call
Definition: call.cc:750
grpc_op::data
union grpc_op::grpc_op_data data
grpc_gcp_HandshakerReq
struct grpc_gcp_HandshakerReq grpc_gcp_HandshakerReq
Definition: handshaker.upb.h:43
gpr_once_init
GPRAPI void gpr_once_init(gpr_once *once, void(*init_function)(void))
alts_grpc_handshaker_client::recv_initial_metadata
grpc_metadata_array recv_initial_metadata
Definition: alts_handshaker_client.cc:76
gpr_zalloc
GPRAPI void * gpr_zalloc(size_t size)
Definition: alloc.cc:40
client
static uv_tcp_t client
Definition: test-callback-stack.c:33
uint32_t
unsigned int uint32_t
Definition: stdint-msvc2008.h:80
grpc_gcp_ServerHandshakeParameters
struct grpc_gcp_ServerHandshakeParameters grpc_gcp_ServerHandshakeParameters
Definition: handshaker.upb.h:39
recv_message_result
Definition: alts_handshaker_client.cc:47
alts_handshaker_client_shutdown
void alts_handshaker_client_shutdown(alts_handshaker_client *client)
Definition: alts_handshaker_client.cc:895
grpc_metadata_array_destroy
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array)
Definition: metadata_array.cc:35
ALTS_HANDSHAKER_SERVICE_URL_FOR_TESTING
#define ALTS_HANDSHAKER_SERVICE_URL_FOR_TESTING
Definition: alts_handshaker_client.h:36
grpc_gcp_Identity_set_service_account
UPB_INLINE void grpc_gcp_Identity_set_service_account(grpc_gcp_Identity *msg, upb_StringView value)
Definition: handshaker.upb.h:209
TSI_OK
@ TSI_OK
Definition: transport_security_interface.h:32
DEBUG_LOCATION
#define DEBUG_LOCATION
Definition: debug_location.h:41
grpc_op::grpc_op_data::grpc_op_recv_message::recv_message
struct grpc_byte_buffer ** recv_message
Definition: grpc_types.h:693
alts_grpc_handshaker_client::user_data
void * user_data
Definition: alts_handshaker_client.cc:80
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
alts_handshaker_client.h
c
void c(T a)
Definition: miscompile_with_no_unique_address_test.cc:40
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
GRPC_STATUS_OK
@ GRPC_STATUS_OK
Definition: include/grpc/impl/codegen/status.h:30
GRPC_OP_RECV_INITIAL_METADATA
@ GRPC_OP_RECV_INITIAL_METADATA
Definition: grpc_types.h:617
handshaker_call_unref
static void handshaker_call_unref(void *arg, grpc_error_handle)
Definition: alts_handshaker_client.cc:649
grpc_gcp_StartServerHandshakeReq_handshake_parameters_set
UPB_INLINE bool grpc_gcp_StartServerHandshakeReq_handshake_parameters_set(grpc_gcp_StartServerHandshakeReq *msg, int32_t key, grpc_gcp_ServerHandshakeParameters *val, upb_Arena *a)
Definition: handshaker.upb.h:613
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
gpr_realloc
GPRAPI void * gpr_realloc(void *p, size_t size)
Definition: alloc.cc:56
grpc_gcp_HandshakerResp
struct grpc_gcp_HandshakerResp grpc_gcp_HandshakerResp
Definition: handshaker.upb.h:46
queue
Definition: sync_test.cc:39
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
upb_StringView::size
size_t size
Definition: upb/upb/upb.h:74
grpc_core::internal::alts_handshaker_client_check_fields_for_testing
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)
Definition: alts_handshaker_client.cc:790
grpc_call_unref
GRPCAPI void grpc_call_unref(grpc_call *call)
Definition: call.cc:1770
grpc_gcp_HandshakerReq_mutable_next
UPB_INLINE struct grpc_gcp_NextHandshakeMessageReq * grpc_gcp_HandshakerReq_mutable_next(grpc_gcp_HandshakerReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:825
req
static uv_connect_t req
Definition: test-connection-fail.c:30
grpc_core::internal::alts_handshaker_client_set_vtable_for_testing
void alts_handshaker_client_set_vtable_for_testing(alts_handshaker_client *c, alts_handshaker_client_vtable *vtable)
Definition: alts_handshaker_client.cc:805
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
alts_handshaker_client_start_client
tsi_result alts_handshaker_client_start_client(alts_handshaker_client *client)
Definition: alts_handshaker_client.cc:863
http2_server_health_check.resp
resp
Definition: http2_server_health_check.py:31
alts_grpc_handshaker_client::handshake_status_code
grpc_status_code handshake_status_code
Definition: alts_handshaker_client.cc:98
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
grpc_core::internal::alts_handshaker_client_get_send_buffer_for_testing
grpc_byte_buffer * alts_handshaker_client_get_send_buffer_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:744
grpc_byte_buffer
Definition: grpc_types.h:43
grpc_gcp_StartServerHandshakeReq
struct grpc_gcp_StartServerHandshakeReq grpc_gcp_StartServerHandshakeReq
Definition: handshaker.upb.h:40
tsi_handshaker_on_next_done_cb
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)
Definition: transport_security_interface.h:462
tsi_result
tsi_result
Definition: transport_security_interface.h:31
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)
Definition: alts_tsi_handshaker.cc:669
grpc_op
Definition: grpc_types.h:640
GRPC_OP_SEND_MESSAGE
@ GRPC_OP_SEND_MESSAGE
Definition: grpc_types.h:602
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
grpc_core::internal::alts_handshaker_client_get_closure_for_testing
grpc_closure * alts_handshaker_client_get_closure_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:830
alts_grpc_handshaker_client::call
grpc_call * call
Definition: alts_handshaker_client.cc:60
arg
Definition: cmdline.cc:40
grpc_slice_from_static_string
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
Definition: slice/slice.cc:89
kHandshakerClientOpNum
const int kHandshakerClientOpNum
Definition: alts_handshaker_client.cc:41
grpc_empty_slice
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
alts_handshaker_client
Definition: alts_handshaker_client.cc:43
alts_shared_resource.h
alts_handshaker_client_next
tsi_result alts_handshaker_client_next(alts_handshaker_client *client, grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:884
grpc_gcp_HandshakerStatus_details
UPB_INLINE upb_StringView grpc_gcp_HandshakerStatus_details(const grpc_gcp_HandshakerStatus *msg)
Definition: handshaker.upb.h:1019
alts_tsi_utils_deserialize_response
grpc_gcp_HandshakerResp * alts_tsi_utils_deserialize_response(grpc_byte_buffer *resp_buffer, upb_Arena *arena)
Definition: alts_tsi_utils.cc:44
grpc_core::internal::alts_handshaker_client_get_handshaker_for_testing
alts_tsi_handshaker * alts_handshaker_client_get_handshaker_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:814
alts_grpc_handshaker_client::mu
grpc_core::Mutex mu
Definition: alts_handshaker_client.cc:102
start_client
static void start_client(void)
Definition: test-poll.c:540
buffer
char buffer[1024]
Definition: libuv/docs/code/idle-compute/main.c:8
slice_internal.h
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
grpc_gcp_ServerHandshakeParameters_new
UPB_INLINE grpc_gcp_ServerHandshakeParameters * grpc_gcp_ServerHandshakeParameters_new(upb_Arena *arena)
Definition: handshaker.upb.h:444
grpc_gcp_RpcProtocolVersions
struct grpc_gcp_RpcProtocolVersions grpc_gcp_RpcProtocolVersions
Definition: transport_security_common.upb.h:25
grpc_core::internal::alts_tsi_handshaker_get_has_sent_start_message_for_testing
bool alts_tsi_handshaker_get_has_sent_start_message_for_testing(alts_tsi_handshaker *handshaker)
Definition: alts_tsi_handshaker.cc:689
grpc_gcp_ServerHandshakeParameters_add_record_protocols
UPB_INLINE bool grpc_gcp_ServerHandshakeParameters_add_record_protocols(grpc_gcp_ServerHandshakeParameters *msg, upb_StringView val, upb_Arena *arena)
Definition: handshaker.upb.h:495
grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions
UPB_INLINE struct grpc_gcp_RpcProtocolVersions * grpc_gcp_StartClientHandshakeReq_mutable_rpc_versions(grpc_gcp_StartClientHandshakeReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:429
grpc_op::op
grpc_op_type op
Definition: grpc_types.h:642
handle_response_done
static void handle_response_done(alts_grpc_handshaker_client *client, tsi_result status, const unsigned char *bytes_to_send, size_t bytes_to_send_size, tsi_handshaker_result *result)
Definition: alts_handshaker_client.cc:176
grpc_gcp_HandshakerResp_out_frames
UPB_INLINE upb_StringView grpc_gcp_HandshakerResp_out_frames(const grpc_gcp_HandshakerResp *msg)
Definition: handshaker.upb.h:1064
grpc_op::grpc_op_data::grpc_op_send_initial_metadata::count
size_t count
Definition: grpc_types.h:653
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
grpc_gcp_StartServerHandshakeReq_add_application_protocols
UPB_INLINE bool grpc_gcp_StartServerHandshakeReq_add_application_protocols(grpc_gcp_StartServerHandshakeReq *msg, upb_StringView val, upb_Arena *arena)
Definition: handshaker.upb.h:609
grpc_op::grpc_op_data::grpc_op_recv_status_on_client::status_details
grpc_slice * status_details
Definition: grpc_types.h:703
alts_tsi_handshaker_result_create
tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp *resp, bool is_client, tsi_handshaker_result **result)
Definition: alts_tsi_handshaker.cc:265
details
static grpc_slice details
Definition: test/core/fling/client.cc:46
value
const char * value
Definition: hpack_parser_table.cc:165
grpc_slice_to_c_string
GPRAPI char * grpc_slice_to_c_string(grpc_slice s)
Definition: slice/slice.cc:35
recv_message_result::result
tsi_handshaker_result * result
Definition: alts_handshaker_client.cc:51
GRPC_OP_RECV_MESSAGE
@ GRPC_OP_RECV_MESSAGE
Definition: grpc_types.h:621
TSI_DATA_CORRUPTED
@ TSI_DATA_CORRUPTED
Definition: transport_security_interface.h:40
grpc_alts_credentials_options
Definition: grpc_alts_credentials_options.h:35
alts_grpc_handshaker_client
Definition: alts_handshaker_client.cc:54
grpc_core::internal::alts_handshaker_client_set_recv_bytes_for_testing
void alts_handshaker_client_set_recv_bytes_for_testing(alts_handshaker_client *c, grpc_slice *recv_bytes)
Definition: alts_handshaker_client.cc:768
grpc_core::Mutex
Definition: src/core/lib/gprpp/sync.h:61
upb::Arena
Definition: upb.hpp:68
grpc_gcp_Identity
struct grpc_gcp_Identity grpc_gcp_Identity
Definition: handshaker.upb.h:36
grpc_alts_credentials_options_copy
grpc_alts_credentials_options * grpc_alts_credentials_options_copy(const grpc_alts_credentials_options *options)
Definition: grpc_alts_credentials_options.cc:26
grpc_slice_from_copied_buffer
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
Definition: slice/slice.cc:170
ALTS_APPLICATION_PROTOCOL
#define ALTS_APPLICATION_PROTOCOL
Definition: alts_handshaker_client.h:34
alts_grpc_handshaker_client::buffer_size
size_t buffer_size
Definition: alts_handshaker_client.cc:94
alts_tsi_utils.h
GRPC_PROPAGATE_DEFAULTS
#define GRPC_PROPAGATE_DEFAULTS
Definition: propagation_bits.h:45
make_grpc_call
static tsi_result make_grpc_call(alts_handshaker_client *c, bool is_start)
Definition: alts_handshaker_client.cc:429
upb_StringView
Definition: upb/upb/upb.h:72
alts_grpc_handshaker_client::base
alts_handshaker_client base
Definition: alts_handshaker_client.cc:55
grpc_gcp_HandshakerReq_new
UPB_INLINE grpc_gcp_HandshakerReq * grpc_gcp_HandshakerReq_new(upb_Arena *arena)
Definition: handshaker.upb.h:732
alts_grpc_handshaker_client
struct alts_grpc_handshaker_client alts_grpc_handshaker_client
alts_handshaker_client_destroy
void alts_handshaker_client_destroy(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:902
upb.hpp
GRPC_OP_SEND_INITIAL_METADATA
@ GRPC_OP_SEND_INITIAL_METADATA
Definition: grpc_types.h:598
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
grpc_op::grpc_op_data::send_message
struct grpc_op::grpc_op_data::grpc_op_send_message send_message
TSI_ALTS_INITIAL_BUFFER_SIZE
#define TSI_ALTS_INITIAL_BUFFER_SIZE
Definition: alts_handshaker_client.cc:39
grpc_core::internal::alts_handshaker_client_set_grpc_caller_for_testing
void alts_handshaker_client_set_grpc_caller_for_testing(alts_handshaker_client *c, alts_grpc_caller caller)
Definition: alts_handshaker_client.cc:736
alts_grpc_handshaker_client::refs
gpr_refcount refs
Definition: alts_handshaker_client.cc:58
alts_grpc_handshaker_client::on_status_received
grpc_closure on_status_received
Definition: alts_handshaker_client.cc:96
alts_tsi_handshaker_has_shutdown
bool alts_tsi_handshaker_has_shutdown(alts_tsi_handshaker *handshaker)
Definition: alts_tsi_handshaker.cc:633
grpc_channel_create_pollset_set_call
grpc_call * grpc_channel_create_pollset_set_call(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_pollset_set *pollset_set, const grpc_slice &method, const grpc_slice *host, grpc_core::Timestamp deadline, void *reserved)
Definition: channel.cc:331
handshaker_client_send_buffer_destroy
static void handshaker_client_send_buffer_destroy(alts_grpc_handshaker_client *client)
Definition: alts_handshaker_client.cc:111
alloc.h
handshaker_client_start_client
static tsi_result handshaker_client_start_client(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:521
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
grpc_op::grpc_op_data::recv_status_on_client
struct grpc_op::grpc_op_data::grpc_op_recv_status_on_client recv_status_on_client
fix_build_deps.r
r
Definition: fix_build_deps.py:491
grpc_iomgr_cb_func
void(* grpc_iomgr_cb_func)(void *arg, grpc_error_handle error)
Definition: closure.h:53
grpc_gcp_StartClientHandshakeReq_set_target_name
UPB_INLINE void grpc_gcp_StartClientHandshakeReq_set_target_name(grpc_gcp_StartClientHandshakeReq *msg, upb_StringView value)
Definition: handshaker.upb.h:422
upb_StringView_FromDataAndSize
UPB_INLINE upb_StringView upb_StringView_FromDataAndSize(const char *data, size_t size)
Definition: upb/upb/upb.h:77
grpc_gcp_StartServerHandshakeReq_set_max_frame_size
UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_max_frame_size(grpc_gcp_StartServerHandshakeReq *msg, uint32_t value)
Definition: handshaker.upb.h:664
grpc_slice::data
union grpc_slice::grpc_slice_data data
ALTS_RECORD_PROTOCOL
#define ALTS_RECORD_PROTOCOL
Definition: alts_handshaker_client.h:35
grpc_gcp_StartServerHandshakeReq_set_in_bytes
UPB_INLINE void grpc_gcp_StartServerHandshakeReq_set_in_bytes(grpc_gcp_StartServerHandshakeReq *msg, upb_StringView value)
Definition: handshaker.upb.h:622
grpc_byte_buffer_destroy
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)
Definition: byte_buffer.cc:81
TSI_INVALID_ARGUMENT
@ TSI_INVALID_ARGUMENT
Definition: transport_security_interface.h:34
grpc_gcp_HandshakerReq_mutable_server_start
UPB_INLINE struct grpc_gcp_StartServerHandshakeReq * grpc_gcp_HandshakerReq_mutable_server_start(grpc_gcp_HandshakerReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:813
grpc_core::internal::alts_handshaker_client_set_fields_for_testing
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)
Definition: alts_handshaker_client.cc:776
arg
struct arg arg
alts_grpc_handshaker_client::pending_recv_message_result
recv_message_result * pending_recv_message_result
Definition: alts_handshaker_client.cc:106
alts_grpc_handshaker_client::cb
tsi_handshaker_on_next_done_cb cb
Definition: alts_handshaker_client.cc:79
grpc_core::internal::alts_handshaker_client_get_initial_metadata_for_testing
grpc_metadata_array * alts_handshaker_client_get_initial_metadata_for_testing(alts_handshaker_client *c)
Definition: alts_handshaker_client.cc:760
grpc_core::ExecCtx::Run
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
Definition: exec_ctx.cc:98
alts_tsi_utils_convert_to_tsi_result
tsi_result alts_tsi_utils_convert_to_tsi_result(grpc_status_code code)
Definition: alts_tsi_utils.cc:27
grpc_channel
struct grpc_channel grpc_channel
Definition: grpc_types.h:62
alts_grpc_handshaker_client::on_handshaker_service_resp_recv
grpc_closure on_handshaker_service_resp_recv
Definition: alts_handshaker_client.cc:69
ALTS_SERVICE_METHOD
#define ALTS_SERVICE_METHOD
Definition: alts_handshaker_client.h:33
alts_grpc_handshaker_client::is_client
bool is_client
Definition: alts_handshaker_client.cc:88
upb_StringView_FromString
UPB_INLINE upb_StringView upb_StringView_FromString(const char *data)
Definition: upb/upb/upb.h:85
tsi_handshaker_result
Definition: transport_security.h:121
alts_grpc_handshaker_client::buffer
unsigned char * buffer
Definition: alts_handshaker_client.cc:93
internal
Definition: benchmark/test/output_test_helper.cc:20
grpc_core::internal::alts_handshaker_client_on_status_received_for_testing
void alts_handshaker_client_on_status_received_for_testing(alts_handshaker_client *c, grpc_status_code status, grpc_error_handle error)
Definition: alts_handshaker_client.cc:844
grpc_call_start_batch_and_execute
grpc_call_error grpc_call_start_batch_and_execute(grpc_call *call, const grpc_op *ops, size_t nops, grpc_closure *closure)
Definition: call.cc:1847
alts_grpc_handshaker_client::grpc_caller
alts_grpc_caller grpc_caller
Definition: alts_handshaker_client.cc:66
grpc_core::Timestamp::InfFuture
static constexpr Timestamp InfFuture()
Definition: src/core/lib/gprpp/time.h:79
gpr_ref_init
GPRAPI void gpr_ref_init(gpr_refcount *r, int n)
Definition: sync.cc:86
grpc_op::grpc_op_data::recv_initial_metadata
struct grpc_op::grpc_op_data::grpc_op_recv_initial_metadata recv_initial_metadata
continue_make_grpc_call
static tsi_result continue_make_grpc_call(alts_grpc_handshaker_client *client, bool is_start)
Definition: alts_handshaker_client.cc:291
code
Definition: bloaty/third_party/zlib/contrib/infback9/inftree9.h:24
grpc_gcp_HandshakerReq_serialize
UPB_INLINE char * grpc_gcp_HandshakerReq_serialize(const grpc_gcp_HandshakerReq *msg, upb_Arena *arena, size_t *len)
Definition: handshaker.upb.h:754
handshaker_client_start_server
static tsi_result handshaker_client_start_server(alts_handshaker_client *c, grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:579
gpr_unref
GPRAPI int gpr_unref(gpr_refcount *r)
Definition: sync.cc:103
grpc_error
Definition: error_internal.h:42
maybe_complete_tsi_next
static void maybe_complete_tsi_next(alts_grpc_handshaker_client *client, bool receive_status_finished, recv_message_result *pending_recv_message_result)
Definition: alts_handshaker_client.cc:144
grpc_gcp_StartClientHandshakeReq
struct grpc_gcp_StartClientHandshakeReq grpc_gcp_StartClientHandshakeReq
Definition: handshaker.upb.h:38
GRPC_OP_RECV_STATUS_ON_CLIENT
@ GRPC_OP_RECV_STATUS_ON_CLIENT
Definition: grpc_types.h:627
grpc_op::grpc_op_data::grpc_op_recv_initial_metadata::recv_initial_metadata
grpc_metadata_array * recv_initial_metadata
Definition: grpc_types.h:685
grpc_gcp_HandshakerResp_status
const UPB_INLINE grpc_gcp_HandshakerStatus * grpc_gcp_HandshakerResp_status(const grpc_gcp_HandshakerResp *msg)
Definition: handshaker.upb.h:1088
grpc_gcp_HandshakerStatus_code
UPB_INLINE uint32_t grpc_gcp_HandshakerStatus_code(const grpc_gcp_HandshakerStatus *msg)
Definition: handshaker.upb.h:1013
grpc_gcp_NextHandshakeMessageReq_set_in_bytes
UPB_INLINE void grpc_gcp_NextHandshakeMessageReq_set_in_bytes(grpc_gcp_NextHandshakeMessageReq *msg, upb_StringView value)
Definition: handshaker.upb.h:726
recv_message_result::status
tsi_result status
Definition: alts_handshaker_client.cc:48
handshaker_client_next
static tsi_result handshaker_client_next(alts_handshaker_client *c, grpc_slice *bytes_received)
Definition: alts_handshaker_client.cc:616
grpc_gcp_ALTS
@ grpc_gcp_ALTS
Definition: handshaker.upb.h:65
grpc_closure
Definition: closure.h:56
op
static grpc_op * op
Definition: test/core/fling/client.cc:47
ops
static grpc_op ops[6]
Definition: test/core/fling/client.cc:39
upb_Arena
Definition: upb_internal.h:36
grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions
UPB_INLINE struct grpc_gcp_RpcProtocolVersions * grpc_gcp_StartServerHandshakeReq_mutable_rpc_versions(grpc_gcp_StartServerHandshakeReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:655
grpc_core::Closure::Run
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
Definition: closure.h:250
gpr_ref
GPRAPI void gpr_ref(gpr_refcount *r)
Definition: sync.cc:88
alts_grpc_handshaker_client::status
grpc_status_code status
Definition: alts_handshaker_client.cc:74
alts_handshaker_client::vtable
const alts_handshaker_client_vtable * vtable
Definition: alts_handshaker_client.cc:44
sync.h
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
alts_grpc_handshaker_client::max_frame_size
size_t max_frame_size
Definition: alts_handshaker_client.cc:108
call.h
grpc_gcp_HandshakerReq_mutable_client_start
UPB_INLINE struct grpc_gcp_StartClientHandshakeReq * grpc_gcp_HandshakerReq_mutable_client_start(grpc_gcp_HandshakerReq *msg, upb_Arena *arena)
Definition: handshaker.upb.h:801
grpc_slice_unref_internal
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:39
grpc_metadata_array_init
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array)
Definition: metadata_array.cc:30
is_handshake_finished_properly
static bool is_handshake_finished_properly(grpc_gcp_HandshakerResp *resp)
Definition: alts_handshaker_client.cc:118
channel.h
grpc_slice_copy
GPRAPI grpc_slice grpc_slice_copy(grpc_slice s)
Definition: slice/slice.cc:46
port_platform.h
grpc_call_cancel_internal
void grpc_call_cancel_internal(grpc_call *call)
Definition: call.cc:1806
alts_grpc_handshaker_client::send_buffer
grpc_byte_buffer * send_buffer
Definition: alts_handshaker_client.cc:72


grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:41