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