1# Copyright 2015 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cimport libc.time 16 17ctypedef ssize_t intptr_t 18ctypedef size_t uintptr_t 19ctypedef signed char int8_t 20ctypedef signed short int16_t 21ctypedef signed int int32_t 22ctypedef signed long long int64_t 23ctypedef unsigned char uint8_t 24ctypedef unsigned short uint16_t 25ctypedef unsigned int uint32_t 26ctypedef unsigned long long uint64_t 27 28 29cdef extern from "grpc/support/alloc.h": 30 31 void *gpr_malloc(size_t size) nogil 32 void *gpr_zalloc(size_t size) nogil 33 void gpr_free(void *ptr) nogil 34 void *gpr_realloc(void *p, size_t size) nogil 35 36 37cdef extern from "grpc/byte_buffer_reader.h": 38 39 struct grpc_byte_buffer_reader: 40 # We don't care about the internals 41 pass 42 43 44cdef extern from "grpc/impl/codegen/grpc_types.h": 45 ctypedef struct grpc_experimental_completion_queue_functor: 46 void (*functor_run)(grpc_experimental_completion_queue_functor*, int); 47 48 49cdef extern from "grpc/grpc.h": 50 51 ctypedef struct grpc_slice: 52 # don't worry about writing out the members of grpc_slice; we never access 53 # them directly. 54 pass 55 56 grpc_slice grpc_slice_ref(grpc_slice s) nogil 57 void grpc_slice_unref(grpc_slice s) nogil 58 grpc_slice grpc_empty_slice() nogil 59 grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *)) nogil 60 grpc_slice grpc_slice_new_with_len( 61 void *p, size_t len, void (*destroy)(void *, size_t)) nogil 62 grpc_slice grpc_slice_malloc(size_t length) nogil 63 grpc_slice grpc_slice_from_copied_string(const char *source) nogil 64 grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len) nogil 65 grpc_slice grpc_slice_copy(grpc_slice s) nogil 66 67 # Declare functions for function-like macros (because Cython)... 68 void *grpc_slice_start_ptr "GRPC_SLICE_START_PTR" (grpc_slice s) nogil 69 size_t grpc_slice_length "GRPC_SLICE_LENGTH" (grpc_slice s) nogil 70 71 const int GPR_MS_PER_SEC 72 const int GPR_US_PER_SEC 73 const int GPR_NS_PER_SEC 74 75 ctypedef enum gpr_clock_type: 76 GPR_CLOCK_MONOTONIC 77 GPR_CLOCK_REALTIME 78 GPR_CLOCK_PRECISE 79 GPR_TIMESPAN 80 81 ctypedef struct gpr_timespec: 82 int64_t seconds "tv_sec" 83 int32_t nanoseconds "tv_nsec" 84 gpr_clock_type clock_type 85 86 gpr_timespec gpr_time_0(gpr_clock_type type) nogil 87 gpr_timespec gpr_inf_future(gpr_clock_type type) nogil 88 gpr_timespec gpr_inf_past(gpr_clock_type type) nogil 89 90 gpr_timespec gpr_now(gpr_clock_type clock) nogil 91 92 gpr_timespec gpr_convert_clock_type(gpr_timespec t, 93 gpr_clock_type target_clock) nogil 94 95 gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) nogil 96 gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) nogil 97 double gpr_timespec_to_micros(gpr_timespec t) nogil 98 99 gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil 100 101 int gpr_time_cmp(gpr_timespec a, gpr_timespec b) nogil 102 103 ctypedef struct grpc_byte_buffer: 104 # We don't care about the internals. 105 pass 106 107 grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices, 108 size_t nslices) nogil 109 size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) nogil 110 void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer) nogil 111 112 int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, 113 grpc_byte_buffer *buffer) nogil 114 int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, 115 grpc_slice *slice) nogil 116 void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) nogil 117 118 ctypedef enum grpc_status_code: 119 GRPC_STATUS_OK 120 GRPC_STATUS_CANCELLED 121 GRPC_STATUS_UNKNOWN 122 GRPC_STATUS_INVALID_ARGUMENT 123 GRPC_STATUS_DEADLINE_EXCEEDED 124 GRPC_STATUS_NOT_FOUND 125 GRPC_STATUS_ALREADY_EXISTS 126 GRPC_STATUS_PERMISSION_DENIED 127 GRPC_STATUS_UNAUTHENTICATED 128 GRPC_STATUS_RESOURCE_EXHAUSTED 129 GRPC_STATUS_FAILED_PRECONDITION 130 GRPC_STATUS_ABORTED 131 GRPC_STATUS_OUT_OF_RANGE 132 GRPC_STATUS_UNIMPLEMENTED 133 GRPC_STATUS_INTERNAL 134 GRPC_STATUS_UNAVAILABLE 135 GRPC_STATUS_DATA_LOSS 136 GRPC_STATUS__DO_NOT_USE 137 138 const char *GRPC_ARG_ENABLE_CENSUS 139 const char *GRPC_ARG_MAX_CONCURRENT_STREAMS 140 const char *GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH 141 const char *GRPC_ARG_MAX_SEND_MESSAGE_LENGTH 142 const char *GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER 143 const char *GRPC_ARG_DEFAULT_AUTHORITY 144 const char *GRPC_ARG_PRIMARY_USER_AGENT_STRING 145 const char *GRPC_ARG_SECONDARY_USER_AGENT_STRING 146 const char *GRPC_SSL_TARGET_NAME_OVERRIDE_ARG 147 const char *GRPC_SSL_SESSION_CACHE_ARG 148 const char *_GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM \ 149 "GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM" 150 const char *GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL 151 const char *GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET 152 153 const int GRPC_WRITE_BUFFER_HINT 154 const int GRPC_WRITE_NO_COMPRESS 155 const int GRPC_WRITE_USED_MASK 156 157 const int GRPC_INITIAL_METADATA_WAIT_FOR_READY 158 const int GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET 159 const int GRPC_INITIAL_METADATA_USED_MASK 160 161 const int GRPC_MAX_COMPLETION_QUEUE_PLUCKERS 162 163 ctypedef struct grpc_completion_queue: 164 # We don't care about the internals (and in fact don't know them) 165 pass 166 167 ctypedef struct grpc_channel: 168 # We don't care about the internals (and in fact don't know them) 169 pass 170 171 ctypedef struct grpc_server: 172 # We don't care about the internals (and in fact don't know them) 173 pass 174 175 ctypedef struct grpc_call: 176 # We don't care about the internals (and in fact don't know them) 177 pass 178 179 ctypedef enum grpc_arg_type: 180 GRPC_ARG_STRING 181 GRPC_ARG_INTEGER 182 GRPC_ARG_POINTER 183 184 ctypedef struct grpc_arg_pointer_vtable: 185 void *(*copy)(void *) 186 void (*destroy)(void *) 187 int (*cmp)(void *, void *) 188 189 ctypedef struct grpc_arg_value_pointer: 190 void *address "p" 191 grpc_arg_pointer_vtable *vtable 192 193 union grpc_arg_value: 194 char *string 195 int integer 196 grpc_arg_value_pointer pointer 197 198 ctypedef struct grpc_arg: 199 grpc_arg_type type 200 char *key 201 grpc_arg_value value 202 203 ctypedef struct grpc_channel_args: 204 size_t arguments_length "num_args" 205 grpc_arg *arguments "args" 206 207 ctypedef enum grpc_stream_compression_level: 208 GRPC_STREAM_COMPRESS_LEVEL_NONE 209 GRPC_STREAM_COMPRESS_LEVEL_LOW 210 GRPC_STREAM_COMPRESS_LEVEL_MED 211 GRPC_STREAM_COMPRESS_LEVEL_HIGH 212 213 ctypedef enum grpc_call_error: 214 GRPC_CALL_OK 215 GRPC_CALL_ERROR 216 GRPC_CALL_ERROR_NOT_ON_SERVER 217 GRPC_CALL_ERROR_NOT_ON_CLIENT 218 GRPC_CALL_ERROR_ALREADY_ACCEPTED 219 GRPC_CALL_ERROR_ALREADY_INVOKED 220 GRPC_CALL_ERROR_NOT_INVOKED 221 GRPC_CALL_ERROR_ALREADY_FINISHED 222 GRPC_CALL_ERROR_TOO_MANY_OPERATIONS 223 GRPC_CALL_ERROR_INVALID_FLAGS 224 GRPC_CALL_ERROR_INVALID_METADATA 225 226 ctypedef enum grpc_cq_completion_type: 227 GRPC_CQ_NEXT 228 GRPC_CQ_PLUCK 229 230 ctypedef enum grpc_cq_polling_type: 231 GRPC_CQ_DEFAULT_POLLING 232 GRPC_CQ_NON_LISTENING 233 GRPC_CQ_NON_POLLING 234 235 ctypedef struct grpc_completion_queue_attributes: 236 int version 237 grpc_cq_completion_type cq_completion_type 238 grpc_cq_polling_type cq_polling_type 239 240 ctypedef enum grpc_connectivity_state: 241 GRPC_CHANNEL_IDLE 242 GRPC_CHANNEL_CONNECTING 243 GRPC_CHANNEL_READY 244 GRPC_CHANNEL_TRANSIENT_FAILURE 245 GRPC_CHANNEL_SHUTDOWN 246 247 ctypedef struct grpc_metadata: 248 grpc_slice key 249 grpc_slice value 250 # ignore the 'internal_data.obfuscated' fields. 251 252 ctypedef enum grpc_completion_type: 253 GRPC_QUEUE_SHUTDOWN 254 GRPC_QUEUE_TIMEOUT 255 GRPC_OP_COMPLETE 256 257 ctypedef struct grpc_event: 258 grpc_completion_type type 259 int success 260 void *tag 261 262 ctypedef struct grpc_metadata_array: 263 size_t count 264 size_t capacity 265 grpc_metadata *metadata 266 267 void grpc_metadata_array_init(grpc_metadata_array *array) nogil 268 void grpc_metadata_array_destroy(grpc_metadata_array *array) nogil 269 270 ctypedef struct grpc_call_details: 271 grpc_slice method 272 grpc_slice host 273 gpr_timespec deadline 274 275 void grpc_call_details_init(grpc_call_details *details) nogil 276 void grpc_call_details_destroy(grpc_call_details *details) nogil 277 278 ctypedef enum grpc_op_type: 279 GRPC_OP_SEND_INITIAL_METADATA 280 GRPC_OP_SEND_MESSAGE 281 GRPC_OP_SEND_CLOSE_FROM_CLIENT 282 GRPC_OP_SEND_STATUS_FROM_SERVER 283 GRPC_OP_RECV_INITIAL_METADATA 284 GRPC_OP_RECV_MESSAGE 285 GRPC_OP_RECV_STATUS_ON_CLIENT 286 GRPC_OP_RECV_CLOSE_ON_SERVER 287 288 ctypedef struct grpc_op_send_initial_metadata_maybe_compression_level: 289 uint8_t is_set 290 grpc_compression_level level 291 292 ctypedef struct grpc_op_data_send_initial_metadata: 293 size_t count 294 grpc_metadata *metadata 295 grpc_op_send_initial_metadata_maybe_compression_level maybe_compression_level 296 297 ctypedef struct grpc_op_data_send_status_from_server: 298 size_t trailing_metadata_count 299 grpc_metadata *trailing_metadata 300 grpc_status_code status 301 grpc_slice *status_details 302 303 ctypedef struct grpc_op_data_recv_status_on_client: 304 grpc_metadata_array *trailing_metadata 305 grpc_status_code *status 306 grpc_slice *status_details 307 char** error_string 308 309 ctypedef struct grpc_op_data_recv_close_on_server: 310 int *cancelled 311 312 ctypedef struct grpc_op_data_send_message: 313 grpc_byte_buffer *send_message 314 315 ctypedef struct grpc_op_data_receive_message: 316 grpc_byte_buffer **receive_message "recv_message" 317 318 ctypedef struct grpc_op_data_receive_initial_metadata: 319 grpc_metadata_array *receive_initial_metadata "recv_initial_metadata" 320 321 union grpc_op_data: 322 grpc_op_data_send_initial_metadata send_initial_metadata 323 grpc_op_data_send_message send_message 324 grpc_op_data_send_status_from_server send_status_from_server 325 grpc_op_data_receive_initial_metadata receive_initial_metadata "recv_initial_metadata" 326 grpc_op_data_receive_message receive_message "recv_message" 327 grpc_op_data_recv_status_on_client receive_status_on_client "recv_status_on_client" 328 grpc_op_data_recv_close_on_server receive_close_on_server "recv_close_on_server" 329 330 ctypedef struct grpc_op: 331 grpc_op_type type "op" 332 uint32_t flags 333 void * reserved 334 grpc_op_data data 335 336 void grpc_init() nogil 337 void grpc_shutdown() nogil 338 void grpc_shutdown_blocking() nogil 339 int grpc_is_initialized() nogil 340 341 ctypedef struct grpc_completion_queue_factory: 342 pass 343 344 grpc_completion_queue_factory *grpc_completion_queue_factory_lookup( 345 const grpc_completion_queue_attributes* attributes) nogil 346 grpc_completion_queue *grpc_completion_queue_create( 347 const grpc_completion_queue_factory* factory, 348 const grpc_completion_queue_attributes* attr, void* reserved) nogil 349 grpc_completion_queue *grpc_completion_queue_create_for_next(void *reserved) nogil 350 351 grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, 352 gpr_timespec deadline, 353 void *reserved) nogil 354 grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, 355 gpr_timespec deadline, 356 void *reserved) nogil 357 void grpc_completion_queue_shutdown(grpc_completion_queue *cq) nogil 358 void grpc_completion_queue_destroy(grpc_completion_queue *cq) nogil 359 360 grpc_completion_queue *grpc_completion_queue_create_for_callback( 361 grpc_experimental_completion_queue_functor* shutdown_callback, 362 void *reserved) nogil 363 364 grpc_call_error grpc_call_start_batch( 365 grpc_call *call, const grpc_op *ops, size_t nops, void *tag, 366 void *reserved) nogil 367 grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved) nogil 368 grpc_call_error grpc_call_cancel_with_status(grpc_call *call, 369 grpc_status_code status, 370 const char *description, 371 void *reserved) nogil 372 char *grpc_call_get_peer(grpc_call *call) nogil 373 void grpc_call_unref(grpc_call *call) nogil 374 375 grpc_channel *grpc_insecure_channel_create(const char *target, 376 const grpc_channel_args *args, 377 void *reserved) nogil 378 grpc_call *grpc_channel_create_call( 379 grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, 380 grpc_completion_queue *completion_queue, grpc_slice method, 381 const grpc_slice *host, gpr_timespec deadline, void *reserved) nogil 382 grpc_connectivity_state grpc_channel_check_connectivity_state( 383 grpc_channel *channel, int try_to_connect) nogil 384 void grpc_channel_watch_connectivity_state( 385 grpc_channel *channel, grpc_connectivity_state last_observed_state, 386 gpr_timespec deadline, grpc_completion_queue *cq, void *tag) nogil 387 char *grpc_channel_get_target(grpc_channel *channel) nogil 388 void grpc_channel_destroy(grpc_channel *channel) nogil 389 390 grpc_server *grpc_server_create( 391 const grpc_channel_args *args, void *reserved) nogil 392 grpc_call_error grpc_server_request_call( 393 grpc_server *server, grpc_call **call, grpc_call_details *details, 394 grpc_metadata_array *request_metadata, grpc_completion_queue 395 *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void 396 *tag_new) nogil 397 void grpc_server_register_completion_queue(grpc_server *server, 398 grpc_completion_queue *cq, 399 void *reserved) nogil 400 401 ctypedef struct grpc_server_config_fetcher: 402 pass 403 404 void grpc_server_set_config_fetcher( 405 grpc_server* server, grpc_server_config_fetcher* config_fetcher) nogil 406 407 grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create() nogil 408 409 410 int grpc_server_add_insecure_http2_port( 411 grpc_server *server, const char *addr) nogil 412 void grpc_server_start(grpc_server *server) nogil 413 void grpc_server_shutdown_and_notify( 414 grpc_server *server, grpc_completion_queue *cq, void *tag) nogil 415 void grpc_server_cancel_all_calls(grpc_server *server) nogil 416 void grpc_server_destroy(grpc_server *server) nogil 417 418 char* grpc_channelz_get_top_channels(intptr_t start_channel_id) 419 char* grpc_channelz_get_servers(intptr_t start_server_id) 420 char* grpc_channelz_get_server(intptr_t server_id) 421 char* grpc_channelz_get_server_sockets(intptr_t server_id, 422 intptr_t start_socket_id, 423 intptr_t max_results) 424 char* grpc_channelz_get_channel(intptr_t channel_id) 425 char* grpc_channelz_get_subchannel(intptr_t subchannel_id) 426 char* grpc_channelz_get_socket(intptr_t socket_id) 427 428 429cdef extern from "grpc/grpc_security.h": 430 431 # Declare this as an enum, this is the only way to make it a const in 432 # cython 433 enum: GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX 434 435 ctypedef enum grpc_ssl_roots_override_result: 436 GRPC_SSL_ROOTS_OVERRIDE_OK 437 GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY 438 GRPC_SSL_ROOTS_OVERRIDE_FAILED 439 440 ctypedef enum grpc_ssl_client_certificate_request_type: 441 GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE, 442 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY 443 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY 444 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY 445 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY 446 447 ctypedef enum grpc_security_level: 448 GRPC_SECURITY_MIN 449 GRPC_SECURITY_NONE = GRPC_SECURITY_MIN 450 GRPC_INTEGRITY_ONLY 451 GRPC_PRIVACY_AND_INTEGRITY 452 GRPC_SECURITY_MAX = GRPC_PRIVACY_AND_INTEGRITY 453 454 ctypedef enum grpc_ssl_certificate_config_reload_status: 455 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED 456 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW 457 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL 458 459 ctypedef struct grpc_ssl_server_certificate_config: 460 # We don't care about the internals 461 pass 462 463 ctypedef struct grpc_ssl_server_credentials_options: 464 # We don't care about the internals 465 pass 466 467 grpc_ssl_server_certificate_config * grpc_ssl_server_certificate_config_create( 468 const char *pem_root_certs, 469 const grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, 470 size_t num_key_cert_pairs) 471 472 void grpc_ssl_server_certificate_config_destroy(grpc_ssl_server_certificate_config *config) 473 474 ctypedef grpc_ssl_certificate_config_reload_status (*grpc_ssl_server_certificate_config_callback)( 475 void *user_data, 476 grpc_ssl_server_certificate_config **config) 477 478 grpc_ssl_server_credentials_options *grpc_ssl_server_credentials_create_options_using_config( 479 grpc_ssl_client_certificate_request_type client_certificate_request, 480 grpc_ssl_server_certificate_config *certificate_config) 481 482 grpc_ssl_server_credentials_options* grpc_ssl_server_credentials_create_options_using_config_fetcher( 483 grpc_ssl_client_certificate_request_type client_certificate_request, 484 grpc_ssl_server_certificate_config_callback cb, 485 void *user_data) 486 487 grpc_server_credentials *grpc_ssl_server_credentials_create_with_options( 488 grpc_ssl_server_credentials_options *options) 489 490 ctypedef struct grpc_ssl_pem_key_cert_pair: 491 const char *private_key 492 const char *certificate_chain "cert_chain" 493 494 ctypedef struct grpc_channel_credentials: 495 # We don't care about the internals (and in fact don't know them) 496 pass 497 498 ctypedef struct grpc_call_credentials: 499 # We don't care about the internals (and in fact don't know them) 500 pass 501 502 ctypedef struct grpc_ssl_session_cache: 503 # We don't care about the internals (and in fact don't know them) 504 pass 505 506 ctypedef struct verify_peer_options: 507 # We don't care about the internals (and in fact don't know them) 508 pass 509 510 ctypedef void (*grpc_ssl_roots_override_callback)(char **pem_root_certs) 511 512 grpc_ssl_session_cache *grpc_ssl_session_cache_create_lru(size_t capacity) 513 void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache) 514 515 void grpc_set_ssl_roots_override_callback( 516 grpc_ssl_roots_override_callback cb) nogil 517 518 grpc_channel_credentials *grpc_google_default_credentials_create(grpc_call_credentials* call_credentials) nogil 519 grpc_channel_credentials *grpc_ssl_credentials_create( 520 const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair, 521 verify_peer_options *verify_options, void *reserved) nogil 522 grpc_channel_credentials *grpc_composite_channel_credentials_create( 523 grpc_channel_credentials *creds1, grpc_call_credentials *creds2, 524 void *reserved) nogil 525 void grpc_channel_credentials_release(grpc_channel_credentials *creds) nogil 526 527 grpc_channel_credentials *grpc_xds_credentials_create( 528 grpc_channel_credentials *fallback_creds) nogil 529 530 grpc_channel_credentials *grpc_insecure_credentials_create() nogil 531 532 grpc_server_credentials *grpc_xds_server_credentials_create( 533 grpc_server_credentials *fallback_creds) nogil 534 535 grpc_server_credentials *grpc_insecure_server_credentials_create() nogil 536 537 grpc_call_credentials *grpc_composite_call_credentials_create( 538 grpc_call_credentials *creds1, grpc_call_credentials *creds2, 539 void *reserved) nogil 540 grpc_call_credentials *grpc_google_compute_engine_credentials_create( 541 void *reserved) nogil 542 grpc_call_credentials *grpc_service_account_jwt_access_credentials_create( 543 const char *json_key, 544 gpr_timespec token_lifetime, void *reserved) nogil 545 grpc_call_credentials *grpc_google_refresh_token_credentials_create( 546 const char *json_refresh_token, void *reserved) nogil 547 grpc_call_credentials *grpc_google_iam_credentials_create( 548 const char *authorization_token, const char *authority_selector, 549 void *reserved) nogil 550 void grpc_call_credentials_release(grpc_call_credentials *creds) nogil 551 552 grpc_channel *grpc_secure_channel_create( 553 grpc_channel_credentials *creds, const char *target, 554 const grpc_channel_args *args, void *reserved) nogil 555 556 ctypedef struct grpc_server_credentials: 557 # We don't care about the internals (and in fact don't know them) 558 pass 559 560 void grpc_server_credentials_release(grpc_server_credentials *creds) nogil 561 562 int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr, 563 grpc_server_credentials *creds) nogil 564 565 grpc_call_error grpc_call_set_credentials(grpc_call *call, 566 grpc_call_credentials *creds) nogil 567 568 ctypedef struct grpc_auth_context: 569 # We don't care about the internals (and in fact don't know them) 570 pass 571 572 ctypedef struct grpc_auth_metadata_context: 573 const char *service_url 574 const char *method_name 575 const grpc_auth_context *channel_auth_context 576 577 ctypedef void (*grpc_credentials_plugin_metadata_cb)( 578 void *user_data, const grpc_metadata *creds_md, size_t num_creds_md, 579 grpc_status_code status, const char *error_details) 580 581 ctypedef struct grpc_metadata_credentials_plugin: 582 int (*get_metadata)( 583 void *state, grpc_auth_metadata_context context, 584 grpc_credentials_plugin_metadata_cb cb, void *user_data, 585 grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX], 586 size_t *num_creds_md, grpc_status_code *status, 587 const char **error_details) except * 588 void (*destroy)(void *state) except * 589 void *state 590 const char *type 591 592 grpc_call_credentials *grpc_metadata_credentials_create_from_plugin( 593 grpc_metadata_credentials_plugin plugin, grpc_security_level min_security_level, void *reserved) nogil 594 595 ctypedef struct grpc_auth_property_iterator: 596 pass 597 598 ctypedef struct grpc_auth_property: 599 char *name 600 char *value 601 size_t value_length 602 603 grpc_auth_property *grpc_auth_property_iterator_next( 604 grpc_auth_property_iterator *it) 605 606 grpc_auth_property_iterator grpc_auth_context_property_iterator( 607 const grpc_auth_context *ctx) 608 609 grpc_auth_property_iterator grpc_auth_context_peer_identity( 610 const grpc_auth_context *ctx) 611 612 char *grpc_auth_context_peer_identity_property_name( 613 const grpc_auth_context *ctx) 614 615 grpc_auth_property_iterator grpc_auth_context_find_properties_by_name( 616 const grpc_auth_context *ctx, const char *name) 617 618 grpc_auth_context_peer_is_authenticated( 619 const grpc_auth_context *ctx) 620 621 grpc_auth_context *grpc_call_auth_context(grpc_call *call) 622 623 void grpc_auth_context_release(grpc_auth_context *context) 624 625 grpc_channel_credentials *grpc_local_credentials_create( 626 grpc_local_connect_type type) 627 grpc_server_credentials *grpc_local_server_credentials_create( 628 grpc_local_connect_type type) 629 630 ctypedef struct grpc_alts_credentials_options: 631 # We don't care about the internals (and in fact don't know them) 632 pass 633 634 grpc_channel_credentials *grpc_alts_credentials_create( 635 const grpc_alts_credentials_options *options) 636 grpc_server_credentials *grpc_alts_server_credentials_create( 637 const grpc_alts_credentials_options *options) 638 639 grpc_alts_credentials_options* grpc_alts_credentials_client_options_create() 640 grpc_alts_credentials_options* grpc_alts_credentials_server_options_create() 641 void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options) 642 void grpc_alts_credentials_client_options_add_target_service_account(grpc_alts_credentials_options *options, const char *service_account) 643 644 645 646cdef extern from "grpc/compression.h": 647 648 ctypedef enum grpc_compression_algorithm: 649 GRPC_COMPRESS_NONE 650 GRPC_COMPRESS_DEFLATE 651 GRPC_COMPRESS_GZIP 652 GRPC_COMPRESS_STREAM_GZIP 653 GRPC_COMPRESS_ALGORITHMS_COUNT 654 655 ctypedef enum grpc_compression_level: 656 GRPC_COMPRESS_LEVEL_NONE 657 GRPC_COMPRESS_LEVEL_LOW 658 GRPC_COMPRESS_LEVEL_MED 659 GRPC_COMPRESS_LEVEL_HIGH 660 GRPC_COMPRESS_LEVEL_COUNT 661 662 ctypedef struct grpc_compression_options: 663 uint32_t enabled_algorithms_bitset 664 665 int grpc_compression_algorithm_parse( 666 grpc_slice value, grpc_compression_algorithm *algorithm) nogil 667 int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm, 668 const char **name) nogil 669 grpc_compression_algorithm grpc_compression_algorithm_for_level( 670 grpc_compression_level level, uint32_t accepted_encodings) nogil 671 void grpc_compression_options_init(grpc_compression_options *opts) nogil 672 void grpc_compression_options_enable_algorithm( 673 grpc_compression_options *opts, 674 grpc_compression_algorithm algorithm) nogil 675 void grpc_compression_options_disable_algorithm( 676 grpc_compression_options *opts, 677 grpc_compression_algorithm algorithm) nogil 678 int grpc_compression_options_is_algorithm_enabled( 679 const grpc_compression_options *opts, 680 grpc_compression_algorithm algorithm) nogil 681 682cdef extern from "grpc/impl/codegen/compression_types.h": 683 684 const char *_GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \ 685 "GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY" 686 687 688cdef extern from "grpc/grpc_security_constants.h": 689 ctypedef enum grpc_local_connect_type: 690 UDS 691 LOCAL_TCP 692