1 # Copyright 2015 gRPC authors.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 ctypedef ssize_t intptr_t
18 ctypedef size_t uintptr_t
19 ctypedef signed char int8_t
20 ctypedef signed short int16_t
21 ctypedef signed int int32_t
22 ctypedef signed long long int64_t
23 ctypedef unsigned char uint8_t
24 ctypedef unsigned short uint16_t
25 ctypedef unsigned int uint32_t
26 ctypedef unsigned long long uint64_t
29 cdef extern from "grpc/support/alloc.h":
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
37 cdef extern from "grpc/byte_buffer_reader.h":
39 struct grpc_byte_buffer_reader:
40 # We don't care about the internals
44 cdef 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);
49 cdef extern from "grpc/grpc.h":
51 ctypedef struct grpc_slice:
52 # don't worry about writing out the members of grpc_slice; we never access
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
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
71 const int GPR_MS_PER_SEC
72 const int GPR_US_PER_SEC
73 const int GPR_NS_PER_SEC
75 ctypedef enum gpr_clock_type:
81 ctypedef struct gpr_timespec:
82 int64_t seconds "tv_sec"
83 int32_t nanoseconds "tv_nsec"
84 gpr_clock_type clock_type
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
90 gpr_timespec gpr_now(gpr_clock_type clock) nogil
92 gpr_timespec gpr_convert_clock_type(gpr_timespec t,
93 gpr_clock_type target_clock) nogil
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
99 gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) nogil
101 int gpr_time_cmp(gpr_timespec a, gpr_timespec b) nogil
103 ctypedef struct grpc_byte_buffer:
104 # We don't care about the internals.
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
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
118 ctypedef enum grpc_status_code:
120 GRPC_STATUS_CANCELLED
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
131 GRPC_STATUS_OUT_OF_RANGE
132 GRPC_STATUS_UNIMPLEMENTED
134 GRPC_STATUS_UNAVAILABLE
135 GRPC_STATUS_DATA_LOSS
136 GRPC_STATUS__DO_NOT_USE
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
153 const int GRPC_WRITE_BUFFER_HINT
154 const int GRPC_WRITE_NO_COMPRESS
155 const int GRPC_WRITE_USED_MASK
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
161 const int GRPC_MAX_COMPLETION_QUEUE_PLUCKERS
163 ctypedef struct grpc_completion_queue:
164 # We don't care about the internals (and in fact don't know them)
167 ctypedef struct grpc_channel:
168 # We don't care about the internals (and in fact don't know them)
171 ctypedef struct grpc_server:
172 # We don't care about the internals (and in fact don't know them)
175 ctypedef struct grpc_call:
176 # We don't care about the internals (and in fact don't know them)
179 ctypedef enum grpc_arg_type:
184 ctypedef struct grpc_arg_pointer_vtable:
185 void *(*copy)(void *)
186 void (*destroy)(void *)
187 int (*cmp)(void *, void *)
189 ctypedef struct grpc_arg_value_pointer:
191 grpc_arg_pointer_vtable *vtable
193 union grpc_arg_value:
196 grpc_arg_value_pointer pointer
198 ctypedef struct grpc_arg:
203 ctypedef struct grpc_channel_args:
204 size_t arguments_length "num_args"
205 grpc_arg *arguments "args"
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
213 ctypedef enum 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
226 ctypedef enum grpc_cq_completion_type:
230 ctypedef enum grpc_cq_polling_type:
231 GRPC_CQ_DEFAULT_POLLING
232 GRPC_CQ_NON_LISTENING
235 ctypedef struct grpc_completion_queue_attributes:
237 grpc_cq_completion_type cq_completion_type
238 grpc_cq_polling_type cq_polling_type
240 ctypedef enum grpc_connectivity_state:
242 GRPC_CHANNEL_CONNECTING
244 GRPC_CHANNEL_TRANSIENT_FAILURE
245 GRPC_CHANNEL_SHUTDOWN
247 ctypedef struct grpc_metadata:
250 # ignore the 'internal_data.obfuscated' fields.
252 ctypedef enum grpc_completion_type:
257 ctypedef struct grpc_event:
258 grpc_completion_type type
262 ctypedef struct grpc_metadata_array:
265 grpc_metadata *metadata
267 void grpc_metadata_array_init(grpc_metadata_array *array) nogil
268 void grpc_metadata_array_destroy(grpc_metadata_array *array) nogil
270 ctypedef struct grpc_call_details:
273 gpr_timespec deadline
275 void grpc_call_details_init(grpc_call_details *details) nogil
276 void grpc_call_details_destroy(grpc_call_details *details) nogil
278 ctypedef enum grpc_op_type:
279 GRPC_OP_SEND_INITIAL_METADATA
281 GRPC_OP_SEND_CLOSE_FROM_CLIENT
282 GRPC_OP_SEND_STATUS_FROM_SERVER
283 GRPC_OP_RECV_INITIAL_METADATA
285 GRPC_OP_RECV_STATUS_ON_CLIENT
286 GRPC_OP_RECV_CLOSE_ON_SERVER
288 ctypedef struct grpc_op_send_initial_metadata_maybe_compression_level:
290 grpc_compression_level level
292 ctypedef struct grpc_op_data_send_initial_metadata:
294 grpc_metadata *metadata
295 grpc_op_send_initial_metadata_maybe_compression_level maybe_compression_level
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
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
309 ctypedef struct grpc_op_data_recv_close_on_server:
312 ctypedef struct grpc_op_data_send_message:
313 grpc_byte_buffer *send_message
315 ctypedef struct grpc_op_data_receive_message:
316 grpc_byte_buffer **receive_message "recv_message"
318 ctypedef struct grpc_op_data_receive_initial_metadata:
319 grpc_metadata_array *receive_initial_metadata "recv_initial_metadata"
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"
330 ctypedef struct grpc_op:
331 grpc_op_type type "op"
336 void grpc_init() nogil
337 void grpc_shutdown() nogil
338 void grpc_shutdown_blocking() nogil
339 int grpc_is_initialized() nogil
341 ctypedef struct grpc_completion_queue_factory:
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
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
360 grpc_completion_queue *grpc_completion_queue_create_for_callback(
361 grpc_experimental_completion_queue_functor* shutdown_callback,
362 void *reserved) nogil
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
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
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
397 void grpc_server_register_completion_queue(grpc_server *server,
398 grpc_completion_queue *cq,
399 void *reserved) nogil
400 int grpc_server_add_insecure_http2_port(
401 grpc_server *server, const char *addr) nogil
402 void grpc_server_start(grpc_server *server) nogil
403 void grpc_server_shutdown_and_notify(
404 grpc_server *server, grpc_completion_queue *cq, void *tag) nogil
405 void grpc_server_cancel_all_calls(grpc_server *server) nogil
406 void grpc_server_destroy(grpc_server *server) nogil
408 char* grpc_channelz_get_top_channels(intptr_t start_channel_id)
409 char* grpc_channelz_get_servers(intptr_t start_server_id)
410 char* grpc_channelz_get_server(intptr_t server_id)
411 char* grpc_channelz_get_server_sockets(intptr_t server_id,
412 intptr_t start_socket_id,
413 intptr_t max_results)
414 char* grpc_channelz_get_channel(intptr_t channel_id)
415 char* grpc_channelz_get_subchannel(intptr_t subchannel_id)
416 char* grpc_channelz_get_socket(intptr_t socket_id)
419 cdef extern from "grpc/grpc_security.h":
421 # Declare this as an enum, this is the only way to make it a const in
423 enum: GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX
425 ctypedef enum grpc_ssl_roots_override_result:
426 GRPC_SSL_ROOTS_OVERRIDE_OK
427 GRPC_SSL_ROOTS_OVERRIDE_FAILED_PERMANENTLY
428 GRPC_SSL_ROOTS_OVERRIDE_FAILED
430 ctypedef enum grpc_ssl_client_certificate_request_type:
431 GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE,
432 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
433 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY
434 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY
435 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY
437 ctypedef enum grpc_security_level:
439 GRPC_SECURITY_NONE = GRPC_SECURITY_MIN
441 GRPC_PRIVACY_AND_INTEGRITY
442 GRPC_SECURITY_MAX = GRPC_PRIVACY_AND_INTEGRITY
444 ctypedef enum grpc_ssl_certificate_config_reload_status:
445 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED
446 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW
447 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL
449 ctypedef struct grpc_ssl_server_certificate_config:
450 # We don't care about the internals
453 ctypedef struct grpc_ssl_server_credentials_options:
454 # We don't care about the internals
457 grpc_ssl_server_certificate_config * grpc_ssl_server_certificate_config_create(
458 const char *pem_root_certs,
459 const grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
460 size_t num_key_cert_pairs)
462 void grpc_ssl_server_certificate_config_destroy(grpc_ssl_server_certificate_config *config)
464 ctypedef grpc_ssl_certificate_config_reload_status (*grpc_ssl_server_certificate_config_callback)(
466 grpc_ssl_server_certificate_config **config)
468 grpc_ssl_server_credentials_options *grpc_ssl_server_credentials_create_options_using_config(
469 grpc_ssl_client_certificate_request_type client_certificate_request,
470 grpc_ssl_server_certificate_config *certificate_config)
472 grpc_ssl_server_credentials_options* grpc_ssl_server_credentials_create_options_using_config_fetcher(
473 grpc_ssl_client_certificate_request_type client_certificate_request,
474 grpc_ssl_server_certificate_config_callback cb,
477 grpc_server_credentials *grpc_ssl_server_credentials_create_with_options(
478 grpc_ssl_server_credentials_options *options)
480 ctypedef struct grpc_ssl_pem_key_cert_pair:
481 const char *private_key
482 const char *certificate_chain "cert_chain"
484 ctypedef struct grpc_channel_credentials:
485 # We don't care about the internals (and in fact don't know them)
488 ctypedef struct grpc_call_credentials:
489 # We don't care about the internals (and in fact don't know them)
492 ctypedef struct grpc_ssl_session_cache:
493 # We don't care about the internals (and in fact don't know them)
496 ctypedef struct verify_peer_options:
497 # We don't care about the internals (and in fact don't know them)
500 ctypedef void (*grpc_ssl_roots_override_callback)(char **pem_root_certs)
502 grpc_ssl_session_cache *grpc_ssl_session_cache_create_lru(size_t capacity)
503 void grpc_ssl_session_cache_destroy(grpc_ssl_session_cache* cache)
505 void grpc_set_ssl_roots_override_callback(
506 grpc_ssl_roots_override_callback cb) nogil
508 grpc_channel_credentials *grpc_google_default_credentials_create(grpc_call_credentials* call_credentials) nogil
509 grpc_channel_credentials *grpc_ssl_credentials_create(
510 const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
511 verify_peer_options *verify_options, void *reserved) nogil
512 grpc_channel_credentials *grpc_composite_channel_credentials_create(
513 grpc_channel_credentials *creds1, grpc_call_credentials *creds2,
514 void *reserved) nogil
515 void grpc_channel_credentials_release(grpc_channel_credentials *creds) nogil
517 grpc_call_credentials *grpc_composite_call_credentials_create(
518 grpc_call_credentials *creds1, grpc_call_credentials *creds2,
519 void *reserved) nogil
520 grpc_call_credentials *grpc_google_compute_engine_credentials_create(
521 void *reserved) nogil
522 grpc_call_credentials *grpc_service_account_jwt_access_credentials_create(
523 const char *json_key,
524 gpr_timespec token_lifetime, void *reserved) nogil
525 grpc_call_credentials *grpc_google_refresh_token_credentials_create(
526 const char *json_refresh_token, void *reserved) nogil
527 grpc_call_credentials *grpc_google_iam_credentials_create(
528 const char *authorization_token, const char *authority_selector,
529 void *reserved) nogil
530 void grpc_call_credentials_release(grpc_call_credentials *creds) nogil
532 grpc_channel *grpc_secure_channel_create(
533 grpc_channel_credentials *creds, const char *target,
534 const grpc_channel_args *args, void *reserved) nogil
536 ctypedef struct grpc_server_credentials:
537 # We don't care about the internals (and in fact don't know them)
540 void grpc_server_credentials_release(grpc_server_credentials *creds) nogil
542 int grpc_server_add_secure_http2_port(grpc_server *server, const char *addr,
543 grpc_server_credentials *creds) nogil
545 grpc_call_error grpc_call_set_credentials(grpc_call *call,
546 grpc_call_credentials *creds) nogil
548 ctypedef struct grpc_auth_context:
549 # We don't care about the internals (and in fact don't know them)
552 ctypedef struct grpc_auth_metadata_context:
553 const char *service_url
554 const char *method_name
555 const grpc_auth_context *channel_auth_context
557 ctypedef void (*grpc_credentials_plugin_metadata_cb)(
558 void *user_data, const grpc_metadata *creds_md, size_t num_creds_md,
559 grpc_status_code status, const char *error_details)
561 ctypedef struct grpc_metadata_credentials_plugin:
563 void *state, grpc_auth_metadata_context context,
564 grpc_credentials_plugin_metadata_cb cb, void *user_data,
565 grpc_metadata creds_md[GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX],
566 size_t *num_creds_md, grpc_status_code *status,
567 const char **error_details) except *
568 void (*destroy)(void *state) except *
572 grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
573 grpc_metadata_credentials_plugin plugin, grpc_security_level min_security_level, void *reserved) nogil
575 ctypedef struct grpc_auth_property_iterator:
578 ctypedef struct grpc_auth_property:
583 grpc_auth_property *grpc_auth_property_iterator_next(
584 grpc_auth_property_iterator *it)
586 grpc_auth_property_iterator grpc_auth_context_property_iterator(
587 const grpc_auth_context *ctx)
589 grpc_auth_property_iterator grpc_auth_context_peer_identity(
590 const grpc_auth_context *ctx)
592 char *grpc_auth_context_peer_identity_property_name(
593 const grpc_auth_context *ctx)
595 grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(
596 const grpc_auth_context *ctx, const char *name)
598 grpc_auth_context_peer_is_authenticated(
599 const grpc_auth_context *ctx)
601 grpc_auth_context *grpc_call_auth_context(grpc_call *call)
603 void grpc_auth_context_release(grpc_auth_context *context)
605 grpc_channel_credentials *grpc_local_credentials_create(
606 grpc_local_connect_type type)
607 grpc_server_credentials *grpc_local_server_credentials_create(
608 grpc_local_connect_type type)
610 ctypedef struct grpc_alts_credentials_options:
611 # We don't care about the internals (and in fact don't know them)
614 grpc_channel_credentials *grpc_alts_credentials_create(
615 const grpc_alts_credentials_options *options)
616 grpc_server_credentials *grpc_alts_server_credentials_create(
617 const grpc_alts_credentials_options *options)
619 grpc_alts_credentials_options* grpc_alts_credentials_client_options_create()
620 grpc_alts_credentials_options* grpc_alts_credentials_server_options_create()
621 void grpc_alts_credentials_options_destroy(grpc_alts_credentials_options *options)
622 void grpc_alts_credentials_client_options_add_target_service_account(grpc_alts_credentials_options *options, const char *service_account)
626 cdef extern from "grpc/compression.h":
628 ctypedef enum grpc_compression_algorithm:
630 GRPC_COMPRESS_DEFLATE
632 GRPC_COMPRESS_STREAM_GZIP
633 GRPC_COMPRESS_ALGORITHMS_COUNT
635 ctypedef enum grpc_compression_level:
636 GRPC_COMPRESS_LEVEL_NONE
637 GRPC_COMPRESS_LEVEL_LOW
638 GRPC_COMPRESS_LEVEL_MED
639 GRPC_COMPRESS_LEVEL_HIGH
640 GRPC_COMPRESS_LEVEL_COUNT
642 ctypedef struct grpc_compression_options:
643 uint32_t enabled_algorithms_bitset
645 int grpc_compression_algorithm_parse(
646 grpc_slice value, grpc_compression_algorithm *algorithm) nogil
647 int grpc_compression_algorithm_name(grpc_compression_algorithm algorithm,
648 const char **name) nogil
649 grpc_compression_algorithm grpc_compression_algorithm_for_level(
650 grpc_compression_level level, uint32_t accepted_encodings) nogil
651 void grpc_compression_options_init(grpc_compression_options *opts) nogil
652 void grpc_compression_options_enable_algorithm(
653 grpc_compression_options *opts,
654 grpc_compression_algorithm algorithm) nogil
655 void grpc_compression_options_disable_algorithm(
656 grpc_compression_options *opts,
657 grpc_compression_algorithm algorithm) nogil
658 int grpc_compression_options_is_algorithm_enabled(
659 const grpc_compression_options *opts,
660 grpc_compression_algorithm algorithm) nogil
662 cdef extern from "grpc/impl/codegen/compression_types.h":
664 const char *_GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
665 "GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY"
668 cdef extern from "grpc/grpc_security_constants.h":
669 ctypedef enum grpc_local_connect_type: