Skip to content

Commit

Permalink
Add Callback Helpers to .NET Interop Layer (microsoft#2719)
Browse files Browse the repository at this point in the history
  • Loading branch information
thhous-msft authored May 16, 2022
1 parent 428aa22 commit 9f7e323
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/cs/lib/msquic_extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma warning disable IDE0073
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//
#pragma warning restore IDE0073

using System;

namespace Microsoft.Quic
{
internal unsafe static class MsQuicExtensions
{
public static void SetConnectionCallback(this ref QUIC_API_TABLE Table, QUIC_HANDLE* Handle, delegate* unmanaged[Cdecl]<QUIC_HANDLE*, void*, QUIC_CONNECTION_EVENT*, int> Callback, void* Context)
{
Table.SetCallbackHandler(Handle, Callback, Context);
}

public static void SetStreamCallback(this ref QUIC_API_TABLE Table, QUIC_HANDLE* Handle, delegate* unmanaged[Cdecl]<QUIC_HANDLE*, void*, QUIC_STREAM_EVENT*, int> Callback, void* Context)
{
Table.SetCallbackHandler(Handle, Callback, Context);
}

public static void SetListenerCallback(this ref QUIC_API_TABLE Table, QUIC_HANDLE* Handle, delegate* unmanaged[Cdecl]<QUIC_HANDLE*, void*, QUIC_LISTENER_EVENT*, int> Callback, void* Context)
{
Table.SetCallbackHandler(Handle, Callback, Context);
}
}
}

0 comments on commit 9f7e323

Please sign in to comment.