call.c
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 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 
24 #include "call.h"
25 
26 #include <ext/spl/spl_exceptions.h>
27 #include <zend_exceptions.h>
28 
29 #include <grpc/support/alloc.h>
30 
31 #include "call_credentials.h"
32 #include "completion_queue.h"
33 #include "timeval.h"
34 #include "channel.h"
35 #include "byte_buffer.h"
36 
37 zend_class_entry *grpc_ce_call;
38 PHP_GRPC_DECLARE_OBJECT_HANDLER(call_ce_handlers)
39 
40 /* Frees and destroys an instance of wrapped_grpc_call */
41 PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_call)
42  if (p->owned && p->wrapped != NULL) {
43  grpc_call_unref(p->wrapped);
44  }
46 
47 /* Initializes an instance of wrapped_grpc_call to be associated with an
48  * object of a class specified by class_type */
49 php_grpc_zend_object create_wrapped_grpc_call(zend_class_entry *class_type
50  TSRMLS_DC) {
51  PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_call);
52  zend_object_std_init(&intern->std, class_type TSRMLS_CC);
53  object_properties_init(&intern->std, class_type);
54  PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_call, call_ce_handlers);
55 }
56 
57 /* Creates and returns a PHP array object with the data in a
58  * grpc_metadata_array. Returns NULL on failure */
60  *metadata_array TSRMLS_DC) {
61  int count = metadata_array->count;
62  grpc_metadata *elements = metadata_array->metadata;
63  zval *array;
65  array_init(array);
66  int i;
67  HashTable *array_hash;
68  zval *inner_array;
69  char *str_key;
70  char *str_val;
71  size_t key_len;
72  zval *data = NULL;
73 
74  array_hash = Z_ARRVAL_P(array);
76  for (i = 0; i < count; i++) {
77  elem = &elements[i];
78  key_len = GRPC_SLICE_LENGTH(elem->key);
79  str_key = ecalloc(key_len + 1, sizeof(char));
80  memcpy(str_key, GRPC_SLICE_START_PTR(elem->key), key_len);
81  str_val = ecalloc(GRPC_SLICE_LENGTH(elem->value) + 1, sizeof(char));
82  memcpy(str_val, GRPC_SLICE_START_PTR(elem->value),
83  GRPC_SLICE_LENGTH(elem->value));
84  if (php_grpc_zend_hash_find(array_hash, str_key, key_len, (void **)&data)
85  == SUCCESS) {
86  if (Z_TYPE_P(data) != IS_ARRAY) {
87  zend_throw_exception(zend_exception_get_default(TSRMLS_C),
88  "Metadata hash somehow contains wrong types.",
89  1 TSRMLS_CC);
90  efree(str_key);
91  efree(str_val);
93  return NULL;
94  }
96  GRPC_SLICE_LENGTH(elem->value),
97  false);
98  } else {
99  PHP_GRPC_MAKE_STD_ZVAL(inner_array);
100  array_init(inner_array);
101  php_grpc_add_next_index_stringl(inner_array, str_val,
102  GRPC_SLICE_LENGTH(elem->value), false);
103  add_assoc_zval(array, str_key, inner_array);
104  PHP_GRPC_FREE_STD_ZVAL(inner_array);
105  }
106  efree(str_key);
107  efree(str_val);
108  }
109  return array;
110 }
111 
112 /* Populates a grpc_metadata_array with the data in a PHP array object.
113  Returns true on success and false on failure */
115  HashTable *array_hash;
116  HashTable *inner_array_hash;
117  zval *value;
118  zval *inner_array;
120  metadata->count = 0;
121  metadata->metadata = NULL;
122  if (Z_TYPE_P(array) != IS_ARRAY) {
123  return false;
124  }
125  array_hash = Z_ARRVAL_P(array);
126 
127  char *key;
128  int key_type;
130  inner_array)
131  if (key_type != HASH_KEY_IS_STRING || key == NULL) {
132  return false;
133  }
134  if (Z_TYPE_P(inner_array) != IS_ARRAY) {
135  return false;
136  }
137  inner_array_hash = Z_ARRVAL_P(inner_array);
138  metadata->capacity += zend_hash_num_elements(inner_array_hash);
140 
141  metadata->metadata = gpr_malloc(metadata->capacity * sizeof(grpc_metadata));
142 
143  char *key1 = NULL;
144  int key_type1;
145  PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(array_hash, key1, key_type1,
146  inner_array)
147  if (key_type1 != HASH_KEY_IS_STRING) {
148  return false;
149  }
151  return false;
152  }
153  inner_array_hash = Z_ARRVAL_P(inner_array);
154  PHP_GRPC_HASH_FOREACH_VAL_START(inner_array_hash, value)
155  if (Z_TYPE_P(value) != IS_STRING) {
156  return false;
157  }
158  metadata->metadata[metadata->count].key =
160  metadata->metadata[metadata->count].value =
161  grpc_slice_from_copied_buffer(Z_STRVAL_P(value), Z_STRLEN_P(value));
162  metadata->count += 1;
165  return true;
166 }
167 
170  size_t i;
171  if (array->metadata) {
172  for (i = 0; i < array->count; i++) {
173  grpc_slice_unref(array->metadata[i].key);
174  grpc_slice_unref(array->metadata[i].value);
175  }
176  }
178 }
179 
180 /* Wraps a grpc_call struct in a PHP object. Owned indicates whether the
181  struct should be destroyed at the end of the object's lifecycle */
182 zval *grpc_php_wrap_call(grpc_call *wrapped, bool owned TSRMLS_DC) {
183  zval *call_object;
184  PHP_GRPC_MAKE_STD_ZVAL(call_object);
185  object_init_ex(call_object, grpc_ce_call);
186  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
187  call_object);
188  call->wrapped = wrapped;
189  call->owned = owned;
190  return call_object;
191 }
192 
201 PHP_METHOD(Call, __construct) {
202  zval *channel_obj;
203  char *method;
204  php_grpc_int method_len;
205  zval *deadline_obj;
206  char *host_override = NULL;
207  php_grpc_int host_override_len = 0;
208  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
209  getThis());
210 
211  /* "OsO|s" == 1 Object, 1 string, 1 Object, 1 optional string */
212  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "OsO|s", &channel_obj,
213  grpc_ce_channel, &method, &method_len,
214  &deadline_obj, grpc_ce_timeval, &host_override,
215  &host_override_len) == FAILURE) {
216  zend_throw_exception(spl_ce_InvalidArgumentException,
217  "Call expects a Channel, a String, a Timeval and "
218  "an optional String", 1 TSRMLS_CC);
219  return;
220  }
221  wrapped_grpc_channel *channel =
222  PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_channel, channel_obj);
223  if (channel->wrapper == NULL) {
224  zend_throw_exception(spl_ce_InvalidArgumentException,
225  "Call cannot be constructed from a closed Channel",
226  1 TSRMLS_CC);
227  return;
228  }
229  gpr_mu_lock(&channel->wrapper->mu);
230  if (channel->wrapper == NULL || channel->wrapper->wrapped == NULL) {
231  zend_throw_exception(spl_ce_InvalidArgumentException,
232  "Call cannot be constructed from a closed Channel",
233  1 TSRMLS_CC);
234  gpr_mu_unlock(&channel->wrapper->mu);
235  return;
236  }
237  add_property_zval(getThis(), "channel", channel_obj);
238  wrapped_grpc_timeval *deadline =
239  PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_timeval, deadline_obj);
241  grpc_slice host_slice = host_override != NULL ?
243  call->wrapped =
244  grpc_channel_create_call(channel->wrapper->wrapped, NULL,
246  completion_queue, method_slice,
247  host_override != NULL ? &host_slice : NULL,
248  deadline->wrapped, NULL);
249  grpc_slice_unref(method_slice);
250  grpc_slice_unref(host_slice);
251  call->owned = true;
252  call->channel = channel;
253  gpr_mu_unlock(&channel->wrapper->mu);
254 }
255 
261 PHP_METHOD(Call, startBatch) {
262  zval *result;
264  object_init(result);
266  zval *recv_status;
267  zval *value;
268  zval *inner_value;
269  zval *message_value;
270  zval *message_flags;
271  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
272  getThis());
273  if (call->channel) {
274  // startBatch in gRPC PHP server doesn't have channel in it.
275  if (call->channel->wrapper == NULL ||
276  call->channel->wrapper->wrapped == NULL) {
277  zend_throw_exception(spl_ce_RuntimeException,
278  "startBatch Error. Channel is closed",
279  1 TSRMLS_CC);
280  }
281  }
282 
283  grpc_op ops[8];
284  size_t op_num = 0;
285  zval *array;
286  HashTable *array_hash;
287  HashTable *status_hash;
288  HashTable *message_hash;
289 
292  grpc_metadata_array recv_metadata;
293  grpc_metadata_array recv_trailing_metadata;
295  grpc_slice recv_status_details = grpc_empty_slice();
296  grpc_slice send_status_details = grpc_empty_slice();
297  grpc_byte_buffer *message = NULL;
298  int cancelled;
300 
301  zend_string* zmessage = NULL;
302 
305  grpc_metadata_array_init(&recv_metadata);
306  grpc_metadata_array_init(&recv_trailing_metadata);
307  memset(ops, 0, sizeof(ops));
308 
309  /* "a" == 1 array */
310  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) ==
311  FAILURE) {
312  zend_throw_exception(spl_ce_InvalidArgumentException,
313  "start_batch expects an array", 1 TSRMLS_CC);
314  goto cleanup;
315  }
316 
317  // c-core may call rand(). If we don't call srand() here, all the
318  // random numbers being returned would be the same.
320  srand(now.tv_nsec);
321 
322  array_hash = Z_ARRVAL_P(array);
323 
324  char *key = NULL;
325  int key_type;
327  value)
328  if (key_type != HASH_KEY_IS_LONG || key != NULL) {
329  zend_throw_exception(spl_ce_InvalidArgumentException,
330  "batch keys must be integers", 1 TSRMLS_CC);
331  goto cleanup;
332  }
333 
334  ops[op_num].op = (grpc_op_type)index;
335  ops[op_num].flags = 0;
336  ops[op_num].reserved = NULL;
337 
338  switch(index) {
341  zend_throw_exception(spl_ce_InvalidArgumentException,
342  "Bad metadata value given", 1 TSRMLS_CC);
343  goto cleanup;
344  }
346  ops[op_num].data.send_initial_metadata.metadata = metadata.metadata;
347  break;
349  if (Z_TYPE_P(value) != IS_ARRAY) {
350  zend_throw_exception(spl_ce_InvalidArgumentException,
351  "Expected an array for send message",
352  1 TSRMLS_CC);
353  goto cleanup;
354  }
355  message_hash = Z_ARRVAL_P(value);
356  if (php_grpc_zend_hash_find(message_hash, "flags", sizeof("flags"),
357  (void **)&message_flags) == SUCCESS) {
358  if (Z_TYPE_P(message_flags) != IS_LONG) {
359  zend_throw_exception(spl_ce_InvalidArgumentException,
360  "Expected an int for message flags",
361  1 TSRMLS_CC);
362  }
363  ops[op_num].flags = Z_LVAL_P(message_flags) & GRPC_WRITE_USED_MASK;
364  }
365  if (php_grpc_zend_hash_find(message_hash, "message", sizeof("message"),
366  (void **)&message_value) != SUCCESS ||
367  Z_TYPE_P(message_value) != IS_STRING) {
368  zend_throw_exception(spl_ce_InvalidArgumentException,
369  "Expected a string for send message",
370  1 TSRMLS_CC);
371  goto cleanup;
372  }
374  string_to_byte_buffer(Z_STRVAL_P(message_value),
375  Z_STRLEN_P(message_value));
376  break;
378  break;
380  status_hash = Z_ARRVAL_P(value);
381  if (php_grpc_zend_hash_find(status_hash, "metadata", sizeof("metadata"),
382  (void **)&inner_value) == SUCCESS) {
383  if (!create_metadata_array(inner_value, &trailing_metadata)) {
384  zend_throw_exception(spl_ce_InvalidArgumentException,
385  "Bad trailing metadata value given",
386  1 TSRMLS_CC);
387  goto cleanup;
388  }
390  trailing_metadata.metadata;
392  trailing_metadata.count;
393  }
394  if (php_grpc_zend_hash_find(status_hash, "code", sizeof("code"),
395  (void**)&inner_value) == SUCCESS) {
396  if (Z_TYPE_P(inner_value) != IS_LONG) {
397  zend_throw_exception(spl_ce_InvalidArgumentException,
398  "Status code must be an integer",
399  1 TSRMLS_CC);
400  goto cleanup;
401  }
403  Z_LVAL_P(inner_value);
404  } else {
405  zend_throw_exception(spl_ce_InvalidArgumentException,
406  "Integer status code is required",
407  1 TSRMLS_CC);
408  goto cleanup;
409  }
410  if (php_grpc_zend_hash_find(status_hash, "details", sizeof("details"),
411  (void**)&inner_value) == SUCCESS) {
412  if (Z_TYPE_P(inner_value) != IS_STRING) {
413  zend_throw_exception(spl_ce_InvalidArgumentException,
414  "Status details must be a string",
415  1 TSRMLS_CC);
416  goto cleanup;
417  }
418  send_status_details = grpc_slice_from_copied_string(
419  Z_STRVAL_P(inner_value));
421  &send_status_details;
422  } else {
423  zend_throw_exception(spl_ce_InvalidArgumentException,
424  "String status details is required",
425  1 TSRMLS_CC);
426  goto cleanup;
427  }
428  break;
431  &recv_metadata;
432  break;
435  break;
438  &recv_trailing_metadata;
441  &recv_status_details;
442  break;
444  ops[op_num].data.recv_close_on_server.cancelled = &cancelled;
445  break;
446  default:
447  zend_throw_exception(spl_ce_InvalidArgumentException,
448  "Unrecognized key in batch", 1 TSRMLS_CC);
449  goto cleanup;
450  }
451  op_num++;
453 
454  error = grpc_call_start_batch(call->wrapped, ops, op_num, call->wrapped,
455  NULL);
456  if (error != GRPC_CALL_OK) {
457  zend_throw_exception(spl_ce_LogicException,
458  "start_batch was called incorrectly",
459  (long)error TSRMLS_CC);
460  goto cleanup;
461  }
464  zval *recv_md;
465  for (int i = 0; i < op_num; i++) {
466  switch(ops[i].op) {
468  add_property_bool(result, "send_metadata", true);
469  break;
471  add_property_bool(result, "send_message", true);
472  break;
474  add_property_bool(result, "send_close", true);
475  break;
477  add_property_bool(result, "send_status", true);
478  break;
480  recv_md = grpc_parse_metadata_array(&recv_metadata);
481  add_property_zval(result, "metadata", recv_md);
482  zval_ptr_dtor(recv_md);
483  PHP_GRPC_FREE_STD_ZVAL(recv_md);
485  break;
488 
489  if (zmessage == NULL) {
490  add_property_null(result, "message");
491  } else {
492  zval zmessage_val;
493  ZVAL_NEW_STR(&zmessage_val, zmessage);
494  add_property_zval(result, "message", &zmessage_val);
495  zval_ptr_dtor(&zmessage_val);
496  }
497  break;
499  PHP_GRPC_MAKE_STD_ZVAL(recv_status);
500  object_init(recv_status);
501  recv_md = grpc_parse_metadata_array(&recv_trailing_metadata);
502  add_property_zval(recv_status, "metadata", recv_md);
503  zval_ptr_dtor(recv_md);
504  PHP_GRPC_FREE_STD_ZVAL(recv_md);
506  add_property_long(recv_status, "code", status);
507  char *status_details_text = grpc_slice_to_c_string(recv_status_details);
508  php_grpc_add_property_string(recv_status, "details", status_details_text,
509  true);
510  gpr_free(status_details_text);
511  add_property_zval(result, "status", recv_status);
512  zval_ptr_dtor(recv_status);
513  PHP_GRPC_DELREF(recv_status);
514  PHP_GRPC_FREE_STD_ZVAL(recv_status);
515  break;
517  add_property_bool(result, "cancelled", cancelled);
518  break;
519  default:
520  break;
521  }
522  }
523 
524 cleanup:
527  grpc_metadata_array_destroy(&recv_metadata);
528  grpc_metadata_array_destroy(&recv_trailing_metadata);
529  grpc_slice_unref(recv_status_details);
530  grpc_slice_unref(send_status_details);
531  for (int i = 0; i < op_num; i++) {
532  if (ops[i].op == GRPC_OP_SEND_MESSAGE) {
533  grpc_byte_buffer_destroy(ops[i].data.send_message.send_message);
534  }
535  if (ops[i].op == GRPC_OP_RECV_MESSAGE) {
537  }
538  }
540 }
541 
546 PHP_METHOD(Call, getPeer) {
547  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
548  getThis());
549  char *peer = grpc_call_get_peer(call->wrapped);
550  PHP_GRPC_RETVAL_STRING(peer, 1);
551  gpr_free(peer);
552 }
553 
560  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
561  getThis());
562  grpc_call_cancel(call->wrapped, NULL);
563 }
564 
570 PHP_METHOD(Call, setCredentials) {
571  zval *creds_obj;
572 
573  /* "O" == 1 Object */
574  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &creds_obj,
575  grpc_ce_call_credentials) == FAILURE) {
576  zend_throw_exception(spl_ce_InvalidArgumentException,
577  "setCredentials expects 1 CallCredentials",
578  1 TSRMLS_CC);
579  return;
580  }
581 
582  wrapped_grpc_call_credentials *creds =
583  PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call_credentials, creds_obj);
584  wrapped_grpc_call *call = PHP_GRPC_GET_WRAPPED_OBJECT(wrapped_grpc_call,
585  getThis());
586 
588  error = grpc_call_set_credentials(call->wrapped, creds->wrapped);
589  RETURN_LONG(error);
590 }
591 
592 ZEND_BEGIN_ARG_INFO_EX(arginfo_construct, 0, 0, 3)
593  ZEND_ARG_INFO(0, channel)
594  ZEND_ARG_INFO(0, method)
595  ZEND_ARG_INFO(0, deadline)
596  ZEND_ARG_INFO(0, host_override)
597 ZEND_END_ARG_INFO()
598 
599 ZEND_BEGIN_ARG_INFO_EX(arginfo_startBatch, 0, 0, 1)
600  ZEND_ARG_INFO(0, ops)
601 ZEND_END_ARG_INFO()
602 
603 ZEND_BEGIN_ARG_INFO_EX(arginfo_getPeer, 0, 0, 0)
604 ZEND_END_ARG_INFO()
605 
606 ZEND_BEGIN_ARG_INFO_EX(arginfo_cancel, 0, 0, 0)
607 ZEND_END_ARG_INFO()
608 
609 ZEND_BEGIN_ARG_INFO_EX(arginfo_setCredentials, 0, 0, 1)
610  ZEND_ARG_INFO(0, credentials)
611 ZEND_END_ARG_INFO()
612 
613 static zend_function_entry call_methods[] = {
614  PHP_ME(Call, __construct, arginfo_construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
615  PHP_ME(Call, startBatch, arginfo_startBatch, ZEND_ACC_PUBLIC)
616  PHP_ME(Call, getPeer, arginfo_getPeer, ZEND_ACC_PUBLIC)
617  PHP_ME(Call, cancel, arginfo_cancel, ZEND_ACC_PUBLIC)
618  PHP_ME(Call, setCredentials, arginfo_setCredentials, ZEND_ACC_PUBLIC)
619  PHP_FE_END
620 };
621 
622 void grpc_init_call(TSRMLS_D) {
623  zend_class_entry ce;
624  INIT_CLASS_ENTRY(ce, "Grpc\\Call", call_methods);
625  ce.create_object = create_wrapped_grpc_call;
626  grpc_ce_call = zend_register_internal_class(&ce TSRMLS_CC);
627  PHP_GRPC_INIT_HANDLER(wrapped_grpc_call, call_ce_handlers);
628 }
php_grpc_add_property_string
#define php_grpc_add_property_string(arg, name, context, b)
Definition: php7_wrapper.h:28
grpc_slice_unref
GPRAPI void grpc_slice_unref(grpc_slice s)
Definition: slice_api.cc:32
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
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
gpr_mu_unlock
GPRAPI void gpr_mu_unlock(gpr_mu *mu)
grpc_call_cancel
GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved)
Definition: call.cc:1782
completion_queue
grpc_completion_queue * completion_queue
Definition: completion_queue.c:21
now
static double now(void)
Definition: test/core/fling/client.cc:130
grpc_op::grpc_op_data::grpc_op_recv_status_on_client::trailing_metadata
grpc_metadata_array * trailing_metadata
Definition: grpc_types.h:701
grpc_op::grpc_op_data::grpc_op_recv_status_on_client::status
grpc_status_code * status
Definition: grpc_types.h:702
cleanup
void cleanup(void)
Definition: bloaty/third_party/zlib/examples/enough.c:182
metadata
Definition: cq_verifier.cc:48
php_grpc_zend_object
#define php_grpc_zend_object
Definition: php7_wrapper.h:27
memset
return memset(p, 0, total)
PHP_GRPC_FREE_STD_ZVAL
#define PHP_GRPC_FREE_STD_ZVAL(pzv)
Definition: php7_wrapper.h:44
GRPC_CALL_ERROR
@ GRPC_CALL_ERROR
Definition: grpc_types.h:468
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
call_methods
static zend_function_entry call_methods[]
Definition: call.c:613
PHP_GRPC_HASH_FOREACH_VAL_START
#define PHP_GRPC_HASH_FOREACH_VAL_START(ht, data)
Definition: php7_wrapper.h:86
grpc_header_key_is_legal
GRPCAPI int grpc_header_key_is_legal(grpc_slice slice)
Definition: validate_metadata.cc:99
grpc_call_get_peer
GRPCAPI char * grpc_call_get_peer(grpc_call *call)
Definition: call.cc:1774
grpc_metadata_array
Definition: grpc_types.h:579
php_grpc_add_next_index_stringl
#define php_grpc_add_next_index_stringl(data, str, len, b)
Definition: php7_wrapper.h:37
grpc_op::reserved
void * reserved
Definition: grpc_types.h:646
channel.h
array
PHP_PROTO_OBJECT_FREE_END PHP_PROTO_OBJECT_DTOR_END intern array
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/array.c:111
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
metadata
struct metadata metadata
elem
Timer elem
Definition: event_engine/iomgr_event_engine/timer_heap_test.cc:109
grpc_ce_call
zend_class_entry * grpc_ce_call
Definition: call.c:37
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
string_to_byte_buffer
grpc_byte_buffer * string_to_byte_buffer(char *string, size_t length)
Definition: byte_buffer.c:27
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
GRPC_CALL_OK
@ GRPC_CALL_OK
Definition: grpc_types.h:466
status
absl::Status status
Definition: rls.cc:251
gpr_inf_future
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
Definition: src/core/lib/gpr/time.cc:55
php_grpc_ulong
#define php_grpc_ulong
Definition: php7_wrapper.h:26
xds_manager.p
p
Definition: xds_manager.py:60
grpc_parse_metadata_array
zval * grpc_parse_metadata_array(grpc_metadata_array *metadata_array TSRMLS_DC)
Definition: call.c:59
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
PHP_GRPC_INIT_HANDLER
#define PHP_GRPC_INIT_HANDLER(class_object, handler_name)
Definition: php7_wrapper.h:140
PHP_GRPC_HASH_FOREACH_LONG_KEY_VAL_START
#define PHP_GRPC_HASH_FOREACH_LONG_KEY_VAL_START(ht, key, key_type, index, data)
Definition: php7_wrapper.h:98
grpc_op::grpc_op_data::recv_message
struct grpc_op::grpc_op_data::grpc_op_recv_message recv_message
PHP_METHOD
PHP_METHOD(Call, __construct)
Definition: call.c:201
call
FilterStackCall * call
Definition: call.cc:750
grpc_op::data
union grpc_op::grpc_op_data data
byte_buffer_to_zend_string
zend_string * byte_buffer_to_zend_string(grpc_byte_buffer *buffer)
Definition: byte_buffer.c:34
create_wrapped_grpc_call
php_grpc_zend_object create_wrapped_grpc_call(zend_class_entry *class_type TSRMLS_DC)
Definition: call.c:49
grpc_metadata_array_destroy
GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array)
Definition: metadata_array.cc:35
PHP_GRPC_FREE_WRAPPED_FUNC_END
#define PHP_GRPC_FREE_WRAPPED_FUNC_END()
Definition: php7_wrapper.h:73
grpc_op::grpc_op_data::grpc_op_recv_message::recv_message
struct grpc_byte_buffer ** recv_message
Definition: grpc_types.h:693
call.h
grpc_metadata
Definition: grpc_types.h:537
memcpy
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
grpc_status._async.trailing_metadata
trailing_metadata
Definition: grpcio_status/grpc_status/_async.py:36
GRPC_OP_RECV_INITIAL_METADATA
@ GRPC_OP_RECV_INITIAL_METADATA
Definition: grpc_types.h:617
array
Definition: undname.c:101
GRPC_OP_SEND_STATUS_FROM_SERVER
@ GRPC_OP_SEND_STATUS_FROM_SERVER
Definition: grpc_types.h:612
PHP_GRPC_DECLARE_OBJECT_HANDLER
#define PHP_GRPC_DECLARE_OBJECT_HANDLER(handler_name)
Definition: php7_wrapper.h:146
grpc::testing::key1
const char key1[]
Definition: client_context_test_peer_test.cc:32
PHP_GRPC_GET_WRAPPED_OBJECT
#define PHP_GRPC_GET_WRAPPED_OBJECT(class_object, zv)
Definition: php7_wrapper.h:149
php_grpc_int
#define php_grpc_int
Definition: php7_wrapper.h:24
grpc_call_unref
GRPCAPI void grpc_call_unref(grpc_call *call)
Definition: call.cc:1770
grpc_op::grpc_op_data::grpc_op_send_status_from_server::status
grpc_status_code status
Definition: grpc_types.h:673
completion_queue.h
PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START
#define PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(ht, key, key_type, data)
Definition: php7_wrapper.h:89
grpc_op_type
grpc_op_type
Definition: grpc_types.h:593
grpc_call
struct grpc_call grpc_call
Definition: grpc_types.h:70
grpc_byte_buffer
Definition: grpc_types.h:43
grpc_php_wrap_call
zval * grpc_php_wrap_call(grpc_call *wrapped, bool owned TSRMLS_DC)
Definition: call.c:182
grpc_php_metadata_array_destroy_including_entries
void grpc_php_metadata_array_destroy_including_entries(grpc_metadata_array *array)
Definition: call.c:168
grpc_op
Definition: grpc_types.h:640
GRPC_OP_SEND_MESSAGE
@ GRPC_OP_SEND_MESSAGE
Definition: grpc_types.h:602
grpc_ce_call_credentials
zend_class_entry * grpc_ce_call_credentials
Definition: call_credentials.c:34
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
grpc_slice_from_static_string
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source)
Definition: slice/slice.cc:89
grpc_op::grpc_op_data::grpc_op_send_status_from_server::trailing_metadata
grpc_metadata * trailing_metadata
Definition: grpc_types.h:672
grpc_empty_slice
GPRAPI grpc_slice grpc_empty_slice(void)
Definition: slice/slice.cc:42
Call
Definition: api_fuzzer.cc:319
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
GRPC_WRITE_USED_MASK
#define GRPC_WRITE_USED_MASK
Definition: grpc_types.h:517
PHP_GRPC_RETVAL_STRING
#define PHP_GRPC_RETVAL_STRING(val, dup)
Definition: php7_wrapper.h:40
gpr_mu_lock
GPRAPI void gpr_mu_lock(gpr_mu *mu)
metadata::count
size_t count
Definition: cq_verifier.cc:49
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
timeval.h
gpr_now
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock)
grpc_op::op
grpc_op_type op
Definition: grpc_types.h:642
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_op::grpc_op_data::grpc_op_recv_status_on_client::status_details
grpc_slice * status_details
Definition: grpc_types.h:703
grpc::testing::SUCCESS
@ SUCCESS
Definition: h2_ssl_cert_test.cc:201
grpc_call_set_credentials
GRPCAPI grpc_call_error grpc_call_set_credentials(grpc_call *call, grpc_call_credentials *creds)
Definition: security_context.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
grpc_channel_create_call
GRPCAPI grpc_call * grpc_channel_create_call(grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, grpc_slice method, const grpc_slice *host, gpr_timespec deadline, void *reserved)
Definition: channel.cc:311
grpc_op::grpc_op_data::recv_close_on_server
struct grpc_op::grpc_op_data::grpc_op_recv_close_on_server recv_close_on_server
GRPC_OP_RECV_MESSAGE
@ GRPC_OP_RECV_MESSAGE
Definition: grpc_types.h:621
grpc_completion_queue_pluck
GRPCAPI grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, gpr_timespec deadline, void *reserved)
Definition: completion_queue.cc:1328
grpc_slice_from_copied_buffer
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len)
Definition: slice/slice.cc:170
GRPC_PROPAGATE_DEFAULTS
#define GRPC_PROPAGATE_DEFAULTS
Definition: propagation_bits.h:45
grpc_op::grpc_op_data::send_status_from_server
struct grpc_op::grpc_op_data::grpc_op_send_status_from_server send_status_from_server
key
const char * key
Definition: hpack_parser_table.cc:164
wrapped
grpc_call * wrapped
Definition: src/php/ext/grpc/call.h:32
PHP_GRPC_HASH_FOREACH_END
#define PHP_GRPC_HASH_FOREACH_END()
Definition: php7_wrapper.h:105
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
GRPC_OP_SEND_INITIAL_METADATA
@ GRPC_OP_SEND_INITIAL_METADATA
Definition: grpc_types.h:598
intern
upb_strtable_uninit & intern
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/map.c:222
grpc_op::grpc_op_data::send_message
struct grpc_op::grpc_op_data::grpc_op_send_message send_message
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
PHP_GRPC_MAKE_STD_ZVAL
#define PHP_GRPC_MAKE_STD_ZVAL(pzv)
Definition: php7_wrapper.h:42
PHP_GRPC_ALLOC_CLASS_OBJECT
#define PHP_GRPC_ALLOC_CLASS_OBJECT(class_object)
Definition: php7_wrapper.h:77
alloc.h
grpc_op::grpc_op_data::grpc_op_send_initial_metadata::metadata
grpc_metadata * metadata
Definition: grpc_types.h:654
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
grpc_op::grpc_op_data::grpc_op_send_status_from_server::trailing_metadata_count
size_t trailing_metadata_count
Definition: grpc_types.h:671
grpc_byte_buffer_destroy
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *bb)
Definition: byte_buffer.cc:81
create_metadata_array
bool create_metadata_array(zval *array, grpc_metadata_array *metadata)
Definition: call.c:114
call_credentials.h
cancel
bool cancel
Definition: client_callback_end2end_test.cc:634
GRPC_OP_RECV_CLOSE_ON_SERVER
@ GRPC_OP_RECV_CLOSE_ON_SERVER
Definition: grpc_types.h:633
PHP_GRPC_FREE_CLASS_OBJECT
#define PHP_GRPC_FREE_CLASS_OBJECT(class_object, handler)
Definition: php7_wrapper.h:82
PHP_GRPC_DELREF
#define PHP_GRPC_DELREF(zv)
Definition: php7_wrapper.h:45
grpc_ce_timeval
zend_class_entry * grpc_ce_timeval
Definition: timeval.c:29
grpc_op::grpc_op_data::recv_initial_metadata
struct grpc_op::grpc_op_data::grpc_op_recv_initial_metadata recv_initial_metadata
grpc_op::grpc_op_data::grpc_op_send_status_from_server::status_details
grpc_slice * status_details
Definition: grpc_types.h:677
gpr_timespec
Definition: gpr_types.h:50
GRPC_OP_RECV_STATUS_ON_CLIENT
@ GRPC_OP_RECV_STATUS_ON_CLIENT
Definition: grpc_types.h:627
key_type
upb_fieldtype_t key_type
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1071
grpc_op::grpc_op_data::grpc_op_recv_initial_metadata::recv_initial_metadata
grpc_metadata_array * recv_initial_metadata
Definition: grpc_types.h:685
GPR_CLOCK_REALTIME
@ GPR_CLOCK_REALTIME
Definition: gpr_types.h:39
method
NSString * method
Definition: ProtoMethod.h:28
PHP_GRPC_FREE_WRAPPED_FUNC_START
#define PHP_GRPC_FREE_WRAPPED_FUNC_START(class_object)
Definition: php7_wrapper.h:70
byte_buffer.h
RETURN_DESTROY_ZVAL
#define RETURN_DESTROY_ZVAL(val)
Definition: php7_wrapper.h:55
grpc_init_call
void grpc_init_call(TSRMLS_D)
Definition: call.c:622
php_grpc_zend_hash_find
static int php_grpc_zend_hash_find(HashTable *ht, char *key, int len, void **value)
Definition: php7_wrapper.h:107
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
grpc_call_start_batch
GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved)
Definition: call.cc:1831
if
if(p->owned &&p->wrapped !=NULL)
Definition: call.c:42
grpc_op::grpc_op_data::grpc_op_recv_close_on_server::cancelled
int * cancelled
Definition: grpc_types.h:714
grpc_ce_channel
zend_class_entry * grpc_ce_channel
Definition: channel.c:40
GRPC_OP_SEND_CLOSE_FROM_CLIENT
@ GRPC_OP_SEND_CLOSE_FROM_CLIENT
Definition: grpc_types.h:607
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
grpc_metadata_array_init
GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array)
Definition: metadata_array.cc:30
owned
bool owned
Definition: src/php/ext/grpc/call.h:31


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:42