2 #region Copyright notice and license
4 // Copyright 2015 gRPC authors.
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
21 using System.Collections.Concurrent;
22 using System.Diagnostics;
24 using System.Reflection;
25 using System.Runtime.InteropServices;
26 using System.Threading;
28 using Grpc.Core.Logging;
29 using Grpc.Core.Utils;
31 namespace Grpc.Core.Internal
33 internal partial class NativeMethods
35 #region Native methods
37 public readonly Delegates.grpcsharp_init_delegate grpcsharp_init;
38 public readonly Delegates.grpcsharp_shutdown_delegate grpcsharp_shutdown;
39 public readonly Delegates.grpcsharp_version_string_delegate grpcsharp_version_string;
40 public readonly Delegates.grpcsharp_batch_context_create_delegate grpcsharp_batch_context_create;
41 public readonly Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate grpcsharp_batch_context_recv_initial_metadata;
42 public readonly Delegates.grpcsharp_batch_context_recv_message_length_delegate grpcsharp_batch_context_recv_message_length;
43 public readonly Delegates.grpcsharp_batch_context_recv_message_next_slice_peek_delegate grpcsharp_batch_context_recv_message_next_slice_peek;
44 public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate grpcsharp_batch_context_recv_status_on_client_status;
45 public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate grpcsharp_batch_context_recv_status_on_client_details;
46 public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
47 public readonly Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate grpcsharp_batch_context_recv_close_on_server_cancelled;
48 public readonly Delegates.grpcsharp_batch_context_reset_delegate grpcsharp_batch_context_reset;
49 public readonly Delegates.grpcsharp_batch_context_destroy_delegate grpcsharp_batch_context_destroy;
50 public readonly Delegates.grpcsharp_request_call_context_create_delegate grpcsharp_request_call_context_create;
51 public readonly Delegates.grpcsharp_request_call_context_call_delegate grpcsharp_request_call_context_call;
52 public readonly Delegates.grpcsharp_request_call_context_method_delegate grpcsharp_request_call_context_method;
53 public readonly Delegates.grpcsharp_request_call_context_host_delegate grpcsharp_request_call_context_host;
54 public readonly Delegates.grpcsharp_request_call_context_deadline_delegate grpcsharp_request_call_context_deadline;
55 public readonly Delegates.grpcsharp_request_call_context_request_metadata_delegate grpcsharp_request_call_context_request_metadata;
56 public readonly Delegates.grpcsharp_request_call_context_reset_delegate grpcsharp_request_call_context_reset;
57 public readonly Delegates.grpcsharp_request_call_context_destroy_delegate grpcsharp_request_call_context_destroy;
58 public readonly Delegates.grpcsharp_composite_call_credentials_create_delegate grpcsharp_composite_call_credentials_create;
59 public readonly Delegates.grpcsharp_call_credentials_release_delegate grpcsharp_call_credentials_release;
60 public readonly Delegates.grpcsharp_call_cancel_delegate grpcsharp_call_cancel;
61 public readonly Delegates.grpcsharp_call_cancel_with_status_delegate grpcsharp_call_cancel_with_status;
62 public readonly Delegates.grpcsharp_call_start_unary_delegate grpcsharp_call_start_unary;
63 public readonly Delegates.grpcsharp_call_start_client_streaming_delegate grpcsharp_call_start_client_streaming;
64 public readonly Delegates.grpcsharp_call_start_server_streaming_delegate grpcsharp_call_start_server_streaming;
65 public readonly Delegates.grpcsharp_call_start_duplex_streaming_delegate grpcsharp_call_start_duplex_streaming;
66 public readonly Delegates.grpcsharp_call_send_message_delegate grpcsharp_call_send_message;
67 public readonly Delegates.grpcsharp_call_send_close_from_client_delegate grpcsharp_call_send_close_from_client;
68 public readonly Delegates.grpcsharp_call_send_status_from_server_delegate grpcsharp_call_send_status_from_server;
69 public readonly Delegates.grpcsharp_call_recv_message_delegate grpcsharp_call_recv_message;
70 public readonly Delegates.grpcsharp_call_recv_initial_metadata_delegate grpcsharp_call_recv_initial_metadata;
71 public readonly Delegates.grpcsharp_call_start_serverside_delegate grpcsharp_call_start_serverside;
72 public readonly Delegates.grpcsharp_call_send_initial_metadata_delegate grpcsharp_call_send_initial_metadata;
73 public readonly Delegates.grpcsharp_call_set_credentials_delegate grpcsharp_call_set_credentials;
74 public readonly Delegates.grpcsharp_call_get_peer_delegate grpcsharp_call_get_peer;
75 public readonly Delegates.grpcsharp_call_destroy_delegate grpcsharp_call_destroy;
76 public readonly Delegates.grpcsharp_channel_args_create_delegate grpcsharp_channel_args_create;
77 public readonly Delegates.grpcsharp_channel_args_set_string_delegate grpcsharp_channel_args_set_string;
78 public readonly Delegates.grpcsharp_channel_args_set_integer_delegate grpcsharp_channel_args_set_integer;
79 public readonly Delegates.grpcsharp_channel_args_destroy_delegate grpcsharp_channel_args_destroy;
80 public readonly Delegates.grpcsharp_override_default_ssl_roots_delegate grpcsharp_override_default_ssl_roots;
81 public readonly Delegates.grpcsharp_ssl_credentials_create_delegate grpcsharp_ssl_credentials_create;
82 public readonly Delegates.grpcsharp_composite_channel_credentials_create_delegate grpcsharp_composite_channel_credentials_create;
83 public readonly Delegates.grpcsharp_channel_credentials_release_delegate grpcsharp_channel_credentials_release;
84 public readonly Delegates.grpcsharp_insecure_channel_create_delegate grpcsharp_insecure_channel_create;
85 public readonly Delegates.grpcsharp_secure_channel_create_delegate grpcsharp_secure_channel_create;
86 public readonly Delegates.grpcsharp_channel_create_call_delegate grpcsharp_channel_create_call;
87 public readonly Delegates.grpcsharp_channel_check_connectivity_state_delegate grpcsharp_channel_check_connectivity_state;
88 public readonly Delegates.grpcsharp_channel_watch_connectivity_state_delegate grpcsharp_channel_watch_connectivity_state;
89 public readonly Delegates.grpcsharp_channel_get_target_delegate grpcsharp_channel_get_target;
90 public readonly Delegates.grpcsharp_channel_destroy_delegate grpcsharp_channel_destroy;
91 public readonly Delegates.grpcsharp_sizeof_grpc_event_delegate grpcsharp_sizeof_grpc_event;
92 public readonly Delegates.grpcsharp_completion_queue_create_async_delegate grpcsharp_completion_queue_create_async;
93 public readonly Delegates.grpcsharp_completion_queue_create_sync_delegate grpcsharp_completion_queue_create_sync;
94 public readonly Delegates.grpcsharp_completion_queue_shutdown_delegate grpcsharp_completion_queue_shutdown;
95 public readonly Delegates.grpcsharp_completion_queue_next_delegate grpcsharp_completion_queue_next;
96 public readonly Delegates.grpcsharp_completion_queue_pluck_delegate grpcsharp_completion_queue_pluck;
97 public readonly Delegates.grpcsharp_completion_queue_destroy_delegate grpcsharp_completion_queue_destroy;
98 public readonly Delegates.gprsharp_free_delegate gprsharp_free;
99 public readonly Delegates.grpcsharp_metadata_array_create_delegate grpcsharp_metadata_array_create;
100 public readonly Delegates.grpcsharp_metadata_array_add_delegate grpcsharp_metadata_array_add;
101 public readonly Delegates.grpcsharp_metadata_array_count_delegate grpcsharp_metadata_array_count;
102 public readonly Delegates.grpcsharp_metadata_array_get_key_delegate grpcsharp_metadata_array_get_key;
103 public readonly Delegates.grpcsharp_metadata_array_get_value_delegate grpcsharp_metadata_array_get_value;
104 public readonly Delegates.grpcsharp_metadata_array_destroy_full_delegate grpcsharp_metadata_array_destroy_full;
105 public readonly Delegates.grpcsharp_redirect_log_delegate grpcsharp_redirect_log;
106 public readonly Delegates.grpcsharp_native_callback_dispatcher_init_delegate grpcsharp_native_callback_dispatcher_init;
107 public readonly Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate grpcsharp_metadata_credentials_create_from_plugin;
108 public readonly Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate grpcsharp_metadata_credentials_notify_from_plugin;
109 public readonly Delegates.grpcsharp_ssl_server_credentials_create_delegate grpcsharp_ssl_server_credentials_create;
110 public readonly Delegates.grpcsharp_server_credentials_release_delegate grpcsharp_server_credentials_release;
111 public readonly Delegates.grpcsharp_server_create_delegate grpcsharp_server_create;
112 public readonly Delegates.grpcsharp_server_register_completion_queue_delegate grpcsharp_server_register_completion_queue;
113 public readonly Delegates.grpcsharp_server_add_insecure_http2_port_delegate grpcsharp_server_add_insecure_http2_port;
114 public readonly Delegates.grpcsharp_server_add_secure_http2_port_delegate grpcsharp_server_add_secure_http2_port;
115 public readonly Delegates.grpcsharp_server_start_delegate grpcsharp_server_start;
116 public readonly Delegates.grpcsharp_server_request_call_delegate grpcsharp_server_request_call;
117 public readonly Delegates.grpcsharp_server_cancel_all_calls_delegate grpcsharp_server_cancel_all_calls;
118 public readonly Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate grpcsharp_server_shutdown_and_notify_callback;
119 public readonly Delegates.grpcsharp_server_destroy_delegate grpcsharp_server_destroy;
120 public readonly Delegates.grpcsharp_call_auth_context_delegate grpcsharp_call_auth_context;
121 public readonly Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate grpcsharp_auth_context_peer_identity_property_name;
122 public readonly Delegates.grpcsharp_auth_context_property_iterator_delegate grpcsharp_auth_context_property_iterator;
123 public readonly Delegates.grpcsharp_auth_property_iterator_next_delegate grpcsharp_auth_property_iterator_next;
124 public readonly Delegates.grpcsharp_auth_context_release_delegate grpcsharp_auth_context_release;
125 public readonly Delegates.gprsharp_now_delegate gprsharp_now;
126 public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future;
127 public readonly Delegates.gprsharp_inf_past_delegate gprsharp_inf_past;
128 public readonly Delegates.gprsharp_convert_clock_type_delegate gprsharp_convert_clock_type;
129 public readonly Delegates.gprsharp_sizeof_timespec_delegate gprsharp_sizeof_timespec;
130 public readonly Delegates.grpcsharp_test_callback_delegate grpcsharp_test_callback;
131 public readonly Delegates.grpcsharp_test_nop_delegate grpcsharp_test_nop;
132 public readonly Delegates.grpcsharp_test_override_method_delegate grpcsharp_test_override_method;
136 public NativeMethods(UnmanagedLibrary library)
138 this.grpcsharp_init = GetMethodDelegate<Delegates.grpcsharp_init_delegate>(library);
139 this.grpcsharp_shutdown = GetMethodDelegate<Delegates.grpcsharp_shutdown_delegate>(library);
140 this.grpcsharp_version_string = GetMethodDelegate<Delegates.grpcsharp_version_string_delegate>(library);
141 this.grpcsharp_batch_context_create = GetMethodDelegate<Delegates.grpcsharp_batch_context_create_delegate>(library);
142 this.grpcsharp_batch_context_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate>(library);
143 this.grpcsharp_batch_context_recv_message_length = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_length_delegate>(library);
144 this.grpcsharp_batch_context_recv_message_next_slice_peek = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_next_slice_peek_delegate>(library);
145 this.grpcsharp_batch_context_recv_status_on_client_status = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate>(library);
146 this.grpcsharp_batch_context_recv_status_on_client_details = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate>(library);
147 this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate>(library);
148 this.grpcsharp_batch_context_recv_close_on_server_cancelled = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate>(library);
149 this.grpcsharp_batch_context_reset = GetMethodDelegate<Delegates.grpcsharp_batch_context_reset_delegate>(library);
150 this.grpcsharp_batch_context_destroy = GetMethodDelegate<Delegates.grpcsharp_batch_context_destroy_delegate>(library);
151 this.grpcsharp_request_call_context_create = GetMethodDelegate<Delegates.grpcsharp_request_call_context_create_delegate>(library);
152 this.grpcsharp_request_call_context_call = GetMethodDelegate<Delegates.grpcsharp_request_call_context_call_delegate>(library);
153 this.grpcsharp_request_call_context_method = GetMethodDelegate<Delegates.grpcsharp_request_call_context_method_delegate>(library);
154 this.grpcsharp_request_call_context_host = GetMethodDelegate<Delegates.grpcsharp_request_call_context_host_delegate>(library);
155 this.grpcsharp_request_call_context_deadline = GetMethodDelegate<Delegates.grpcsharp_request_call_context_deadline_delegate>(library);
156 this.grpcsharp_request_call_context_request_metadata = GetMethodDelegate<Delegates.grpcsharp_request_call_context_request_metadata_delegate>(library);
157 this.grpcsharp_request_call_context_reset = GetMethodDelegate<Delegates.grpcsharp_request_call_context_reset_delegate>(library);
158 this.grpcsharp_request_call_context_destroy = GetMethodDelegate<Delegates.grpcsharp_request_call_context_destroy_delegate>(library);
159 this.grpcsharp_composite_call_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_call_credentials_create_delegate>(library);
160 this.grpcsharp_call_credentials_release = GetMethodDelegate<Delegates.grpcsharp_call_credentials_release_delegate>(library);
161 this.grpcsharp_call_cancel = GetMethodDelegate<Delegates.grpcsharp_call_cancel_delegate>(library);
162 this.grpcsharp_call_cancel_with_status = GetMethodDelegate<Delegates.grpcsharp_call_cancel_with_status_delegate>(library);
163 this.grpcsharp_call_start_unary = GetMethodDelegate<Delegates.grpcsharp_call_start_unary_delegate>(library);
164 this.grpcsharp_call_start_client_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_client_streaming_delegate>(library);
165 this.grpcsharp_call_start_server_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_server_streaming_delegate>(library);
166 this.grpcsharp_call_start_duplex_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_duplex_streaming_delegate>(library);
167 this.grpcsharp_call_send_message = GetMethodDelegate<Delegates.grpcsharp_call_send_message_delegate>(library);
168 this.grpcsharp_call_send_close_from_client = GetMethodDelegate<Delegates.grpcsharp_call_send_close_from_client_delegate>(library);
169 this.grpcsharp_call_send_status_from_server = GetMethodDelegate<Delegates.grpcsharp_call_send_status_from_server_delegate>(library);
170 this.grpcsharp_call_recv_message = GetMethodDelegate<Delegates.grpcsharp_call_recv_message_delegate>(library);
171 this.grpcsharp_call_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_recv_initial_metadata_delegate>(library);
172 this.grpcsharp_call_start_serverside = GetMethodDelegate<Delegates.grpcsharp_call_start_serverside_delegate>(library);
173 this.grpcsharp_call_send_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_send_initial_metadata_delegate>(library);
174 this.grpcsharp_call_set_credentials = GetMethodDelegate<Delegates.grpcsharp_call_set_credentials_delegate>(library);
175 this.grpcsharp_call_get_peer = GetMethodDelegate<Delegates.grpcsharp_call_get_peer_delegate>(library);
176 this.grpcsharp_call_destroy = GetMethodDelegate<Delegates.grpcsharp_call_destroy_delegate>(library);
177 this.grpcsharp_channel_args_create = GetMethodDelegate<Delegates.grpcsharp_channel_args_create_delegate>(library);
178 this.grpcsharp_channel_args_set_string = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_string_delegate>(library);
179 this.grpcsharp_channel_args_set_integer = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_integer_delegate>(library);
180 this.grpcsharp_channel_args_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_args_destroy_delegate>(library);
181 this.grpcsharp_override_default_ssl_roots = GetMethodDelegate<Delegates.grpcsharp_override_default_ssl_roots_delegate>(library);
182 this.grpcsharp_ssl_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_credentials_create_delegate>(library);
183 this.grpcsharp_composite_channel_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_channel_credentials_create_delegate>(library);
184 this.grpcsharp_channel_credentials_release = GetMethodDelegate<Delegates.grpcsharp_channel_credentials_release_delegate>(library);
185 this.grpcsharp_insecure_channel_create = GetMethodDelegate<Delegates.grpcsharp_insecure_channel_create_delegate>(library);
186 this.grpcsharp_secure_channel_create = GetMethodDelegate<Delegates.grpcsharp_secure_channel_create_delegate>(library);
187 this.grpcsharp_channel_create_call = GetMethodDelegate<Delegates.grpcsharp_channel_create_call_delegate>(library);
188 this.grpcsharp_channel_check_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_check_connectivity_state_delegate>(library);
189 this.grpcsharp_channel_watch_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_watch_connectivity_state_delegate>(library);
190 this.grpcsharp_channel_get_target = GetMethodDelegate<Delegates.grpcsharp_channel_get_target_delegate>(library);
191 this.grpcsharp_channel_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_destroy_delegate>(library);
192 this.grpcsharp_sizeof_grpc_event = GetMethodDelegate<Delegates.grpcsharp_sizeof_grpc_event_delegate>(library);
193 this.grpcsharp_completion_queue_create_async = GetMethodDelegate<Delegates.grpcsharp_completion_queue_create_async_delegate>(library);
194 this.grpcsharp_completion_queue_create_sync = GetMethodDelegate<Delegates.grpcsharp_completion_queue_create_sync_delegate>(library);
195 this.grpcsharp_completion_queue_shutdown = GetMethodDelegate<Delegates.grpcsharp_completion_queue_shutdown_delegate>(library);
196 this.grpcsharp_completion_queue_next = GetMethodDelegate<Delegates.grpcsharp_completion_queue_next_delegate>(library);
197 this.grpcsharp_completion_queue_pluck = GetMethodDelegate<Delegates.grpcsharp_completion_queue_pluck_delegate>(library);
198 this.grpcsharp_completion_queue_destroy = GetMethodDelegate<Delegates.grpcsharp_completion_queue_destroy_delegate>(library);
199 this.gprsharp_free = GetMethodDelegate<Delegates.gprsharp_free_delegate>(library);
200 this.grpcsharp_metadata_array_create = GetMethodDelegate<Delegates.grpcsharp_metadata_array_create_delegate>(library);
201 this.grpcsharp_metadata_array_add = GetMethodDelegate<Delegates.grpcsharp_metadata_array_add_delegate>(library);
202 this.grpcsharp_metadata_array_count = GetMethodDelegate<Delegates.grpcsharp_metadata_array_count_delegate>(library);
203 this.grpcsharp_metadata_array_get_key = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_key_delegate>(library);
204 this.grpcsharp_metadata_array_get_value = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_value_delegate>(library);
205 this.grpcsharp_metadata_array_destroy_full = GetMethodDelegate<Delegates.grpcsharp_metadata_array_destroy_full_delegate>(library);
206 this.grpcsharp_redirect_log = GetMethodDelegate<Delegates.grpcsharp_redirect_log_delegate>(library);
207 this.grpcsharp_native_callback_dispatcher_init = GetMethodDelegate<Delegates.grpcsharp_native_callback_dispatcher_init_delegate>(library);
208 this.grpcsharp_metadata_credentials_create_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate>(library);
209 this.grpcsharp_metadata_credentials_notify_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate>(library);
210 this.grpcsharp_ssl_server_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_server_credentials_create_delegate>(library);
211 this.grpcsharp_server_credentials_release = GetMethodDelegate<Delegates.grpcsharp_server_credentials_release_delegate>(library);
212 this.grpcsharp_server_create = GetMethodDelegate<Delegates.grpcsharp_server_create_delegate>(library);
213 this.grpcsharp_server_register_completion_queue = GetMethodDelegate<Delegates.grpcsharp_server_register_completion_queue_delegate>(library);
214 this.grpcsharp_server_add_insecure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_insecure_http2_port_delegate>(library);
215 this.grpcsharp_server_add_secure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_secure_http2_port_delegate>(library);
216 this.grpcsharp_server_start = GetMethodDelegate<Delegates.grpcsharp_server_start_delegate>(library);
217 this.grpcsharp_server_request_call = GetMethodDelegate<Delegates.grpcsharp_server_request_call_delegate>(library);
218 this.grpcsharp_server_cancel_all_calls = GetMethodDelegate<Delegates.grpcsharp_server_cancel_all_calls_delegate>(library);
219 this.grpcsharp_server_shutdown_and_notify_callback = GetMethodDelegate<Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate>(library);
220 this.grpcsharp_server_destroy = GetMethodDelegate<Delegates.grpcsharp_server_destroy_delegate>(library);
221 this.grpcsharp_call_auth_context = GetMethodDelegate<Delegates.grpcsharp_call_auth_context_delegate>(library);
222 this.grpcsharp_auth_context_peer_identity_property_name = GetMethodDelegate<Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate>(library);
223 this.grpcsharp_auth_context_property_iterator = GetMethodDelegate<Delegates.grpcsharp_auth_context_property_iterator_delegate>(library);
224 this.grpcsharp_auth_property_iterator_next = GetMethodDelegate<Delegates.grpcsharp_auth_property_iterator_next_delegate>(library);
225 this.grpcsharp_auth_context_release = GetMethodDelegate<Delegates.grpcsharp_auth_context_release_delegate>(library);
226 this.gprsharp_now = GetMethodDelegate<Delegates.gprsharp_now_delegate>(library);
227 this.gprsharp_inf_future = GetMethodDelegate<Delegates.gprsharp_inf_future_delegate>(library);
228 this.gprsharp_inf_past = GetMethodDelegate<Delegates.gprsharp_inf_past_delegate>(library);
229 this.gprsharp_convert_clock_type = GetMethodDelegate<Delegates.gprsharp_convert_clock_type_delegate>(library);
230 this.gprsharp_sizeof_timespec = GetMethodDelegate<Delegates.gprsharp_sizeof_timespec_delegate>(library);
231 this.grpcsharp_test_callback = GetMethodDelegate<Delegates.grpcsharp_test_callback_delegate>(library);
232 this.grpcsharp_test_nop = GetMethodDelegate<Delegates.grpcsharp_test_nop_delegate>(library);
233 this.grpcsharp_test_override_method = GetMethodDelegate<Delegates.grpcsharp_test_override_method_delegate>(library);
236 public NativeMethods(DllImportsFromStaticLib unusedInstance)
238 this.grpcsharp_init = DllImportsFromStaticLib.grpcsharp_init;
239 this.grpcsharp_shutdown = DllImportsFromStaticLib.grpcsharp_shutdown;
240 this.grpcsharp_version_string = DllImportsFromStaticLib.grpcsharp_version_string;
241 this.grpcsharp_batch_context_create = DllImportsFromStaticLib.grpcsharp_batch_context_create;
242 this.grpcsharp_batch_context_recv_initial_metadata = DllImportsFromStaticLib.grpcsharp_batch_context_recv_initial_metadata;
243 this.grpcsharp_batch_context_recv_message_length = DllImportsFromStaticLib.grpcsharp_batch_context_recv_message_length;
244 this.grpcsharp_batch_context_recv_message_next_slice_peek = DllImportsFromStaticLib.grpcsharp_batch_context_recv_message_next_slice_peek;
245 this.grpcsharp_batch_context_recv_status_on_client_status = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_status;
246 this.grpcsharp_batch_context_recv_status_on_client_details = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_details;
247 this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = DllImportsFromStaticLib.grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
248 this.grpcsharp_batch_context_recv_close_on_server_cancelled = DllImportsFromStaticLib.grpcsharp_batch_context_recv_close_on_server_cancelled;
249 this.grpcsharp_batch_context_reset = DllImportsFromStaticLib.grpcsharp_batch_context_reset;
250 this.grpcsharp_batch_context_destroy = DllImportsFromStaticLib.grpcsharp_batch_context_destroy;
251 this.grpcsharp_request_call_context_create = DllImportsFromStaticLib.grpcsharp_request_call_context_create;
252 this.grpcsharp_request_call_context_call = DllImportsFromStaticLib.grpcsharp_request_call_context_call;
253 this.grpcsharp_request_call_context_method = DllImportsFromStaticLib.grpcsharp_request_call_context_method;
254 this.grpcsharp_request_call_context_host = DllImportsFromStaticLib.grpcsharp_request_call_context_host;
255 this.grpcsharp_request_call_context_deadline = DllImportsFromStaticLib.grpcsharp_request_call_context_deadline;
256 this.grpcsharp_request_call_context_request_metadata = DllImportsFromStaticLib.grpcsharp_request_call_context_request_metadata;
257 this.grpcsharp_request_call_context_reset = DllImportsFromStaticLib.grpcsharp_request_call_context_reset;
258 this.grpcsharp_request_call_context_destroy = DllImportsFromStaticLib.grpcsharp_request_call_context_destroy;
259 this.grpcsharp_composite_call_credentials_create = DllImportsFromStaticLib.grpcsharp_composite_call_credentials_create;
260 this.grpcsharp_call_credentials_release = DllImportsFromStaticLib.grpcsharp_call_credentials_release;
261 this.grpcsharp_call_cancel = DllImportsFromStaticLib.grpcsharp_call_cancel;
262 this.grpcsharp_call_cancel_with_status = DllImportsFromStaticLib.grpcsharp_call_cancel_with_status;
263 this.grpcsharp_call_start_unary = DllImportsFromStaticLib.grpcsharp_call_start_unary;
264 this.grpcsharp_call_start_client_streaming = DllImportsFromStaticLib.grpcsharp_call_start_client_streaming;
265 this.grpcsharp_call_start_server_streaming = DllImportsFromStaticLib.grpcsharp_call_start_server_streaming;
266 this.grpcsharp_call_start_duplex_streaming = DllImportsFromStaticLib.grpcsharp_call_start_duplex_streaming;
267 this.grpcsharp_call_send_message = DllImportsFromStaticLib.grpcsharp_call_send_message;
268 this.grpcsharp_call_send_close_from_client = DllImportsFromStaticLib.grpcsharp_call_send_close_from_client;
269 this.grpcsharp_call_send_status_from_server = DllImportsFromStaticLib.grpcsharp_call_send_status_from_server;
270 this.grpcsharp_call_recv_message = DllImportsFromStaticLib.grpcsharp_call_recv_message;
271 this.grpcsharp_call_recv_initial_metadata = DllImportsFromStaticLib.grpcsharp_call_recv_initial_metadata;
272 this.grpcsharp_call_start_serverside = DllImportsFromStaticLib.grpcsharp_call_start_serverside;
273 this.grpcsharp_call_send_initial_metadata = DllImportsFromStaticLib.grpcsharp_call_send_initial_metadata;
274 this.grpcsharp_call_set_credentials = DllImportsFromStaticLib.grpcsharp_call_set_credentials;
275 this.grpcsharp_call_get_peer = DllImportsFromStaticLib.grpcsharp_call_get_peer;
276 this.grpcsharp_call_destroy = DllImportsFromStaticLib.grpcsharp_call_destroy;
277 this.grpcsharp_channel_args_create = DllImportsFromStaticLib.grpcsharp_channel_args_create;
278 this.grpcsharp_channel_args_set_string = DllImportsFromStaticLib.grpcsharp_channel_args_set_string;
279 this.grpcsharp_channel_args_set_integer = DllImportsFromStaticLib.grpcsharp_channel_args_set_integer;
280 this.grpcsharp_channel_args_destroy = DllImportsFromStaticLib.grpcsharp_channel_args_destroy;
281 this.grpcsharp_override_default_ssl_roots = DllImportsFromStaticLib.grpcsharp_override_default_ssl_roots;
282 this.grpcsharp_ssl_credentials_create = DllImportsFromStaticLib.grpcsharp_ssl_credentials_create;
283 this.grpcsharp_composite_channel_credentials_create = DllImportsFromStaticLib.grpcsharp_composite_channel_credentials_create;
284 this.grpcsharp_channel_credentials_release = DllImportsFromStaticLib.grpcsharp_channel_credentials_release;
285 this.grpcsharp_insecure_channel_create = DllImportsFromStaticLib.grpcsharp_insecure_channel_create;
286 this.grpcsharp_secure_channel_create = DllImportsFromStaticLib.grpcsharp_secure_channel_create;
287 this.grpcsharp_channel_create_call = DllImportsFromStaticLib.grpcsharp_channel_create_call;
288 this.grpcsharp_channel_check_connectivity_state = DllImportsFromStaticLib.grpcsharp_channel_check_connectivity_state;
289 this.grpcsharp_channel_watch_connectivity_state = DllImportsFromStaticLib.grpcsharp_channel_watch_connectivity_state;
290 this.grpcsharp_channel_get_target = DllImportsFromStaticLib.grpcsharp_channel_get_target;
291 this.grpcsharp_channel_destroy = DllImportsFromStaticLib.grpcsharp_channel_destroy;
292 this.grpcsharp_sizeof_grpc_event = DllImportsFromStaticLib.grpcsharp_sizeof_grpc_event;
293 this.grpcsharp_completion_queue_create_async = DllImportsFromStaticLib.grpcsharp_completion_queue_create_async;
294 this.grpcsharp_completion_queue_create_sync = DllImportsFromStaticLib.grpcsharp_completion_queue_create_sync;
295 this.grpcsharp_completion_queue_shutdown = DllImportsFromStaticLib.grpcsharp_completion_queue_shutdown;
296 this.grpcsharp_completion_queue_next = DllImportsFromStaticLib.grpcsharp_completion_queue_next;
297 this.grpcsharp_completion_queue_pluck = DllImportsFromStaticLib.grpcsharp_completion_queue_pluck;
298 this.grpcsharp_completion_queue_destroy = DllImportsFromStaticLib.grpcsharp_completion_queue_destroy;
299 this.gprsharp_free = DllImportsFromStaticLib.gprsharp_free;
300 this.grpcsharp_metadata_array_create = DllImportsFromStaticLib.grpcsharp_metadata_array_create;
301 this.grpcsharp_metadata_array_add = DllImportsFromStaticLib.grpcsharp_metadata_array_add;
302 this.grpcsharp_metadata_array_count = DllImportsFromStaticLib.grpcsharp_metadata_array_count;
303 this.grpcsharp_metadata_array_get_key = DllImportsFromStaticLib.grpcsharp_metadata_array_get_key;
304 this.grpcsharp_metadata_array_get_value = DllImportsFromStaticLib.grpcsharp_metadata_array_get_value;
305 this.grpcsharp_metadata_array_destroy_full = DllImportsFromStaticLib.grpcsharp_metadata_array_destroy_full;
306 this.grpcsharp_redirect_log = DllImportsFromStaticLib.grpcsharp_redirect_log;
307 this.grpcsharp_native_callback_dispatcher_init = DllImportsFromStaticLib.grpcsharp_native_callback_dispatcher_init;
308 this.grpcsharp_metadata_credentials_create_from_plugin = DllImportsFromStaticLib.grpcsharp_metadata_credentials_create_from_plugin;
309 this.grpcsharp_metadata_credentials_notify_from_plugin = DllImportsFromStaticLib.grpcsharp_metadata_credentials_notify_from_plugin;
310 this.grpcsharp_ssl_server_credentials_create = DllImportsFromStaticLib.grpcsharp_ssl_server_credentials_create;
311 this.grpcsharp_server_credentials_release = DllImportsFromStaticLib.grpcsharp_server_credentials_release;
312 this.grpcsharp_server_create = DllImportsFromStaticLib.grpcsharp_server_create;
313 this.grpcsharp_server_register_completion_queue = DllImportsFromStaticLib.grpcsharp_server_register_completion_queue;
314 this.grpcsharp_server_add_insecure_http2_port = DllImportsFromStaticLib.grpcsharp_server_add_insecure_http2_port;
315 this.grpcsharp_server_add_secure_http2_port = DllImportsFromStaticLib.grpcsharp_server_add_secure_http2_port;
316 this.grpcsharp_server_start = DllImportsFromStaticLib.grpcsharp_server_start;
317 this.grpcsharp_server_request_call = DllImportsFromStaticLib.grpcsharp_server_request_call;
318 this.grpcsharp_server_cancel_all_calls = DllImportsFromStaticLib.grpcsharp_server_cancel_all_calls;
319 this.grpcsharp_server_shutdown_and_notify_callback = DllImportsFromStaticLib.grpcsharp_server_shutdown_and_notify_callback;
320 this.grpcsharp_server_destroy = DllImportsFromStaticLib.grpcsharp_server_destroy;
321 this.grpcsharp_call_auth_context = DllImportsFromStaticLib.grpcsharp_call_auth_context;
322 this.grpcsharp_auth_context_peer_identity_property_name = DllImportsFromStaticLib.grpcsharp_auth_context_peer_identity_property_name;
323 this.grpcsharp_auth_context_property_iterator = DllImportsFromStaticLib.grpcsharp_auth_context_property_iterator;
324 this.grpcsharp_auth_property_iterator_next = DllImportsFromStaticLib.grpcsharp_auth_property_iterator_next;
325 this.grpcsharp_auth_context_release = DllImportsFromStaticLib.grpcsharp_auth_context_release;
326 this.gprsharp_now = DllImportsFromStaticLib.gprsharp_now;
327 this.gprsharp_inf_future = DllImportsFromStaticLib.gprsharp_inf_future;
328 this.gprsharp_inf_past = DllImportsFromStaticLib.gprsharp_inf_past;
329 this.gprsharp_convert_clock_type = DllImportsFromStaticLib.gprsharp_convert_clock_type;
330 this.gprsharp_sizeof_timespec = DllImportsFromStaticLib.gprsharp_sizeof_timespec;
331 this.grpcsharp_test_callback = DllImportsFromStaticLib.grpcsharp_test_callback;
332 this.grpcsharp_test_nop = DllImportsFromStaticLib.grpcsharp_test_nop;
333 this.grpcsharp_test_override_method = DllImportsFromStaticLib.grpcsharp_test_override_method;
336 public NativeMethods(DllImportsFromSharedLib unusedInstance)
338 this.grpcsharp_init = DllImportsFromSharedLib.grpcsharp_init;
339 this.grpcsharp_shutdown = DllImportsFromSharedLib.grpcsharp_shutdown;
340 this.grpcsharp_version_string = DllImportsFromSharedLib.grpcsharp_version_string;
341 this.grpcsharp_batch_context_create = DllImportsFromSharedLib.grpcsharp_batch_context_create;
342 this.grpcsharp_batch_context_recv_initial_metadata = DllImportsFromSharedLib.grpcsharp_batch_context_recv_initial_metadata;
343 this.grpcsharp_batch_context_recv_message_length = DllImportsFromSharedLib.grpcsharp_batch_context_recv_message_length;
344 this.grpcsharp_batch_context_recv_message_next_slice_peek = DllImportsFromSharedLib.grpcsharp_batch_context_recv_message_next_slice_peek;
345 this.grpcsharp_batch_context_recv_status_on_client_status = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_status;
346 this.grpcsharp_batch_context_recv_status_on_client_details = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_details;
347 this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = DllImportsFromSharedLib.grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
348 this.grpcsharp_batch_context_recv_close_on_server_cancelled = DllImportsFromSharedLib.grpcsharp_batch_context_recv_close_on_server_cancelled;
349 this.grpcsharp_batch_context_reset = DllImportsFromSharedLib.grpcsharp_batch_context_reset;
350 this.grpcsharp_batch_context_destroy = DllImportsFromSharedLib.grpcsharp_batch_context_destroy;
351 this.grpcsharp_request_call_context_create = DllImportsFromSharedLib.grpcsharp_request_call_context_create;
352 this.grpcsharp_request_call_context_call = DllImportsFromSharedLib.grpcsharp_request_call_context_call;
353 this.grpcsharp_request_call_context_method = DllImportsFromSharedLib.grpcsharp_request_call_context_method;
354 this.grpcsharp_request_call_context_host = DllImportsFromSharedLib.grpcsharp_request_call_context_host;
355 this.grpcsharp_request_call_context_deadline = DllImportsFromSharedLib.grpcsharp_request_call_context_deadline;
356 this.grpcsharp_request_call_context_request_metadata = DllImportsFromSharedLib.grpcsharp_request_call_context_request_metadata;
357 this.grpcsharp_request_call_context_reset = DllImportsFromSharedLib.grpcsharp_request_call_context_reset;
358 this.grpcsharp_request_call_context_destroy = DllImportsFromSharedLib.grpcsharp_request_call_context_destroy;
359 this.grpcsharp_composite_call_credentials_create = DllImportsFromSharedLib.grpcsharp_composite_call_credentials_create;
360 this.grpcsharp_call_credentials_release = DllImportsFromSharedLib.grpcsharp_call_credentials_release;
361 this.grpcsharp_call_cancel = DllImportsFromSharedLib.grpcsharp_call_cancel;
362 this.grpcsharp_call_cancel_with_status = DllImportsFromSharedLib.grpcsharp_call_cancel_with_status;
363 this.grpcsharp_call_start_unary = DllImportsFromSharedLib.grpcsharp_call_start_unary;
364 this.grpcsharp_call_start_client_streaming = DllImportsFromSharedLib.grpcsharp_call_start_client_streaming;
365 this.grpcsharp_call_start_server_streaming = DllImportsFromSharedLib.grpcsharp_call_start_server_streaming;
366 this.grpcsharp_call_start_duplex_streaming = DllImportsFromSharedLib.grpcsharp_call_start_duplex_streaming;
367 this.grpcsharp_call_send_message = DllImportsFromSharedLib.grpcsharp_call_send_message;
368 this.grpcsharp_call_send_close_from_client = DllImportsFromSharedLib.grpcsharp_call_send_close_from_client;
369 this.grpcsharp_call_send_status_from_server = DllImportsFromSharedLib.grpcsharp_call_send_status_from_server;
370 this.grpcsharp_call_recv_message = DllImportsFromSharedLib.grpcsharp_call_recv_message;
371 this.grpcsharp_call_recv_initial_metadata = DllImportsFromSharedLib.grpcsharp_call_recv_initial_metadata;
372 this.grpcsharp_call_start_serverside = DllImportsFromSharedLib.grpcsharp_call_start_serverside;
373 this.grpcsharp_call_send_initial_metadata = DllImportsFromSharedLib.grpcsharp_call_send_initial_metadata;
374 this.grpcsharp_call_set_credentials = DllImportsFromSharedLib.grpcsharp_call_set_credentials;
375 this.grpcsharp_call_get_peer = DllImportsFromSharedLib.grpcsharp_call_get_peer;
376 this.grpcsharp_call_destroy = DllImportsFromSharedLib.grpcsharp_call_destroy;
377 this.grpcsharp_channel_args_create = DllImportsFromSharedLib.grpcsharp_channel_args_create;
378 this.grpcsharp_channel_args_set_string = DllImportsFromSharedLib.grpcsharp_channel_args_set_string;
379 this.grpcsharp_channel_args_set_integer = DllImportsFromSharedLib.grpcsharp_channel_args_set_integer;
380 this.grpcsharp_channel_args_destroy = DllImportsFromSharedLib.grpcsharp_channel_args_destroy;
381 this.grpcsharp_override_default_ssl_roots = DllImportsFromSharedLib.grpcsharp_override_default_ssl_roots;
382 this.grpcsharp_ssl_credentials_create = DllImportsFromSharedLib.grpcsharp_ssl_credentials_create;
383 this.grpcsharp_composite_channel_credentials_create = DllImportsFromSharedLib.grpcsharp_composite_channel_credentials_create;
384 this.grpcsharp_channel_credentials_release = DllImportsFromSharedLib.grpcsharp_channel_credentials_release;
385 this.grpcsharp_insecure_channel_create = DllImportsFromSharedLib.grpcsharp_insecure_channel_create;
386 this.grpcsharp_secure_channel_create = DllImportsFromSharedLib.grpcsharp_secure_channel_create;
387 this.grpcsharp_channel_create_call = DllImportsFromSharedLib.grpcsharp_channel_create_call;
388 this.grpcsharp_channel_check_connectivity_state = DllImportsFromSharedLib.grpcsharp_channel_check_connectivity_state;
389 this.grpcsharp_channel_watch_connectivity_state = DllImportsFromSharedLib.grpcsharp_channel_watch_connectivity_state;
390 this.grpcsharp_channel_get_target = DllImportsFromSharedLib.grpcsharp_channel_get_target;
391 this.grpcsharp_channel_destroy = DllImportsFromSharedLib.grpcsharp_channel_destroy;
392 this.grpcsharp_sizeof_grpc_event = DllImportsFromSharedLib.grpcsharp_sizeof_grpc_event;
393 this.grpcsharp_completion_queue_create_async = DllImportsFromSharedLib.grpcsharp_completion_queue_create_async;
394 this.grpcsharp_completion_queue_create_sync = DllImportsFromSharedLib.grpcsharp_completion_queue_create_sync;
395 this.grpcsharp_completion_queue_shutdown = DllImportsFromSharedLib.grpcsharp_completion_queue_shutdown;
396 this.grpcsharp_completion_queue_next = DllImportsFromSharedLib.grpcsharp_completion_queue_next;
397 this.grpcsharp_completion_queue_pluck = DllImportsFromSharedLib.grpcsharp_completion_queue_pluck;
398 this.grpcsharp_completion_queue_destroy = DllImportsFromSharedLib.grpcsharp_completion_queue_destroy;
399 this.gprsharp_free = DllImportsFromSharedLib.gprsharp_free;
400 this.grpcsharp_metadata_array_create = DllImportsFromSharedLib.grpcsharp_metadata_array_create;
401 this.grpcsharp_metadata_array_add = DllImportsFromSharedLib.grpcsharp_metadata_array_add;
402 this.grpcsharp_metadata_array_count = DllImportsFromSharedLib.grpcsharp_metadata_array_count;
403 this.grpcsharp_metadata_array_get_key = DllImportsFromSharedLib.grpcsharp_metadata_array_get_key;
404 this.grpcsharp_metadata_array_get_value = DllImportsFromSharedLib.grpcsharp_metadata_array_get_value;
405 this.grpcsharp_metadata_array_destroy_full = DllImportsFromSharedLib.grpcsharp_metadata_array_destroy_full;
406 this.grpcsharp_redirect_log = DllImportsFromSharedLib.grpcsharp_redirect_log;
407 this.grpcsharp_native_callback_dispatcher_init = DllImportsFromSharedLib.grpcsharp_native_callback_dispatcher_init;
408 this.grpcsharp_metadata_credentials_create_from_plugin = DllImportsFromSharedLib.grpcsharp_metadata_credentials_create_from_plugin;
409 this.grpcsharp_metadata_credentials_notify_from_plugin = DllImportsFromSharedLib.grpcsharp_metadata_credentials_notify_from_plugin;
410 this.grpcsharp_ssl_server_credentials_create = DllImportsFromSharedLib.grpcsharp_ssl_server_credentials_create;
411 this.grpcsharp_server_credentials_release = DllImportsFromSharedLib.grpcsharp_server_credentials_release;
412 this.grpcsharp_server_create = DllImportsFromSharedLib.grpcsharp_server_create;
413 this.grpcsharp_server_register_completion_queue = DllImportsFromSharedLib.grpcsharp_server_register_completion_queue;
414 this.grpcsharp_server_add_insecure_http2_port = DllImportsFromSharedLib.grpcsharp_server_add_insecure_http2_port;
415 this.grpcsharp_server_add_secure_http2_port = DllImportsFromSharedLib.grpcsharp_server_add_secure_http2_port;
416 this.grpcsharp_server_start = DllImportsFromSharedLib.grpcsharp_server_start;
417 this.grpcsharp_server_request_call = DllImportsFromSharedLib.grpcsharp_server_request_call;
418 this.grpcsharp_server_cancel_all_calls = DllImportsFromSharedLib.grpcsharp_server_cancel_all_calls;
419 this.grpcsharp_server_shutdown_and_notify_callback = DllImportsFromSharedLib.grpcsharp_server_shutdown_and_notify_callback;
420 this.grpcsharp_server_destroy = DllImportsFromSharedLib.grpcsharp_server_destroy;
421 this.grpcsharp_call_auth_context = DllImportsFromSharedLib.grpcsharp_call_auth_context;
422 this.grpcsharp_auth_context_peer_identity_property_name = DllImportsFromSharedLib.grpcsharp_auth_context_peer_identity_property_name;
423 this.grpcsharp_auth_context_property_iterator = DllImportsFromSharedLib.grpcsharp_auth_context_property_iterator;
424 this.grpcsharp_auth_property_iterator_next = DllImportsFromSharedLib.grpcsharp_auth_property_iterator_next;
425 this.grpcsharp_auth_context_release = DllImportsFromSharedLib.grpcsharp_auth_context_release;
426 this.gprsharp_now = DllImportsFromSharedLib.gprsharp_now;
427 this.gprsharp_inf_future = DllImportsFromSharedLib.gprsharp_inf_future;
428 this.gprsharp_inf_past = DllImportsFromSharedLib.gprsharp_inf_past;
429 this.gprsharp_convert_clock_type = DllImportsFromSharedLib.gprsharp_convert_clock_type;
430 this.gprsharp_sizeof_timespec = DllImportsFromSharedLib.gprsharp_sizeof_timespec;
431 this.grpcsharp_test_callback = DllImportsFromSharedLib.grpcsharp_test_callback;
432 this.grpcsharp_test_nop = DllImportsFromSharedLib.grpcsharp_test_nop;
433 this.grpcsharp_test_override_method = DllImportsFromSharedLib.grpcsharp_test_override_method;
437 /// Delegate types for all published native methods. Declared under inner class to prevent scope pollution.
439 public class Delegates
441 public delegate void grpcsharp_init_delegate();
442 public delegate void grpcsharp_shutdown_delegate();
443 public delegate IntPtr grpcsharp_version_string_delegate(); // returns not-owned const char*
444 public delegate BatchContextSafeHandle grpcsharp_batch_context_create_delegate();
445 public delegate IntPtr grpcsharp_batch_context_recv_initial_metadata_delegate(BatchContextSafeHandle ctx);
446 public delegate IntPtr grpcsharp_batch_context_recv_message_length_delegate(BatchContextSafeHandle ctx);
447 public delegate int grpcsharp_batch_context_recv_message_next_slice_peek_delegate(BatchContextSafeHandle ctx, out UIntPtr sliceLen, out IntPtr sliceDataPtr);
448 public delegate StatusCode grpcsharp_batch_context_recv_status_on_client_status_delegate(BatchContextSafeHandle ctx);
449 public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_details_delegate(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
450 public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate(BatchContextSafeHandle ctx);
451 public delegate int grpcsharp_batch_context_recv_close_on_server_cancelled_delegate(BatchContextSafeHandle ctx);
452 public delegate void grpcsharp_batch_context_reset_delegate(BatchContextSafeHandle ctx);
453 public delegate void grpcsharp_batch_context_destroy_delegate(IntPtr ctx);
454 public delegate RequestCallContextSafeHandle grpcsharp_request_call_context_create_delegate();
455 public delegate CallSafeHandle grpcsharp_request_call_context_call_delegate(RequestCallContextSafeHandle ctx);
456 public delegate IntPtr grpcsharp_request_call_context_method_delegate(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
457 public delegate IntPtr grpcsharp_request_call_context_host_delegate(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
458 public delegate Timespec grpcsharp_request_call_context_deadline_delegate(RequestCallContextSafeHandle ctx);
459 public delegate IntPtr grpcsharp_request_call_context_request_metadata_delegate(RequestCallContextSafeHandle ctx);
460 public delegate void grpcsharp_request_call_context_reset_delegate(RequestCallContextSafeHandle ctx);
461 public delegate void grpcsharp_request_call_context_destroy_delegate(IntPtr ctx);
462 public delegate CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create_delegate(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
463 public delegate void grpcsharp_call_credentials_release_delegate(IntPtr credentials);
464 public delegate CallError grpcsharp_call_cancel_delegate(CallSafeHandle call);
465 public delegate CallError grpcsharp_call_cancel_with_status_delegate(CallSafeHandle call, StatusCode status, string description);
466 public delegate CallError grpcsharp_call_start_unary_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
467 public delegate CallError grpcsharp_call_start_client_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
468 public delegate CallError grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
469 public delegate CallError grpcsharp_call_start_duplex_streaming_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
470 public delegate CallError grpcsharp_call_send_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
471 public delegate CallError grpcsharp_call_send_close_from_client_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
472 public delegate CallError grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
473 public delegate CallError grpcsharp_call_recv_message_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
474 public delegate CallError grpcsharp_call_recv_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
475 public delegate CallError grpcsharp_call_start_serverside_delegate(CallSafeHandle call, BatchContextSafeHandle ctx);
476 public delegate CallError grpcsharp_call_send_initial_metadata_delegate(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
477 public delegate CallError grpcsharp_call_set_credentials_delegate(CallSafeHandle call, CallCredentialsSafeHandle credentials);
478 public delegate CStringSafeHandle grpcsharp_call_get_peer_delegate(CallSafeHandle call);
479 public delegate void grpcsharp_call_destroy_delegate(IntPtr call);
480 public delegate ChannelArgsSafeHandle grpcsharp_channel_args_create_delegate(UIntPtr numArgs);
481 public delegate void grpcsharp_channel_args_set_string_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
482 public delegate void grpcsharp_channel_args_set_integer_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
483 public delegate void grpcsharp_channel_args_destroy_delegate(IntPtr args);
484 public delegate void grpcsharp_override_default_ssl_roots_delegate(string pemRootCerts);
485 public delegate ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create_delegate(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey, IntPtr verifyPeerCallbackTag);
486 public delegate ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create_delegate(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
487 public delegate void grpcsharp_channel_credentials_release_delegate(IntPtr credentials);
488 public delegate ChannelSafeHandle grpcsharp_insecure_channel_create_delegate(string target, ChannelArgsSafeHandle channelArgs);
489 public delegate ChannelSafeHandle grpcsharp_secure_channel_create_delegate(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
490 public delegate CallSafeHandle grpcsharp_channel_create_call_delegate(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
491 public delegate ChannelState grpcsharp_channel_check_connectivity_state_delegate(ChannelSafeHandle channel, int tryToConnect);
492 public delegate void grpcsharp_channel_watch_connectivity_state_delegate(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
493 public delegate CStringSafeHandle grpcsharp_channel_get_target_delegate(ChannelSafeHandle call);
494 public delegate void grpcsharp_channel_destroy_delegate(IntPtr channel);
495 public delegate int grpcsharp_sizeof_grpc_event_delegate();
496 public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_async_delegate();
497 public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync_delegate();
498 public delegate void grpcsharp_completion_queue_shutdown_delegate(CompletionQueueSafeHandle cq);
499 public delegate CompletionQueueEvent grpcsharp_completion_queue_next_delegate(CompletionQueueSafeHandle cq);
500 public delegate CompletionQueueEvent grpcsharp_completion_queue_pluck_delegate(CompletionQueueSafeHandle cq, IntPtr tag);
501 public delegate void grpcsharp_completion_queue_destroy_delegate(IntPtr cq);
502 public delegate void gprsharp_free_delegate(IntPtr ptr);
503 public delegate MetadataArraySafeHandle grpcsharp_metadata_array_create_delegate(UIntPtr capacity);
504 public delegate void grpcsharp_metadata_array_add_delegate(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
505 public delegate UIntPtr grpcsharp_metadata_array_count_delegate(IntPtr metadataArray);
506 public delegate IntPtr grpcsharp_metadata_array_get_key_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
507 public delegate IntPtr grpcsharp_metadata_array_get_value_delegate(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
508 public delegate void grpcsharp_metadata_array_destroy_full_delegate(IntPtr array);
509 public delegate void grpcsharp_redirect_log_delegate(GprLogDelegate callback);
510 public delegate void grpcsharp_native_callback_dispatcher_init_delegate(NativeCallbackDispatcherCallback dispatcher);
511 public delegate CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin_delegate(IntPtr nativeCallbackTag);
512 public delegate void grpcsharp_metadata_credentials_notify_from_plugin_delegate(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
513 public delegate ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create_delegate(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, SslClientCertificateRequestType clientCertificateRequest);
514 public delegate void grpcsharp_server_credentials_release_delegate(IntPtr credentials);
515 public delegate ServerSafeHandle grpcsharp_server_create_delegate(ChannelArgsSafeHandle args);
516 public delegate void grpcsharp_server_register_completion_queue_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq);
517 public delegate int grpcsharp_server_add_insecure_http2_port_delegate(ServerSafeHandle server, string addr);
518 public delegate int grpcsharp_server_add_secure_http2_port_delegate(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
519 public delegate void grpcsharp_server_start_delegate(ServerSafeHandle server);
520 public delegate CallError grpcsharp_server_request_call_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
521 public delegate void grpcsharp_server_cancel_all_calls_delegate(ServerSafeHandle server);
522 public delegate void grpcsharp_server_shutdown_and_notify_callback_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
523 public delegate void grpcsharp_server_destroy_delegate(IntPtr server);
524 public delegate AuthContextSafeHandle grpcsharp_call_auth_context_delegate(CallSafeHandle call);
525 public delegate IntPtr grpcsharp_auth_context_peer_identity_property_name_delegate(AuthContextSafeHandle authContext); // returns const char*
526 public delegate AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator_delegate(AuthContextSafeHandle authContext);
527 public delegate IntPtr grpcsharp_auth_property_iterator_next_delegate(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator); // returns const auth_property*
528 public delegate void grpcsharp_auth_context_release_delegate(IntPtr authContext);
529 public delegate Timespec gprsharp_now_delegate(ClockType clockType);
530 public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType);
531 public delegate Timespec gprsharp_inf_past_delegate(ClockType clockType);
532 public delegate Timespec gprsharp_convert_clock_type_delegate(Timespec t, ClockType targetClock);
533 public delegate int gprsharp_sizeof_timespec_delegate();
534 public delegate CallError grpcsharp_test_callback_delegate([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
535 public delegate IntPtr grpcsharp_test_nop_delegate(IntPtr ptr);
536 public delegate void grpcsharp_test_override_method_delegate(string methodName, string variant);
540 /// grpc_csharp_ext used as a static library (e.g Unity iOS).
542 internal class DllImportsFromStaticLib
544 private const string ImportName = "__Internal";
546 [DllImport(ImportName)]
547 public static extern void grpcsharp_init();
549 [DllImport(ImportName)]
550 public static extern void grpcsharp_shutdown();
552 [DllImport(ImportName)]
553 public static extern IntPtr grpcsharp_version_string();
555 [DllImport(ImportName)]
556 public static extern BatchContextSafeHandle grpcsharp_batch_context_create();
558 [DllImport(ImportName)]
559 public static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
561 [DllImport(ImportName)]
562 public static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
564 [DllImport(ImportName)]
565 public static extern int grpcsharp_batch_context_recv_message_next_slice_peek(BatchContextSafeHandle ctx, out UIntPtr sliceLen, out IntPtr sliceDataPtr);
567 [DllImport(ImportName)]
568 public static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
570 [DllImport(ImportName)]
571 public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
573 [DllImport(ImportName)]
574 public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx);
576 [DllImport(ImportName)]
577 public static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
579 [DllImport(ImportName)]
580 public static extern void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx);
582 [DllImport(ImportName)]
583 public static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
585 [DllImport(ImportName)]
586 public static extern RequestCallContextSafeHandle grpcsharp_request_call_context_create();
588 [DllImport(ImportName)]
589 public static extern CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx);
591 [DllImport(ImportName)]
592 public static extern IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
594 [DllImport(ImportName)]
595 public static extern IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
597 [DllImport(ImportName)]
598 public static extern Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx);
600 [DllImport(ImportName)]
601 public static extern IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx);
603 [DllImport(ImportName)]
604 public static extern void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx);
606 [DllImport(ImportName)]
607 public static extern void grpcsharp_request_call_context_destroy(IntPtr ctx);
609 [DllImport(ImportName)]
610 public static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
612 [DllImport(ImportName)]
613 public static extern void grpcsharp_call_credentials_release(IntPtr credentials);
615 [DllImport(ImportName)]
616 public static extern CallError grpcsharp_call_cancel(CallSafeHandle call);
618 [DllImport(ImportName)]
619 public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
621 [DllImport(ImportName)]
622 public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
624 [DllImport(ImportName)]
625 public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
627 [DllImport(ImportName)]
628 public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
630 [DllImport(ImportName)]
631 public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
633 [DllImport(ImportName)]
634 public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
636 [DllImport(ImportName)]
637 public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx);
639 [DllImport(ImportName)]
640 public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
642 [DllImport(ImportName)]
643 public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx);
645 [DllImport(ImportName)]
646 public static extern CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx);
648 [DllImport(ImportName)]
649 public static extern CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx);
651 [DllImport(ImportName)]
652 public static extern CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
654 [DllImport(ImportName)]
655 public static extern CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
657 [DllImport(ImportName)]
658 public static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
660 [DllImport(ImportName)]
661 public static extern void grpcsharp_call_destroy(IntPtr call);
663 [DllImport(ImportName)]
664 public static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
666 [DllImport(ImportName)]
667 public static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
669 [DllImport(ImportName)]
670 public static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
672 [DllImport(ImportName)]
673 public static extern void grpcsharp_channel_args_destroy(IntPtr args);
675 [DllImport(ImportName)]
676 public static extern void grpcsharp_override_default_ssl_roots(string pemRootCerts);
678 [DllImport(ImportName)]
679 public static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey, IntPtr verifyPeerCallbackTag);
681 [DllImport(ImportName)]
682 public static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
684 [DllImport(ImportName)]
685 public static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
687 [DllImport(ImportName)]
688 public static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
690 [DllImport(ImportName)]
691 public static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
693 [DllImport(ImportName)]
694 public static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
696 [DllImport(ImportName)]
697 public static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
699 [DllImport(ImportName)]
700 public static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
702 [DllImport(ImportName)]
703 public static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
705 [DllImport(ImportName)]
706 public static extern void grpcsharp_channel_destroy(IntPtr channel);
708 [DllImport(ImportName)]
709 public static extern int grpcsharp_sizeof_grpc_event();
711 [DllImport(ImportName)]
712 public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_async();
714 [DllImport(ImportName)]
715 public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync();
717 [DllImport(ImportName)]
718 public static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
720 [DllImport(ImportName)]
721 public static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
723 [DllImport(ImportName)]
724 public static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
726 [DllImport(ImportName)]
727 public static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
729 [DllImport(ImportName)]
730 public static extern void gprsharp_free(IntPtr ptr);
732 [DllImport(ImportName)]
733 public static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
735 [DllImport(ImportName)]
736 public static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
738 [DllImport(ImportName)]
739 public static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
741 [DllImport(ImportName)]
742 public static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
744 [DllImport(ImportName)]
745 public static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
747 [DllImport(ImportName)]
748 public static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
750 [DllImport(ImportName)]
751 public static extern void grpcsharp_redirect_log(GprLogDelegate callback);
753 [DllImport(ImportName)]
754 public static extern void grpcsharp_native_callback_dispatcher_init(NativeCallbackDispatcherCallback dispatcher);
756 [DllImport(ImportName)]
757 public static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(IntPtr nativeCallbackTag);
759 [DllImport(ImportName)]
760 public static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
762 [DllImport(ImportName)]
763 public static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, SslClientCertificateRequestType clientCertificateRequest);
765 [DllImport(ImportName)]
766 public static extern void grpcsharp_server_credentials_release(IntPtr credentials);
768 [DllImport(ImportName)]
769 public static extern ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args);
771 [DllImport(ImportName)]
772 public static extern void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq);
774 [DllImport(ImportName)]
775 public static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
777 [DllImport(ImportName)]
778 public static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
780 [DllImport(ImportName)]
781 public static extern void grpcsharp_server_start(ServerSafeHandle server);
783 [DllImport(ImportName)]
784 public static extern CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
786 [DllImport(ImportName)]
787 public static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
789 [DllImport(ImportName)]
790 public static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
792 [DllImport(ImportName)]
793 public static extern void grpcsharp_server_destroy(IntPtr server);
795 [DllImport(ImportName)]
796 public static extern AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call);
798 [DllImport(ImportName)]
799 public static extern IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext);
801 [DllImport(ImportName)]
802 public static extern AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext);
804 [DllImport(ImportName)]
805 public static extern IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator);
807 [DllImport(ImportName)]
808 public static extern void grpcsharp_auth_context_release(IntPtr authContext);
810 [DllImport(ImportName)]
811 public static extern Timespec gprsharp_now(ClockType clockType);
813 [DllImport(ImportName)]
814 public static extern Timespec gprsharp_inf_future(ClockType clockType);
816 [DllImport(ImportName)]
817 public static extern Timespec gprsharp_inf_past(ClockType clockType);
819 [DllImport(ImportName)]
820 public static extern Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock);
822 [DllImport(ImportName)]
823 public static extern int gprsharp_sizeof_timespec();
825 [DllImport(ImportName)]
826 public static extern CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
828 [DllImport(ImportName)]
829 public static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
831 [DllImport(ImportName)]
832 public static extern void grpcsharp_test_override_method(string methodName, string variant);
836 /// grpc_csharp_ext used a shared library (e.g on Unity Standalone and Android).
838 internal class DllImportsFromSharedLib
840 private const string ImportName = "grpc_csharp_ext";
842 [DllImport(ImportName)]
843 public static extern void grpcsharp_init();
845 [DllImport(ImportName)]
846 public static extern void grpcsharp_shutdown();
848 [DllImport(ImportName)]
849 public static extern IntPtr grpcsharp_version_string();
851 [DllImport(ImportName)]
852 public static extern BatchContextSafeHandle grpcsharp_batch_context_create();
854 [DllImport(ImportName)]
855 public static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
857 [DllImport(ImportName)]
858 public static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
860 [DllImport(ImportName)]
861 public static extern int grpcsharp_batch_context_recv_message_next_slice_peek(BatchContextSafeHandle ctx, out UIntPtr sliceLen, out IntPtr sliceDataPtr);
863 [DllImport(ImportName)]
864 public static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
866 [DllImport(ImportName)]
867 public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength);
869 [DllImport(ImportName)]
870 public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx);
872 [DllImport(ImportName)]
873 public static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
875 [DllImport(ImportName)]
876 public static extern void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx);
878 [DllImport(ImportName)]
879 public static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
881 [DllImport(ImportName)]
882 public static extern RequestCallContextSafeHandle grpcsharp_request_call_context_create();
884 [DllImport(ImportName)]
885 public static extern CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx);
887 [DllImport(ImportName)]
888 public static extern IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength);
890 [DllImport(ImportName)]
891 public static extern IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength);
893 [DllImport(ImportName)]
894 public static extern Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx);
896 [DllImport(ImportName)]
897 public static extern IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx);
899 [DllImport(ImportName)]
900 public static extern void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx);
902 [DllImport(ImportName)]
903 public static extern void grpcsharp_request_call_context_destroy(IntPtr ctx);
905 [DllImport(ImportName)]
906 public static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
908 [DllImport(ImportName)]
909 public static extern void grpcsharp_call_credentials_release(IntPtr credentials);
911 [DllImport(ImportName)]
912 public static extern CallError grpcsharp_call_cancel(CallSafeHandle call);
914 [DllImport(ImportName)]
915 public static extern CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
917 [DllImport(ImportName)]
918 public static extern CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
920 [DllImport(ImportName)]
921 public static extern CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
923 [DllImport(ImportName)]
924 public static extern CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
926 [DllImport(ImportName)]
927 public static extern CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags);
929 [DllImport(ImportName)]
930 public static extern CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, byte[] sendBuffer, UIntPtr sendBufferLen, WriteFlags writeFlags, int sendEmptyInitialMetadata);
932 [DllImport(ImportName)]
933 public static extern CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx);
935 [DllImport(ImportName)]
936 public static extern CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, byte[] statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, byte[] optionalSendBuffer, UIntPtr optionalSendBufferLen, WriteFlags writeFlags);
938 [DllImport(ImportName)]
939 public static extern CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx);
941 [DllImport(ImportName)]
942 public static extern CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx);
944 [DllImport(ImportName)]
945 public static extern CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx);
947 [DllImport(ImportName)]
948 public static extern CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
950 [DllImport(ImportName)]
951 public static extern CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
953 [DllImport(ImportName)]
954 public static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
956 [DllImport(ImportName)]
957 public static extern void grpcsharp_call_destroy(IntPtr call);
959 [DllImport(ImportName)]
960 public static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
962 [DllImport(ImportName)]
963 public static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
965 [DllImport(ImportName)]
966 public static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
968 [DllImport(ImportName)]
969 public static extern void grpcsharp_channel_args_destroy(IntPtr args);
971 [DllImport(ImportName)]
972 public static extern void grpcsharp_override_default_ssl_roots(string pemRootCerts);
974 [DllImport(ImportName)]
975 public static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey, IntPtr verifyPeerCallbackTag);
977 [DllImport(ImportName)]
978 public static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
980 [DllImport(ImportName)]
981 public static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
983 [DllImport(ImportName)]
984 public static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
986 [DllImport(ImportName)]
987 public static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
989 [DllImport(ImportName)]
990 public static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
992 [DllImport(ImportName)]
993 public static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
995 [DllImport(ImportName)]
996 public static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
998 [DllImport(ImportName)]
999 public static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
1001 [DllImport(ImportName)]
1002 public static extern void grpcsharp_channel_destroy(IntPtr channel);
1004 [DllImport(ImportName)]
1005 public static extern int grpcsharp_sizeof_grpc_event();
1007 [DllImport(ImportName)]
1008 public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_async();
1010 [DllImport(ImportName)]
1011 public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync();
1013 [DllImport(ImportName)]
1014 public static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
1016 [DllImport(ImportName)]
1017 public static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
1019 [DllImport(ImportName)]
1020 public static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
1022 [DllImport(ImportName)]
1023 public static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
1025 [DllImport(ImportName)]
1026 public static extern void gprsharp_free(IntPtr ptr);
1028 [DllImport(ImportName)]
1029 public static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
1031 [DllImport(ImportName)]
1032 public static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
1034 [DllImport(ImportName)]
1035 public static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
1037 [DllImport(ImportName)]
1038 public static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength);
1040 [DllImport(ImportName)]
1041 public static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength);
1043 [DllImport(ImportName)]
1044 public static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
1046 [DllImport(ImportName)]
1047 public static extern void grpcsharp_redirect_log(GprLogDelegate callback);
1049 [DllImport(ImportName)]
1050 public static extern void grpcsharp_native_callback_dispatcher_init(NativeCallbackDispatcherCallback dispatcher);
1052 [DllImport(ImportName)]
1053 public static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(IntPtr nativeCallbackTag);
1055 [DllImport(ImportName)]
1056 public static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
1058 [DllImport(ImportName)]
1059 public static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, SslClientCertificateRequestType clientCertificateRequest);
1061 [DllImport(ImportName)]
1062 public static extern void grpcsharp_server_credentials_release(IntPtr credentials);
1064 [DllImport(ImportName)]
1065 public static extern ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args);
1067 [DllImport(ImportName)]
1068 public static extern void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq);
1070 [DllImport(ImportName)]
1071 public static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
1073 [DllImport(ImportName)]
1074 public static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
1076 [DllImport(ImportName)]
1077 public static extern void grpcsharp_server_start(ServerSafeHandle server);
1079 [DllImport(ImportName)]
1080 public static extern CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx);
1082 [DllImport(ImportName)]
1083 public static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
1085 [DllImport(ImportName)]
1086 public static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
1088 [DllImport(ImportName)]
1089 public static extern void grpcsharp_server_destroy(IntPtr server);
1091 [DllImport(ImportName)]
1092 public static extern AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call);
1094 [DllImport(ImportName)]
1095 public static extern IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext);
1097 [DllImport(ImportName)]
1098 public static extern AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext);
1100 [DllImport(ImportName)]
1101 public static extern IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator);
1103 [DllImport(ImportName)]
1104 public static extern void grpcsharp_auth_context_release(IntPtr authContext);
1106 [DllImport(ImportName)]
1107 public static extern Timespec gprsharp_now(ClockType clockType);
1109 [DllImport(ImportName)]
1110 public static extern Timespec gprsharp_inf_future(ClockType clockType);
1112 [DllImport(ImportName)]
1113 public static extern Timespec gprsharp_inf_past(ClockType clockType);
1115 [DllImport(ImportName)]
1116 public static extern Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock);
1118 [DllImport(ImportName)]
1119 public static extern int gprsharp_sizeof_timespec();
1121 [DllImport(ImportName)]
1122 public static extern CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback);
1124 [DllImport(ImportName)]
1125 public static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
1127 [DllImport(ImportName)]
1128 public static extern void grpcsharp_test_override_method(string methodName, string variant);