private MsQuicApi(NativeApi *vtable) { uint status; SetParamDelegate = Marshal.GetDelegateForFunctionPointer <SetParamDelegate>( vtable->SetParam); GetParamDelegate = Marshal.GetDelegateForFunctionPointer <GetParamDelegate>( vtable->GetParam); SetCallbackHandlerDelegate = Marshal.GetDelegateForFunctionPointer <SetCallbackHandlerDelegate>( vtable->SetCallbackHandler); RegistrationOpenDelegate = Marshal.GetDelegateForFunctionPointer <RegistrationOpenDelegate>( vtable->RegistrationOpen); RegistrationCloseDelegate = Marshal.GetDelegateForFunctionPointer <RegistrationCloseDelegate>( vtable->RegistrationClose); ConfigurationOpenDelegate = Marshal.GetDelegateForFunctionPointer <ConfigurationOpenDelegate>( vtable->ConfigurationOpen); ConfigurationCloseDelegate = Marshal.GetDelegateForFunctionPointer <ConfigurationCloseDelegate>( vtable->ConfigurationClose); ConfigurationLoadCredentialDelegate = Marshal.GetDelegateForFunctionPointer <ConfigurationLoadCredentialDelegate>( vtable->ConfigurationLoadCredential); ListenerOpenDelegate = Marshal.GetDelegateForFunctionPointer <ListenerOpenDelegate>( vtable->ListenerOpen); ListenerCloseDelegate = Marshal.GetDelegateForFunctionPointer <ListenerCloseDelegate>( vtable->ListenerClose); ListenerStartDelegate = Marshal.GetDelegateForFunctionPointer <ListenerStartDelegate>( vtable->ListenerStart); ListenerStopDelegate = Marshal.GetDelegateForFunctionPointer <ListenerStopDelegate>( vtable->ListenerStop); ConnectionOpenDelegate = Marshal.GetDelegateForFunctionPointer <ConnectionOpenDelegate>( vtable->ConnectionOpen); ConnectionCloseDelegate = Marshal.GetDelegateForFunctionPointer <ConnectionCloseDelegate>( vtable->ConnectionClose); ConnectionSetConfigurationDelegate = Marshal.GetDelegateForFunctionPointer <ConnectionSetConfigurationDelegate>( vtable->ConnectionSetConfiguration); ConnectionShutdownDelegate = Marshal.GetDelegateForFunctionPointer <ConnectionShutdownDelegate>( vtable->ConnectionShutdown); ConnectionStartDelegate = Marshal.GetDelegateForFunctionPointer <ConnectionStartDelegate>( vtable->ConnectionStart); StreamOpenDelegate = Marshal.GetDelegateForFunctionPointer <StreamOpenDelegate>( vtable->StreamOpen); StreamCloseDelegate = Marshal.GetDelegateForFunctionPointer <StreamCloseDelegate>( vtable->StreamClose); StreamStartDelegate = Marshal.GetDelegateForFunctionPointer <StreamStartDelegate>( vtable->StreamStart); StreamShutdownDelegate = Marshal.GetDelegateForFunctionPointer <StreamShutdownDelegate>( vtable->StreamShutdown); StreamSendDelegate = Marshal.GetDelegateForFunctionPointer <StreamSendDelegate>( vtable->StreamSend); StreamReceiveCompleteDelegate = Marshal.GetDelegateForFunctionPointer <StreamReceiveCompleteDelegate>( vtable->StreamReceiveComplete); StreamReceiveSetEnabledDelegate = Marshal.GetDelegateForFunctionPointer <StreamReceiveSetEnabledDelegate>( vtable->StreamReceiveSetEnabled); var cfg = new RegistrationConfig { AppName = ".NET", ExecutionProfile = QUIC_EXECUTION_PROFILE.QUIC_EXECUTION_PROFILE_LOW_LATENCY }; status = RegistrationOpenDelegate(ref cfg, out SafeMsQuicRegistrationHandle handle); QuicExceptionHelpers.ThrowIfFailed(status, "RegistrationOpen failed."); Registration = handle; }
internal static extern int MsQuicOpen(int version, out NativeApi *registration);