Ejemplo n.º 1
0
        internal static unsafe void SetIPEndPointParam(MsQuicApi api, SafeHandle nativeObject, uint param, IPEndPoint value)
        {
            Internals.SocketAddress socketAddress = IPEndPointExtensions.Serialize(value);

            // MsQuic always reads same amount of memory as if IPv6 was used, so we can't pass pointer to socketAddress.Buffer directly
            Span <byte> address = stackalloc byte[Internals.SocketAddress.IPv6AddressSize];

            socketAddress.Buffer.AsSpan(0, socketAddress.Size).CopyTo(address);
            address.Slice(socketAddress.Size).Clear();

            fixed(byte *paddress = &MemoryMarshal.GetReference(address))
            {
                QuicExceptionHelpers.ThrowIfFailed(
                    api.SetParamDelegate(nativeObject, param, (uint)address.Length, paddress),
                    "Could not set IPEndPoint");
            }
        }
Ejemplo n.º 2
0
 internal static unsafe void SetULongParam(MsQuicApi api, SafeHandle nativeObject, uint param, ulong value)
 {
     QuicExceptionHelpers.ThrowIfFailed(
         api.SetParamDelegate(nativeObject, param, sizeof(ulong), (byte *)&value),
         "Could not set ulong.");
 }
Ejemplo n.º 3
0
 internal static unsafe void SetUShortParam(MsQuicApi api, SafeHandle nativeObject, QUIC_PARAM_LEVEL level, uint param, ushort value)
 {
     QuicExceptionHelpers.ThrowIfFailed(
         api.SetParamDelegate(nativeObject, level, param, sizeof(ushort), (byte *)&value),
         "Could not set ushort.");
 }