blob: dc7eb6536d550916dbe1889888b9dfb7917fd53c [file] [log] [blame]
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001/* automatically generated by rust-bindgen */
2
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003pub const GRPC_ARES: u32 = 1;
4pub const GRPC_IF_NAMETOINDEX: u32 = 1;
5pub const GRPC_ALLOW_EXCEPTIONS: u32 = 1;
6pub const GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY: &'static [u8; 31usize] =
7 b"grpc-internal-encoding-request\0";
8pub const GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM: &'static [u8; 35usize] =
9 b"grpc.default_compression_algorithm\0";
10pub const GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL: &'static [u8; 31usize] =
11 b"grpc.default_compression_level\0";
12pub const GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET: &'static [u8; 43usize] =
13 b"grpc.compression_enabled_algorithms_bitset\0";
14pub const GRPC_ALLOW_GPR_SLICE_FUNCTIONS: u32 = 1;
15pub const GRPC_SLICE_BUFFER_INLINE_ELEMENTS: u32 = 8;
16pub const GRPC_ARG_ENABLE_CENSUS: &'static [u8; 12usize] = b"grpc.census\0";
17pub const GRPC_ARG_ENABLE_LOAD_REPORTING: &'static [u8; 19usize] = b"grpc.loadreporting\0";
18pub const GRPC_ARG_MINIMAL_STACK: &'static [u8; 19usize] = b"grpc.minimal_stack\0";
19pub const GRPC_ARG_MAX_CONCURRENT_STREAMS: &'static [u8; 28usize] =
20 b"grpc.max_concurrent_streams\0";
21pub const GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH: &'static [u8; 32usize] =
22 b"grpc.max_receive_message_length\0";
23pub const GRPC_ARG_MAX_MESSAGE_LENGTH: &'static [u8; 32usize] =
24 b"grpc.max_receive_message_length\0";
25pub const GRPC_ARG_MAX_SEND_MESSAGE_LENGTH: &'static [u8; 29usize] =
26 b"grpc.max_send_message_length\0";
27pub const GRPC_ARG_MAX_CONNECTION_IDLE_MS: &'static [u8; 28usize] =
28 b"grpc.max_connection_idle_ms\0";
29pub const GRPC_ARG_MAX_CONNECTION_AGE_MS: &'static [u8; 27usize] = b"grpc.max_connection_age_ms\0";
30pub const GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS: &'static [u8; 33usize] =
31 b"grpc.max_connection_age_grace_ms\0";
32pub const GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS: &'static [u8; 28usize] =
33 b"grpc.client_idle_timeout_ms\0";
34pub const GRPC_ARG_ENABLE_PER_MESSAGE_COMPRESSION: &'static [u8; 29usize] =
35 b"grpc.per_message_compression\0";
36pub const GRPC_ARG_ENABLE_PER_MESSAGE_DECOMPRESSION: &'static [u8; 31usize] =
37 b"grpc.per_message_decompression\0";
38pub const GRPC_ARG_ENABLE_DEADLINE_CHECKS: &'static [u8; 30usize] =
39 b"grpc.enable_deadline_checking\0";
40pub const GRPC_ARG_HTTP2_INITIAL_SEQUENCE_NUMBER: &'static [u8; 35usize] =
41 b"grpc.http2.initial_sequence_number\0";
42pub const GRPC_ARG_HTTP2_STREAM_LOOKAHEAD_BYTES: &'static [u8; 27usize] =
43 b"grpc.http2.lookahead_bytes\0";
44pub const GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_DECODER: &'static [u8; 36usize] =
45 b"grpc.http2.hpack_table_size.decoder\0";
46pub const GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER: &'static [u8; 36usize] =
47 b"grpc.http2.hpack_table_size.encoder\0";
48pub const GRPC_ARG_HTTP2_MAX_FRAME_SIZE: &'static [u8; 26usize] = b"grpc.http2.max_frame_size\0";
49pub const GRPC_ARG_HTTP2_BDP_PROBE: &'static [u8; 21usize] = b"grpc.http2.bdp_probe\0";
50pub const GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS: &'static [u8; 37usize] =
51 b"grpc.http2.min_time_between_pings_ms\0";
52pub const GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS: &'static [u8; 45usize] =
53 b"grpc.http2.min_ping_interval_without_data_ms\0";
54pub const GRPC_ARG_HTTP2_SCHEME: &'static [u8; 18usize] = b"grpc.http2_scheme\0";
55pub const GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA: &'static [u8; 34usize] =
56 b"grpc.http2.max_pings_without_data\0";
57pub const GRPC_ARG_HTTP2_MAX_PING_STRIKES: &'static [u8; 28usize] =
58 b"grpc.http2.max_ping_strikes\0";
59pub const GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE: &'static [u8; 29usize] =
60 b"grpc.http2.write_buffer_size\0";
61pub const GRPC_ARG_HTTP2_ENABLE_TRUE_BINARY: &'static [u8; 23usize] = b"grpc.http2.true_binary\0";
62pub const GRPC_ARG_KEEPALIVE_TIME_MS: &'static [u8; 23usize] = b"grpc.keepalive_time_ms\0";
63pub const GRPC_ARG_KEEPALIVE_TIMEOUT_MS: &'static [u8; 26usize] = b"grpc.keepalive_timeout_ms\0";
64pub const GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS: &'static [u8; 36usize] =
65 b"grpc.keepalive_permit_without_calls\0";
66pub const GRPC_ARG_DEFAULT_AUTHORITY: &'static [u8; 23usize] = b"grpc.default_authority\0";
67pub const GRPC_ARG_PRIMARY_USER_AGENT_STRING: &'static [u8; 24usize] = b"grpc.primary_user_agent\0";
68pub const GRPC_ARG_SECONDARY_USER_AGENT_STRING: &'static [u8; 26usize] =
69 b"grpc.secondary_user_agent\0";
70pub const GRPC_ARG_MIN_RECONNECT_BACKOFF_MS: &'static [u8; 30usize] =
71 b"grpc.min_reconnect_backoff_ms\0";
72pub const GRPC_ARG_MAX_RECONNECT_BACKOFF_MS: &'static [u8; 30usize] =
73 b"grpc.max_reconnect_backoff_ms\0";
74pub const GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS: &'static [u8; 34usize] =
75 b"grpc.initial_reconnect_backoff_ms\0";
76pub const GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS: &'static [u8; 41usize] =
77 b"grpc.dns_min_time_between_resolutions_ms\0";
78pub const GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS: &'static [u8; 33usize] =
79 b"grpc.server_handshake_timeout_ms\0";
80pub const GRPC_SSL_TARGET_NAME_OVERRIDE_ARG: &'static [u8; 30usize] =
81 b"grpc.ssl_target_name_override\0";
82pub const GRPC_SSL_SESSION_CACHE_ARG: &'static [u8; 23usize] = b"grpc.ssl_session_cache\0";
83pub const GRPC_ARG_TSI_MAX_FRAME_SIZE: &'static [u8; 24usize] = b"grpc.tsi.max_frame_size\0";
84pub const GRPC_ARG_MAX_METADATA_SIZE: &'static [u8; 23usize] = b"grpc.max_metadata_size\0";
85pub const GRPC_ARG_ALLOW_REUSEPORT: &'static [u8; 18usize] = b"grpc.so_reuseport\0";
86pub const GRPC_ARG_RESOURCE_QUOTA: &'static [u8; 20usize] = b"grpc.resource_quota\0";
87pub const GRPC_ARG_EXPAND_WILDCARD_ADDRS: &'static [u8; 27usize] = b"grpc.expand_wildcard_addrs\0";
88pub const GRPC_ARG_SERVICE_CONFIG: &'static [u8; 20usize] = b"grpc.service_config\0";
89pub const GRPC_ARG_SERVICE_CONFIG_DISABLE_RESOLUTION: &'static [u8; 39usize] =
90 b"grpc.service_config_disable_resolution\0";
91pub const GRPC_ARG_LB_POLICY_NAME: &'static [u8; 20usize] = b"grpc.lb_policy_name\0";
92pub const GRPC_ARG_SOCKET_MUTATOR: &'static [u8; 20usize] = b"grpc.socket_mutator\0";
93pub const GRPC_ARG_SOCKET_FACTORY: &'static [u8; 20usize] = b"grpc.socket_factory\0";
94pub const GRPC_ARG_MAX_CHANNEL_TRACE_EVENT_MEMORY_PER_NODE: &'static [u8; 45usize] =
95 b"grpc.max_channel_trace_event_memory_per_node\0";
96pub const GRPC_ARG_ENABLE_CHANNELZ: &'static [u8; 21usize] = b"grpc.enable_channelz\0";
97pub const GRPC_ARG_USE_CRONET_PACKET_COALESCING: &'static [u8; 34usize] =
98 b"grpc.use_cronet_packet_coalescing\0";
99pub const GRPC_ARG_TCP_READ_CHUNK_SIZE: &'static [u8; 38usize] =
100 b"grpc.experimental.tcp_read_chunk_size\0";
101pub const GRPC_TCP_DEFAULT_READ_SLICE_SIZE: u32 = 8192;
102pub const GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE: &'static [u8; 42usize] =
103 b"grpc.experimental.tcp_min_read_chunk_size\0";
104pub const GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE: &'static [u8; 42usize] =
105 b"grpc.experimental.tcp_max_read_chunk_size\0";
106pub const GRPC_ARG_TCP_TX_ZEROCOPY_ENABLED: &'static [u8; 42usize] =
107 b"grpc.experimental.tcp_tx_zerocopy_enabled\0";
108pub const GRPC_ARG_TCP_TX_ZEROCOPY_SEND_BYTES_THRESHOLD: &'static [u8; 55usize] =
109 b"grpc.experimental.tcp_tx_zerocopy_send_bytes_threshold\0";
110pub const GRPC_ARG_TCP_TX_ZEROCOPY_MAX_SIMULT_SENDS: &'static [u8; 57usize] =
111 b"grpc.experimental.tcp_tx_zerocopy_max_simultaneous_sends\0";
112pub const GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS: &'static [u8; 28usize] =
113 b"grpc.grpclb_call_timeout_ms\0";
114pub const GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS: &'static [u8; 32usize] =
115 b"grpc.grpclb_fallback_timeout_ms\0";
116pub const GRPC_ARG_PRIORITY_FAILOVER_TIMEOUT_MS: &'static [u8; 34usize] =
117 b"grpc.priority_failover_timeout_ms\0";
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200118pub const GRPC_ARG_WORKAROUND_CRONET_COMPRESSION: &'static [u8; 35usize] =
119 b"grpc.workaround.cronet_compression\0";
120pub const GRPC_ARG_OPTIMIZATION_TARGET: &'static [u8; 25usize] = b"grpc.optimization_target\0";
121pub const GRPC_ARG_ENABLE_RETRIES: &'static [u8; 20usize] = b"grpc.enable_retries\0";
122pub const GRPC_ARG_PER_RPC_RETRY_BUFFER_SIZE: &'static [u8; 31usize] =
123 b"grpc.per_rpc_retry_buffer_size\0";
124pub const GRPC_ARG_MOBILE_LOG_CONTEXT: &'static [u8; 24usize] = b"grpc.mobile_log_context\0";
125pub const GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER: &'static [u8; 37usize] =
126 b"grpc.disable_client_authority_filter\0";
127pub const GRPC_ARG_ENABLE_HTTP_PROXY: &'static [u8; 23usize] = b"grpc.enable_http_proxy\0";
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +0100128pub const GRPC_ARG_HTTP_PROXY: &'static [u8; 16usize] = b"grpc.http_proxy\0";
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200129pub const GRPC_ARG_SURFACE_USER_AGENT: &'static [u8; 24usize] = b"grpc.surface_user_agent\0";
130pub const GRPC_ARG_INHIBIT_HEALTH_CHECKING: &'static [u8; 29usize] =
131 b"grpc.inhibit_health_checking\0";
132pub const GRPC_ARG_DNS_ENABLE_SRV_QUERIES: &'static [u8; 28usize] =
133 b"grpc.dns_enable_srv_queries\0";
134pub const GRPC_ARG_DNS_ARES_QUERY_TIMEOUT_MS: &'static [u8; 28usize] =
135 b"grpc.dns_ares_query_timeout\0";
136pub const GRPC_ARG_USE_LOCAL_SUBCHANNEL_POOL: &'static [u8; 31usize] =
137 b"grpc.use_local_subchannel_pool\0";
138pub const GRPC_ARG_CHANNEL_POOL_DOMAIN: &'static [u8; 28usize] = b"grpc.channel_pooling_domain\0";
139pub const GRPC_ARG_CHANNEL_ID: &'static [u8; 16usize] = b"grpc.channel_id\0";
140pub const GRPC_DEFAULT_MAX_SEND_MESSAGE_LENGTH: i32 = -1;
141pub const GRPC_DEFAULT_MAX_RECV_MESSAGE_LENGTH: u32 = 4194304;
142pub const GRPC_WRITE_BUFFER_HINT: u32 = 1;
143pub const GRPC_WRITE_NO_COMPRESS: u32 = 2;
144pub const GRPC_WRITE_THROUGH: u32 = 4;
145pub const GRPC_WRITE_USED_MASK: u32 = 7;
146pub const GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST: u32 = 16;
147pub const GRPC_INITIAL_METADATA_WAIT_FOR_READY: u32 = 32;
148pub const GRPC_INITIAL_METADATA_CACHEABLE_REQUEST: u32 = 64;
149pub const GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET: u32 = 128;
150pub const GRPC_INITIAL_METADATA_CORKED: u32 = 256;
151pub const GRPC_INITIAL_METADATA_USED_MASK: u32 = 500;
152pub const GRPC_CQ_CURRENT_VERSION: u32 = 2;
153pub const GRPC_CQ_VERSION_MINIMUM_FOR_CALLBACKABLE: u32 = 2;
154pub const GRPC_MAX_COMPLETION_QUEUE_PLUCKERS: u32 = 6;
155pub const GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME: &'static [u8; 24usize] =
156 b"transport_security_type\0";
157pub const GRPC_SSL_TRANSPORT_SECURITY_TYPE: &'static [u8; 4usize] = b"ssl\0";
158pub const GRPC_X509_CN_PROPERTY_NAME: &'static [u8; 17usize] = b"x509_common_name\0";
159pub const GRPC_X509_SAN_PROPERTY_NAME: &'static [u8; 30usize] = b"x509_subject_alternative_name\0";
160pub const GRPC_X509_PEM_CERT_PROPERTY_NAME: &'static [u8; 14usize] = b"x509_pem_cert\0";
161pub const GRPC_X509_PEM_CERT_CHAIN_PROPERTY_NAME: &'static [u8; 20usize] = b"x509_pem_cert_chain\0";
162pub const GRPC_SSL_SESSION_REUSED_PROPERTY: &'static [u8; 19usize] = b"ssl_session_reused\0";
163pub const GRPC_TRANSPORT_SECURITY_LEVEL_PROPERTY_NAME: &'static [u8; 15usize] = b"security_level\0";
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +0100164pub const GRPC_PEER_SPIFFE_ID_PROPERTY_NAME: &'static [u8; 15usize] = b"peer_spiffe_id\0";
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200165pub const GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR: &'static [u8; 33usize] =
166 b"GRPC_DEFAULT_SSL_ROOTS_FILE_PATH\0";
167pub const GRPC_GOOGLE_CREDENTIALS_ENV_VAR: &'static [u8; 31usize] =
168 b"GOOGLE_APPLICATION_CREDENTIALS\0";
169pub const GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX: u32 = 4;
170#[repr(u32)]
171#[doc = " The various compression algorithms supported by gRPC (not sorted by"]
172#[doc = " compression level)"]
173#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
174pub enum grpc_compression_algorithm {
175 GRPC_COMPRESS_NONE = 0,
176 GRPC_COMPRESS_DEFLATE = 1,
177 GRPC_COMPRESS_GZIP = 2,
178 GRPC_COMPRESS_STREAM_GZIP = 3,
179 GRPC_COMPRESS_ALGORITHMS_COUNT = 4,
180}
181#[repr(u32)]
182#[doc = " Compression levels allow a party with knowledge of its peer's accepted"]
183#[doc = " encodings to request compression in an abstract way. The level-algorithm"]
184#[doc = " mapping is performed internally and depends on the peer's supported"]
185#[doc = " compression algorithms."]
186#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
187pub enum grpc_compression_level {
188 GRPC_COMPRESS_LEVEL_NONE = 0,
189 GRPC_COMPRESS_LEVEL_LOW = 1,
190 GRPC_COMPRESS_LEVEL_MED = 2,
191 GRPC_COMPRESS_LEVEL_HIGH = 3,
192 GRPC_COMPRESS_LEVEL_COUNT = 4,
193}
194#[repr(C)]
195#[derive(Debug, Copy, Clone)]
196pub struct grpc_compression_options {
197 #[doc = " All algs are enabled by default. This option corresponds to the channel"]
198 #[doc = " argument key behind \\a GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET"]
199 pub enabled_algorithms_bitset: u32,
200 pub default_level: grpc_compression_options_grpc_compression_options_default_level,
201 pub default_algorithm: grpc_compression_options_grpc_compression_options_default_algorithm,
202}
203#[doc = " The default compression level. It'll be used in the absence of call"]
204#[doc = " specific settings. This option corresponds to the channel"]
205#[doc = " argument key behind \\a GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL. If present,"]
206#[doc = " takes precedence over \\a default_algorithm."]
207#[doc = " TODO(dgq): currently only available for server channels."]
208#[repr(C)]
209#[derive(Debug, Copy, Clone)]
210pub struct grpc_compression_options_grpc_compression_options_default_level {
211 pub is_set: ::std::os::raw::c_int,
212 pub level: grpc_compression_level,
213}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200214#[doc = " The default message compression algorithm. It'll be used in the absence of"]
215#[doc = " call specific settings. This option corresponds to the channel argument key"]
216#[doc = " behind \\a GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM."]
217#[repr(C)]
218#[derive(Debug, Copy, Clone)]
219pub struct grpc_compression_options_grpc_compression_options_default_algorithm {
220 pub is_set: ::std::os::raw::c_int,
221 pub algorithm: grpc_compression_algorithm,
222}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200223#[repr(C)]
224#[derive(Debug, Copy, Clone)]
225pub struct grpc_slice_refcount {
226 _unused: [u8; 0],
227}
228#[doc = " A grpc_slice s, if initialized, represents the byte range"]
229#[doc = "s.bytes[0..s.length-1]."]
230#[doc = ""]
231#[doc = "It can have an associated ref count which has a destruction routine to be run"]
232#[doc = "when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref())."]
233#[doc = "Multiple grpc_slice values may share a ref count."]
234#[doc = ""]
235#[doc = "If the slice does not have a refcount, it represents an inlined small piece"]
236#[doc = "of data that is copied by value."]
237#[repr(C)]
238#[derive(Copy, Clone)]
239pub struct grpc_slice {
240 pub refcount: *mut grpc_slice_refcount,
241 pub data: grpc_slice_grpc_slice_data,
242}
243#[repr(C)]
244#[derive(Copy, Clone)]
245pub union grpc_slice_grpc_slice_data {
246 pub refcounted: grpc_slice_grpc_slice_data_grpc_slice_refcounted,
247 pub inlined: grpc_slice_grpc_slice_data_grpc_slice_inlined,
248 _bindgen_union_align: [u64; 3usize],
249}
250#[repr(C)]
251#[derive(Debug, Copy, Clone)]
252pub struct grpc_slice_grpc_slice_data_grpc_slice_refcounted {
253 pub length: usize,
254 pub bytes: *mut u8,
255}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200256#[repr(C)]
257#[derive(Debug, Copy, Clone)]
258pub struct grpc_slice_grpc_slice_data_grpc_slice_inlined {
259 pub length: u8,
260 pub bytes: [u8; 23usize],
261}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200262impl ::std::fmt::Debug for grpc_slice_grpc_slice_data {
263 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
264 write!(f, "grpc_slice_grpc_slice_data {{ union }}")
265 }
266}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200267impl ::std::fmt::Debug for grpc_slice {
268 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
269 write!(
270 f,
271 "grpc_slice {{ refcount: {:?}, data: {:?} }}",
272 self.refcount, self.data
273 )
274 }
275}
276#[doc = " Represents an expandable array of slices, to be interpreted as a"]
277#[doc = "single item."]
278#[repr(C)]
279#[derive(Copy, Clone)]
280pub struct grpc_slice_buffer {
281 #[doc = " This is for internal use only. External users (i.e any code outside grpc"]
282 #[doc = " core) MUST NOT use this field"]
283 pub base_slices: *mut grpc_slice,
284 #[doc = " slices in the array (Points to the first valid grpc_slice in the array)"]
285 pub slices: *mut grpc_slice,
286 #[doc = " the number of slices in the array"]
287 pub count: usize,
288 #[doc = " the number of slices allocated in the array. External users (i.e any code"]
289 #[doc = " outside grpc core) MUST NOT use this field"]
290 pub capacity: usize,
291 #[doc = " the combined length of all slices in the array"]
292 pub length: usize,
293 #[doc = " inlined elements to avoid allocations"]
294 pub inlined: [grpc_slice; 8usize],
295}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200296impl ::std::fmt::Debug for grpc_slice_buffer {
297 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +0100298 write ! (f , "grpc_slice_buffer {{ base_slices: {:?}, slices: {:?}, count: {:?}, capacity: {:?}, length: {:?}, inlined: {:?} }}" , self . base_slices , self . slices , self . count , self . capacity , self . length , self . inlined)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200299 }
300}
301#[repr(u32)]
302#[doc = " The clocks we support."]
303#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
304pub enum gpr_clock_type {
305 #[doc = " Monotonic clock. Epoch undefined. Always moves forwards."]
306 GPR_CLOCK_MONOTONIC = 0,
307 #[doc = " Realtime clock. May jump forwards or backwards. Settable by"]
308 #[doc = "the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970."]
309 GPR_CLOCK_REALTIME = 1,
310 #[doc = " CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch"]
311 #[doc = "undefined. Degrades to GPR_CLOCK_REALTIME on other platforms."]
312 GPR_CLOCK_PRECISE = 2,
313 #[doc = " Unmeasurable clock type: no base, created by taking the difference"]
314 #[doc = "between two times"]
315 GPR_TIMESPAN = 3,
316}
317#[doc = " Analogous to struct timespec. On some machines, absolute times may be in"]
318#[doc = " local time."]
319#[repr(C)]
320#[derive(Debug, Copy, Clone)]
321pub struct gpr_timespec {
322 pub tv_sec: i64,
323 pub tv_nsec: i32,
324 #[doc = " Against which clock was this time measured? (or GPR_TIMESPAN if"]
325 #[doc = "this is a relative time measure)"]
326 pub clock_type: gpr_clock_type,
327}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200328pub type gpr_atm = isize;
329extern "C" {
330 #[doc = " Adds \\a delta to \\a *value, clamping the result to the range specified"]
331 #[doc = "by \\a min and \\a max. Returns the new value."]
332 pub fn gpr_atm_no_barrier_clamped_add(
333 value: *mut gpr_atm,
334 delta: gpr_atm,
335 min: gpr_atm,
336 max: gpr_atm,
337 ) -> gpr_atm;
338}
339#[repr(C)]
340#[derive(Debug, Copy, Clone)]
341pub struct gpr_event {
342 pub state: gpr_atm,
343}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200344#[repr(C)]
345#[derive(Debug, Copy, Clone)]
346pub struct gpr_refcount {
347 pub count: gpr_atm,
348}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200349#[repr(C)]
350#[derive(Debug, Copy, Clone)]
351pub struct gpr_stats_counter {
352 pub value: gpr_atm,
353}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200354extern "C" {
355 #[doc = " Initialize *ev."]
356 pub fn gpr_event_init(ev: *mut gpr_event);
357}
358extern "C" {
359 #[doc = " Set *ev so that gpr_event_get() and gpr_event_wait() will return value."]
360 #[doc = "Requires: *ev initialized; value != NULL; no prior or concurrent calls to"]
361 #[doc = "gpr_event_set(ev, ...) since initialization."]
362 pub fn gpr_event_set(ev: *mut gpr_event, value: *mut ::std::os::raw::c_void);
363}
364extern "C" {
365 #[doc = " Return the value set by gpr_event_set(ev, ...), or NULL if no such call has"]
366 #[doc = "completed. If the result is non-NULL, all operations that occurred prior to"]
367 #[doc = "the gpr_event_set(ev, ...) set will be visible after this call returns."]
368 #[doc = "Requires: *ev initialized. This operation is faster than acquiring a mutex"]
369 #[doc = "on most platforms."]
370 pub fn gpr_event_get(ev: *mut gpr_event) -> *mut ::std::os::raw::c_void;
371}
372extern "C" {
373 #[doc = " Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is"]
374 #[doc = "exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use"]
375 #[doc = "abs_deadline==gpr_inf_future for no deadline. When the event has been"]
376 #[doc = "signalled before the call, this operation is faster than acquiring a mutex"]
377 #[doc = "on most platforms."]
378 pub fn gpr_event_wait(
379 ev: *mut gpr_event,
380 abs_deadline: gpr_timespec,
381 ) -> *mut ::std::os::raw::c_void;
382}
383extern "C" {
384 #[doc = " Initialize *r to value n."]
385 pub fn gpr_ref_init(r: *mut gpr_refcount, n: ::std::os::raw::c_int);
386}
387extern "C" {
388 #[doc = " Increment the reference count *r. Requires *r initialized."]
389 pub fn gpr_ref(r: *mut gpr_refcount);
390}
391extern "C" {
392 #[doc = " Increment the reference count *r. Requires *r initialized."]
393 #[doc = "Crashes if refcount is zero"]
394 pub fn gpr_ref_non_zero(r: *mut gpr_refcount);
395}
396extern "C" {
397 #[doc = " Increment the reference count *r by n. Requires *r initialized, n > 0."]
398 pub fn gpr_refn(r: *mut gpr_refcount, n: ::std::os::raw::c_int);
399}
400extern "C" {
401 #[doc = " Decrement the reference count *r and return non-zero iff it has reached"]
402 #[doc = "zero. . Requires *r initialized."]
403 pub fn gpr_unref(r: *mut gpr_refcount) -> ::std::os::raw::c_int;
404}
405extern "C" {
406 #[doc = " Return non-zero iff the reference count of *r is one, and thus is owned"]
407 #[doc = "by exactly one object."]
408 pub fn gpr_ref_is_unique(r: *mut gpr_refcount) -> ::std::os::raw::c_int;
409}
410extern "C" {
411 #[doc = " Initialize *c to the value n."]
412 pub fn gpr_stats_init(c: *mut gpr_stats_counter, n: isize);
413}
414extern "C" {
415 #[doc = " *c += inc. Requires: *c initialized."]
416 pub fn gpr_stats_inc(c: *mut gpr_stats_counter, inc: isize);
417}
418extern "C" {
419 #[doc = " Return *c. Requires: *c initialized."]
420 pub fn gpr_stats_read(c: *const gpr_stats_counter) -> isize;
421}
422extern "C" {
423 #[doc = " Increment the refcount of s. Requires slice is initialized."]
424 #[doc = "Returns s."]
425 pub fn grpc_slice_ref(s: grpc_slice) -> grpc_slice;
426}
427extern "C" {
428 #[doc = " Decrement the ref count of s. If the ref count of s reaches zero, all"]
429 #[doc = "slices sharing the ref count are destroyed, and considered no longer"]
430 #[doc = "initialized. If s is ultimately derived from a call to grpc_slice_new(start,"]
431 #[doc = "len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is"]
432 #[doc = "ultimately derived from a call to grpc_slice_new_with_len(start, len, dest)"]
433 #[doc = "where dest!=NULL , then (*dest)(start, len). Requires s initialized."]
434 pub fn grpc_slice_unref(s: grpc_slice);
435}
436extern "C" {
437 #[doc = " Copy slice - create a new slice that contains the same data as s"]
438 pub fn grpc_slice_copy(s: grpc_slice) -> grpc_slice;
439}
440extern "C" {
441 #[doc = " Create a slice pointing at some data. Calls malloc to allocate a refcount"]
442 #[doc = "for the object, and arranges that destroy will be called with the pointer"]
443 #[doc = "passed in at destruction."]
444 pub fn grpc_slice_new(
445 p: *mut ::std::os::raw::c_void,
446 len: usize,
447 destroy: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
448 ) -> grpc_slice;
449}
450extern "C" {
451 #[doc = " Equivalent to grpc_slice_new, but with a separate pointer that is"]
452 #[doc = "passed to the destroy function. This function can be useful when"]
453 #[doc = "the data is part of a larger structure that must be destroyed when"]
454 #[doc = "the data is no longer needed."]
455 pub fn grpc_slice_new_with_user_data(
456 p: *mut ::std::os::raw::c_void,
457 len: usize,
458 destroy: ::std::option::Option<unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void)>,
459 user_data: *mut ::std::os::raw::c_void,
460 ) -> grpc_slice;
461}
462extern "C" {
463 #[doc = " Equivalent to grpc_slice_new, but with a two argument destroy function that"]
464 #[doc = "also takes the slice length."]
465 pub fn grpc_slice_new_with_len(
466 p: *mut ::std::os::raw::c_void,
467 len: usize,
468 destroy: ::std::option::Option<
469 unsafe extern "C" fn(arg1: *mut ::std::os::raw::c_void, arg2: usize),
470 >,
471 ) -> grpc_slice;
472}
473extern "C" {
474 #[doc = " Equivalent to grpc_slice_new(malloc(len), len, free), but saves one malloc()"]
475 #[doc = "call."]
476 #[doc = "Aborts if malloc() fails."]
477 pub fn grpc_slice_malloc(length: usize) -> grpc_slice;
478}
479extern "C" {
480 pub fn grpc_slice_malloc_large(length: usize) -> grpc_slice;
481}
482extern "C" {
483 #[doc = " Intern a slice:"]
484 #[doc = ""]
485 #[doc = "The return value for two invocations of this function with the same sequence"]
486 #[doc = "of bytes is a slice which points to the same memory."]
487 pub fn grpc_slice_intern(slice: grpc_slice) -> grpc_slice;
488}
489extern "C" {
490 #[doc = " Create a slice by copying a string."]
491 #[doc = "Does not preserve null terminators."]
492 #[doc = "Equivalent to:"]
493 #[doc = "size_t len = strlen(source);"]
494 #[doc = "grpc_slice slice = grpc_slice_malloc(len);"]
495 #[doc = "memcpy(slice->data, source, len);"]
496 pub fn grpc_slice_from_copied_string(source: *const ::std::os::raw::c_char) -> grpc_slice;
497}
498extern "C" {
499 #[doc = " Create a slice by copying a buffer."]
500 #[doc = "Equivalent to:"]
501 #[doc = "grpc_slice slice = grpc_slice_malloc(len);"]
502 #[doc = "memcpy(slice->data, source, len);"]
503 pub fn grpc_slice_from_copied_buffer(
504 source: *const ::std::os::raw::c_char,
505 len: usize,
506 ) -> grpc_slice;
507}
508extern "C" {
509 #[doc = " Create a slice pointing to constant memory"]
510 pub fn grpc_slice_from_static_string(source: *const ::std::os::raw::c_char) -> grpc_slice;
511}
512extern "C" {
513 #[doc = " Create a slice pointing to constant memory"]
514 pub fn grpc_slice_from_static_buffer(
515 source: *const ::std::os::raw::c_void,
516 len: usize,
517 ) -> grpc_slice;
518}
519extern "C" {
520 #[doc = " Return a result slice derived from s, which shares a ref count with \\a s,"]
521 #[doc = "where result.data==s.data+begin, and result.length==end-begin. The ref count"]
522 #[doc = "of \\a s is increased by one. Do not assign result back to \\a s."]
523 #[doc = "Requires s initialized, begin <= end, begin <= s.length, and"]
524 #[doc = "end <= source->length."]
525 pub fn grpc_slice_sub(s: grpc_slice, begin: usize, end: usize) -> grpc_slice;
526}
527extern "C" {
528 #[doc = " The same as grpc_slice_sub, but without altering the ref count"]
529 pub fn grpc_slice_sub_no_ref(s: grpc_slice, begin: usize, end: usize) -> grpc_slice;
530}
531extern "C" {
532 #[doc = " Splits s into two: modifies s to be s[0:split], and returns a new slice,"]
533 #[doc = "sharing a refcount with s, that contains s[split:s.length]."]
534 #[doc = "Requires s initialized, split <= s.length"]
535 pub fn grpc_slice_split_tail(s: *mut grpc_slice, split: usize) -> grpc_slice;
536}
537#[repr(u32)]
538#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
539pub enum grpc_slice_ref_whom {
540 GRPC_SLICE_REF_TAIL = 1,
541 GRPC_SLICE_REF_HEAD = 2,
542 GRPC_SLICE_REF_BOTH = 3,
543}
544extern "C" {
545 #[doc = " The same as grpc_slice_split_tail, but with an option to skip altering"]
546 #[doc = " refcounts (grpc_slice_split_tail_maybe_ref(..., true) is equivalent to"]
547 #[doc = " grpc_slice_split_tail(...))"]
548 pub fn grpc_slice_split_tail_maybe_ref(
549 s: *mut grpc_slice,
550 split: usize,
551 ref_whom: grpc_slice_ref_whom,
552 ) -> grpc_slice;
553}
554extern "C" {
555 #[doc = " Splits s into two: modifies s to be s[split:s.length], and returns a new"]
556 #[doc = "slice, sharing a refcount with s, that contains s[0:split]."]
557 #[doc = "Requires s initialized, split <= s.length"]
558 pub fn grpc_slice_split_head(s: *mut grpc_slice, split: usize) -> grpc_slice;
559}
560extern "C" {
561 pub fn grpc_empty_slice() -> grpc_slice;
562}
563extern "C" {
564 pub fn grpc_slice_default_hash_impl(s: grpc_slice) -> u32;
565}
566extern "C" {
567 pub fn grpc_slice_default_eq_impl(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
568}
569extern "C" {
570 pub fn grpc_slice_eq(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
571}
572extern "C" {
573 #[doc = " Returns <0 if a < b, ==0 if a == b, >0 if a > b"]
574 #[doc = "The order is arbitrary, and is not guaranteed to be stable across different"]
575 #[doc = "versions of the API."]
576 pub fn grpc_slice_cmp(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
577}
578extern "C" {
579 pub fn grpc_slice_str_cmp(
580 a: grpc_slice,
581 b: *const ::std::os::raw::c_char,
582 ) -> ::std::os::raw::c_int;
583}
584extern "C" {
585 #[doc = " return non-zero if the first blen bytes of a are equal to b"]
586 pub fn grpc_slice_buf_start_eq(
587 a: grpc_slice,
588 b: *const ::std::os::raw::c_void,
589 blen: usize,
590 ) -> ::std::os::raw::c_int;
591}
592extern "C" {
593 #[doc = " return the index of the last instance of \\a c in \\a s, or -1 if not found"]
594 pub fn grpc_slice_rchr(s: grpc_slice, c: ::std::os::raw::c_char) -> ::std::os::raw::c_int;
595}
596extern "C" {
597 pub fn grpc_slice_chr(s: grpc_slice, c: ::std::os::raw::c_char) -> ::std::os::raw::c_int;
598}
599extern "C" {
600 #[doc = " return the index of the first occurrence of \\a needle in \\a haystack, or -1"]
601 #[doc = "if it's not found"]
602 pub fn grpc_slice_slice(haystack: grpc_slice, needle: grpc_slice) -> ::std::os::raw::c_int;
603}
604extern "C" {
605 pub fn grpc_slice_hash(s: grpc_slice) -> u32;
606}
607extern "C" {
608 #[doc = " Do two slices point at the same memory, with the same length"]
609 #[doc = "If a or b is inlined, actually compares data"]
610 pub fn grpc_slice_is_equivalent(a: grpc_slice, b: grpc_slice) -> ::std::os::raw::c_int;
611}
612extern "C" {
613 #[doc = " Return a slice pointing to newly allocated memory that has the same contents"]
614 #[doc = " as \\a s"]
615 pub fn grpc_slice_dup(a: grpc_slice) -> grpc_slice;
616}
617extern "C" {
618 #[doc = " Return a copy of slice as a C string. Offers no protection against embedded"]
619 #[doc = "NULL's. Returned string must be freed with gpr_free."]
620 pub fn grpc_slice_to_c_string(s: grpc_slice) -> *mut ::std::os::raw::c_char;
621}
622extern "C" {
623 #[doc = " Return if an algorithm is message compression algorithm."]
624 pub fn grpc_compression_algorithm_is_message(
625 algorithm: grpc_compression_algorithm,
626 ) -> ::std::os::raw::c_int;
627}
628extern "C" {
629 #[doc = " Return if an algorithm is stream compression algorithm."]
630 pub fn grpc_compression_algorithm_is_stream(
631 algorithm: grpc_compression_algorithm,
632 ) -> ::std::os::raw::c_int;
633}
634extern "C" {
635 #[doc = " Parses the \\a slice as a grpc_compression_algorithm instance and updating \\a"]
636 #[doc = " algorithm. Returns 1 upon success, 0 otherwise."]
637 pub fn grpc_compression_algorithm_parse(
638 value: grpc_slice,
639 algorithm: *mut grpc_compression_algorithm,
640 ) -> ::std::os::raw::c_int;
641}
642extern "C" {
643 #[doc = " Updates \\a name with the encoding name corresponding to a valid \\a"]
644 #[doc = " algorithm. Note that \\a name is statically allocated and must *not* be freed."]
645 #[doc = " Returns 1 upon success, 0 otherwise."]
646 pub fn grpc_compression_algorithm_name(
647 algorithm: grpc_compression_algorithm,
648 name: *mut *const ::std::os::raw::c_char,
649 ) -> ::std::os::raw::c_int;
650}
651extern "C" {
652 #[doc = " Returns the compression algorithm corresponding to \\a level for the"]
653 #[doc = " compression algorithms encoded in the \\a accepted_encodings bitset."]
654 pub fn grpc_compression_algorithm_for_level(
655 level: grpc_compression_level,
656 accepted_encodings: u32,
657 ) -> grpc_compression_algorithm;
658}
659extern "C" {
660 pub fn grpc_compression_options_init(opts: *mut grpc_compression_options);
661}
662extern "C" {
663 #[doc = " Mark \\a algorithm as enabled in \\a opts."]
664 pub fn grpc_compression_options_enable_algorithm(
665 opts: *mut grpc_compression_options,
666 algorithm: grpc_compression_algorithm,
667 );
668}
669extern "C" {
670 #[doc = " Mark \\a algorithm as disabled in \\a opts."]
671 pub fn grpc_compression_options_disable_algorithm(
672 opts: *mut grpc_compression_options,
673 algorithm: grpc_compression_algorithm,
674 );
675}
676extern "C" {
677 #[doc = " Returns true if \\a algorithm is marked as enabled in \\a opts."]
678 pub fn grpc_compression_options_is_algorithm_enabled(
679 opts: *const grpc_compression_options,
680 algorithm: grpc_compression_algorithm,
681 ) -> ::std::os::raw::c_int;
682}
683pub mod grpc_status_code {
684 pub type Type = i32;
685 #[doc = " Not an error; returned on success"]
686 pub const GRPC_STATUS_OK: Type = 0;
687 #[doc = " The operation was cancelled (typically by the caller)."]
688 pub const GRPC_STATUS_CANCELLED: Type = 1;
689 #[doc = " Unknown error. An example of where this error may be returned is"]
690 #[doc = "if a Status value received from another address space belongs to"]
691 #[doc = "an error-space that is not known in this address space. Also"]
692 #[doc = "errors raised by APIs that do not return enough error information"]
693 #[doc = "may be converted to this error."]
694 pub const GRPC_STATUS_UNKNOWN: Type = 2;
695 #[doc = " Client specified an invalid argument. Note that this differs"]
696 #[doc = "from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments"]
697 #[doc = "that are problematic regardless of the state of the system"]
698 #[doc = "(e.g., a malformed file name)."]
699 pub const GRPC_STATUS_INVALID_ARGUMENT: Type = 3;
700 #[doc = " Deadline expired before operation could complete. For operations"]
701 #[doc = "that change the state of the system, this error may be returned"]
702 #[doc = "even if the operation has completed successfully. For example, a"]
703 #[doc = "successful response from a server could have been delayed long"]
704 #[doc = "enough for the deadline to expire."]
705 pub const GRPC_STATUS_DEADLINE_EXCEEDED: Type = 4;
706 #[doc = " Some requested entity (e.g., file or directory) was not found."]
707 pub const GRPC_STATUS_NOT_FOUND: Type = 5;
708 #[doc = " Some entity that we attempted to create (e.g., file or directory)"]
709 #[doc = "already exists."]
710 pub const GRPC_STATUS_ALREADY_EXISTS: Type = 6;
711 #[doc = " The caller does not have permission to execute the specified"]
712 #[doc = "operation. PERMISSION_DENIED must not be used for rejections"]
713 #[doc = "caused by exhausting some resource (use RESOURCE_EXHAUSTED"]
714 #[doc = "instead for those errors). PERMISSION_DENIED must not be"]
715 #[doc = "used if the caller can not be identified (use UNAUTHENTICATED"]
716 #[doc = "instead for those errors)."]
717 pub const GRPC_STATUS_PERMISSION_DENIED: Type = 7;
718 #[doc = " The request does not have valid authentication credentials for the"]
719 #[doc = "operation."]
720 pub const GRPC_STATUS_UNAUTHENTICATED: Type = 16;
721 #[doc = " Some resource has been exhausted, perhaps a per-user quota, or"]
722 #[doc = "perhaps the entire file system is out of space."]
723 pub const GRPC_STATUS_RESOURCE_EXHAUSTED: Type = 8;
724 #[doc = " Operation was rejected because the system is not in a state"]
725 #[doc = "required for the operation's execution. For example, directory"]
726 #[doc = "to be deleted may be non-empty, an rmdir operation is applied to"]
727 #[doc = "a non-directory, etc."]
728 #[doc = ""]
729 #[doc = "A litmus test that may help a service implementor in deciding"]
730 #[doc = "between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:"]
731 #[doc = "(a) Use UNAVAILABLE if the client can retry just the failing call."]
732 #[doc = "(b) Use ABORTED if the client should retry at a higher-level"]
733 #[doc = "(e.g., restarting a read-modify-write sequence)."]
734 #[doc = "(c) Use FAILED_PRECONDITION if the client should not retry until"]
735 #[doc = "the system state has been explicitly fixed. E.g., if an \"rmdir\""]
736 #[doc = "fails because the directory is non-empty, FAILED_PRECONDITION"]
737 #[doc = "should be returned since the client should not retry unless"]
738 #[doc = "they have first fixed up the directory by deleting files from it."]
739 #[doc = "(d) Use FAILED_PRECONDITION if the client performs conditional"]
740 #[doc = "REST Get/Update/Delete on a resource and the resource on the"]
741 #[doc = "server does not match the condition. E.g., conflicting"]
742 #[doc = "read-modify-write on the same resource."]
743 pub const GRPC_STATUS_FAILED_PRECONDITION: Type = 9;
744 #[doc = " The operation was aborted, typically due to a concurrency issue"]
745 #[doc = "like sequencer check failures, transaction aborts, etc."]
746 #[doc = ""]
747 #[doc = "See litmus test above for deciding between FAILED_PRECONDITION,"]
748 #[doc = "ABORTED, and UNAVAILABLE."]
749 pub const GRPC_STATUS_ABORTED: Type = 10;
750 #[doc = " Operation was attempted past the valid range. E.g., seeking or"]
751 #[doc = "reading past end of file."]
752 #[doc = ""]
753 #[doc = "Unlike INVALID_ARGUMENT, this error indicates a problem that may"]
754 #[doc = "be fixed if the system state changes. For example, a 32-bit file"]
755 #[doc = "system will generate INVALID_ARGUMENT if asked to read at an"]
756 #[doc = "offset that is not in the range [0,2^32-1], but it will generate"]
757 #[doc = "OUT_OF_RANGE if asked to read from an offset past the current"]
758 #[doc = "file size."]
759 #[doc = ""]
760 #[doc = "There is a fair bit of overlap between FAILED_PRECONDITION and"]
761 #[doc = "OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific"]
762 #[doc = "error) when it applies so that callers who are iterating through"]
763 #[doc = "a space can easily look for an OUT_OF_RANGE error to detect when"]
764 #[doc = "they are done."]
765 pub const GRPC_STATUS_OUT_OF_RANGE: Type = 11;
766 #[doc = " Operation is not implemented or not supported/enabled in this service."]
767 pub const GRPC_STATUS_UNIMPLEMENTED: Type = 12;
768 #[doc = " Internal errors. Means some invariants expected by underlying"]
769 #[doc = "system has been broken. If you see one of these errors,"]
770 #[doc = "something is very broken."]
771 pub const GRPC_STATUS_INTERNAL: Type = 13;
772 #[doc = " The service is currently unavailable. This is a most likely a"]
773 #[doc = "transient condition and may be corrected by retrying with"]
774 #[doc = "a backoff. Note that it is not always safe to retry non-idempotent"]
775 #[doc = "operations."]
776 #[doc = ""]
777 #[doc = "WARNING: Although data MIGHT not have been transmitted when this"]
778 #[doc = "status occurs, there is NOT A GUARANTEE that the server has not seen"]
779 #[doc = "anything. So in general it is unsafe to retry on this status code"]
780 #[doc = "if the call is non-idempotent."]
781 #[doc = ""]
782 #[doc = "See litmus test above for deciding between FAILED_PRECONDITION,"]
783 #[doc = "ABORTED, and UNAVAILABLE."]
784 pub const GRPC_STATUS_UNAVAILABLE: Type = 14;
785 #[doc = " Unrecoverable data loss or corruption."]
786 pub const GRPC_STATUS_DATA_LOSS: Type = 15;
787 #[doc = " Force users to include a default branch:"]
788 pub const GRPC_STATUS__DO_NOT_USE: Type = -1;
789}
790#[repr(u32)]
791#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
792pub enum grpc_byte_buffer_type {
793 GRPC_BB_RAW = 0,
794}
795#[repr(C)]
796#[derive(Copy, Clone)]
797pub struct grpc_byte_buffer {
798 pub reserved: *mut ::std::os::raw::c_void,
799 pub type_: grpc_byte_buffer_type,
800 pub data: grpc_byte_buffer_grpc_byte_buffer_data,
801}
802#[repr(C)]
803#[derive(Copy, Clone)]
804pub union grpc_byte_buffer_grpc_byte_buffer_data {
805 pub reserved: grpc_byte_buffer_grpc_byte_buffer_data__bindgen_ty_1,
806 pub raw: grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer,
807 _bindgen_union_align: [u64; 38usize],
808}
809#[repr(C)]
810#[derive(Debug, Copy, Clone)]
811pub struct grpc_byte_buffer_grpc_byte_buffer_data__bindgen_ty_1 {
812 pub reserved: [*mut ::std::os::raw::c_void; 8usize],
813}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200814#[repr(C)]
815#[derive(Copy, Clone)]
816pub struct grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer {
817 pub compression: grpc_compression_algorithm,
818 pub slice_buffer: grpc_slice_buffer,
819}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200820impl ::std::fmt::Debug for grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer {
821 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +0100822 write ! (f , "grpc_byte_buffer_grpc_byte_buffer_data_grpc_compressed_buffer {{ compression: {:?}, slice_buffer: {:?} }}" , self . compression , self . slice_buffer)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200823 }
824}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200825impl ::std::fmt::Debug for grpc_byte_buffer_grpc_byte_buffer_data {
826 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
827 write!(f, "grpc_byte_buffer_grpc_byte_buffer_data {{ union }}")
828 }
829}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200830impl ::std::fmt::Debug for grpc_byte_buffer {
831 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
832 write!(
833 f,
834 "grpc_byte_buffer {{ reserved: {:?}, type: {:?}, data: {:?} }}",
835 self.reserved, self.type_, self.data
836 )
837 }
838}
839#[repr(C)]
840#[derive(Debug, Copy, Clone)]
841pub struct grpc_completion_queue {
842 _unused: [u8; 0],
843}
844#[repr(C)]
845#[derive(Debug, Copy, Clone)]
846pub struct grpc_alarm {
847 _unused: [u8; 0],
848}
849#[repr(C)]
850#[derive(Debug, Copy, Clone)]
851pub struct grpc_channel {
852 _unused: [u8; 0],
853}
854#[repr(C)]
855#[derive(Debug, Copy, Clone)]
856pub struct grpc_server {
857 _unused: [u8; 0],
858}
859#[repr(C)]
860#[derive(Debug, Copy, Clone)]
861pub struct grpc_call {
862 _unused: [u8; 0],
863}
864#[repr(C)]
865#[derive(Debug, Copy, Clone)]
866pub struct grpc_socket_mutator {
867 _unused: [u8; 0],
868}
869#[repr(C)]
870#[derive(Debug, Copy, Clone)]
871pub struct grpc_socket_factory {
872 _unused: [u8; 0],
873}
874#[repr(u32)]
875#[doc = " Type specifier for grpc_arg"]
876#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
877pub enum grpc_arg_type {
878 GRPC_ARG_STRING = 0,
879 GRPC_ARG_INTEGER = 1,
880 GRPC_ARG_POINTER = 2,
881}
882#[repr(C)]
883#[derive(Debug, Copy, Clone)]
884pub struct grpc_arg_pointer_vtable {
885 pub copy: ::std::option::Option<
886 unsafe extern "C" fn(p: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_void,
887 >,
888 pub destroy: ::std::option::Option<unsafe extern "C" fn(p: *mut ::std::os::raw::c_void)>,
889 pub cmp: ::std::option::Option<
890 unsafe extern "C" fn(
891 p: *mut ::std::os::raw::c_void,
892 q: *mut ::std::os::raw::c_void,
893 ) -> ::std::os::raw::c_int,
894 >,
895}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200896#[doc = " A single argument... each argument has a key and a value"]
897#[doc = ""]
898#[doc = "A note on naming keys:"]
899#[doc = "Keys are namespaced into groups, usually grouped by library, and are"]
900#[doc = "keys for module XYZ are named XYZ.key1, XYZ.key2, etc. Module names must"]
901#[doc = "be restricted to the regex [A-Za-z][_A-Za-z0-9]{,15}."]
902#[doc = "Key names must be restricted to the regex [A-Za-z][_A-Za-z0-9]{,47}."]
903#[doc = ""]
904#[doc = "GRPC core library keys are prefixed by grpc."]
905#[doc = ""]
906#[doc = "Library authors are strongly encouraged to \\#define symbolic constants for"]
907#[doc = "their keys so that it's possible to change them in the future."]
908#[repr(C)]
909#[derive(Copy, Clone)]
910pub struct grpc_arg {
911 pub type_: grpc_arg_type,
912 pub key: *mut ::std::os::raw::c_char,
913 pub value: grpc_arg_grpc_arg_value,
914}
915#[repr(C)]
916#[derive(Copy, Clone)]
917pub union grpc_arg_grpc_arg_value {
918 pub string: *mut ::std::os::raw::c_char,
919 pub integer: ::std::os::raw::c_int,
920 pub pointer: grpc_arg_grpc_arg_value_grpc_arg_pointer,
921 _bindgen_union_align: [u64; 2usize],
922}
923#[repr(C)]
924#[derive(Debug, Copy, Clone)]
925pub struct grpc_arg_grpc_arg_value_grpc_arg_pointer {
926 pub p: *mut ::std::os::raw::c_void,
927 pub vtable: *const grpc_arg_pointer_vtable,
928}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200929impl ::std::fmt::Debug for grpc_arg_grpc_arg_value {
930 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
931 write!(f, "grpc_arg_grpc_arg_value {{ union }}")
932 }
933}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200934impl ::std::fmt::Debug for grpc_arg {
935 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
936 write!(
937 f,
938 "grpc_arg {{ type: {:?}, key: {:?}, value: {:?} }}",
939 self.type_, self.key, self.value
940 )
941 }
942}
943#[doc = " An array of arguments that can be passed around."]
944#[doc = ""]
945#[doc = "Used to set optional channel-level configuration."]
946#[doc = "These configuration options are modelled as key-value pairs as defined"]
947#[doc = "by grpc_arg; keys are strings to allow easy backwards-compatible extension"]
948#[doc = "by arbitrary parties. All evaluation is performed at channel creation"]
949#[doc = "time (i.e. the keys and values in this structure need only live through the"]
950#[doc = "creation invocation)."]
951#[doc = ""]
952#[doc = "However, if one of the args has grpc_arg_type==GRPC_ARG_POINTER, then the"]
953#[doc = "grpc_arg_pointer_vtable must live until the channel args are done being"]
954#[doc = "used by core (i.e. when the object for use with which they were passed"]
955#[doc = "is destroyed)."]
956#[doc = ""]
957#[doc = "See the description of the \\ref grpc_arg_keys \"available args\" for more"]
958#[doc = "details."]
959#[repr(C)]
960#[derive(Debug, Copy, Clone)]
961pub struct grpc_channel_args {
962 pub num_args: usize,
963 pub args: *mut grpc_arg,
964}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +0200965#[repr(u32)]
966#[doc = " Result of a grpc call. If the caller satisfies the prerequisites of a"]
967#[doc = "particular operation, the grpc_call_error returned will be GRPC_CALL_OK."]
968#[doc = "Receiving any other value listed here is an indication of a bug in the"]
969#[doc = "caller."]
970#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
971pub enum grpc_call_error {
972 #[doc = " everything went ok"]
973 GRPC_CALL_OK = 0,
974 #[doc = " something failed, we don't know what"]
975 GRPC_CALL_ERROR = 1,
976 #[doc = " this method is not available on the server"]
977 GRPC_CALL_ERROR_NOT_ON_SERVER = 2,
978 #[doc = " this method is not available on the client"]
979 GRPC_CALL_ERROR_NOT_ON_CLIENT = 3,
980 #[doc = " this method must be called before server_accept"]
981 GRPC_CALL_ERROR_ALREADY_ACCEPTED = 4,
982 #[doc = " this method must be called before invoke"]
983 GRPC_CALL_ERROR_ALREADY_INVOKED = 5,
984 #[doc = " this method must be called after invoke"]
985 GRPC_CALL_ERROR_NOT_INVOKED = 6,
986 #[doc = " this call is already finished"]
987 #[doc = "(writes_done or write_status has already been called)"]
988 GRPC_CALL_ERROR_ALREADY_FINISHED = 7,
989 #[doc = " there is already an outstanding read/write operation on the call"]
990 GRPC_CALL_ERROR_TOO_MANY_OPERATIONS = 8,
991 #[doc = " the flags value was illegal for this call"]
992 GRPC_CALL_ERROR_INVALID_FLAGS = 9,
993 #[doc = " invalid metadata was passed to this call"]
994 GRPC_CALL_ERROR_INVALID_METADATA = 10,
995 #[doc = " invalid message was passed to this call"]
996 GRPC_CALL_ERROR_INVALID_MESSAGE = 11,
997 #[doc = " completion queue for notification has not been registered"]
998 #[doc = " with the server"]
999 GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE = 12,
1000 #[doc = " this batch of operations leads to more operations than allowed"]
1001 GRPC_CALL_ERROR_BATCH_TOO_BIG = 13,
1002 #[doc = " payload type requested is not the type registered"]
1003 GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH = 14,
1004 #[doc = " completion queue has been shutdown"]
1005 GRPC_CALL_ERROR_COMPLETION_QUEUE_SHUTDOWN = 15,
1006}
1007#[doc = " A single metadata element"]
1008#[repr(C)]
1009#[derive(Copy, Clone)]
1010pub struct grpc_metadata {
1011 #[doc = " the key, value values are expected to line up with grpc_mdelem: if"]
1012 #[doc = "changing them, update metadata.h at the same time."]
1013 pub key: grpc_slice,
1014 pub value: grpc_slice,
1015 pub flags: u32,
1016 pub internal_data: grpc_metadata__bindgen_ty_1,
1017}
1018#[doc = " The following fields are reserved for grpc internal use."]
1019#[doc = "There is no need to initialize them, and they will be set to garbage"]
1020#[doc = "during calls to grpc."]
1021#[repr(C)]
1022#[derive(Debug, Copy, Clone)]
1023pub struct grpc_metadata__bindgen_ty_1 {
1024 pub obfuscated: [*mut ::std::os::raw::c_void; 4usize],
1025}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001026impl ::std::fmt::Debug for grpc_metadata {
1027 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1028 write!(
1029 f,
1030 "grpc_metadata {{ key: {:?}, value: {:?}, flags: {:?}, internal_data: {:?} }}",
1031 self.key, self.value, self.flags, self.internal_data
1032 )
1033 }
1034}
1035#[repr(u32)]
1036#[doc = " The type of completion (for grpc_event)"]
1037#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1038pub enum grpc_completion_type {
1039 #[doc = " Shutting down"]
1040 GRPC_QUEUE_SHUTDOWN = 0,
1041 #[doc = " No event before timeout"]
1042 GRPC_QUEUE_TIMEOUT = 1,
1043 #[doc = " Operation completion"]
1044 GRPC_OP_COMPLETE = 2,
1045}
1046#[doc = " The result of an operation."]
1047#[doc = ""]
1048#[doc = "Returned by a completion queue when the operation started with tag."]
1049#[repr(C)]
1050#[derive(Debug, Copy, Clone)]
1051pub struct grpc_event {
1052 #[doc = " The type of the completion."]
1053 pub type_: grpc_completion_type,
1054 #[doc = " If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates"]
1055 #[doc = "whether the operation was successful or not; 0 in case of failure and"]
1056 #[doc = "non-zero in case of success."]
1057 #[doc = "If grpc_completion_type is GRPC_QUEUE_SHUTDOWN or GRPC_QUEUE_TIMEOUT, this"]
1058 #[doc = "field is guaranteed to be 0"]
1059 pub success: ::std::os::raw::c_int,
1060 #[doc = " The tag passed to grpc_call_start_batch etc to start this operation."]
1061 #[doc = "Only* GRPC_OP_COMPLETE has a tag. For all other grpc_completion_type"]
1062 #[doc = "values, tag is uninitialized."]
1063 pub tag: *mut ::std::os::raw::c_void,
1064}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001065#[repr(C)]
1066#[derive(Debug, Copy, Clone)]
1067pub struct grpc_metadata_array {
1068 pub count: usize,
1069 pub capacity: usize,
1070 pub metadata: *mut grpc_metadata,
1071}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001072#[repr(C)]
1073#[derive(Copy, Clone)]
1074pub struct grpc_call_details {
1075 pub method: grpc_slice,
1076 pub host: grpc_slice,
1077 pub deadline: gpr_timespec,
1078 pub flags: u32,
1079 pub reserved: *mut ::std::os::raw::c_void,
1080}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001081impl ::std::fmt::Debug for grpc_call_details {
1082 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01001083 write ! (f , "grpc_call_details {{ method: {:?}, host: {:?}, deadline: {:?}, flags: {:?}, reserved: {:?} }}" , self . method , self . host , self . deadline , self . flags , self . reserved)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001084 }
1085}
1086#[repr(u32)]
1087#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1088pub enum grpc_op_type {
1089 #[doc = " Send initial metadata: one and only one instance MUST be sent for each"]
1090 #[doc = "call, unless the call was cancelled - in which case this can be skipped."]
1091 #[doc = "This op completes after all bytes of metadata have been accepted by"]
1092 #[doc = "outgoing flow control."]
1093 GRPC_OP_SEND_INITIAL_METADATA = 0,
1094 #[doc = " Send a message: 0 or more of these operations can occur for each call."]
1095 #[doc = "This op completes after all bytes for the message have been accepted by"]
1096 #[doc = "outgoing flow control."]
1097 GRPC_OP_SEND_MESSAGE = 1,
1098 #[doc = " Send a close from the client: one and only one instance MUST be sent from"]
1099 #[doc = "the client, unless the call was cancelled - in which case this can be"]
1100 #[doc = "skipped. This op completes after all bytes for the call"]
1101 #[doc = "(including the close) have passed outgoing flow control."]
1102 GRPC_OP_SEND_CLOSE_FROM_CLIENT = 2,
1103 #[doc = " Send status from the server: one and only one instance MUST be sent from"]
1104 #[doc = "the server unless the call was cancelled - in which case this can be"]
1105 #[doc = "skipped. This op completes after all bytes for the call"]
1106 #[doc = "(including the status) have passed outgoing flow control."]
1107 GRPC_OP_SEND_STATUS_FROM_SERVER = 3,
1108 #[doc = " Receive initial metadata: one and only one MUST be made on the client,"]
1109 #[doc = "must not be made on the server."]
1110 #[doc = "This op completes after all initial metadata has been read from the"]
1111 #[doc = "peer."]
1112 GRPC_OP_RECV_INITIAL_METADATA = 4,
1113 #[doc = " Receive a message: 0 or more of these operations can occur for each call."]
1114 #[doc = "This op completes after all bytes of the received message have been"]
1115 #[doc = "read, or after a half-close has been received on this call."]
1116 GRPC_OP_RECV_MESSAGE = 5,
1117 #[doc = " Receive status on the client: one and only one must be made on the client."]
1118 #[doc = "This operation always succeeds, meaning ops paired with this operation"]
1119 #[doc = "will also appear to succeed, even though they may not have. In that case"]
1120 #[doc = "the status will indicate some failure."]
1121 #[doc = "This op completes after all activity on the call has completed."]
1122 GRPC_OP_RECV_STATUS_ON_CLIENT = 6,
1123 #[doc = " Receive close on the server: one and only one must be made on the"]
1124 #[doc = "server. This op completes after the close has been received by the"]
1125 #[doc = "server. This operation always succeeds, meaning ops paired with"]
1126 #[doc = "this operation will also appear to succeed, even though they may not"]
1127 #[doc = "have."]
1128 GRPC_OP_RECV_CLOSE_ON_SERVER = 7,
1129}
1130#[doc = " Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT"]
1131#[doc = "which has no arguments)"]
1132#[repr(C)]
1133#[derive(Copy, Clone)]
1134pub struct grpc_op {
1135 #[doc = " Operation type, as defined by grpc_op_type"]
1136 pub op: grpc_op_type,
1137 #[doc = " Write flags bitset for grpc_begin_messages"]
1138 pub flags: u32,
1139 #[doc = " Reserved for future usage"]
1140 pub reserved: *mut ::std::os::raw::c_void,
1141 pub data: grpc_op_grpc_op_data,
1142}
1143#[repr(C)]
1144#[derive(Copy, Clone)]
1145pub union grpc_op_grpc_op_data {
1146 pub reserved: grpc_op_grpc_op_data__bindgen_ty_1,
1147 pub send_initial_metadata: grpc_op_grpc_op_data_grpc_op_send_initial_metadata,
1148 pub send_message: grpc_op_grpc_op_data_grpc_op_send_message,
1149 pub send_status_from_server: grpc_op_grpc_op_data_grpc_op_send_status_from_server,
1150 pub recv_initial_metadata: grpc_op_grpc_op_data_grpc_op_recv_initial_metadata,
1151 pub recv_message: grpc_op_grpc_op_data_grpc_op_recv_message,
1152 pub recv_status_on_client: grpc_op_grpc_op_data_grpc_op_recv_status_on_client,
1153 pub recv_close_on_server: grpc_op_grpc_op_data_grpc_op_recv_close_on_server,
1154 _bindgen_union_align: [u64; 8usize],
1155}
1156#[doc = " Reserved for future usage"]
1157#[repr(C)]
1158#[derive(Debug, Copy, Clone)]
1159pub struct grpc_op_grpc_op_data__bindgen_ty_1 {
1160 pub reserved: [*mut ::std::os::raw::c_void; 8usize],
1161}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001162#[repr(C)]
1163#[derive(Debug, Copy, Clone)]
1164pub struct grpc_op_grpc_op_data_grpc_op_send_initial_metadata { pub count : usize , pub metadata : * mut grpc_metadata , pub maybe_compression_level : grpc_op_grpc_op_data_grpc_op_send_initial_metadata_grpc_op_send_initial_metadata_maybe_compression_level , }
1165#[doc = " If \\a is_set, \\a compression_level will be used for the call."]
1166#[doc = " Otherwise, \\a compression_level won't be considered"]
1167#[repr(C)]
1168#[derive(Debug, Copy, Clone)]
1169pub struct grpc_op_grpc_op_data_grpc_op_send_initial_metadata_grpc_op_send_initial_metadata_maybe_compression_level
1170{
1171 pub is_set: u8,
1172 pub level: grpc_compression_level,
1173}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001174#[repr(C)]
1175#[derive(Debug, Copy, Clone)]
1176pub struct grpc_op_grpc_op_data_grpc_op_send_message {
1177 #[doc = " This op takes ownership of the slices in send_message. After"]
1178 #[doc = " a call completes, the contents of send_message are not guaranteed"]
1179 #[doc = " and likely empty. The original owner should still call"]
1180 #[doc = " grpc_byte_buffer_destroy() on this object however."]
1181 pub send_message: *mut grpc_byte_buffer,
1182}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001183#[repr(C)]
1184#[derive(Debug, Copy, Clone)]
1185pub struct grpc_op_grpc_op_data_grpc_op_send_status_from_server {
1186 pub trailing_metadata_count: usize,
1187 pub trailing_metadata: *mut grpc_metadata,
1188 pub status: grpc_status_code::Type,
1189 #[doc = " optional: set to NULL if no details need sending, non-NULL if they do"]
1190 #[doc = " pointer will not be retained past the start_batch call"]
1191 pub status_details: *mut grpc_slice,
1192}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001193#[doc = " ownership of the array is with the caller, but ownership of the elements"]
1194#[doc = "stays with the call object (ie key, value members are owned by the call"]
1195#[doc = "object, recv_initial_metadata->array is owned by the caller)."]
1196#[doc = "After the operation completes, call grpc_metadata_array_destroy on this"]
1197#[doc = "value, or reuse it in a future op."]
1198#[repr(C)]
1199#[derive(Debug, Copy, Clone)]
1200pub struct grpc_op_grpc_op_data_grpc_op_recv_initial_metadata {
1201 pub recv_initial_metadata: *mut grpc_metadata_array,
1202}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001203#[doc = " ownership of the byte buffer is moved to the caller; the caller must"]
1204#[doc = "call grpc_byte_buffer_destroy on this value, or reuse it in a future op."]
1205#[doc = "The returned byte buffer will be NULL if trailing metadata was"]
1206#[doc = "received instead of a message."]
1207#[repr(C)]
1208#[derive(Debug, Copy, Clone)]
1209pub struct grpc_op_grpc_op_data_grpc_op_recv_message {
1210 pub recv_message: *mut *mut grpc_byte_buffer,
1211}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001212#[repr(C)]
1213#[derive(Debug, Copy, Clone)]
1214pub struct grpc_op_grpc_op_data_grpc_op_recv_status_on_client {
1215 #[doc = " ownership of the array is with the caller, but ownership of the"]
1216 #[doc = "elements stays with the call object (ie key, value members are owned"]
1217 #[doc = "by the call object, trailing_metadata->array is owned by the caller)."]
1218 #[doc = "After the operation completes, call grpc_metadata_array_destroy on"]
1219 #[doc = "this value, or reuse it in a future op."]
1220 pub trailing_metadata: *mut grpc_metadata_array,
1221 pub status: *mut grpc_status_code::Type,
1222 pub status_details: *mut grpc_slice,
1223 #[doc = " If this is not nullptr, it will be populated with the full fidelity"]
1224 #[doc = " error string for debugging purposes. The application is responsible"]
1225 #[doc = " for freeing the data by using gpr_free()."]
1226 pub error_string: *mut *const ::std::os::raw::c_char,
1227}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001228#[repr(C)]
1229#[derive(Debug, Copy, Clone)]
1230pub struct grpc_op_grpc_op_data_grpc_op_recv_close_on_server {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01001231 #[doc = " out argument, set to 1 if the call failed at the server for"]
1232 #[doc = "a reason other than a non-OK status (cancel, deadline"]
1233 #[doc = "exceeded, network failure, etc.), 0 otherwise (RPC processing ran to"]
1234 #[doc = "completion and was able to provide any status from the server)"]
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001235 pub cancelled: *mut ::std::os::raw::c_int,
1236}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001237impl ::std::fmt::Debug for grpc_op_grpc_op_data {
1238 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1239 write!(f, "grpc_op_grpc_op_data {{ union }}")
1240 }
1241}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001242impl ::std::fmt::Debug for grpc_op {
1243 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1244 write!(
1245 f,
1246 "grpc_op {{ op: {:?}, flags: {:?}, reserved: {:?}, data: {:?} }}",
1247 self.op, self.flags, self.reserved, self.data
1248 )
1249 }
1250}
1251#[doc = " Information requested from the channel."]
1252#[repr(C)]
1253#[derive(Debug, Copy, Clone)]
1254pub struct grpc_channel_info {
1255 #[doc = " If non-NULL, will be set to point to a string indicating the LB"]
1256 #[doc = " policy name. Caller takes ownership."]
1257 pub lb_policy_name: *mut *mut ::std::os::raw::c_char,
1258 #[doc = " If non-NULL, will be set to point to a string containing the"]
1259 #[doc = " service config used by the channel in JSON form."]
1260 pub service_config_json: *mut *mut ::std::os::raw::c_char,
1261}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001262#[repr(C)]
1263#[derive(Debug, Copy, Clone)]
1264pub struct grpc_resource_quota {
1265 _unused: [u8; 0],
1266}
1267#[repr(u32)]
1268#[doc = " Completion queues internally MAY maintain a set of file descriptors in a"]
1269#[doc = "structure called 'pollset'. This enum specifies if a completion queue has an"]
1270#[doc = "associated pollset and any restrictions on the type of file descriptors that"]
1271#[doc = "can be present in the pollset."]
1272#[doc = ""]
1273#[doc = "I/O progress can only be made when grpc_completion_queue_next() or"]
1274#[doc = "grpc_completion_queue_pluck() are called on the completion queue (unless the"]
1275#[doc = "grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important"]
1276#[doc = "to actively call these APIs"]
1277#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1278pub enum grpc_cq_polling_type {
1279 #[doc = " The completion queue will have an associated pollset and there is no"]
1280 #[doc = "restriction on the type of file descriptors the pollset may contain"]
1281 GRPC_CQ_DEFAULT_POLLING = 0,
1282 #[doc = " Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will"]
1283 #[doc = "not contain any 'listening file descriptors' (i.e file descriptors used to"]
1284 #[doc = "listen to incoming channels)"]
1285 GRPC_CQ_NON_LISTENING = 1,
1286 #[doc = " The completion queue will not have an associated pollset. Note that"]
1287 #[doc = "grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still"]
1288 #[doc = "be called to pop events from the completion queue; it is not required to"]
1289 #[doc = "call them actively to make I/O progress"]
1290 GRPC_CQ_NON_POLLING = 2,
1291}
1292#[repr(u32)]
1293#[doc = " Specifies the type of APIs to use to pop events from the completion queue"]
1294#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1295pub enum grpc_cq_completion_type {
1296 #[doc = " Events are popped out by calling grpc_completion_queue_next() API ONLY"]
1297 GRPC_CQ_NEXT = 0,
1298 #[doc = " Events are popped out by calling grpc_completion_queue_pluck() API ONLY"]
1299 GRPC_CQ_PLUCK = 1,
1300 #[doc = " EXPERIMENTAL: Events trigger a callback specified as the tag"]
1301 GRPC_CQ_CALLBACK = 2,
1302}
1303#[doc = " EXPERIMENTAL: Specifies an interface class to be used as a tag"]
1304#[doc = "for callback-based completion queues. This can be used directly,"]
1305#[doc = "as the first element of a struct in C, or as a base class in C++."]
1306#[doc = "Its \"run\" value should be assigned to some non-member function, such as"]
1307#[doc = "a static method."]
1308#[repr(C)]
1309#[derive(Debug, Copy, Clone)]
1310pub struct grpc_experimental_completion_queue_functor {
1311 #[doc = " The run member specifies a function that will be called when this"]
1312 #[doc = "tag is extracted from the completion queue. Its arguments will be a"]
1313 #[doc = "pointer to this functor and a boolean that indicates whether the"]
1314 #[doc = "operation succeeded (non-zero) or failed (zero)"]
1315 pub functor_run: ::std::option::Option<
1316 unsafe extern "C" fn(
1317 arg1: *mut grpc_experimental_completion_queue_functor,
1318 arg2: ::std::os::raw::c_int,
1319 ),
1320 >,
1321 #[doc = " The inlineable member specifies whether this functor can be run inline."]
1322 #[doc = "This should only be used for trivial internally-defined functors."]
1323 pub inlineable: ::std::os::raw::c_int,
1324 #[doc = " The following fields are not API. They are meant for internal use."]
1325 pub internal_success: ::std::os::raw::c_int,
1326 pub internal_next: *mut grpc_experimental_completion_queue_functor,
1327}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001328#[repr(C)]
1329#[derive(Debug, Copy, Clone)]
1330pub struct grpc_completion_queue_attributes {
1331 #[doc = " The version number of this structure. More fields might be added to this"]
1332 #[doc = "structure in future."]
1333 pub version: ::std::os::raw::c_int,
1334 #[doc = " Set to GRPC_CQ_CURRENT_VERSION"]
1335 pub cq_completion_type: grpc_cq_completion_type,
1336 pub cq_polling_type: grpc_cq_polling_type,
1337 #[doc = " When creating a callbackable CQ, pass in a functor to get invoked when"]
1338 #[doc = " shutdown is complete"]
1339 pub cq_shutdown_cb: *mut grpc_experimental_completion_queue_functor,
1340}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001341#[repr(C)]
1342#[derive(Debug, Copy, Clone)]
1343pub struct grpc_completion_queue_factory {
1344 _unused: [u8; 0],
1345}
1346extern "C" {
1347 #[doc = " Returns a RAW byte buffer instance over the given slices (up to \\a nslices)."]
1348 #[doc = ""]
1349 #[doc = " Increases the reference count for all \\a slices processed. The user is"]
1350 #[doc = " responsible for invoking grpc_byte_buffer_destroy on the returned instance."]
1351 pub fn grpc_raw_byte_buffer_create(
1352 slices: *mut grpc_slice,
1353 nslices: usize,
1354 ) -> *mut grpc_byte_buffer;
1355}
1356extern "C" {
1357 #[doc = " Returns a *compressed* RAW byte buffer instance over the given slices (up to"]
1358 #[doc = " \\a nslices). The \\a compression argument defines the compression algorithm"]
1359 #[doc = " used to generate the data in \\a slices."]
1360 #[doc = ""]
1361 #[doc = " Increases the reference count for all \\a slices processed. The user is"]
1362 #[doc = " responsible for invoking grpc_byte_buffer_destroy on the returned instance."]
1363 pub fn grpc_raw_compressed_byte_buffer_create(
1364 slices: *mut grpc_slice,
1365 nslices: usize,
1366 compression: grpc_compression_algorithm,
1367 ) -> *mut grpc_byte_buffer;
1368}
1369extern "C" {
1370 #[doc = " Copies input byte buffer \\a bb."]
1371 #[doc = ""]
1372 #[doc = " Increases the reference count of all the source slices. The user is"]
1373 #[doc = " responsible for calling grpc_byte_buffer_destroy over the returned copy."]
1374 pub fn grpc_byte_buffer_copy(bb: *mut grpc_byte_buffer) -> *mut grpc_byte_buffer;
1375}
1376extern "C" {
1377 #[doc = " Returns the size of the given byte buffer, in bytes."]
1378 pub fn grpc_byte_buffer_length(bb: *mut grpc_byte_buffer) -> usize;
1379}
1380extern "C" {
1381 #[doc = " Destroys \\a byte_buffer deallocating all its memory."]
1382 pub fn grpc_byte_buffer_destroy(byte_buffer: *mut grpc_byte_buffer);
1383}
1384extern "C" {
1385 #[doc = " Initialize \\a reader to read over \\a buffer."]
1386 #[doc = " Returns 1 upon success, 0 otherwise."]
1387 pub fn grpc_byte_buffer_reader_init(
1388 reader: *mut grpc_byte_buffer_reader,
1389 buffer: *mut grpc_byte_buffer,
1390 ) -> ::std::os::raw::c_int;
1391}
1392extern "C" {
1393 #[doc = " Cleanup and destroy \\a reader"]
1394 pub fn grpc_byte_buffer_reader_destroy(reader: *mut grpc_byte_buffer_reader);
1395}
1396extern "C" {
1397 #[doc = " Updates \\a slice with the next piece of data from from \\a reader and returns"]
1398 #[doc = " 1. Returns 0 at the end of the stream. Caller is responsible for calling"]
1399 #[doc = " grpc_slice_unref on the result."]
1400 pub fn grpc_byte_buffer_reader_next(
1401 reader: *mut grpc_byte_buffer_reader,
1402 slice: *mut grpc_slice,
1403 ) -> ::std::os::raw::c_int;
1404}
1405extern "C" {
1406 #[doc = " EXPERIMENTAL API - This function may be removed and changed, in the future."]
1407 #[doc = ""]
1408 #[doc = " Updates \\a slice with the next piece of data from from \\a reader and returns"]
1409 #[doc = " 1. Returns 0 at the end of the stream. Caller is responsible for making sure"]
1410 #[doc = " the slice pointer remains valid when accessed."]
1411 #[doc = ""]
1412 #[doc = " NOTE: Do not use this function unless the caller can guarantee that the"]
1413 #[doc = " underlying grpc_byte_buffer outlasts the use of the slice. This is only"]
1414 #[doc = " safe when the underlying grpc_byte_buffer remains immutable while slice"]
1415 #[doc = " is being accessed."]
1416 pub fn grpc_byte_buffer_reader_peek(
1417 reader: *mut grpc_byte_buffer_reader,
1418 slice: *mut *mut grpc_slice,
1419 ) -> ::std::os::raw::c_int;
1420}
1421extern "C" {
1422 #[doc = " Merge all data from \\a reader into single slice"]
1423 pub fn grpc_byte_buffer_reader_readall(reader: *mut grpc_byte_buffer_reader) -> grpc_slice;
1424}
1425extern "C" {
1426 #[doc = " Returns a RAW byte buffer instance from the output of \\a reader."]
1427 pub fn grpc_raw_byte_buffer_from_reader(
1428 reader: *mut grpc_byte_buffer_reader,
1429 ) -> *mut grpc_byte_buffer;
1430}
1431extern "C" {
1432 #[doc = " initialize a slice buffer"]
1433 pub fn grpc_slice_buffer_init(sb: *mut grpc_slice_buffer);
1434}
1435extern "C" {
1436 #[doc = " destroy a slice buffer - unrefs any held elements"]
1437 pub fn grpc_slice_buffer_destroy(sb: *mut grpc_slice_buffer);
1438}
1439extern "C" {
1440 #[doc = " Add an element to a slice buffer - takes ownership of the slice."]
1441 #[doc = "This function is allowed to concatenate the passed in slice to the end of"]
1442 #[doc = "some other slice if desired by the slice buffer."]
1443 pub fn grpc_slice_buffer_add(sb: *mut grpc_slice_buffer, slice: grpc_slice);
1444}
1445extern "C" {
1446 #[doc = " add an element to a slice buffer - takes ownership of the slice and returns"]
1447 #[doc = "the index of the slice."]
1448 #[doc = "Guarantees that the slice will not be concatenated at the end of another"]
1449 #[doc = "slice (i.e. the data for this slice will begin at the first byte of the"]
1450 #[doc = "slice at the returned index in sb->slices)"]
1451 #[doc = "The implementation MAY decide to concatenate data at the end of a small"]
1452 #[doc = "slice added in this fashion."]
1453 pub fn grpc_slice_buffer_add_indexed(sb: *mut grpc_slice_buffer, slice: grpc_slice) -> usize;
1454}
1455extern "C" {
1456 pub fn grpc_slice_buffer_addn(sb: *mut grpc_slice_buffer, slices: *mut grpc_slice, n: usize);
1457}
1458extern "C" {
1459 #[doc = " add a very small (less than 8 bytes) amount of data to the end of a slice"]
1460 #[doc = "buffer: returns a pointer into which to add the data"]
1461 pub fn grpc_slice_buffer_tiny_add(sb: *mut grpc_slice_buffer, len: usize) -> *mut u8;
1462}
1463extern "C" {
1464 #[doc = " pop the last buffer, but don't unref it"]
1465 pub fn grpc_slice_buffer_pop(sb: *mut grpc_slice_buffer);
1466}
1467extern "C" {
1468 #[doc = " clear a slice buffer, unref all elements"]
1469 pub fn grpc_slice_buffer_reset_and_unref(sb: *mut grpc_slice_buffer);
1470}
1471extern "C" {
1472 #[doc = " swap the contents of two slice buffers"]
1473 pub fn grpc_slice_buffer_swap(a: *mut grpc_slice_buffer, b: *mut grpc_slice_buffer);
1474}
1475extern "C" {
1476 #[doc = " move all of the elements of src into dst"]
1477 pub fn grpc_slice_buffer_move_into(src: *mut grpc_slice_buffer, dst: *mut grpc_slice_buffer);
1478}
1479extern "C" {
1480 #[doc = " remove n bytes from the end of a slice buffer"]
1481 pub fn grpc_slice_buffer_trim_end(
1482 src: *mut grpc_slice_buffer,
1483 n: usize,
1484 garbage: *mut grpc_slice_buffer,
1485 );
1486}
1487extern "C" {
1488 #[doc = " move the first n bytes of src into dst"]
1489 pub fn grpc_slice_buffer_move_first(
1490 src: *mut grpc_slice_buffer,
1491 n: usize,
1492 dst: *mut grpc_slice_buffer,
1493 );
1494}
1495extern "C" {
1496 #[doc = " move the first n bytes of src into dst without adding references"]
1497 pub fn grpc_slice_buffer_move_first_no_ref(
1498 src: *mut grpc_slice_buffer,
1499 n: usize,
1500 dst: *mut grpc_slice_buffer,
1501 );
1502}
1503extern "C" {
1504 #[doc = " move the first n bytes of src into dst (copying them)"]
1505 pub fn grpc_slice_buffer_move_first_into_buffer(
1506 src: *mut grpc_slice_buffer,
1507 n: usize,
1508 dst: *mut ::std::os::raw::c_void,
1509 );
1510}
1511extern "C" {
1512 #[doc = " take the first slice in the slice buffer"]
1513 pub fn grpc_slice_buffer_take_first(src: *mut grpc_slice_buffer) -> grpc_slice;
1514}
1515extern "C" {
1516 #[doc = " undo the above with (a possibly different) \\a slice"]
1517 pub fn grpc_slice_buffer_undo_take_first(src: *mut grpc_slice_buffer, slice: grpc_slice);
1518}
1519#[repr(u32)]
1520#[doc = " Connectivity state of a channel."]
1521#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1522pub enum grpc_connectivity_state {
1523 #[doc = " channel is idle"]
1524 GRPC_CHANNEL_IDLE = 0,
1525 #[doc = " channel is connecting"]
1526 GRPC_CHANNEL_CONNECTING = 1,
1527 #[doc = " channel is ready for work"]
1528 GRPC_CHANNEL_READY = 2,
1529 #[doc = " channel has seen a failure but expects to recover"]
1530 GRPC_CHANNEL_TRANSIENT_FAILURE = 3,
1531 #[doc = " channel has seen a failure that it cannot recover from"]
1532 GRPC_CHANNEL_SHUTDOWN = 4,
1533}
1534extern "C" {
1535 #[doc = " Time constants."]
1536 pub fn gpr_time_0(type_: gpr_clock_type) -> gpr_timespec;
1537}
1538extern "C" {
1539 #[doc = " The zero time interval."]
1540 pub fn gpr_inf_future(type_: gpr_clock_type) -> gpr_timespec;
1541}
1542extern "C" {
1543 #[doc = " The far future"]
1544 pub fn gpr_inf_past(type_: gpr_clock_type) -> gpr_timespec;
1545}
1546extern "C" {
1547 #[doc = " initialize time subsystem"]
1548 pub fn gpr_time_init();
1549}
1550extern "C" {
1551 #[doc = " Return the current time measured from the given clocks epoch."]
1552 pub fn gpr_now(clock: gpr_clock_type) -> gpr_timespec;
1553}
1554extern "C" {
1555 #[doc = " Convert a timespec from one clock to another"]
1556 pub fn gpr_convert_clock_type(t: gpr_timespec, target_clock: gpr_clock_type) -> gpr_timespec;
1557}
1558extern "C" {
1559 #[doc = " Return -ve, 0, or +ve according to whether a < b, a == b, or a > b"]
1560 #[doc = "respectively."]
1561 pub fn gpr_time_cmp(a: gpr_timespec, b: gpr_timespec) -> ::std::os::raw::c_int;
1562}
1563extern "C" {
1564 pub fn gpr_time_max(a: gpr_timespec, b: gpr_timespec) -> gpr_timespec;
1565}
1566extern "C" {
1567 pub fn gpr_time_min(a: gpr_timespec, b: gpr_timespec) -> gpr_timespec;
1568}
1569extern "C" {
1570 #[doc = " Add and subtract times. Calculations saturate at infinities."]
1571 pub fn gpr_time_add(a: gpr_timespec, b: gpr_timespec) -> gpr_timespec;
1572}
1573extern "C" {
1574 pub fn gpr_time_sub(a: gpr_timespec, b: gpr_timespec) -> gpr_timespec;
1575}
1576extern "C" {
1577 #[doc = " Return a timespec representing a given number of time units. INT64_MIN is"]
1578 #[doc = "interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future."]
1579 pub fn gpr_time_from_micros(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1580}
1581extern "C" {
1582 pub fn gpr_time_from_nanos(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1583}
1584extern "C" {
1585 pub fn gpr_time_from_millis(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1586}
1587extern "C" {
1588 pub fn gpr_time_from_seconds(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1589}
1590extern "C" {
1591 pub fn gpr_time_from_minutes(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1592}
1593extern "C" {
1594 pub fn gpr_time_from_hours(x: i64, clock_type: gpr_clock_type) -> gpr_timespec;
1595}
1596extern "C" {
1597 pub fn gpr_time_to_millis(timespec: gpr_timespec) -> i32;
1598}
1599extern "C" {
1600 #[doc = " Return 1 if two times are equal or within threshold of each other,"]
1601 #[doc = "0 otherwise"]
1602 pub fn gpr_time_similar(
1603 a: gpr_timespec,
1604 b: gpr_timespec,
1605 threshold: gpr_timespec,
1606 ) -> ::std::os::raw::c_int;
1607}
1608extern "C" {
1609 #[doc = " Sleep until at least 'until' - an absolute timeout"]
1610 pub fn gpr_sleep_until(until: gpr_timespec);
1611}
1612extern "C" {
1613 pub fn gpr_timespec_to_micros(t: gpr_timespec) -> f64;
1614}
1615extern "C" {
1616 #[doc = " \\mainpage GRPC Core"]
1617 #[doc = ""]
1618 #[doc = " The GRPC Core library is a low-level library designed to be wrapped by higher"]
1619 #[doc = " level libraries. The top-level API is provided in grpc.h. Security related"]
1620 #[doc = " functionality lives in grpc_security.h."]
1621 pub fn grpc_metadata_array_init(array: *mut grpc_metadata_array);
1622}
1623extern "C" {
1624 pub fn grpc_metadata_array_destroy(array: *mut grpc_metadata_array);
1625}
1626extern "C" {
1627 pub fn grpc_call_details_init(details: *mut grpc_call_details);
1628}
1629extern "C" {
1630 pub fn grpc_call_details_destroy(details: *mut grpc_call_details);
1631}
1632extern "C" {
1633 #[doc = " Registers a plugin to be initialized and destroyed with the library."]
1634 #[doc = ""]
1635 #[doc = "The \\a init and \\a destroy functions will be invoked as part of"]
1636 #[doc = "\\a grpc_init() and \\a grpc_shutdown(), respectively."]
1637 #[doc = "Note that these functions can be invoked an arbitrary number of times"]
1638 #[doc = "(and hence so will \\a init and \\a destroy)."]
1639 #[doc = "It is safe to pass NULL to either argument. Plugins are destroyed in"]
1640 #[doc = "the reverse order they were initialized."]
1641 pub fn grpc_register_plugin(
1642 init: ::std::option::Option<unsafe extern "C" fn()>,
1643 destroy: ::std::option::Option<unsafe extern "C" fn()>,
1644 );
1645}
1646extern "C" {
1647 #[doc = " Initialize the grpc library."]
1648 #[doc = ""]
1649 #[doc = "After it's called, a matching invocation to grpc_shutdown() is expected."]
1650 #[doc = ""]
1651 #[doc = "It is not safe to call any other grpc functions before calling this."]
1652 #[doc = "(To avoid overhead, little checking is done, and some things may work. We"]
1653 #[doc = "do not warrant that they will continue to do so in future revisions of this"]
1654 #[doc = "library)."]
1655 pub fn grpc_init();
1656}
1657extern "C" {
1658 #[doc = " Shut down the grpc library."]
1659 #[doc = ""]
1660 #[doc = "Before it's called, there should haven been a matching invocation to"]
1661 #[doc = "grpc_init()."]
1662 #[doc = ""]
1663 #[doc = "The last call to grpc_shutdown will initiate cleaning up of grpc library"]
1664 #[doc = "internals, which can happen in another thread. Once the clean-up is done,"]
1665 #[doc = "no memory is used by grpc, nor are any instructions executing within the"]
1666 #[doc = "grpc library. Prior to calling, all application owned grpc objects must"]
1667 #[doc = "have been destroyed."]
1668 pub fn grpc_shutdown();
1669}
1670extern "C" {
1671 #[doc = " EXPERIMENTAL. Returns 1 if the grpc library has been initialized."]
1672 #[doc = "TODO(ericgribkoff) Decide if this should be promoted to non-experimental as"]
1673 #[doc = "part of stabilizing the fork support API, as tracked in"]
1674 #[doc = "https://github.com/grpc/grpc/issues/15334"]
1675 pub fn grpc_is_initialized() -> ::std::os::raw::c_int;
1676}
1677extern "C" {
1678 #[doc = " EXPERIMENTAL. Blocking shut down grpc library."]
1679 #[doc = "This is only for wrapped language to use now."]
1680 pub fn grpc_shutdown_blocking();
1681}
1682extern "C" {
1683 #[doc = " Return a string representing the current version of grpc"]
1684 pub fn grpc_version_string() -> *const ::std::os::raw::c_char;
1685}
1686extern "C" {
1687 #[doc = " Return a string specifying what the 'g' in gRPC stands for"]
1688 pub fn grpc_g_stands_for() -> *const ::std::os::raw::c_char;
1689}
1690extern "C" {
1691 #[doc = " Returns the completion queue factory based on the attributes. MAY return a"]
1692 #[doc = "NULL if no factory can be found"]
1693 pub fn grpc_completion_queue_factory_lookup(
1694 attributes: *const grpc_completion_queue_attributes,
1695 ) -> *const grpc_completion_queue_factory;
1696}
1697extern "C" {
1698 #[doc = " Helper function to create a completion queue with grpc_cq_completion_type"]
1699 #[doc = "of GRPC_CQ_NEXT and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING"]
1700 pub fn grpc_completion_queue_create_for_next(
1701 reserved: *mut ::std::os::raw::c_void,
1702 ) -> *mut grpc_completion_queue;
1703}
1704extern "C" {
1705 #[doc = " Helper function to create a completion queue with grpc_cq_completion_type"]
1706 #[doc = "of GRPC_CQ_PLUCK and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING"]
1707 pub fn grpc_completion_queue_create_for_pluck(
1708 reserved: *mut ::std::os::raw::c_void,
1709 ) -> *mut grpc_completion_queue;
1710}
1711extern "C" {
1712 #[doc = " Helper function to create a completion queue with grpc_cq_completion_type"]
1713 #[doc = "of GRPC_CQ_CALLBACK and grpc_cq_polling_type of GRPC_CQ_DEFAULT_POLLING."]
1714 #[doc = "This function is experimental."]
1715 pub fn grpc_completion_queue_create_for_callback(
1716 shutdown_callback: *mut grpc_experimental_completion_queue_functor,
1717 reserved: *mut ::std::os::raw::c_void,
1718 ) -> *mut grpc_completion_queue;
1719}
1720extern "C" {
1721 #[doc = " Create a completion queue"]
1722 pub fn grpc_completion_queue_create(
1723 factory: *const grpc_completion_queue_factory,
1724 attributes: *const grpc_completion_queue_attributes,
1725 reserved: *mut ::std::os::raw::c_void,
1726 ) -> *mut grpc_completion_queue;
1727}
1728extern "C" {
1729 #[doc = " Blocks until an event is available, the completion queue is being shut down,"]
1730 #[doc = "or deadline is reached."]
1731 #[doc = ""]
1732 #[doc = "Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,"]
1733 #[doc = "otherwise a grpc_event describing the event that occurred."]
1734 #[doc = ""]
1735 #[doc = "Callers must not call grpc_completion_queue_next and"]
1736 #[doc = "grpc_completion_queue_pluck simultaneously on the same completion queue."]
1737 pub fn grpc_completion_queue_next(
1738 cq: *mut grpc_completion_queue,
1739 deadline: gpr_timespec,
1740 reserved: *mut ::std::os::raw::c_void,
1741 ) -> grpc_event;
1742}
1743extern "C" {
1744 #[doc = " Blocks until an event with tag 'tag' is available, the completion queue is"]
1745 #[doc = "being shutdown or deadline is reached."]
1746 #[doc = ""]
1747 #[doc = "Returns a grpc_event with type GRPC_QUEUE_TIMEOUT on timeout,"]
1748 #[doc = "otherwise a grpc_event describing the event that occurred."]
1749 #[doc = ""]
1750 #[doc = "Callers must not call grpc_completion_queue_next and"]
1751 #[doc = "grpc_completion_queue_pluck simultaneously on the same completion queue."]
1752 #[doc = ""]
1753 #[doc = "Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS"]
1754 #[doc = "concurrently executing plucks at any time."]
1755 pub fn grpc_completion_queue_pluck(
1756 cq: *mut grpc_completion_queue,
1757 tag: *mut ::std::os::raw::c_void,
1758 deadline: gpr_timespec,
1759 reserved: *mut ::std::os::raw::c_void,
1760 ) -> grpc_event;
1761}
1762extern "C" {
1763 #[doc = " Begin destruction of a completion queue. Once all possible events are"]
1764 #[doc = "drained then grpc_completion_queue_next will start to produce"]
1765 #[doc = "GRPC_QUEUE_SHUTDOWN events only. At that point it's safe to call"]
1766 #[doc = "grpc_completion_queue_destroy."]
1767 #[doc = ""]
1768 #[doc = "After calling this function applications should ensure that no"]
1769 #[doc = "NEW work is added to be published on this completion queue."]
1770 pub fn grpc_completion_queue_shutdown(cq: *mut grpc_completion_queue);
1771}
1772extern "C" {
1773 #[doc = " Destroy a completion queue. The caller must ensure that the queue is"]
1774 #[doc = "drained and no threads are executing grpc_completion_queue_next"]
1775 pub fn grpc_completion_queue_destroy(cq: *mut grpc_completion_queue);
1776}
1777extern "C" {
1778 #[doc = " EXPERIMENTAL API ************/"]
1779 #[doc = " grpc_flush_cq_tls_cache() MUST be called on the same thread,"]
1780 #[doc = " with the same cq."]
1781 pub fn grpc_completion_queue_thread_local_cache_init(cq: *mut grpc_completion_queue);
1782}
1783extern "C" {
1784 #[doc = " EXPERIMENTAL API ************/"]
1785 #[doc = " Returns 1 if there was contents in the cache. If there was an event"]
1786 #[doc = " in \\a cq tls cache, its tag is placed in tag, and ok is set to the"]
1787 #[doc = " event success."]
1788 pub fn grpc_completion_queue_thread_local_cache_flush(
1789 cq: *mut grpc_completion_queue,
1790 tag: *mut *mut ::std::os::raw::c_void,
1791 ok: *mut ::std::os::raw::c_int,
1792 ) -> ::std::os::raw::c_int;
1793}
1794extern "C" {
1795 #[doc = " Check the connectivity state of a channel."]
1796 pub fn grpc_channel_check_connectivity_state(
1797 channel: *mut grpc_channel,
1798 try_to_connect: ::std::os::raw::c_int,
1799 ) -> grpc_connectivity_state;
1800}
1801extern "C" {
1802 #[doc = " Number of active \"external connectivity state watchers\" attached to a"]
1803 #[doc = " channel."]
1804 #[doc = " Useful for testing."]
1805 pub fn grpc_channel_num_external_connectivity_watchers(
1806 channel: *mut grpc_channel,
1807 ) -> ::std::os::raw::c_int;
1808}
1809extern "C" {
1810 #[doc = " Watch for a change in connectivity state."]
1811 #[doc = "Once the channel connectivity state is different from last_observed_state,"]
1812 #[doc = "tag will be enqueued on cq with success=1."]
1813 #[doc = "If deadline expires BEFORE the state is changed, tag will be enqueued on cq"]
1814 #[doc = "with success=0."]
1815 pub fn grpc_channel_watch_connectivity_state(
1816 channel: *mut grpc_channel,
1817 last_observed_state: grpc_connectivity_state,
1818 deadline: gpr_timespec,
1819 cq: *mut grpc_completion_queue,
1820 tag: *mut ::std::os::raw::c_void,
1821 );
1822}
1823extern "C" {
1824 #[doc = " Check whether a grpc channel supports connectivity watcher"]
1825 pub fn grpc_channel_support_connectivity_watcher(
1826 channel: *mut grpc_channel,
1827 ) -> ::std::os::raw::c_int;
1828}
1829extern "C" {
1830 #[doc = " Create a call given a grpc_channel, in order to call 'method'. All"]
1831 #[doc = "completions are sent to 'completion_queue'. 'method' and 'host' need only"]
1832 #[doc = "live through the invocation of this function."]
1833 #[doc = "If parent_call is non-NULL, it must be a server-side call. It will be used"]
1834 #[doc = "to propagate properties from the server call to this new client call,"]
1835 #[doc = "depending on the value of \\a propagation_mask (see propagation_bits.h for"]
1836 #[doc = "possible values)."]
1837 pub fn grpc_channel_create_call(
1838 channel: *mut grpc_channel,
1839 parent_call: *mut grpc_call,
1840 propagation_mask: u32,
1841 completion_queue: *mut grpc_completion_queue,
1842 method: grpc_slice,
1843 host: *const grpc_slice,
1844 deadline: gpr_timespec,
1845 reserved: *mut ::std::os::raw::c_void,
1846 ) -> *mut grpc_call;
1847}
1848extern "C" {
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02001849 #[doc = " Pre-register a method/host pair on a channel."]
1850 #[doc = "method and host are not owned and must remain alive while the channel is"]
1851 #[doc = "alive."]
1852 pub fn grpc_channel_register_call(
1853 channel: *mut grpc_channel,
1854 method: *const ::std::os::raw::c_char,
1855 host: *const ::std::os::raw::c_char,
1856 reserved: *mut ::std::os::raw::c_void,
1857 ) -> *mut ::std::os::raw::c_void;
1858}
1859extern "C" {
1860 #[doc = " Create a call given a handle returned from grpc_channel_register_call."]
1861 #[doc = "\\sa grpc_channel_create_call."]
1862 pub fn grpc_channel_create_registered_call(
1863 channel: *mut grpc_channel,
1864 parent_call: *mut grpc_call,
1865 propagation_mask: u32,
1866 completion_queue: *mut grpc_completion_queue,
1867 registered_call_handle: *mut ::std::os::raw::c_void,
1868 deadline: gpr_timespec,
1869 reserved: *mut ::std::os::raw::c_void,
1870 ) -> *mut grpc_call;
1871}
1872extern "C" {
1873 #[doc = " Allocate memory in the grpc_call arena: this memory is automatically"]
1874 #[doc = "discarded at call completion"]
1875 pub fn grpc_call_arena_alloc(call: *mut grpc_call, size: usize) -> *mut ::std::os::raw::c_void;
1876}
1877extern "C" {
1878 #[doc = " Start a batch of operations defined in the array ops; when complete, post a"]
1879 #[doc = "completion of type 'tag' to the completion queue bound to the call."]
1880 #[doc = "The order of ops specified in the batch has no significance."]
1881 #[doc = "Only one operation of each type can be active at once in any given"]
1882 #[doc = "batch."]
1883 #[doc = "If a call to grpc_call_start_batch returns GRPC_CALL_OK you must call"]
1884 #[doc = "grpc_completion_queue_next or grpc_completion_queue_pluck on the completion"]
1885 #[doc = "queue associated with 'call' for work to be performed. If a call to"]
1886 #[doc = "grpc_call_start_batch returns any value other than GRPC_CALL_OK it is"]
1887 #[doc = "guaranteed that no state associated with 'call' is changed and it is not"]
1888 #[doc = "appropriate to call grpc_completion_queue_next or"]
1889 #[doc = "grpc_completion_queue_pluck consequent to the failed grpc_call_start_batch"]
1890 #[doc = "call."]
1891 #[doc = "If a call to grpc_call_start_batch with an empty batch returns"]
1892 #[doc = "GRPC_CALL_OK, the tag is put in the completion queue immediately."]
1893 #[doc = "THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment"]
1894 #[doc = "needs to be synchronized. As an optimization, you may synchronize batches"]
1895 #[doc = "containing just send operations independently from batches containing just"]
1896 #[doc = "receive operations. Access to grpc_call_start_batch with an empty batch is"]
1897 #[doc = "thread-compatible."]
1898 pub fn grpc_call_start_batch(
1899 call: *mut grpc_call,
1900 ops: *const grpc_op,
1901 nops: usize,
1902 tag: *mut ::std::os::raw::c_void,
1903 reserved: *mut ::std::os::raw::c_void,
1904 ) -> grpc_call_error;
1905}
1906extern "C" {
1907 #[doc = " Returns a newly allocated string representing the endpoint to which this"]
1908 #[doc = "call is communicating with. The string is in the uri format accepted by"]
1909 #[doc = "grpc_channel_create."]
1910 #[doc = "The returned string should be disposed of with gpr_free()."]
1911 #[doc = ""]
1912 #[doc = "WARNING: this value is never authenticated or subject to any security"]
1913 #[doc = "related code. It must not be used for any authentication related"]
1914 #[doc = "functionality. Instead, use grpc_auth_context."]
1915 pub fn grpc_call_get_peer(call: *mut grpc_call) -> *mut ::std::os::raw::c_char;
1916}
1917#[repr(C)]
1918#[derive(Debug, Copy, Clone)]
1919pub struct census_context {
1920 _unused: [u8; 0],
1921}
1922extern "C" {
1923 #[doc = " Set census context for a call; Must be called before first call to"]
1924 #[doc = "grpc_call_start_batch()."]
1925 pub fn grpc_census_call_set_context(call: *mut grpc_call, context: *mut census_context);
1926}
1927extern "C" {
1928 #[doc = " Retrieve the calls current census context."]
1929 pub fn grpc_census_call_get_context(call: *mut grpc_call) -> *mut census_context;
1930}
1931extern "C" {
1932 #[doc = " Return a newly allocated string representing the target a channel was"]
1933 #[doc = "created for."]
1934 pub fn grpc_channel_get_target(channel: *mut grpc_channel) -> *mut ::std::os::raw::c_char;
1935}
1936extern "C" {
1937 #[doc = " Request info about the channel."]
1938 #[doc = "\\a channel_info indicates what information is being requested and"]
1939 #[doc = "how that information will be returned."]
1940 #[doc = "\\a channel_info is owned by the caller."]
1941 pub fn grpc_channel_get_info(
1942 channel: *mut grpc_channel,
1943 channel_info: *const grpc_channel_info,
1944 );
1945}
1946extern "C" {
1947 #[doc = " EXPERIMENTAL. Resets the channel's connect backoff."]
1948 #[doc = "TODO(roth): When we see whether this proves useful, either promote"]
1949 #[doc = "to non-experimental or remove it."]
1950 pub fn grpc_channel_reset_connect_backoff(channel: *mut grpc_channel);
1951}
1952extern "C" {
1953 #[doc = " Create a client channel to 'target'. Additional channel level configuration"]
1954 #[doc = "MAY be provided by grpc_channel_args, though the expectation is that most"]
1955 #[doc = "clients will want to simply pass NULL. The user data in 'args' need only"]
1956 #[doc = "live through the invocation of this function. However, if any args of the"]
1957 #[doc = "'pointer' type are passed, then the referenced vtable must be maintained"]
1958 #[doc = "by the caller until grpc_channel_destroy terminates. See grpc_channel_args"]
1959 #[doc = "definition for more on this."]
1960 pub fn grpc_insecure_channel_create(
1961 target: *const ::std::os::raw::c_char,
1962 args: *const grpc_channel_args,
1963 reserved: *mut ::std::os::raw::c_void,
1964 ) -> *mut grpc_channel;
1965}
1966extern "C" {
1967 #[doc = " Create a lame client: this client fails every operation attempted on it."]
1968 pub fn grpc_lame_client_channel_create(
1969 target: *const ::std::os::raw::c_char,
1970 error_code: grpc_status_code::Type,
1971 error_message: *const ::std::os::raw::c_char,
1972 ) -> *mut grpc_channel;
1973}
1974extern "C" {
1975 #[doc = " Close and destroy a grpc channel"]
1976 pub fn grpc_channel_destroy(channel: *mut grpc_channel);
1977}
1978extern "C" {
1979 #[doc = " Cancel an RPC."]
1980 #[doc = "Can be called multiple times, from any thread."]
1981 #[doc = "THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status"]
1982 #[doc = "are thread-safe, and can be called at any point before grpc_call_unref"]
1983 #[doc = "is called."]
1984 pub fn grpc_call_cancel(
1985 call: *mut grpc_call,
1986 reserved: *mut ::std::os::raw::c_void,
1987 ) -> grpc_call_error;
1988}
1989extern "C" {
1990 #[doc = " Cancel an RPC."]
1991 #[doc = "Can be called multiple times, from any thread."]
1992 #[doc = "If a status has not been received for the call, set it to the status code"]
1993 #[doc = "and description passed in."]
1994 #[doc = "Importantly, this function does not send status nor description to the"]
1995 #[doc = "remote endpoint."]
1996 #[doc = "Note that \\a description doesn't need be a static string."]
1997 #[doc = "It doesn't need to be alive after the call to"]
1998 #[doc = "grpc_call_cancel_with_status completes."]
1999 pub fn grpc_call_cancel_with_status(
2000 call: *mut grpc_call,
2001 status: grpc_status_code::Type,
2002 description: *const ::std::os::raw::c_char,
2003 reserved: *mut ::std::os::raw::c_void,
2004 ) -> grpc_call_error;
2005}
2006extern "C" {
2007 #[doc = " Ref a call."]
2008 #[doc = "THREAD SAFETY: grpc_call_ref is thread-compatible"]
2009 pub fn grpc_call_ref(call: *mut grpc_call);
2010}
2011extern "C" {
2012 #[doc = " Unref a call."]
2013 #[doc = "THREAD SAFETY: grpc_call_unref is thread-compatible"]
2014 pub fn grpc_call_unref(call: *mut grpc_call);
2015}
2016extern "C" {
2017 #[doc = " Request notification of a new call."]
2018 #[doc = "Once a call is received, a notification tagged with \\a tag_new is added to"]
2019 #[doc = "\\a cq_for_notification. \\a call, \\a details and \\a request_metadata are"]
2020 #[doc = "updated with the appropriate call information. \\a cq_bound_to_call is bound"]
2021 #[doc = "to \\a call, and batch operation notifications for that call will be posted"]
2022 #[doc = "to \\a cq_bound_to_call."]
2023 #[doc = "Note that \\a cq_for_notification must have been registered to the server via"]
2024 #[doc = "\\a grpc_server_register_completion_queue."]
2025 pub fn grpc_server_request_call(
2026 server: *mut grpc_server,
2027 call: *mut *mut grpc_call,
2028 details: *mut grpc_call_details,
2029 request_metadata: *mut grpc_metadata_array,
2030 cq_bound_to_call: *mut grpc_completion_queue,
2031 cq_for_notification: *mut grpc_completion_queue,
2032 tag_new: *mut ::std::os::raw::c_void,
2033 ) -> grpc_call_error;
2034}
2035#[repr(u32)]
2036#[doc = " How to handle payloads for a registered method"]
2037#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2038pub enum grpc_server_register_method_payload_handling {
2039 #[doc = " Don't try to read the payload"]
2040 GRPC_SRM_PAYLOAD_NONE = 0,
2041 #[doc = " Read the initial payload as a byte buffer"]
2042 GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER = 1,
2043}
2044extern "C" {
2045 #[doc = " Registers a method in the server."]
2046 #[doc = "Methods to this (host, method) pair will not be reported by"]
2047 #[doc = "grpc_server_request_call, but instead be reported by"]
2048 #[doc = "grpc_server_request_registered_call when passed the appropriate"]
2049 #[doc = "registered_method (as returned by this function)."]
2050 #[doc = "Must be called before grpc_server_start."]
2051 #[doc = "Returns NULL on failure."]
2052 pub fn grpc_server_register_method(
2053 server: *mut grpc_server,
2054 method: *const ::std::os::raw::c_char,
2055 host: *const ::std::os::raw::c_char,
2056 payload_handling: grpc_server_register_method_payload_handling,
2057 flags: u32,
2058 ) -> *mut ::std::os::raw::c_void;
2059}
2060extern "C" {
2061 #[doc = " Request notification of a new pre-registered call. 'cq_for_notification'"]
2062 #[doc = "must have been registered to the server via"]
2063 #[doc = "grpc_server_register_completion_queue."]
2064 pub fn grpc_server_request_registered_call(
2065 server: *mut grpc_server,
2066 registered_method: *mut ::std::os::raw::c_void,
2067 call: *mut *mut grpc_call,
2068 deadline: *mut gpr_timespec,
2069 request_metadata: *mut grpc_metadata_array,
2070 optional_payload: *mut *mut grpc_byte_buffer,
2071 cq_bound_to_call: *mut grpc_completion_queue,
2072 cq_for_notification: *mut grpc_completion_queue,
2073 tag_new: *mut ::std::os::raw::c_void,
2074 ) -> grpc_call_error;
2075}
2076extern "C" {
2077 #[doc = " Create a server. Additional configuration for each incoming channel can"]
2078 #[doc = "be specified with args. If no additional configuration is needed, args can"]
2079 #[doc = "be NULL. The user data in 'args' need only live through the invocation of"]
2080 #[doc = "this function. However, if any args of the 'pointer' type are passed, then"]
2081 #[doc = "the referenced vtable must be maintained by the caller until"]
2082 #[doc = "grpc_server_destroy terminates. See grpc_channel_args definition for more"]
2083 #[doc = "on this."]
2084 pub fn grpc_server_create(
2085 args: *const grpc_channel_args,
2086 reserved: *mut ::std::os::raw::c_void,
2087 ) -> *mut grpc_server;
2088}
2089extern "C" {
2090 #[doc = " Register a completion queue with the server. Must be done for any"]
2091 #[doc = "notification completion queue that is passed to grpc_server_request_*_call"]
2092 #[doc = "and to grpc_server_shutdown_and_notify. Must be performed prior to"]
2093 #[doc = "grpc_server_start."]
2094 pub fn grpc_server_register_completion_queue(
2095 server: *mut grpc_server,
2096 cq: *mut grpc_completion_queue,
2097 reserved: *mut ::std::os::raw::c_void,
2098 );
2099}
2100extern "C" {
2101 #[doc = " Add a HTTP2 over plaintext over tcp listener."]
2102 #[doc = "Returns bound port number on success, 0 on failure."]
2103 #[doc = "REQUIRES: server not started"]
2104 pub fn grpc_server_add_insecure_http2_port(
2105 server: *mut grpc_server,
2106 addr: *const ::std::os::raw::c_char,
2107 ) -> ::std::os::raw::c_int;
2108}
2109extern "C" {
2110 #[doc = " Start a server - tells all listeners to start listening"]
2111 pub fn grpc_server_start(server: *mut grpc_server);
2112}
2113extern "C" {
2114 #[doc = " Begin shutting down a server."]
2115 #[doc = "After completion, no new calls or connections will be admitted."]
2116 #[doc = "Existing calls will be allowed to complete."]
2117 #[doc = "Send a GRPC_OP_COMPLETE event when there are no more calls being serviced."]
2118 #[doc = "Shutdown is idempotent, and all tags will be notified at once if multiple"]
2119 #[doc = "grpc_server_shutdown_and_notify calls are made. 'cq' must have been"]
2120 #[doc = "registered to this server via grpc_server_register_completion_queue."]
2121 pub fn grpc_server_shutdown_and_notify(
2122 server: *mut grpc_server,
2123 cq: *mut grpc_completion_queue,
2124 tag: *mut ::std::os::raw::c_void,
2125 );
2126}
2127extern "C" {
2128 #[doc = " Cancel all in-progress calls."]
2129 #[doc = "Only usable after shutdown."]
2130 pub fn grpc_server_cancel_all_calls(server: *mut grpc_server);
2131}
2132extern "C" {
2133 #[doc = " Destroy a server."]
2134 #[doc = "Shutdown must have completed beforehand (i.e. all tags generated by"]
2135 #[doc = "grpc_server_shutdown_and_notify must have been received, and at least"]
2136 #[doc = "one call to grpc_server_shutdown_and_notify must have been made)."]
2137 pub fn grpc_server_destroy(server: *mut grpc_server);
2138}
2139extern "C" {
2140 #[doc = " Enable or disable a tracer."]
2141 #[doc = ""]
2142 #[doc = "Tracers (usually controlled by the environment variable GRPC_TRACE)"]
2143 #[doc = "allow printf-style debugging on GRPC internals, and are useful for"]
2144 #[doc = "tracking down problems in the field."]
2145 #[doc = ""]
2146 #[doc = "Use of this function is not strictly thread-safe, but the"]
2147 #[doc = "thread-safety issues raised by it should not be of concern."]
2148 pub fn grpc_tracer_set_enabled(
2149 name: *const ::std::os::raw::c_char,
2150 enabled: ::std::os::raw::c_int,
2151 ) -> ::std::os::raw::c_int;
2152}
2153extern "C" {
2154 #[doc = " Check whether a metadata key is legal (will be accepted by core)"]
2155 pub fn grpc_header_key_is_legal(slice: grpc_slice) -> ::std::os::raw::c_int;
2156}
2157extern "C" {
2158 #[doc = " Check whether a non-binary metadata value is legal (will be accepted by"]
2159 #[doc = "core)"]
2160 pub fn grpc_header_nonbin_value_is_legal(slice: grpc_slice) -> ::std::os::raw::c_int;
2161}
2162extern "C" {
2163 #[doc = " Check whether a metadata key corresponds to a binary value"]
2164 pub fn grpc_is_binary_header(slice: grpc_slice) -> ::std::os::raw::c_int;
2165}
2166extern "C" {
2167 #[doc = " Convert grpc_call_error values to a string"]
2168 pub fn grpc_call_error_to_string(error: grpc_call_error) -> *const ::std::os::raw::c_char;
2169}
2170extern "C" {
2171 #[doc = " Create a buffer pool"]
2172 pub fn grpc_resource_quota_create(
2173 trace_name: *const ::std::os::raw::c_char,
2174 ) -> *mut grpc_resource_quota;
2175}
2176extern "C" {
2177 #[doc = " Add a reference to a buffer pool"]
2178 pub fn grpc_resource_quota_ref(resource_quota: *mut grpc_resource_quota);
2179}
2180extern "C" {
2181 #[doc = " Drop a reference to a buffer pool"]
2182 pub fn grpc_resource_quota_unref(resource_quota: *mut grpc_resource_quota);
2183}
2184extern "C" {
2185 #[doc = " Update the size of a buffer pool"]
2186 pub fn grpc_resource_quota_resize(resource_quota: *mut grpc_resource_quota, new_size: usize);
2187}
2188extern "C" {
2189 #[doc = " Update the size of the maximum number of threads allowed"]
2190 pub fn grpc_resource_quota_set_max_threads(
2191 resource_quota: *mut grpc_resource_quota,
2192 new_max_threads: ::std::os::raw::c_int,
2193 );
2194}
2195extern "C" {
2196 #[doc = " Fetch a vtable for a grpc_channel_arg that points to a grpc_resource_quota"]
2197 pub fn grpc_resource_quota_arg_vtable() -> *const grpc_arg_pointer_vtable;
2198}
2199extern "C" {
2200 #[doc = " CHANNELZ API *************/"]
2201 #[doc = "churn as the feature is implemented. This comment will be removed once"]
2202 #[doc = "channelz is officially supported, and these APIs become stable. For now"]
2203 #[doc = "you may track the progress by following this github issue:"]
2204 #[doc = "https://github.com/grpc/grpc/issues/15340"]
2205 #[doc = ""]
2206 #[doc = "the following APIs return allocated JSON strings that match the response"]
2207 #[doc = "objects from the channelz proto, found here:"]
2208 #[doc = "https://github.com/grpc/grpc/blob/master/src/proto/grpc/channelz/channelz.proto."]
2209 #[doc = ""]
2210 #[doc = "For easy conversion to protobuf, The JSON is formatted according to:"]
2211 #[doc = "https://developers.google.com/protocol-buffers/docs/proto3#json."]
2212 pub fn grpc_channelz_get_top_channels(start_channel_id: isize) -> *mut ::std::os::raw::c_char;
2213}
2214extern "C" {
2215 pub fn grpc_channelz_get_servers(start_server_id: isize) -> *mut ::std::os::raw::c_char;
2216}
2217extern "C" {
2218 pub fn grpc_channelz_get_server(server_id: isize) -> *mut ::std::os::raw::c_char;
2219}
2220extern "C" {
2221 pub fn grpc_channelz_get_server_sockets(
2222 server_id: isize,
2223 start_socket_id: isize,
2224 max_results: isize,
2225 ) -> *mut ::std::os::raw::c_char;
2226}
2227extern "C" {
2228 pub fn grpc_channelz_get_channel(channel_id: isize) -> *mut ::std::os::raw::c_char;
2229}
2230extern "C" {
2231 pub fn grpc_channelz_get_subchannel(subchannel_id: isize) -> *mut ::std::os::raw::c_char;
2232}
2233extern "C" {
2234 pub fn grpc_channelz_get_socket(socket_id: isize) -> *mut ::std::os::raw::c_char;
2235}
2236extern "C" {
2237 pub fn grpc_cronet_secure_channel_create(
2238 engine: *mut ::std::os::raw::c_void,
2239 target: *const ::std::os::raw::c_char,
2240 args: *const grpc_channel_args,
2241 reserved: *mut ::std::os::raw::c_void,
2242 ) -> *mut grpc_channel;
2243}
2244extern "C" {
2245 #[doc = " Create a client channel to 'target' using file descriptor 'fd'. The 'target'"]
2246 #[doc = "argument will be used to indicate the name for this channel. See the comment"]
2247 #[doc = "for grpc_insecure_channel_create for description of 'args' argument."]
2248 pub fn grpc_insecure_channel_create_from_fd(
2249 target: *const ::std::os::raw::c_char,
2250 fd: ::std::os::raw::c_int,
2251 args: *const grpc_channel_args,
2252 ) -> *mut grpc_channel;
2253}
2254extern "C" {
2255 #[doc = " Add the connected communication channel based on file descriptor 'fd' to the"]
2256 #[doc = "'server'. The 'fd' must be an open file descriptor corresponding to a"]
2257 #[doc = "connected socket. Events from the file descriptor may come on any of the"]
2258 #[doc = "server completion queues (i.e completion queues registered via the"]
2259 #[doc = "grpc_server_register_completion_queue API)."]
2260 #[doc = ""]
2261 #[doc = "The 'reserved' pointer MUST be NULL."]
2262 pub fn grpc_server_add_insecure_channel_from_fd(
2263 server: *mut grpc_server,
2264 reserved: *mut ::std::os::raw::c_void,
2265 fd: ::std::os::raw::c_int,
2266 );
2267}
2268#[repr(u32)]
2269#[doc = " Results for the SSL roots override callback."]
2270#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2271pub enum grpc_ssl_roots_override_result {
2272 GRPC_SSL_ROOTS_OVERRIDE_OK = 0,
2273 GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY = 1,
2274 #[doc = " Do not try fallback options."]
2275 GRPC_SSL_ROOTS_OVERRIDE_FAIL = 2,
2276}
2277#[repr(u32)]
2278#[doc = " Callback results for dynamically loading a SSL certificate config."]
2279#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2280pub enum grpc_ssl_certificate_config_reload_status {
2281 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_UNCHANGED = 0,
2282 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW = 1,
2283 GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_FAIL = 2,
2284}
2285#[repr(u32)]
2286#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2287pub enum grpc_ssl_client_certificate_request_type {
2288 #[doc = " Server does not request client certificate."]
2289 #[doc = "The certificate presented by the client is not checked by the server at"]
2290 #[doc = "all. (A client may present a self signed or signed certificate or not"]
2291 #[doc = "present a certificate at all and any of those option would be accepted)"]
2292 GRPC_SSL_DONT_REQUEST_CLIENT_CERTIFICATE = 0,
2293 #[doc = " Server requests client certificate but does not enforce that the client"]
2294 #[doc = "presents a certificate."]
2295 #[doc = ""]
2296 #[doc = "If the client presents a certificate, the client authentication is left to"]
2297 #[doc = "the application (the necessary metadata will be available to the"]
2298 #[doc = "application via authentication context properties, see grpc_auth_context)."]
2299 #[doc = ""]
2300 #[doc = "The client's key certificate pair must be valid for the SSL connection to"]
2301 #[doc = "be established."]
2302 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_BUT_DONT_VERIFY = 1,
2303 #[doc = " Server requests client certificate but does not enforce that the client"]
2304 #[doc = "presents a certificate."]
2305 #[doc = ""]
2306 #[doc = "If the client presents a certificate, the client authentication is done by"]
2307 #[doc = "the gRPC framework. (For a successful connection the client needs to either"]
2308 #[doc = "present a certificate that can be verified against the root certificate"]
2309 #[doc = "configured by the server or not present a certificate at all)"]
2310 #[doc = ""]
2311 #[doc = "The client's key certificate pair must be valid for the SSL connection to"]
2312 #[doc = "be established."]
2313 GRPC_SSL_REQUEST_CLIENT_CERTIFICATE_AND_VERIFY = 2,
2314 #[doc = " Server requests client certificate and enforces that the client presents a"]
2315 #[doc = "certificate."]
2316 #[doc = ""]
2317 #[doc = "If the client presents a certificate, the client authentication is left to"]
2318 #[doc = "the application (the necessary metadata will be available to the"]
2319 #[doc = "application via authentication context properties, see grpc_auth_context)."]
2320 #[doc = ""]
2321 #[doc = "The client's key certificate pair must be valid for the SSL connection to"]
2322 #[doc = "be established."]
2323 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_BUT_DONT_VERIFY = 3,
2324 #[doc = " Server requests client certificate and enforces that the client presents a"]
2325 #[doc = "certificate."]
2326 #[doc = ""]
2327 #[doc = "The certificate presented by the client is verified by the gRPC framework."]
2328 #[doc = "(For a successful connection the client needs to present a certificate that"]
2329 #[doc = "can be verified against the root certificate configured by the server)"]
2330 #[doc = ""]
2331 #[doc = "The client's key certificate pair must be valid for the SSL connection to"]
2332 #[doc = "be established."]
2333 GRPC_SSL_REQUEST_AND_REQUIRE_CLIENT_CERTIFICATE_AND_VERIFY = 4,
2334}
2335impl grpc_security_level {
2336 pub const GRPC_SECURITY_NONE: grpc_security_level = grpc_security_level::GRPC_SECURITY_MIN;
2337}
2338impl grpc_security_level {
2339 pub const GRPC_SECURITY_MAX: grpc_security_level =
2340 grpc_security_level::GRPC_PRIVACY_AND_INTEGRITY;
2341}
2342#[repr(u32)]
2343#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2344pub enum grpc_security_level {
2345 GRPC_SECURITY_MIN = 0,
2346 GRPC_INTEGRITY_ONLY = 1,
2347 GRPC_PRIVACY_AND_INTEGRITY = 2,
2348}
2349#[repr(u32)]
2350#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2351pub enum grpc_tls_server_verification_option {
2352 #[doc = " Default option: performs server certificate verification and hostname"]
2353 #[doc = "verification."]
2354 GRPC_TLS_SERVER_VERIFICATION = 0,
2355 #[doc = " Performs server certificate verification, but skips hostname verification"]
2356 #[doc = "Client is responsible for verifying server's identity via"]
2357 #[doc = "server authorization check callback."]
2358 GRPC_TLS_SKIP_HOSTNAME_VERIFICATION = 1,
2359 #[doc = " Skips both server certificate and hostname verification."]
2360 #[doc = "Client is responsible for verifying server's identity and"]
2361 #[doc = "server's certificate via server authorization check callback."]
2362 GRPC_TLS_SKIP_ALL_SERVER_VERIFICATION = 2,
2363}
2364#[repr(u32)]
2365#[doc = " Type of local connections for which local channel/server credentials will be"]
2366#[doc = " applied. It supports UDS and local TCP connections."]
2367#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2368pub enum grpc_local_connect_type {
2369 UDS = 0,
2370 LOCAL_TCP = 1,
2371}
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01002372#[repr(u32)]
2373#[doc = " The TLS versions that are supported by the SSL stack."]
2374#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2375pub enum grpc_tls_version {
2376 TLS1_2 = 0,
2377 TLS1_3 = 1,
2378}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002379#[repr(C)]
2380#[derive(Debug, Copy, Clone)]
2381pub struct grpc_auth_context {
2382 _unused: [u8; 0],
2383}
2384#[repr(C)]
2385#[derive(Debug, Copy, Clone)]
2386pub struct grpc_auth_property_iterator {
2387 pub ctx: *const grpc_auth_context,
2388 pub index: usize,
2389 pub name: *const ::std::os::raw::c_char,
2390}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002391#[doc = " value, if not NULL, is guaranteed to be NULL terminated."]
2392#[repr(C)]
2393#[derive(Debug, Copy, Clone)]
2394pub struct grpc_auth_property {
2395 pub name: *mut ::std::os::raw::c_char,
2396 pub value: *mut ::std::os::raw::c_char,
2397 pub value_length: usize,
2398}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002399extern "C" {
2400 #[doc = " Returns NULL when the iterator is at the end."]
2401 pub fn grpc_auth_property_iterator_next(
2402 it: *mut grpc_auth_property_iterator,
2403 ) -> *const grpc_auth_property;
2404}
2405extern "C" {
2406 #[doc = " Iterates over the auth context."]
2407 pub fn grpc_auth_context_property_iterator(
2408 ctx: *const grpc_auth_context,
2409 ) -> grpc_auth_property_iterator;
2410}
2411extern "C" {
2412 #[doc = " Gets the peer identity. Returns an empty iterator (first _next will return"]
2413 #[doc = "NULL) if the peer is not authenticated."]
2414 pub fn grpc_auth_context_peer_identity(
2415 ctx: *const grpc_auth_context,
2416 ) -> grpc_auth_property_iterator;
2417}
2418extern "C" {
2419 #[doc = " Finds a property in the context. May return an empty iterator (first _next"]
2420 #[doc = "will return NULL) if no property with this name was found in the context."]
2421 pub fn grpc_auth_context_find_properties_by_name(
2422 ctx: *const grpc_auth_context,
2423 name: *const ::std::os::raw::c_char,
2424 ) -> grpc_auth_property_iterator;
2425}
2426extern "C" {
2427 #[doc = " Gets the name of the property that indicates the peer identity. Will return"]
2428 #[doc = "NULL if the peer is not authenticated."]
2429 pub fn grpc_auth_context_peer_identity_property_name(
2430 ctx: *const grpc_auth_context,
2431 ) -> *const ::std::os::raw::c_char;
2432}
2433extern "C" {
2434 #[doc = " Returns 1 if the peer is authenticated, 0 otherwise."]
2435 pub fn grpc_auth_context_peer_is_authenticated(
2436 ctx: *const grpc_auth_context,
2437 ) -> ::std::os::raw::c_int;
2438}
2439extern "C" {
2440 #[doc = " Gets the auth context from the call. Caller needs to call"]
2441 #[doc = "grpc_auth_context_release on the returned context."]
2442 pub fn grpc_call_auth_context(call: *mut grpc_call) -> *mut grpc_auth_context;
2443}
2444extern "C" {
2445 #[doc = " Releases the auth context returned from grpc_call_auth_context."]
2446 pub fn grpc_auth_context_release(context: *mut grpc_auth_context);
2447}
2448extern "C" {
2449 #[doc = " Add a property."]
2450 pub fn grpc_auth_context_add_property(
2451 ctx: *mut grpc_auth_context,
2452 name: *const ::std::os::raw::c_char,
2453 value: *const ::std::os::raw::c_char,
2454 value_length: usize,
2455 );
2456}
2457extern "C" {
2458 #[doc = " Add a C string property."]
2459 pub fn grpc_auth_context_add_cstring_property(
2460 ctx: *mut grpc_auth_context,
2461 name: *const ::std::os::raw::c_char,
2462 value: *const ::std::os::raw::c_char,
2463 );
2464}
2465extern "C" {
2466 #[doc = " Sets the property name. Returns 1 if successful or 0 in case of failure"]
2467 #[doc = "(which means that no property with this name exists)."]
2468 pub fn grpc_auth_context_set_peer_identity_property_name(
2469 ctx: *mut grpc_auth_context,
2470 name: *const ::std::os::raw::c_char,
2471 ) -> ::std::os::raw::c_int;
2472}
2473#[repr(C)]
2474#[derive(Debug, Copy, Clone)]
2475pub struct grpc_ssl_session_cache {
2476 _unused: [u8; 0],
2477}
2478extern "C" {
2479 #[doc = " Create LRU cache for client-side SSL sessions with the given capacity."]
2480 #[doc = "If capacity is < 1, a default capacity is used instead."]
2481 pub fn grpc_ssl_session_cache_create_lru(capacity: usize) -> *mut grpc_ssl_session_cache;
2482}
2483extern "C" {
2484 #[doc = " Destroy SSL session cache."]
2485 pub fn grpc_ssl_session_cache_destroy(cache: *mut grpc_ssl_session_cache);
2486}
2487extern "C" {
2488 #[doc = " Create a channel arg with the given cache object."]
2489 pub fn grpc_ssl_session_cache_create_channel_arg(
2490 cache: *mut grpc_ssl_session_cache,
2491 ) -> grpc_arg;
2492}
2493#[repr(C)]
2494#[derive(Debug, Copy, Clone)]
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01002495pub struct grpc_call_credentials {
2496 _unused: [u8; 0],
2497}
2498extern "C" {
2499 #[doc = " Releases a call credentials object."]
2500 #[doc = "The creator of the credentials object is responsible for its release."]
2501 pub fn grpc_call_credentials_release(creds: *mut grpc_call_credentials);
2502}
2503#[repr(C)]
2504#[derive(Debug, Copy, Clone)]
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002505pub struct grpc_channel_credentials {
2506 _unused: [u8; 0],
2507}
2508extern "C" {
2509 #[doc = " Releases a channel credentials object."]
2510 #[doc = "The creator of the credentials object is responsible for its release."]
2511 pub fn grpc_channel_credentials_release(creds: *mut grpc_channel_credentials);
2512}
2513extern "C" {
2514 #[doc = " Creates default credentials to connect to a google gRPC service."]
2515 #[doc = "WARNING: Do NOT use this credentials to connect to a non-google service as"]
2516 #[doc = "this could result in an oauth2 token leak. The security level of the"]
2517 #[doc = "resulting connection is GRPC_PRIVACY_AND_INTEGRITY."]
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01002518 #[doc = ""]
2519 #[doc = "If specified, the supplied call credentials object will be attached to the"]
2520 #[doc = "returned channel credentials object. The call_credentials object must remain"]
2521 #[doc = "valid throughout the lifetime of the returned grpc_channel_credentials"]
2522 #[doc = "object. It is expected that the call credentials object was generated"]
2523 #[doc = "according to the Application Default Credentials mechanism and asserts the"]
2524 #[doc = "identity of the default service account of the machine. Supplying any other"]
2525 #[doc = "sort of call credential will result in undefined behavior, up to and"]
2526 #[doc = "including the sudden and unexpected failure of RPCs."]
2527 #[doc = ""]
2528 #[doc = "If nullptr is supplied, the returned channel credentials object will use a"]
2529 #[doc = "call credentials object based on the Application Default Credentials"]
2530 #[doc = "mechanism."]
2531 pub fn grpc_google_default_credentials_create(
2532 call_credentials: *mut grpc_call_credentials,
2533 ) -> *mut grpc_channel_credentials;
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002534}
2535#[doc = " Callback for getting the SSL roots override from the application."]
2536#[doc = "In case of success, *pem_roots_certs must be set to a NULL terminated string"]
2537#[doc = "containing the list of PEM encoded root certificates. The ownership is passed"]
2538#[doc = "to the core and freed (laster by the core) with gpr_free."]
2539#[doc = "If this function fails and GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is"]
2540#[doc = "set to a valid path, it will override the roots specified this func"]
2541pub type grpc_ssl_roots_override_callback = ::std::option::Option<
2542 unsafe extern "C" fn(
2543 pem_root_certs: *mut *mut ::std::os::raw::c_char,
2544 ) -> grpc_ssl_roots_override_result,
2545>;
2546extern "C" {
2547 #[doc = " Setup a callback to override the default TLS/SSL roots."]
2548 #[doc = "This function is not thread-safe and must be called at initialization time"]
2549 #[doc = "before any ssl credentials are created to have the desired side effect."]
2550 #[doc = "If GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is set to a valid path, the"]
2551 #[doc = "callback will not be called."]
2552 pub fn grpc_set_ssl_roots_override_callback(cb: grpc_ssl_roots_override_callback);
2553}
2554#[doc = " Object that holds a private key / certificate chain pair in PEM format."]
2555#[repr(C)]
2556#[derive(Debug, Copy, Clone)]
2557pub struct grpc_ssl_pem_key_cert_pair {
2558 #[doc = " private_key is the NULL-terminated string containing the PEM encoding of"]
2559 #[doc = "the client's private key."]
2560 pub private_key: *const ::std::os::raw::c_char,
2561 #[doc = " cert_chain is the NULL-terminated string containing the PEM encoding of"]
2562 #[doc = "the client's certificate chain."]
2563 pub cert_chain: *const ::std::os::raw::c_char,
2564}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002565#[doc = " Deprecated in favor of grpc_ssl_verify_peer_options. It will be removed"]
2566#[doc = "after all of its call sites are migrated to grpc_ssl_verify_peer_options."]
2567#[doc = "Object that holds additional peer-verification options on a secure"]
2568#[doc = "channel."]
2569#[repr(C)]
2570#[derive(Debug, Copy, Clone)]
2571pub struct verify_peer_options {
2572 #[doc = " If non-NULL this callback will be invoked with the expected"]
2573 #[doc = "target_name, the peer's certificate (in PEM format), and whatever"]
2574 #[doc = "userdata pointer is set below. If a non-zero value is returned by this"]
2575 #[doc = "callback then it is treated as a verification failure. Invocation of"]
2576 #[doc = "the callback is blocking, so any implementation should be light-weight."]
2577 pub verify_peer_callback: ::std::option::Option<
2578 unsafe extern "C" fn(
2579 target_name: *const ::std::os::raw::c_char,
2580 peer_pem: *const ::std::os::raw::c_char,
2581 userdata: *mut ::std::os::raw::c_void,
2582 ) -> ::std::os::raw::c_int,
2583 >,
2584 #[doc = " Arbitrary userdata that will be passed as the last argument to"]
2585 #[doc = "verify_peer_callback."]
2586 pub verify_peer_callback_userdata: *mut ::std::os::raw::c_void,
2587 #[doc = " A destruct callback that will be invoked when the channel is being"]
2588 #[doc = "cleaned up. The userdata argument will be passed to it. The intent is"]
2589 #[doc = "to perform any cleanup associated with that userdata."]
2590 pub verify_peer_destruct:
2591 ::std::option::Option<unsafe extern "C" fn(userdata: *mut ::std::os::raw::c_void)>,
2592}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002593#[doc = " Object that holds additional peer-verification options on a secure"]
2594#[doc = "channel."]
2595#[repr(C)]
2596#[derive(Debug, Copy, Clone)]
2597pub struct grpc_ssl_verify_peer_options {
2598 #[doc = " If non-NULL this callback will be invoked with the expected"]
2599 #[doc = "target_name, the peer's certificate (in PEM format), and whatever"]
2600 #[doc = "userdata pointer is set below. If a non-zero value is returned by this"]
2601 #[doc = "callback then it is treated as a verification failure. Invocation of"]
2602 #[doc = "the callback is blocking, so any implementation should be light-weight."]
2603 pub verify_peer_callback: ::std::option::Option<
2604 unsafe extern "C" fn(
2605 target_name: *const ::std::os::raw::c_char,
2606 peer_pem: *const ::std::os::raw::c_char,
2607 userdata: *mut ::std::os::raw::c_void,
2608 ) -> ::std::os::raw::c_int,
2609 >,
2610 #[doc = " Arbitrary userdata that will be passed as the last argument to"]
2611 #[doc = "verify_peer_callback."]
2612 pub verify_peer_callback_userdata: *mut ::std::os::raw::c_void,
2613 #[doc = " A destruct callback that will be invoked when the channel is being"]
2614 #[doc = "cleaned up. The userdata argument will be passed to it. The intent is"]
2615 #[doc = "to perform any cleanup associated with that userdata."]
2616 pub verify_peer_destruct:
2617 ::std::option::Option<unsafe extern "C" fn(userdata: *mut ::std::os::raw::c_void)>,
2618}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002619extern "C" {
2620 #[doc = " Deprecated in favor of grpc_ssl_server_credentials_create_ex. It will be"]
2621 #[doc = "removed after all of its call sites are migrated to"]
2622 #[doc = "grpc_ssl_server_credentials_create_ex. Creates an SSL credentials object."]
2623 #[doc = "The security level of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY."]
2624 #[doc = "- pem_root_certs is the NULL-terminated string containing the PEM encoding"]
2625 #[doc = "of the server root certificates. If this parameter is NULL, the"]
2626 #[doc = "implementation will first try to dereference the file pointed by the"]
2627 #[doc = "GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails,"]
2628 #[doc = "try to get the roots set by grpc_override_ssl_default_roots. Eventually,"]
2629 #[doc = "if all these fail, it will try to get the roots from a well-known place on"]
2630 #[doc = "disk (in the grpc install directory)."]
2631 #[doc = ""]
2632 #[doc = "gRPC has implemented root cache if the underlying OpenSSL library supports"]
2633 #[doc = "it. The gRPC root certificates cache is only applicable on the default"]
2634 #[doc = "root certificates, which is used when this parameter is nullptr. If user"]
2635 #[doc = "provides their own pem_root_certs, when creating an SSL credential object,"]
2636 #[doc = "gRPC would not be able to cache it, and each subchannel will generate a"]
2637 #[doc = "copy of the root store. So it is recommended to avoid providing large room"]
2638 #[doc = "pem with pem_root_certs parameter to avoid excessive memory consumption,"]
2639 #[doc = "particularly on mobile platforms such as iOS."]
2640 #[doc = "- pem_key_cert_pair is a pointer on the object containing client's private"]
2641 #[doc = "key and certificate chain. This parameter can be NULL if the client does"]
2642 #[doc = "not have such a key/cert pair."]
2643 #[doc = "- verify_options is an optional verify_peer_options object which holds"]
2644 #[doc = "additional options controlling how peer certificates are verified. For"]
2645 #[doc = "example, you can supply a callback which receives the peer's certificate"]
2646 #[doc = "with which you can do additional verification. Can be NULL, in which"]
2647 #[doc = "case verification will retain default behavior. Any settings in"]
2648 #[doc = "verify_options are copied during this call, so the verify_options"]
2649 #[doc = "object can be released afterwards."]
2650 pub fn grpc_ssl_credentials_create(
2651 pem_root_certs: *const ::std::os::raw::c_char,
2652 pem_key_cert_pair: *mut grpc_ssl_pem_key_cert_pair,
2653 verify_options: *const verify_peer_options,
2654 reserved: *mut ::std::os::raw::c_void,
2655 ) -> *mut grpc_channel_credentials;
2656}
2657extern "C" {
2658 pub fn grpc_ssl_credentials_create_ex(
2659 pem_root_certs: *const ::std::os::raw::c_char,
2660 pem_key_cert_pair: *mut grpc_ssl_pem_key_cert_pair,
2661 verify_options: *const grpc_ssl_verify_peer_options,
2662 reserved: *mut ::std::os::raw::c_void,
2663 ) -> *mut grpc_channel_credentials;
2664}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002665extern "C" {
2666 #[doc = " Creates a composite channel credentials object. The security level of"]
2667 #[doc = " resulting connection is determined by channel_creds."]
2668 pub fn grpc_composite_channel_credentials_create(
2669 channel_creds: *mut grpc_channel_credentials,
2670 call_creds: *mut grpc_call_credentials,
2671 reserved: *mut ::std::os::raw::c_void,
2672 ) -> *mut grpc_channel_credentials;
2673}
2674extern "C" {
2675 #[doc = " Creates a composite call credentials object."]
2676 pub fn grpc_composite_call_credentials_create(
2677 creds1: *mut grpc_call_credentials,
2678 creds2: *mut grpc_call_credentials,
2679 reserved: *mut ::std::os::raw::c_void,
2680 ) -> *mut grpc_call_credentials;
2681}
2682extern "C" {
2683 #[doc = " Creates a compute engine credentials object for connecting to Google."]
2684 #[doc = "WARNING: Do NOT use this credentials to connect to a non-google service as"]
2685 #[doc = "this could result in an oauth2 token leak."]
2686 pub fn grpc_google_compute_engine_credentials_create(
2687 reserved: *mut ::std::os::raw::c_void,
2688 ) -> *mut grpc_call_credentials;
2689}
2690extern "C" {
2691 pub fn grpc_max_auth_token_lifetime() -> gpr_timespec;
2692}
2693extern "C" {
2694 #[doc = " Creates a JWT credentials object. May return NULL if the input is invalid."]
2695 #[doc = "- json_key is the JSON key string containing the client's private key."]
2696 #[doc = "- token_lifetime is the lifetime of each Json Web Token (JWT) created with"]
2697 #[doc = "this credentials. It should not exceed grpc_max_auth_token_lifetime or"]
2698 #[doc = "will be cropped to this value."]
2699 pub fn grpc_service_account_jwt_access_credentials_create(
2700 json_key: *const ::std::os::raw::c_char,
2701 token_lifetime: gpr_timespec,
2702 reserved: *mut ::std::os::raw::c_void,
2703 ) -> *mut grpc_call_credentials;
2704}
2705extern "C" {
2706 #[doc = " Creates an Oauth2 Refresh Token credentials object for connecting to Google."]
2707 #[doc = "May return NULL if the input is invalid."]
2708 #[doc = "WARNING: Do NOT use this credentials to connect to a non-google service as"]
2709 #[doc = "this could result in an oauth2 token leak."]
2710 #[doc = "- json_refresh_token is the JSON string containing the refresh token itself"]
2711 #[doc = "along with a client_id and client_secret."]
2712 pub fn grpc_google_refresh_token_credentials_create(
2713 json_refresh_token: *const ::std::os::raw::c_char,
2714 reserved: *mut ::std::os::raw::c_void,
2715 ) -> *mut grpc_call_credentials;
2716}
2717extern "C" {
2718 #[doc = " Creates an Oauth2 Access Token credentials with an access token that was"]
2719 #[doc = "acquired by an out of band mechanism."]
2720 pub fn grpc_access_token_credentials_create(
2721 access_token: *const ::std::os::raw::c_char,
2722 reserved: *mut ::std::os::raw::c_void,
2723 ) -> *mut grpc_call_credentials;
2724}
2725extern "C" {
2726 #[doc = " Creates an IAM credentials object for connecting to Google."]
2727 pub fn grpc_google_iam_credentials_create(
2728 authorization_token: *const ::std::os::raw::c_char,
2729 authority_selector: *const ::std::os::raw::c_char,
2730 reserved: *mut ::std::os::raw::c_void,
2731 ) -> *mut grpc_call_credentials;
2732}
2733#[doc = " Options for creating STS Oauth Token Exchange credentials following the IETF"]
2734#[doc = "draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16."]
2735#[doc = "Optional fields may be set to NULL or empty string. It is the responsibility"]
2736#[doc = "of the caller to ensure that the subject and actor tokens are refreshed on"]
2737#[doc = "disk at the specified paths. This API is used for experimental purposes for"]
2738#[doc = "now and may change in the future."]
2739#[repr(C)]
2740#[derive(Debug, Copy, Clone)]
2741pub struct grpc_sts_credentials_options {
2742 pub token_exchange_service_uri: *const ::std::os::raw::c_char,
2743 pub resource: *const ::std::os::raw::c_char,
2744 pub audience: *const ::std::os::raw::c_char,
2745 pub scope: *const ::std::os::raw::c_char,
2746 pub requested_token_type: *const ::std::os::raw::c_char,
2747 pub subject_token_path: *const ::std::os::raw::c_char,
2748 pub subject_token_type: *const ::std::os::raw::c_char,
2749 pub actor_token_path: *const ::std::os::raw::c_char,
2750 pub actor_token_type: *const ::std::os::raw::c_char,
2751}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002752extern "C" {
2753 #[doc = " Creates an STS credentials following the STS Token Exchanged specifed in the"]
2754 #[doc = "IETF draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16."]
2755 #[doc = "This API is used for experimental purposes for now and may change in the"]
2756 #[doc = "future."]
2757 pub fn grpc_sts_credentials_create(
2758 options: *const grpc_sts_credentials_options,
2759 reserved: *mut ::std::os::raw::c_void,
2760 ) -> *mut grpc_call_credentials;
2761}
2762#[doc = " Callback function to be called by the metadata credentials plugin"]
2763#[doc = "implementation when the metadata is ready."]
2764#[doc = "- user_data is the opaque pointer that was passed in the get_metadata method"]
2765#[doc = "of the grpc_metadata_credentials_plugin (see below)."]
2766#[doc = "- creds_md is an array of credentials metadata produced by the plugin. It"]
2767#[doc = "may be set to NULL in case of an error."]
2768#[doc = "- num_creds_md is the number of items in the creds_md array."]
2769#[doc = "- status must be GRPC_STATUS_OK in case of success or another specific error"]
2770#[doc = "code otherwise."]
2771#[doc = "- error_details contains details about the error if any. In case of success"]
2772#[doc = "it should be NULL and will be otherwise ignored."]
2773pub type grpc_credentials_plugin_metadata_cb = ::std::option::Option<
2774 unsafe extern "C" fn(
2775 user_data: *mut ::std::os::raw::c_void,
2776 creds_md: *const grpc_metadata,
2777 num_creds_md: usize,
2778 status: grpc_status_code::Type,
2779 error_details: *const ::std::os::raw::c_char,
2780 ),
2781>;
2782#[doc = " Context that can be used by metadata credentials plugin in order to create"]
2783#[doc = "auth related metadata."]
2784#[repr(C)]
2785#[derive(Debug, Copy, Clone)]
2786pub struct grpc_auth_metadata_context {
2787 #[doc = " The fully qualifed service url."]
2788 pub service_url: *const ::std::os::raw::c_char,
2789 #[doc = " The method name of the RPC being called (not fully qualified)."]
2790 #[doc = "The fully qualified method name can be built from the service_url:"]
2791 #[doc = "full_qualified_method_name = ctx->service_url + '/' + ctx->method_name."]
2792 pub method_name: *const ::std::os::raw::c_char,
2793 #[doc = " The auth_context of the channel which gives the server's identity."]
2794 pub channel_auth_context: *const grpc_auth_context,
2795 #[doc = " Reserved for future use."]
2796 pub reserved: *mut ::std::os::raw::c_void,
2797}
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01002798extern "C" {
2799 #[doc = " Performs a deep copy from \\a from to \\a to."]
2800 pub fn grpc_auth_metadata_context_copy(
2801 from: *mut grpc_auth_metadata_context,
2802 to: *mut grpc_auth_metadata_context,
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002803 );
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01002804}
2805extern "C" {
2806 #[doc = " Releases internal resources held by \\a context."]
2807 pub fn grpc_auth_metadata_context_reset(context: *mut grpc_auth_metadata_context);
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002808}
2809#[doc = " grpc_metadata_credentials plugin is an API user provided structure used to"]
2810#[doc = "create grpc_credentials objects that can be set on a channel (composed) or"]
2811#[doc = "a call. See grpc_credentials_metadata_create_from_plugin below."]
2812#[doc = "The grpc client stack will call the get_metadata method of the plugin for"]
2813#[doc = "every call in scope for the credentials created from it."]
2814#[repr(C)]
2815#[derive(Debug, Copy, Clone)]
2816pub struct grpc_metadata_credentials_plugin {
2817 #[doc = " The implementation of this method has to be non-blocking, but can"]
2818 #[doc = "be performed synchronously or asynchronously."]
2819 #[doc = ""]
2820 #[doc = "If processing occurs synchronously, returns non-zero and populates"]
2821 #[doc = "creds_md, num_creds_md, status, and error_details. In this case,"]
2822 #[doc = "the caller takes ownership of the entries in creds_md and of"]
2823 #[doc = "error_details. Note that if the plugin needs to return more than"]
2824 #[doc = "GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX entries in creds_md, it must"]
2825 #[doc = "return asynchronously."]
2826 #[doc = ""]
2827 #[doc = "If processing occurs asynchronously, returns zero and invokes \\a cb"]
2828 #[doc = "when processing is completed. \\a user_data will be passed as the"]
2829 #[doc = "first parameter of the callback. NOTE: \\a cb MUST be invoked in a"]
2830 #[doc = "different thread, not from the thread in which \\a get_metadata() is"]
2831 #[doc = "invoked."]
2832 #[doc = ""]
2833 #[doc = "\\a context is the information that can be used by the plugin to create"]
2834 #[doc = "auth metadata."]
2835 pub get_metadata: ::std::option::Option<
2836 unsafe extern "C" fn(
2837 state: *mut ::std::os::raw::c_void,
2838 context: grpc_auth_metadata_context,
2839 cb: grpc_credentials_plugin_metadata_cb,
2840 user_data: *mut ::std::os::raw::c_void,
2841 creds_md: *mut grpc_metadata,
2842 num_creds_md: *mut usize,
2843 status: *mut grpc_status_code::Type,
2844 error_details: *mut *const ::std::os::raw::c_char,
2845 ) -> ::std::os::raw::c_int,
2846 >,
2847 #[doc = " Implements debug string of the given plugin. This method returns an"]
2848 #[doc = " allocated string that the caller needs to free using gpr_free()"]
2849 pub debug_string: ::std::option::Option<
2850 unsafe extern "C" fn(state: *mut ::std::os::raw::c_void) -> *mut ::std::os::raw::c_char,
2851 >,
2852 #[doc = " Destroys the plugin state."]
2853 pub destroy: ::std::option::Option<unsafe extern "C" fn(state: *mut ::std::os::raw::c_void)>,
2854 #[doc = " State that will be set as the first parameter of the methods above."]
2855 pub state: *mut ::std::os::raw::c_void,
2856 #[doc = " Type of credentials that this plugin is implementing."]
2857 pub type_: *const ::std::os::raw::c_char,
2858}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02002859extern "C" {
2860 #[doc = " Creates a credentials object from a plugin with a specified minimum security"]
2861 #[doc = " level."]
2862 pub fn grpc_metadata_credentials_create_from_plugin(
2863 plugin: grpc_metadata_credentials_plugin,
2864 min_security_level: grpc_security_level,
2865 reserved: *mut ::std::os::raw::c_void,
2866 ) -> *mut grpc_call_credentials;
2867}
2868extern "C" {
2869 #[doc = " Creates a secure channel using the passed-in credentials. Additional"]
2870 #[doc = "channel level configuration MAY be provided by grpc_channel_args, though"]
2871 #[doc = "the expectation is that most clients will want to simply pass NULL. The"]
2872 #[doc = "user data in 'args' need only live through the invocation of this function."]
2873 #[doc = "However, if any args of the 'pointer' type are passed, then the referenced"]
2874 #[doc = "vtable must be maintained by the caller until grpc_channel_destroy"]
2875 #[doc = "terminates. See grpc_channel_args definition for more on this."]
2876 pub fn grpc_secure_channel_create(
2877 creds: *mut grpc_channel_credentials,
2878 target: *const ::std::os::raw::c_char,
2879 args: *const grpc_channel_args,
2880 reserved: *mut ::std::os::raw::c_void,
2881 ) -> *mut grpc_channel;
2882}
2883#[repr(C)]
2884#[derive(Debug, Copy, Clone)]
2885pub struct grpc_server_credentials {
2886 _unused: [u8; 0],
2887}
2888extern "C" {
2889 #[doc = " Releases a server_credentials object."]
2890 #[doc = "The creator of the server_credentials object is responsible for its release."]
2891 pub fn grpc_server_credentials_release(creds: *mut grpc_server_credentials);
2892}
2893#[repr(C)]
2894#[derive(Debug, Copy, Clone)]
2895pub struct grpc_ssl_server_certificate_config {
2896 _unused: [u8; 0],
2897}
2898extern "C" {
2899 #[doc = " Creates a grpc_ssl_server_certificate_config object."]
2900 #[doc = "- pem_roots_cert is the NULL-terminated string containing the PEM encoding of"]
2901 #[doc = "the client root certificates. This parameter may be NULL if the server does"]
2902 #[doc = "not want the client to be authenticated with SSL."]
2903 #[doc = "- pem_key_cert_pairs is an array private key / certificate chains of the"]
2904 #[doc = "server. This parameter cannot be NULL."]
2905 #[doc = "- num_key_cert_pairs indicates the number of items in the private_key_files"]
2906 #[doc = "and cert_chain_files parameters. It must be at least 1."]
2907 #[doc = "- It is the caller's responsibility to free this object via"]
2908 #[doc = "grpc_ssl_server_certificate_config_destroy()."]
2909 pub fn grpc_ssl_server_certificate_config_create(
2910 pem_root_certs: *const ::std::os::raw::c_char,
2911 pem_key_cert_pairs: *const grpc_ssl_pem_key_cert_pair,
2912 num_key_cert_pairs: usize,
2913 ) -> *mut grpc_ssl_server_certificate_config;
2914}
2915extern "C" {
2916 #[doc = " Destroys a grpc_ssl_server_certificate_config object."]
2917 pub fn grpc_ssl_server_certificate_config_destroy(
2918 config: *mut grpc_ssl_server_certificate_config,
2919 );
2920}
2921#[doc = " Callback to retrieve updated SSL server certificates, private keys, and"]
2922#[doc = "trusted CAs (for client authentication)."]
2923#[doc = "- user_data parameter, if not NULL, contains opaque data to be used by the"]
2924#[doc = "callback."]
2925#[doc = "- Use grpc_ssl_server_certificate_config_create to create the config."]
2926#[doc = "- The caller assumes ownership of the config."]
2927pub type grpc_ssl_server_certificate_config_callback = ::std::option::Option<
2928 unsafe extern "C" fn(
2929 user_data: *mut ::std::os::raw::c_void,
2930 config: *mut *mut grpc_ssl_server_certificate_config,
2931 ) -> grpc_ssl_certificate_config_reload_status,
2932>;
2933extern "C" {
2934 #[doc = " Deprecated in favor of grpc_ssl_server_credentials_create_ex."]
2935 #[doc = "Creates an SSL server_credentials object."]
2936 #[doc = "- pem_roots_cert is the NULL-terminated string containing the PEM encoding of"]
2937 #[doc = "the client root certificates. This parameter may be NULL if the server does"]
2938 #[doc = "not want the client to be authenticated with SSL."]
2939 #[doc = "- pem_key_cert_pairs is an array private key / certificate chains of the"]
2940 #[doc = "server. This parameter cannot be NULL."]
2941 #[doc = "- num_key_cert_pairs indicates the number of items in the private_key_files"]
2942 #[doc = "and cert_chain_files parameters. It should be at least 1."]
2943 #[doc = "- force_client_auth, if set to non-zero will force the client to authenticate"]
2944 #[doc = "with an SSL cert. Note that this option is ignored if pem_root_certs is"]
2945 #[doc = "NULL."]
2946 pub fn grpc_ssl_server_credentials_create(
2947 pem_root_certs: *const ::std::os::raw::c_char,
2948 pem_key_cert_pairs: *mut grpc_ssl_pem_key_cert_pair,
2949 num_key_cert_pairs: usize,
2950 force_client_auth: ::std::os::raw::c_int,
2951 reserved: *mut ::std::os::raw::c_void,
2952 ) -> *mut grpc_server_credentials;
2953}
2954extern "C" {
2955 #[doc = " Deprecated in favor of grpc_ssl_server_credentials_create_with_options."]
2956 #[doc = "Same as grpc_ssl_server_credentials_create method except uses"]
2957 #[doc = "grpc_ssl_client_certificate_request_type enum to support more ways to"]
2958 #[doc = "authenticate client certificates."]
2959 pub fn grpc_ssl_server_credentials_create_ex(
2960 pem_root_certs: *const ::std::os::raw::c_char,
2961 pem_key_cert_pairs: *mut grpc_ssl_pem_key_cert_pair,
2962 num_key_cert_pairs: usize,
2963 client_certificate_request: grpc_ssl_client_certificate_request_type,
2964 reserved: *mut ::std::os::raw::c_void,
2965 ) -> *mut grpc_server_credentials;
2966}
2967#[repr(C)]
2968#[derive(Debug, Copy, Clone)]
2969pub struct grpc_ssl_server_credentials_options {
2970 _unused: [u8; 0],
2971}
2972extern "C" {
2973 #[doc = " Creates an options object using a certificate config. Use this method when"]
2974 #[doc = "the certificates and keys of the SSL server will not change during the"]
2975 #[doc = "server's lifetime."]
2976 #[doc = "- Takes ownership of the certificate_config parameter."]
2977 pub fn grpc_ssl_server_credentials_create_options_using_config(
2978 client_certificate_request: grpc_ssl_client_certificate_request_type,
2979 certificate_config: *mut grpc_ssl_server_certificate_config,
2980 ) -> *mut grpc_ssl_server_credentials_options;
2981}
2982extern "C" {
2983 #[doc = " Creates an options object using a certificate config fetcher. Use this"]
2984 #[doc = "method to reload the certificates and keys of the SSL server without"]
2985 #[doc = "interrupting the operation of the server. Initial certificate config will be"]
2986 #[doc = "fetched during server initialization."]
2987 #[doc = "- user_data parameter, if not NULL, contains opaque data which will be passed"]
2988 #[doc = "to the fetcher (see definition of"]
2989 #[doc = "grpc_ssl_server_certificate_config_callback)."]
2990 pub fn grpc_ssl_server_credentials_create_options_using_config_fetcher(
2991 client_certificate_request: grpc_ssl_client_certificate_request_type,
2992 cb: grpc_ssl_server_certificate_config_callback,
2993 user_data: *mut ::std::os::raw::c_void,
2994 ) -> *mut grpc_ssl_server_credentials_options;
2995}
2996extern "C" {
2997 #[doc = " Destroys a grpc_ssl_server_credentials_options object."]
2998 pub fn grpc_ssl_server_credentials_options_destroy(
2999 options: *mut grpc_ssl_server_credentials_options,
3000 );
3001}
3002extern "C" {
3003 #[doc = " Creates an SSL server_credentials object using the provided options struct."]
3004 #[doc = "- Takes ownership of the options parameter."]
3005 pub fn grpc_ssl_server_credentials_create_with_options(
3006 options: *mut grpc_ssl_server_credentials_options,
3007 ) -> *mut grpc_server_credentials;
3008}
3009extern "C" {
3010 #[doc = " Add a HTTP2 over an encrypted link over tcp listener."]
3011 #[doc = "Returns bound port number on success, 0 on failure."]
3012 #[doc = "REQUIRES: server not started"]
3013 pub fn grpc_server_add_secure_http2_port(
3014 server: *mut grpc_server,
3015 addr: *const ::std::os::raw::c_char,
3016 creds: *mut grpc_server_credentials,
3017 ) -> ::std::os::raw::c_int;
3018}
3019extern "C" {
3020 #[doc = " Sets a credentials to a call. Can only be called on the client side before"]
3021 #[doc = "grpc_call_start_batch."]
3022 pub fn grpc_call_set_credentials(
3023 call: *mut grpc_call,
3024 creds: *mut grpc_call_credentials,
3025 ) -> grpc_call_error;
3026}
3027#[doc = " Callback function that is called when the metadata processing is done."]
3028#[doc = "- Consumed metadata will be removed from the set of metadata available on the"]
3029#[doc = "call. consumed_md may be NULL if no metadata has been consumed."]
3030#[doc = "- Response metadata will be set on the response. response_md may be NULL."]
3031#[doc = "- status is GRPC_STATUS_OK for success or a specific status for an error."]
3032#[doc = "Common error status for auth metadata processing is either"]
3033#[doc = "GRPC_STATUS_UNAUTHENTICATED in case of an authentication failure or"]
3034#[doc = "GRPC_STATUS PERMISSION_DENIED in case of an authorization failure."]
3035#[doc = "- error_details gives details about the error. May be NULL."]
3036pub type grpc_process_auth_metadata_done_cb = ::std::option::Option<
3037 unsafe extern "C" fn(
3038 user_data: *mut ::std::os::raw::c_void,
3039 consumed_md: *const grpc_metadata,
3040 num_consumed_md: usize,
3041 response_md: *const grpc_metadata,
3042 num_response_md: usize,
3043 status: grpc_status_code::Type,
3044 error_details: *const ::std::os::raw::c_char,
3045 ),
3046>;
3047#[doc = " Pluggable server-side metadata processor object."]
3048#[repr(C)]
3049#[derive(Debug, Copy, Clone)]
3050pub struct grpc_auth_metadata_processor {
3051 #[doc = " The context object is read/write: it contains the properties of the"]
3052 #[doc = "channel peer and it is the job of the process function to augment it with"]
3053 #[doc = "properties derived from the passed-in metadata."]
3054 #[doc = "The lifetime of these objects is guaranteed until cb is invoked."]
3055 pub process: ::std::option::Option<
3056 unsafe extern "C" fn(
3057 state: *mut ::std::os::raw::c_void,
3058 context: *mut grpc_auth_context,
3059 md: *const grpc_metadata,
3060 num_md: usize,
3061 cb: grpc_process_auth_metadata_done_cb,
3062 user_data: *mut ::std::os::raw::c_void,
3063 ),
3064 >,
3065 pub destroy: ::std::option::Option<unsafe extern "C" fn(state: *mut ::std::os::raw::c_void)>,
3066 pub state: *mut ::std::os::raw::c_void,
3067}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003068extern "C" {
3069 pub fn grpc_server_credentials_set_auth_metadata_processor(
3070 creds: *mut grpc_server_credentials,
3071 processor: grpc_auth_metadata_processor,
3072 );
3073}
3074#[repr(C)]
3075#[derive(Debug, Copy, Clone)]
3076pub struct grpc_alts_credentials_options {
3077 _unused: [u8; 0],
3078}
3079extern "C" {
3080 #[doc = " This method creates a grpc ALTS credentials client options instance."]
3081 #[doc = " It is used for experimental purpose for now and subject to change."]
3082 pub fn grpc_alts_credentials_client_options_create() -> *mut grpc_alts_credentials_options;
3083}
3084extern "C" {
3085 #[doc = " This method creates a grpc ALTS credentials server options instance."]
3086 #[doc = " It is used for experimental purpose for now and subject to change."]
3087 pub fn grpc_alts_credentials_server_options_create() -> *mut grpc_alts_credentials_options;
3088}
3089extern "C" {
3090 #[doc = " This method adds a target service account to grpc client's ALTS credentials"]
3091 #[doc = " options instance. It is used for experimental purpose for now and subject"]
3092 #[doc = " to change."]
3093 #[doc = ""]
3094 #[doc = " - options: grpc ALTS credentials options instance."]
3095 #[doc = " - service_account: service account of target endpoint."]
3096 pub fn grpc_alts_credentials_client_options_add_target_service_account(
3097 options: *mut grpc_alts_credentials_options,
3098 service_account: *const ::std::os::raw::c_char,
3099 );
3100}
3101extern "C" {
3102 #[doc = " This method destroys a grpc_alts_credentials_options instance by"]
3103 #[doc = " de-allocating all of its occupied memory. It is used for experimental purpose"]
3104 #[doc = " for now and subject to change."]
3105 #[doc = ""]
3106 #[doc = " - options: a grpc_alts_credentials_options instance that needs to be"]
3107 #[doc = " destroyed."]
3108 pub fn grpc_alts_credentials_options_destroy(options: *mut grpc_alts_credentials_options);
3109}
3110extern "C" {
3111 #[doc = " This method creates an ALTS channel credential object. The security"]
3112 #[doc = " level of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY."]
3113 #[doc = " It is used for experimental purpose for now and subject to change."]
3114 #[doc = ""]
3115 #[doc = " - options: grpc ALTS credentials options instance for client."]
3116 #[doc = ""]
3117 #[doc = " It returns the created ALTS channel credential object."]
3118 pub fn grpc_alts_credentials_create(
3119 options: *const grpc_alts_credentials_options,
3120 ) -> *mut grpc_channel_credentials;
3121}
3122extern "C" {
3123 #[doc = " This method creates an ALTS server credential object. It is used for"]
3124 #[doc = " experimental purpose for now and subject to change."]
3125 #[doc = ""]
3126 #[doc = " - options: grpc ALTS credentials options instance for server."]
3127 #[doc = ""]
3128 #[doc = " It returns the created ALTS server credential object."]
3129 pub fn grpc_alts_server_credentials_create(
3130 options: *const grpc_alts_credentials_options,
3131 ) -> *mut grpc_server_credentials;
3132}
3133extern "C" {
3134 #[doc = " This method creates a local channel credential object. The security level"]
3135 #[doc = " of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY for UDS and"]
3136 #[doc = " GRPC_SECURITY_NONE for LOCAL_TCP. It is used for experimental purpose"]
3137 #[doc = " for now and subject to change."]
3138 #[doc = ""]
3139 #[doc = " - type: local connection type"]
3140 #[doc = ""]
3141 #[doc = " It returns the created local channel credential object."]
3142 pub fn grpc_local_credentials_create(
3143 type_: grpc_local_connect_type,
3144 ) -> *mut grpc_channel_credentials;
3145}
3146extern "C" {
3147 #[doc = " This method creates a local server credential object. It is used for"]
3148 #[doc = " experimental purpose for now and subject to change."]
3149 #[doc = ""]
3150 #[doc = " - type: local connection type"]
3151 #[doc = ""]
3152 #[doc = " It returns the created local server credential object."]
3153 pub fn grpc_local_server_credentials_create(
3154 type_: grpc_local_connect_type,
3155 ) -> *mut grpc_server_credentials;
3156}
3157#[repr(C)]
3158#[derive(Debug, Copy, Clone)]
3159pub struct grpc_tls_error_details {
3160 _unused: [u8; 0],
3161}
3162#[repr(C)]
3163#[derive(Debug, Copy, Clone)]
3164pub struct grpc_tls_key_materials_config {
3165 _unused: [u8; 0],
3166}
3167#[repr(C)]
3168#[derive(Debug, Copy, Clone)]
3169pub struct grpc_tls_credential_reload_config {
3170 _unused: [u8; 0],
3171}
3172#[repr(C)]
3173#[derive(Debug, Copy, Clone)]
3174pub struct grpc_tls_server_authorization_check_config {
3175 _unused: [u8; 0],
3176}
3177#[repr(C)]
3178#[derive(Debug, Copy, Clone)]
3179pub struct grpc_tls_credentials_options {
3180 _unused: [u8; 0],
3181}
3182extern "C" {
3183 #[doc = " Create an empty TLS credentials options. It is used for"]
3184 #[doc = " experimental purpose for now and subject to change."]
3185 pub fn grpc_tls_credentials_options_create() -> *mut grpc_tls_credentials_options;
3186}
3187extern "C" {
3188 #[doc = " Set grpc_ssl_client_certificate_request_type field in credentials options"]
3189 #[doc = "with the provided type. options should not be NULL."]
3190 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3191 #[doc = "experimental purpose for now and subject to change."]
3192 pub fn grpc_tls_credentials_options_set_cert_request_type(
3193 options: *mut grpc_tls_credentials_options,
3194 type_: grpc_ssl_client_certificate_request_type,
3195 ) -> ::std::os::raw::c_int;
3196}
3197extern "C" {
3198 #[doc = " Set grpc_tls_server_verification_option field in credentials options"]
3199 #[doc = "with the provided server_verification_option. options should not be NULL."]
3200 #[doc = "This should be called only on the client side."]
3201 #[doc = "If grpc_tls_server_verification_option is not"]
3202 #[doc = "GRPC_TLS_SERVER_VERIFICATION, use of a customer server"]
3203 #[doc = "authorization check (grpc_tls_server_authorization_check_config)"]
3204 #[doc = "will be mandatory."]
3205 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3206 #[doc = "experimental purpose for now and subject to change."]
3207 pub fn grpc_tls_credentials_options_set_server_verification_option(
3208 options: *mut grpc_tls_credentials_options,
3209 server_verification_option: grpc_tls_server_verification_option,
3210 ) -> ::std::os::raw::c_int;
3211}
3212extern "C" {
3213 #[doc = " Set grpc_tls_key_materials_config field in credentials options"]
3214 #[doc = "with the provided config struct whose ownership is transferred."]
3215 #[doc = "Both parameters should not be NULL."]
3216 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3217 #[doc = "experimental purpose for now and subject to change."]
3218 pub fn grpc_tls_credentials_options_set_key_materials_config(
3219 options: *mut grpc_tls_credentials_options,
3220 config: *mut grpc_tls_key_materials_config,
3221 ) -> ::std::os::raw::c_int;
3222}
3223extern "C" {
3224 #[doc = " Set grpc_tls_credential_reload_config field in credentials options"]
3225 #[doc = "with the provided config struct whose ownership is transferred."]
3226 #[doc = "Both parameters should not be NULL."]
3227 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3228 #[doc = "experimental purpose for now and subject to change."]
3229 pub fn grpc_tls_credentials_options_set_credential_reload_config(
3230 options: *mut grpc_tls_credentials_options,
3231 config: *mut grpc_tls_credential_reload_config,
3232 ) -> ::std::os::raw::c_int;
3233}
3234extern "C" {
3235 #[doc = " Set grpc_tls_server_authorization_check_config field in credentials options"]
3236 #[doc = "with the provided config struct whose ownership is transferred."]
3237 #[doc = "Both parameters should not be NULL."]
3238 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3239 #[doc = "experimental purpose for now and subject to change."]
3240 pub fn grpc_tls_credentials_options_set_server_authorization_check_config(
3241 options: *mut grpc_tls_credentials_options,
3242 config: *mut grpc_tls_server_authorization_check_config,
3243 ) -> ::std::os::raw::c_int;
3244}
3245extern "C" {
3246 #[doc = " Create an empty grpc_tls_key_materials_config instance."]
3247 #[doc = " It is used for experimental purpose for now and subject to change."]
3248 pub fn grpc_tls_key_materials_config_create() -> *mut grpc_tls_key_materials_config;
3249}
3250extern "C" {
3251 #[doc = " Set grpc_tls_key_materials_config instance with provided a TLS certificate."]
3252 #[doc = "It's valid for the caller to provide nullptr pem_root_certs, in which case"]
3253 #[doc = "the gRPC-provided root cert will be used. pem_key_cert_pairs should not be"]
3254 #[doc = "NULL."]
3255 #[doc = "The ownerships of |pem_root_certs| and |pem_key_cert_pairs| remain with the"]
3256 #[doc = "caller."]
3257 #[doc = "It returns 1 on success and 0 on failure. It is used for experimental"]
3258 #[doc = "purpose for now and subject to change."]
3259 pub fn grpc_tls_key_materials_config_set_key_materials(
3260 config: *mut grpc_tls_key_materials_config,
3261 pem_root_certs: *const ::std::os::raw::c_char,
3262 pem_key_cert_pairs: *mut *const grpc_ssl_pem_key_cert_pair,
3263 num_key_cert_pairs: usize,
3264 ) -> ::std::os::raw::c_int;
3265}
3266extern "C" {
3267 #[doc = " Set grpc_tls_key_materials_config instance with a provided version number,"]
3268 #[doc = "which is used to keep track of the version of key materials."]
3269 #[doc = "It returns 1 on success and 0 on failure. It is used for"]
3270 #[doc = "experimental purpose for now and subject to change."]
3271 pub fn grpc_tls_key_materials_config_set_version(
3272 config: *mut grpc_tls_key_materials_config,
3273 version: ::std::os::raw::c_int,
3274 ) -> ::std::os::raw::c_int;
3275}
3276extern "C" {
3277 #[doc = " Get the version number of a grpc_tls_key_materials_config instance."]
3278 #[doc = "It returns the version number on success and -1 on failure."]
3279 #[doc = "It is used for experimental purpose for now and subject to change."]
3280 pub fn grpc_tls_key_materials_config_get_version(
3281 config: *mut grpc_tls_key_materials_config,
3282 ) -> ::std::os::raw::c_int;
3283}
3284#[doc = " A callback function provided by gRPC to handle the result of credential"]
3285#[doc = "reload. It is used when schedule API is implemented asynchronously and"]
3286#[doc = "serves to bring the control back to grpc C core. It is used for"]
3287#[doc = "experimental purpose for now and subject to change."]
3288pub type grpc_tls_on_credential_reload_done_cb =
3289 ::std::option::Option<unsafe extern "C" fn(arg: *mut grpc_tls_credential_reload_arg)>;
3290#[doc = " A struct containing all information necessary to schedule/cancel a"]
3291#[doc = "credential reload request."]
3292#[doc = "- cb and cb_user_data represent a gRPC-provided"]
3293#[doc = "callback and an argument passed to it."]
3294#[doc = "- key_materials_config is an in/output parameter containing currently"]
3295#[doc = "used/newly reloaded credentials. If credential reload does not result in"]
3296#[doc = "a new credential, key_materials_config should not be modified. The same"]
3297#[doc = "key_materials_config object can be updated if new key materials is"]
3298#[doc = "available."]
3299#[doc = "- status and error_details are used to hold information about"]
3300#[doc = "errors occurred when a credential reload request is scheduled/cancelled."]
3301#[doc = "- config is a pointer to the unique grpc_tls_credential_reload_config"]
3302#[doc = "instance that this argument corresponds to."]
3303#[doc = "- context is a pointer to a wrapped language implementation of this"]
3304#[doc = "grpc_tls_credential_reload_arg instance."]
3305#[doc = "- destroy_context is a pointer to a caller-provided method that cleans"]
3306#[doc = "up any data associated with the context pointer."]
3307#[doc = "It is used for experimental purposes for now and subject to change."]
3308#[repr(C)]
3309#[derive(Debug, Copy, Clone)]
3310pub struct grpc_tls_credential_reload_arg {
3311 pub cb: grpc_tls_on_credential_reload_done_cb,
3312 pub cb_user_data: *mut ::std::os::raw::c_void,
3313 pub key_materials_config: *mut grpc_tls_key_materials_config,
3314 pub status: grpc_ssl_certificate_config_reload_status,
3315 pub error_details: *mut grpc_tls_error_details,
3316 pub config: *mut grpc_tls_credential_reload_config,
3317 pub context: *mut ::std::os::raw::c_void,
3318 pub destroy_context:
3319 ::std::option::Option<unsafe extern "C" fn(ctx: *mut ::std::os::raw::c_void)>,
3320}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003321extern "C" {
3322 #[doc = " Create a grpc_tls_credential_reload_config instance."]
3323 #[doc = "- config_user_data is config-specific, read-only user data"]
3324 #[doc = "that works for all channels created with a credential using the config."]
3325 #[doc = "- schedule is a pointer to an application-provided callback used to invoke"]
3326 #[doc = "credential reload API. The implementation of this method has to be"]
3327 #[doc = "non-blocking, but can be performed synchronously or asynchronously."]
3328 #[doc = "1) If processing occurs synchronously, it populates"]
3329 #[doc = "arg->key_materials_config, arg->status, and arg->error_details"]
3330 #[doc = "and returns zero."]
3331 #[doc = "2) If processing occurs asynchronously, it returns a non-zero value."]
3332 #[doc = "The application then invokes arg->cb when processing is completed. Note"]
3333 #[doc = "that arg->cb cannot be invoked before schedule API returns."]
3334 #[doc = "- cancel is a pointer to an application-provided callback used to cancel"]
3335 #[doc = "a credential reload request scheduled via an asynchronous schedule API."]
3336 #[doc = "arg is used to pinpoint an exact reloading request to be cancelled."]
3337 #[doc = "The operation may not have any effect if the request has already been"]
3338 #[doc = "processed."]
3339 #[doc = "- destruct is a pointer to an application-provided callback used to clean up"]
3340 #[doc = "any data associated with the config."]
3341 #[doc = "It is used for experimental purpose for now and subject to change."]
3342 pub fn grpc_tls_credential_reload_config_create(
3343 config_user_data: *const ::std::os::raw::c_void,
3344 schedule: ::std::option::Option<
3345 unsafe extern "C" fn(
3346 config_user_data: *mut ::std::os::raw::c_void,
3347 arg: *mut grpc_tls_credential_reload_arg,
3348 ) -> ::std::os::raw::c_int,
3349 >,
3350 cancel: ::std::option::Option<
3351 unsafe extern "C" fn(
3352 config_user_data: *mut ::std::os::raw::c_void,
3353 arg: *mut grpc_tls_credential_reload_arg,
3354 ),
3355 >,
3356 destruct: ::std::option::Option<
3357 unsafe extern "C" fn(config_user_data: *mut ::std::os::raw::c_void),
3358 >,
3359 ) -> *mut grpc_tls_credential_reload_config;
3360}
3361#[doc = " callback function provided by gRPC used to handle the result of server"]
3362#[doc = "authorization check. It is used when schedule API is implemented"]
3363#[doc = "asynchronously, and serves to bring the control back to gRPC C core. It is"]
3364#[doc = "used for experimental purpose for now and subject to change."]
3365pub type grpc_tls_on_server_authorization_check_done_cb =
3366 ::std::option::Option<unsafe extern "C" fn(arg: *mut grpc_tls_server_authorization_check_arg)>;
3367#[doc = " A struct containing all information necessary to schedule/cancel a server"]
3368#[doc = "authorization check request."]
3369#[doc = "- cb and cb_user_data represent a gRPC-provided callback and an argument"]
3370#[doc = "passed to it."]
3371#[doc = "- success will store the result of server authorization check. That is,"]
3372#[doc = "if success returns a non-zero value, it means the authorization check"]
3373#[doc = "passes and if returning zero, it means the check fails."]
3374#[doc = "- target_name is the name of an endpoint the channel is connecting to."]
3375#[doc = "- peer_cert represents a complete certificate chain including both"]
3376#[doc = "signing and leaf certificates."]
3377#[doc = "- status and error_details contain information"]
3378#[doc = "about errors occurred when a server authorization check request is"]
3379#[doc = "scheduled/cancelled."]
3380#[doc = "- config is a pointer to the unique"]
3381#[doc = "grpc_tls_server_authorization_check_config instance that this argument"]
3382#[doc = "corresponds to."]
3383#[doc = "- context is a pointer to a wrapped language implementation of this"]
3384#[doc = "grpc_tls_server_authorization_check_arg instance."]
3385#[doc = "- destroy_context is a pointer to a caller-provided method that cleans"]
3386#[doc = "up any data associated with the context pointer."]
3387#[doc = "It is used for experimental purpose for now and subject to change."]
3388#[repr(C)]
3389#[derive(Debug, Copy, Clone)]
3390pub struct grpc_tls_server_authorization_check_arg {
3391 pub cb: grpc_tls_on_server_authorization_check_done_cb,
3392 pub cb_user_data: *mut ::std::os::raw::c_void,
3393 pub success: ::std::os::raw::c_int,
3394 pub target_name: *const ::std::os::raw::c_char,
3395 pub peer_cert: *const ::std::os::raw::c_char,
3396 pub peer_cert_full_chain: *const ::std::os::raw::c_char,
3397 pub status: grpc_status_code::Type,
3398 pub error_details: *mut grpc_tls_error_details,
3399 pub config: *mut grpc_tls_server_authorization_check_config,
3400 pub context: *mut ::std::os::raw::c_void,
3401 pub destroy_context:
3402 ::std::option::Option<unsafe extern "C" fn(ctx: *mut ::std::os::raw::c_void)>,
3403}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003404extern "C" {
3405 #[doc = " Create a grpc_tls_server_authorization_check_config instance."]
3406 #[doc = "- config_user_data is config-specific, read-only user data"]
3407 #[doc = "that works for all channels created with a credential using the config."]
3408 #[doc = "- schedule is a pointer to an application-provided callback used to invoke"]
3409 #[doc = "server authorization check API. The implementation of this method has to"]
3410 #[doc = "be non-blocking, but can be performed synchronously or asynchronously."]
3411 #[doc = "1)If processing occurs synchronously, it populates arg->result,"]
3412 #[doc = "arg->status, and arg->error_details and returns zero."]
3413 #[doc = "2) If processing occurs asynchronously, it returns a non-zero value. The"]
3414 #[doc = "application then invokes arg->cb when processing is completed. Note that"]
3415 #[doc = "arg->cb cannot be invoked before schedule API returns."]
3416 #[doc = "- cancel is a pointer to an application-provided callback used to cancel a"]
3417 #[doc = "server authorization check request scheduled via an asynchronous schedule"]
3418 #[doc = "API. arg is used to pinpoint an exact check request to be cancelled. The"]
3419 #[doc = "operation may not have any effect if the request has already been"]
3420 #[doc = "processed."]
3421 #[doc = "- destruct is a pointer to an application-provided callback used to clean up"]
3422 #[doc = "any data associated with the config."]
3423 #[doc = "It is used for experimental purpose for now and subject to change."]
3424 pub fn grpc_tls_server_authorization_check_config_create(
3425 config_user_data: *const ::std::os::raw::c_void,
3426 schedule: ::std::option::Option<
3427 unsafe extern "C" fn(
3428 config_user_data: *mut ::std::os::raw::c_void,
3429 arg: *mut grpc_tls_server_authorization_check_arg,
3430 ) -> ::std::os::raw::c_int,
3431 >,
3432 cancel: ::std::option::Option<
3433 unsafe extern "C" fn(
3434 config_user_data: *mut ::std::os::raw::c_void,
3435 arg: *mut grpc_tls_server_authorization_check_arg,
3436 ),
3437 >,
3438 destruct: ::std::option::Option<
3439 unsafe extern "C" fn(config_user_data: *mut ::std::os::raw::c_void),
3440 >,
3441 ) -> *mut grpc_tls_server_authorization_check_config;
3442}
3443extern "C" {
3444 #[doc = " This method creates a TLS channel credential object."]
3445 #[doc = " It takes ownership of the options parameter. The security level"]
3446 #[doc = " of the resulting connection is GRPC_PRIVACY_AND_INTEGRITY."]
3447 #[doc = ""]
3448 #[doc = " - options: grpc TLS credentials options instance."]
3449 #[doc = ""]
3450 #[doc = " It returns the created credential object."]
3451 #[doc = ""]
3452 #[doc = " It is used for experimental purpose for now and subject"]
3453 #[doc = " to change."]
3454 pub fn grpc_tls_credentials_create(
3455 options: *mut grpc_tls_credentials_options,
3456 ) -> *mut grpc_channel_credentials;
3457}
3458extern "C" {
3459 #[doc = " This method creates a TLS server credential object."]
3460 #[doc = " It takes ownership of the options parameter."]
3461 #[doc = ""]
3462 #[doc = " - options: grpc TLS credentials options instance."]
3463 #[doc = ""]
3464 #[doc = " It returns the created credential object."]
3465 #[doc = ""]
3466 #[doc = " It is used for experimental purpose for now and subject"]
3467 #[doc = " to change."]
3468 pub fn grpc_tls_server_credentials_create(
3469 options: *mut grpc_tls_credentials_options,
3470 ) -> *mut grpc_server_credentials;
3471}
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003472extern "C" {
3473 #[doc = " EXPERIMENTAL API - Subject to change"]
3474 #[doc = ""]
3475 #[doc = " This method creates an XDS channel credentials object."]
3476 #[doc = ""]
3477 #[doc = " Creating a channel with credentials of this type indicates that an xDS"]
3478 #[doc = " channel should get credentials configuration from the xDS control plane."]
3479 #[doc = ""]
3480 #[doc = " \\a fallback_credentials are used if the channel target does not have the"]
3481 #[doc = " 'xds:///' scheme or if the xDS control plane does not provide information on"]
3482 #[doc = " how to fetch credentials dynamically. Does NOT take ownership of the \\a"]
3483 #[doc = " fallback_credentials. (Internally takes a ref to the object.)"]
3484 pub fn grpc_xds_credentials_create(
3485 fallback_credentials: *mut grpc_channel_credentials,
3486 ) -> *mut grpc_channel_credentials;
3487}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003488#[repr(u32)]
3489#[doc = " The severity of a log message - use the #defines below when calling into"]
3490#[doc = "gpr_log to additionally supply file and line data"]
3491#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
3492pub enum gpr_log_severity {
3493 GPR_LOG_SEVERITY_DEBUG = 0,
3494 GPR_LOG_SEVERITY_INFO = 1,
3495 GPR_LOG_SEVERITY_ERROR = 2,
3496}
3497extern "C" {
3498 #[doc = " Returns a string representation of the log severity"]
3499 pub fn gpr_log_severity_string(severity: gpr_log_severity) -> *const ::std::os::raw::c_char;
3500}
3501extern "C" {
3502 #[doc = " Log a message. It's advised to use GPR_xxx above to generate the context"]
3503 #[doc = " for each message"]
3504 pub fn gpr_log(
3505 file: *const ::std::os::raw::c_char,
3506 line: ::std::os::raw::c_int,
3507 severity: gpr_log_severity,
3508 format: *const ::std::os::raw::c_char,
3509 ...
3510 );
3511}
3512extern "C" {
3513 pub fn gpr_should_log(severity: gpr_log_severity) -> ::std::os::raw::c_int;
3514}
3515extern "C" {
3516 pub fn gpr_log_message(
3517 file: *const ::std::os::raw::c_char,
3518 line: ::std::os::raw::c_int,
3519 severity: gpr_log_severity,
3520 message: *const ::std::os::raw::c_char,
3521 );
3522}
3523extern "C" {
3524 #[doc = " Set global log verbosity"]
3525 pub fn gpr_set_log_verbosity(min_severity_to_print: gpr_log_severity);
3526}
3527extern "C" {
3528 pub fn gpr_log_verbosity_init();
3529}
3530#[doc = " Log overrides: applications can use this API to intercept logging calls"]
3531#[doc = "and use their own implementations"]
3532#[repr(C)]
3533#[derive(Debug, Copy, Clone)]
3534pub struct gpr_log_func_args {
3535 pub file: *const ::std::os::raw::c_char,
3536 pub line: ::std::os::raw::c_int,
3537 pub severity: gpr_log_severity,
3538 pub message: *const ::std::os::raw::c_char,
3539}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003540pub type gpr_log_func = ::std::option::Option<unsafe extern "C" fn(args: *mut gpr_log_func_args)>;
3541extern "C" {
3542 pub fn gpr_set_log_function(func: gpr_log_func);
3543}
3544extern "C" {
3545 #[doc = " malloc."]
3546 #[doc = " If size==0, always returns NULL. Otherwise this function never returns NULL."]
3547 #[doc = " The pointer returned is suitably aligned for any kind of variable it could"]
3548 #[doc = " contain."]
3549 pub fn gpr_malloc(size: usize) -> *mut ::std::os::raw::c_void;
3550}
3551extern "C" {
3552 #[doc = " like malloc, but zero all bytes before returning them"]
3553 pub fn gpr_zalloc(size: usize) -> *mut ::std::os::raw::c_void;
3554}
3555extern "C" {
3556 #[doc = " free"]
3557 pub fn gpr_free(ptr: *mut ::std::os::raw::c_void);
3558}
3559extern "C" {
3560 #[doc = " realloc, never returns NULL"]
3561 pub fn gpr_realloc(p: *mut ::std::os::raw::c_void, size: usize) -> *mut ::std::os::raw::c_void;
3562}
3563extern "C" {
3564 #[doc = " aligned malloc, never returns NULL, will align to alignment, which"]
3565 #[doc = " must be a power of 2."]
3566 pub fn gpr_malloc_aligned(size: usize, alignment: usize) -> *mut ::std::os::raw::c_void;
3567}
3568extern "C" {
3569 #[doc = " free memory allocated by gpr_malloc_aligned"]
3570 pub fn gpr_free_aligned(ptr: *mut ::std::os::raw::c_void);
3571}
3572extern "C" {
3573 #[doc = " Return the number of CPU cores on the current system. Will return 0 if"]
3574 #[doc = "the information is not available."]
3575 pub fn gpr_cpu_num_cores() -> ::std::os::raw::c_uint;
3576}
3577extern "C" {
3578 #[doc = " Return the CPU on which the current thread is executing; N.B. This should"]
3579 #[doc = "be considered advisory only - it is possible that the thread is switched"]
3580 #[doc = "to a different CPU at any time. Returns a value in range"]
3581 #[doc = "[0, gpr_cpu_num_cores() - 1]"]
3582 pub fn gpr_cpu_current_cpu() -> ::std::os::raw::c_uint;
3583}
3584extern "C" {
3585 #[doc = " Returns a string allocated with gpr_malloc that contains a UTF-8"]
3586 #[doc = " formatted error message, corresponding to the error messageid."]
3587 #[doc = " Use in conjunction with GetLastError() et al."]
3588 pub fn gpr_format_message(messageid: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
3589}
3590extern "C" {
3591 #[doc = " Returns a copy of src that can be passed to gpr_free()."]
3592 #[doc = "If allocation fails or if src is NULL, returns NULL."]
3593 pub fn gpr_strdup(src: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
3594}
3595extern "C" {
3596 #[doc = " printf to a newly-allocated string. The set of supported formats may vary"]
3597 #[doc = "between platforms."]
3598 #[doc = ""]
3599 #[doc = "On success, returns the number of bytes printed (excluding the final '\\0'),"]
3600 #[doc = "and *strp points to a string which must later be destroyed with gpr_free()."]
3601 #[doc = ""]
3602 #[doc = "On error, returns -1 and sets *strp to NULL. If the format string is bad,"]
3603 #[doc = "the result is undefined."]
3604 pub fn gpr_asprintf(
3605 strp: *mut *mut ::std::os::raw::c_char,
3606 format: *const ::std::os::raw::c_char,
3607 ...
3608 ) -> ::std::os::raw::c_int;
3609}
3610pub type gpr_thd_id = usize;
3611extern "C" {
3612 #[doc = " Returns the identifier of the current thread."]
3613 pub fn gpr_thd_currentid() -> gpr_thd_id;
3614}
3615#[doc = " Reader for byte buffers. Iterates over slices in the byte buffer"]
3616#[repr(C)]
3617#[derive(Copy, Clone)]
3618pub struct grpc_byte_buffer_reader {
3619 pub buffer_in: *mut grpc_byte_buffer,
3620 pub buffer_out: *mut grpc_byte_buffer,
3621 pub current: grpc_byte_buffer_reader_grpc_byte_buffer_reader_current,
3622}
3623#[doc = " Different current objects correspond to different types of byte buffers"]
3624#[repr(C)]
3625#[derive(Copy, Clone)]
3626pub union grpc_byte_buffer_reader_grpc_byte_buffer_reader_current {
3627 #[doc = " Index into a slice buffer's array of slices"]
3628 pub index: ::std::os::raw::c_uint,
3629 _bindgen_union_align: u32,
3630}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003631impl ::std::fmt::Debug for grpc_byte_buffer_reader_grpc_byte_buffer_reader_current {
3632 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3633 write!(
3634 f,
3635 "grpc_byte_buffer_reader_grpc_byte_buffer_reader_current {{ union }}"
3636 )
3637 }
3638}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003639impl ::std::fmt::Debug for grpc_byte_buffer_reader {
3640 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
3641 write!(
3642 f,
3643 "grpc_byte_buffer_reader {{ buffer_in: {:?}, buffer_out: {:?}, current: {:?} }}",
3644 self.buffer_in, self.buffer_out, self.current
3645 )
3646 }
3647}
3648#[repr(C)]
3649#[derive(Copy, Clone)]
3650pub struct grpcwrap_batch_context {
3651 pub send_initial_metadata: grpc_metadata_array,
3652 pub send_message: *mut grpc_byte_buffer,
3653 pub send_status_from_server: grpcwrap_batch_context__bindgen_ty_1,
3654 pub recv_initial_metadata: grpc_metadata_array,
3655 pub recv_message: *mut grpc_byte_buffer,
3656 pub recv_status_on_client: grpcwrap_batch_context__bindgen_ty_2,
3657 pub recv_close_on_server_cancelled: ::std::os::raw::c_int,
3658}
3659#[repr(C)]
3660#[derive(Debug, Copy, Clone)]
3661pub struct grpcwrap_batch_context__bindgen_ty_1 {
3662 pub trailing_metadata: grpc_metadata_array,
3663}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003664#[repr(C)]
3665#[derive(Copy, Clone)]
3666pub struct grpcwrap_batch_context__bindgen_ty_2 {
3667 pub trailing_metadata: grpc_metadata_array,
3668 pub status: grpc_status_code::Type,
3669 pub status_details: grpc_slice,
3670}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003671impl ::std::fmt::Debug for grpcwrap_batch_context__bindgen_ty_2 {
3672 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003673 write ! (f , "grpcwrap_batch_context__bindgen_ty_2 {{ trailing_metadata: {:?}, status: {:?}, status_details: {:?} }}" , self . trailing_metadata , self . status , self . status_details)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003674 }
3675}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003676impl ::std::fmt::Debug for grpcwrap_batch_context {
3677 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003678 write ! (f , "grpcwrap_batch_context {{ send_initial_metadata: {:?}, send_message: {:?}, send_status_from_server: {:?}, recv_initial_metadata: {:?}, recv_message: {:?}, recv_status_on_client: {:?}, recv_close_on_server_cancelled: {:?} }}" , self . send_initial_metadata , self . send_message , self . send_status_from_server , self . recv_initial_metadata , self . recv_message , self . recv_status_on_client , self . recv_close_on_server_cancelled)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003679 }
3680}
3681extern "C" {
3682 pub fn grpcwrap_batch_context_create() -> *mut grpcwrap_batch_context;
3683}
3684#[repr(C)]
3685#[derive(Copy, Clone)]
3686pub struct grpcwrap_request_call_context {
3687 pub call: *mut grpc_call,
3688 pub call_details: grpc_call_details,
3689 pub request_metadata: grpc_metadata_array,
3690}
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003691impl ::std::fmt::Debug for grpcwrap_request_call_context {
3692 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003693 write ! (f , "grpcwrap_request_call_context {{ call: {:?}, call_details: {:?}, request_metadata: {:?} }}" , self . call , self . call_details , self . request_metadata)
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003694 }
3695}
3696extern "C" {
3697 pub fn grpcwrap_request_call_context_create() -> *mut grpcwrap_request_call_context;
3698}
3699extern "C" {
3700 #[link_name = "\u{1}_Z45grpcwrap_metadata_array_destroy_metadata_onlyP19grpc_metadata_array"]
3701 pub fn grpcwrap_metadata_array_destroy_metadata_only(array: *mut grpc_metadata_array);
3702}
3703extern "C" {
3704 #[link_name = "\u{1}_Z58grpcwrap_metadata_array_destroy_metadata_including_entriesP19grpc_metadata_array"]
3705 pub fn grpcwrap_metadata_array_destroy_metadata_including_entries(
3706 array: *mut grpc_metadata_array,
3707 );
3708}
3709extern "C" {
3710 pub fn grpcwrap_metadata_array_destroy_full(array: *mut grpc_metadata_array);
3711}
3712extern "C" {
3713 pub fn grpcwrap_metadata_array_init(array: *mut grpc_metadata_array, capacity: usize);
3714}
3715extern "C" {
3716 pub fn grpcwrap_metadata_array_add(
3717 array: *mut grpc_metadata_array,
3718 key: *const ::std::os::raw::c_char,
3719 key_length: usize,
3720 value: *const ::std::os::raw::c_char,
3721 value_length: usize,
3722 );
3723}
3724extern "C" {
3725 pub fn grpcwrap_metadata_array_get_key(
3726 array: *const grpc_metadata_array,
3727 index: usize,
3728 key_length: *mut usize,
3729 ) -> *const ::std::os::raw::c_char;
3730}
3731extern "C" {
3732 pub fn grpcwrap_metadata_array_get_value(
3733 array: *const grpc_metadata_array,
3734 index: usize,
3735 value_length: *mut usize,
3736 ) -> *const ::std::os::raw::c_char;
3737}
3738extern "C" {
3739 pub fn grpcwrap_metadata_array_cleanup(array: *mut grpc_metadata_array);
3740}
3741extern "C" {
3742 pub fn grpcwrap_metadata_array_shrink_to_fit(array: *mut grpc_metadata_array);
3743}
3744extern "C" {
3745 #[link_name = "\u{1}_Z28grpcwrap_metadata_array_moveP19grpc_metadata_arrayS0_"]
3746 pub fn grpcwrap_metadata_array_move(
3747 dest: *mut grpc_metadata_array,
3748 src: *mut grpc_metadata_array,
3749 );
3750}
3751extern "C" {
3752 pub fn grpcwrap_batch_context_destroy(ctx: *mut grpcwrap_batch_context);
3753}
3754extern "C" {
3755 pub fn grpcwrap_request_call_context_destroy(ctx: *mut grpcwrap_request_call_context);
3756}
3757extern "C" {
3758 pub fn grpcwrap_batch_context_recv_initial_metadata(
3759 ctx: *const grpcwrap_batch_context,
3760 ) -> *const grpc_metadata_array;
3761}
3762extern "C" {
3763 pub fn grpcwrap_slice_raw_offset(
3764 slice: *const grpc_slice,
3765 offset: usize,
3766 len: *mut usize,
3767 ) -> *const ::std::os::raw::c_char;
3768}
3769extern "C" {
3770 pub fn grpcwrap_slice_copy(slice: *const grpc_slice) -> grpc_slice;
3771}
3772extern "C" {
3773 pub fn grpcwrap_slice_unref(slice: *const grpc_slice);
3774}
3775extern "C" {
3776 pub fn grpcwrap_slice_ref(slice: *const grpc_slice) -> grpc_slice;
3777}
3778extern "C" {
3779 pub fn grpcwrap_slice_length(slice: *const grpc_slice) -> usize;
3780}
3781extern "C" {
3782 pub fn grpcwrap_batch_context_take_recv_message(
3783 ctx: *mut grpcwrap_batch_context,
3784 ) -> *mut grpc_byte_buffer;
3785}
3786extern "C" {
3787 pub fn grpcwrap_batch_context_recv_status_on_client_status(
3788 ctx: *const grpcwrap_batch_context,
3789 ) -> grpc_status_code::Type;
3790}
3791extern "C" {
3792 pub fn grpcwrap_batch_context_recv_status_on_client_details(
3793 ctx: *const grpcwrap_batch_context,
3794 details_length: *mut usize,
3795 ) -> *const ::std::os::raw::c_char;
3796}
3797extern "C" {
3798 pub fn grpcwrap_batch_context_recv_status_on_client_trailing_metadata(
3799 ctx: *const grpcwrap_batch_context,
3800 ) -> *const grpc_metadata_array;
3801}
3802extern "C" {
3803 pub fn grpcwrap_request_call_context_ref_call(
3804 ctx: *mut grpcwrap_request_call_context,
3805 ) -> *mut grpc_call;
3806}
3807extern "C" {
3808 pub fn grpcwrap_request_call_context_get_call(
3809 ctx: *mut grpcwrap_request_call_context,
3810 ) -> *mut grpc_call;
3811}
3812extern "C" {
3813 pub fn grpcwrap_request_call_context_method(
3814 ctx: *const grpcwrap_request_call_context,
3815 method_length: *mut usize,
3816 ) -> *const ::std::os::raw::c_char;
3817}
3818extern "C" {
3819 pub fn grpcwrap_request_call_context_host(
3820 ctx: *const grpcwrap_request_call_context,
3821 host_length: *mut usize,
3822 ) -> *const ::std::os::raw::c_char;
3823}
3824extern "C" {
3825 pub fn grpcwrap_request_call_context_deadline(
3826 ctx: *const grpcwrap_request_call_context,
3827 ) -> gpr_timespec;
3828}
3829extern "C" {
3830 pub fn grpcwrap_request_call_context_metadata_array(
3831 ctx: *const grpcwrap_request_call_context,
3832 ) -> *const grpc_metadata_array;
3833}
3834extern "C" {
3835 pub fn grpcwrap_batch_context_recv_close_on_server_cancelled(
3836 ctx: *const grpcwrap_batch_context,
3837 ) -> i32;
3838}
3839extern "C" {
3840 pub fn grpcwrap_channel_create_call(
3841 channel: *mut grpc_channel,
3842 parent_call: *mut grpc_call,
3843 propagation_mask: u32,
3844 cq: *mut grpc_completion_queue,
3845 method: *const ::std::os::raw::c_char,
3846 method_len: usize,
3847 host: *const ::std::os::raw::c_char,
3848 host_len: usize,
3849 deadline: gpr_timespec,
3850 ) -> *mut grpc_call;
3851}
3852extern "C" {
3853 pub fn grpcwrap_channel_args_create(num_args: usize) -> *mut grpc_channel_args;
3854}
3855extern "C" {
3856 pub fn grpcwrap_channel_args_set_string(
3857 args: *mut grpc_channel_args,
3858 index: usize,
3859 key: *const ::std::os::raw::c_char,
3860 value: *const ::std::os::raw::c_char,
3861 );
3862}
3863extern "C" {
3864 pub fn grpcwrap_channel_args_set_integer(
3865 args: *mut grpc_channel_args,
3866 index: usize,
3867 key: *const ::std::os::raw::c_char,
3868 value: ::std::os::raw::c_int,
3869 );
3870}
3871extern "C" {
3872 pub fn grpcwrap_channel_args_set_pointer_vtable(
3873 args: *mut grpc_channel_args,
3874 index: usize,
3875 key: *const ::std::os::raw::c_char,
3876 value: *mut ::std::os::raw::c_void,
3877 vtable: *const grpc_arg_pointer_vtable,
3878 );
3879}
3880extern "C" {
3881 pub fn grpcwrap_channel_args_destroy(args: *mut grpc_channel_args);
3882}
3883extern "C" {
3884 pub fn grpcwrap_call_start_unary(
3885 call: *mut grpc_call,
3886 ctx: *mut grpcwrap_batch_context,
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003887 send_buffer: *mut grpc_slice,
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003888 write_flags: u32,
3889 initial_metadata: *mut grpc_metadata_array,
3890 initial_metadata_flags: u32,
3891 tag: *mut ::std::os::raw::c_void,
3892 ) -> grpc_call_error;
3893}
3894extern "C" {
3895 pub fn grpcwrap_call_start_client_streaming(
3896 call: *mut grpc_call,
3897 ctx: *mut grpcwrap_batch_context,
3898 initial_metadata: *mut grpc_metadata_array,
3899 initial_metadata_flags: u32,
3900 tag: *mut ::std::os::raw::c_void,
3901 ) -> grpc_call_error;
3902}
3903extern "C" {
3904 pub fn grpcwrap_call_start_server_streaming(
3905 call: *mut grpc_call,
3906 ctx: *mut grpcwrap_batch_context,
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003907 send_buffer: *mut grpc_slice,
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003908 write_flags: u32,
3909 initial_metadata: *mut grpc_metadata_array,
3910 initial_metadata_flags: u32,
3911 tag: *mut ::std::os::raw::c_void,
3912 ) -> grpc_call_error;
3913}
3914extern "C" {
3915 pub fn grpcwrap_call_start_duplex_streaming(
3916 call: *mut grpc_call,
3917 ctx: *mut grpcwrap_batch_context,
3918 initial_metadata: *mut grpc_metadata_array,
3919 initial_metadata_flags: u32,
3920 tag: *mut ::std::os::raw::c_void,
3921 ) -> grpc_call_error;
3922}
3923extern "C" {
3924 pub fn grpcwrap_call_recv_initial_metadata(
3925 call: *mut grpc_call,
3926 ctx: *mut grpcwrap_batch_context,
3927 tag: *mut ::std::os::raw::c_void,
3928 ) -> grpc_call_error;
3929}
3930extern "C" {
3931 pub fn grpcwrap_call_send_message(
3932 call: *mut grpc_call,
3933 ctx: *mut grpcwrap_batch_context,
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003934 send_buffer: *mut grpc_slice,
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003935 write_flags: u32,
3936 send_empty_initial_metadata: i32,
3937 tag: *mut ::std::os::raw::c_void,
3938 ) -> grpc_call_error;
3939}
3940extern "C" {
3941 pub fn grpcwrap_call_send_close_from_client(
3942 call: *mut grpc_call,
3943 tag: *mut ::std::os::raw::c_void,
3944 ) -> grpc_call_error;
3945}
3946extern "C" {
3947 pub fn grpcwrap_call_send_status_from_server(
3948 call: *mut grpc_call,
3949 ctx: *mut grpcwrap_batch_context,
3950 status_code: grpc_status_code::Type,
3951 status_details: *const ::std::os::raw::c_char,
3952 status_details_len: usize,
3953 trailing_metadata: *mut grpc_metadata_array,
3954 send_empty_initial_metadata: i32,
Jeff Vander Stoep08902cf2020-11-19 19:03:52 +01003955 optional_send_buffer: *mut grpc_slice,
Jeff Vander Stoep3adfea82020-10-14 15:35:59 +02003956 write_flags: u32,
3957 tag: *mut ::std::os::raw::c_void,
3958 ) -> grpc_call_error;
3959}
3960extern "C" {
3961 pub fn grpcwrap_call_recv_message(
3962 call: *mut grpc_call,
3963 ctx: *mut grpcwrap_batch_context,
3964 tag: *mut ::std::os::raw::c_void,
3965 ) -> grpc_call_error;
3966}
3967extern "C" {
3968 pub fn grpcwrap_call_start_serverside(
3969 call: *mut grpc_call,
3970 ctx: *mut grpcwrap_batch_context,
3971 tag: *mut ::std::os::raw::c_void,
3972 ) -> grpc_call_error;
3973}
3974extern "C" {
3975 pub fn grpcwrap_call_send_initial_metadata(
3976 call: *mut grpc_call,
3977 ctx: *mut grpcwrap_batch_context,
3978 initial_metadata: *mut grpc_metadata_array,
3979 tag: *mut ::std::os::raw::c_void,
3980 ) -> grpc_call_error;
3981}
3982extern "C" {
3983 #[doc = " Kick call's completion queue, it should be called after there is an event"]
3984 #[doc = "ready to poll."]
3985 #[doc = "THREAD SAFETY: grpcwrap_call_kick_completion_queue is thread-safe"]
3986 #[doc = "because it does not change the call's state."]
3987 pub fn grpcwrap_call_kick_completion_queue(
3988 call: *mut grpc_call,
3989 tag: *mut ::std::os::raw::c_void,
3990 ) -> grpc_call_error;
3991}
3992extern "C" {
3993 pub fn grpcwrap_server_request_call(
3994 server: *mut grpc_server,
3995 cq: *mut grpc_completion_queue,
3996 ctx: *mut grpcwrap_request_call_context,
3997 tag: *mut ::std::os::raw::c_void,
3998 ) -> grpc_call_error;
3999}