1<%def name="get_native_methods()"><% 2native_method_signatures = [ 3 'void grpcsharp_init()', 4 'void grpcsharp_shutdown()', 5 'IntPtr grpcsharp_version_string() // returns not-owned const char*', 6 'BatchContextSafeHandle grpcsharp_batch_context_create()', 7 'IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx)', 8 'IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx)', 9 'int grpcsharp_batch_context_recv_message_next_slice_peek(BatchContextSafeHandle ctx, out UIntPtr sliceLen, out IntPtr sliceDataPtr)', 10 'StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx)', 11 'IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx, out UIntPtr detailsLength)', 12 'IntPtr grpcsharp_batch_context_recv_status_on_client_error_string(BatchContextSafeHandle ctx)', 13 'IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx)', 14 'int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx)', 15 'void grpcsharp_batch_context_reset(BatchContextSafeHandle ctx)', 16 'void grpcsharp_batch_context_destroy(IntPtr ctx)', 17 'RequestCallContextSafeHandle grpcsharp_request_call_context_create()', 18 'CallSafeHandle grpcsharp_request_call_context_call(RequestCallContextSafeHandle ctx)', 19 'IntPtr grpcsharp_request_call_context_method(RequestCallContextSafeHandle ctx, out UIntPtr methodLength)', 20 'IntPtr grpcsharp_request_call_context_host(RequestCallContextSafeHandle ctx, out UIntPtr hostLength)', 21 'Timespec grpcsharp_request_call_context_deadline(RequestCallContextSafeHandle ctx)', 22 'IntPtr grpcsharp_request_call_context_request_metadata(RequestCallContextSafeHandle ctx)', 23 'void grpcsharp_request_call_context_reset(RequestCallContextSafeHandle ctx)', 24 'void grpcsharp_request_call_context_destroy(IntPtr ctx)', 25 'CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)', 26 'void grpcsharp_call_credentials_release(IntPtr credentials)', 27 'CallError grpcsharp_call_cancel(CallSafeHandle call)', 28 'CallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description)', 29 'CallError grpcsharp_call_start_unary(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 30 'CallError grpcsharp_call_start_client_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 31 'CallError grpcsharp_call_start_server_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 32 'CallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 33 'CallError grpcsharp_call_send_message(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, int sendEmptyInitialMetadata)', 34 'CallError grpcsharp_call_send_close_from_client(CallSafeHandle call, BatchContextSafeHandle ctx)', 35 'CallError grpcsharp_call_send_status_from_server(CallSafeHandle call, BatchContextSafeHandle ctx, StatusCode statusCode, IntPtr statusMessage, UIntPtr statusMessageLen, MetadataArraySafeHandle metadataArray, int sendEmptyInitialMetadata, SliceBufferSafeHandle optionalSendBuffer, WriteFlags writeFlags)', 36 'CallError grpcsharp_call_recv_message(CallSafeHandle call, BatchContextSafeHandle ctx)', 37 'CallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx)', 38 'CallError grpcsharp_call_start_serverside(CallSafeHandle call, BatchContextSafeHandle ctx)', 39 'CallError grpcsharp_call_send_initial_metadata(CallSafeHandle call, BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray)', 40 'CallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials)', 41 'CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call)', 42 'void grpcsharp_call_destroy(IntPtr call)', 43 'ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs)', 44 'void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value)', 45 'void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value)', 46 'void grpcsharp_channel_args_destroy(IntPtr args)', 47 'void grpcsharp_override_default_ssl_roots(string pemRootCerts)', 48 'ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey, IntPtr verifyPeerCallbackTag)', 49 'ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)', 50 'void grpcsharp_channel_credentials_release(IntPtr credentials)', 51 'ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs)', 52 'ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)', 53 'CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline)', 54 'ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect)', 55 'void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)', 56 'CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call)', 57 'void grpcsharp_channel_destroy(IntPtr channel)', 58 'int grpcsharp_sizeof_grpc_event()', 59 'CompletionQueueSafeHandle grpcsharp_completion_queue_create_async()', 60 'CompletionQueueSafeHandle grpcsharp_completion_queue_create_sync()', 61 'void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq)', 62 'CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq)', 63 'CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag)', 64 'void grpcsharp_completion_queue_destroy(IntPtr cq)', 65 'void gprsharp_free(IntPtr ptr)', 66 'MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity)', 67 'void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength)', 68 'UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray)', 69 'IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index, out UIntPtr keyLength)', 70 'IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index, out UIntPtr valueLength)', 71 'void grpcsharp_metadata_array_destroy_full(IntPtr array)', 72 'void grpcsharp_redirect_log(GprLogDelegate callback)', 73 'void grpcsharp_native_callback_dispatcher_init(NativeCallbackDispatcherCallback dispatcher)', 74 'CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(IntPtr nativeCallbackTag)', 75 'void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails)', 76 'ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, SslClientCertificateRequestType clientCertificateRequest)', 77 'void grpcsharp_server_credentials_release(IntPtr credentials)', 78 'ServerSafeHandle grpcsharp_server_create(ChannelArgsSafeHandle args)', 79 'void grpcsharp_server_register_completion_queue(ServerSafeHandle server, CompletionQueueSafeHandle cq)', 80 'int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr)', 81 'int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds)', 82 'void grpcsharp_server_start(ServerSafeHandle server)', 83 'CallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, RequestCallContextSafeHandle ctx)', 84 'void grpcsharp_server_cancel_all_calls(ServerSafeHandle server)', 85 'void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx)', 86 'void grpcsharp_server_destroy(IntPtr server)', 87 'AuthContextSafeHandle grpcsharp_call_auth_context(CallSafeHandle call)', 88 'IntPtr grpcsharp_auth_context_peer_identity_property_name(AuthContextSafeHandle authContext) // returns const char*', 89 'AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator(AuthContextSafeHandle authContext)', 90 'IntPtr grpcsharp_auth_property_iterator_next(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator) // returns const auth_property*', 91 'void grpcsharp_auth_context_release(IntPtr authContext)', 92 'SliceBufferSafeHandle grpcsharp_slice_buffer_create()', 93 'IntPtr grpcsharp_slice_buffer_adjust_tail_space(SliceBufferSafeHandle sliceBuffer, UIntPtr availableTailSpace, UIntPtr requestedTailSpace)', 94 'UIntPtr grpcsharp_slice_buffer_slice_count(SliceBufferSafeHandle sliceBuffer)', 95 'void grpcsharp_slice_buffer_slice_peek(SliceBufferSafeHandle sliceBuffer, UIntPtr index, out UIntPtr sliceLen, out IntPtr sliceDataPtr)', 96 'void grpcsharp_slice_buffer_reset_and_unref(SliceBufferSafeHandle sliceBuffer)', 97 'void grpcsharp_slice_buffer_destroy(IntPtr sliceBuffer)', 98 'Timespec gprsharp_now(ClockType clockType)', 99 'Timespec gprsharp_inf_future(ClockType clockType)', 100 'Timespec gprsharp_inf_past(ClockType clockType)', 101 'Timespec gprsharp_convert_clock_type(Timespec t, ClockType targetClock)', 102 'int gprsharp_sizeof_timespec()', 103 'CallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] NativeCallbackTestDelegate callback)', 104 'IntPtr grpcsharp_test_nop(IntPtr ptr)', 105 'void grpcsharp_test_override_method(string methodName, string variant)', 106 'CallError grpcsharp_test_call_start_unary_echo(CallSafeHandle call, BatchContextSafeHandle ctx, SliceBufferSafeHandle sendBuffer, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags metadataFlags)', 107] 108 109import re 110native_methods = [] 111for signature in native_method_signatures: 112 match = re.match('([A-Za-z0-9_.]+) +([A-Za-z0-9_]+)\\((.*)\\)(.*)', signature) 113 if not match: 114 raise Exception('Malformed signature "%s"' % signature) 115 native_methods.append({'returntype': match.group(1), 'name': match.group(2), 'params': match.group(3), 'comment': match.group(4)}) 116 117return list(native_methods) 118%></%def> 119