Пример #1
0
 public unsafe static extern IntPtr quiche_connect(
     byte *serverName, byte *scid, UIntPtr scid_len, QuicheConfig config);
Пример #2
0
 /// <summary>
 /// Creates a new connection binding to the specified local endpoint, and using the specified config
 /// and a new auto-generated connection ID.
 /// </summary>
 /// <param name="localEndPoint">The local endpoint to bind to.</param>
 /// <param name="config">The <see cref="QuicheConfig"/> to use.</param>
 public QuicConnection(IPEndPoint localEndPoint, QuicheConfig config)
     : this(localEndPoint, QuicConnectionId.NewId(), config)
 {
 }
Пример #3
0
 /// <summary>
 /// Creates a new connection using the specified config and connection ID.
 /// </summary>
 /// <param name="sourceConnectionId">The connection ID to use to identify the local end of the connection</param>
 /// <param name="config">The <see cref="QuicheConfig"/> to use.</param>
 public QuicConnection(QuicConnectionId sourceConnectionId, QuicheConfig config)
 {
     _config            = config;
     _client            = new UdpClient();
     SourceConnectionId = sourceConnectionId;
 }
Пример #4
0
 /// <summary>
 /// Creates a new connectionusing the specified config
 /// and a new auto-generated connection ID.
 /// </summary>
 /// <param name="localEndPoint">The local endpoint to bind to.</param>
 /// <param name="config">The <see cref="QuicheConfig"/> to use.</param>
 public QuicConnection(QuicheConfig config)
     : this(QuicConnectionId.NewId(), config)
 {
 }
Пример #5
0
        private unsafe static IntPtr CreateNativeConnection(string serverName, QuicConnectionId scid, QuicheConfig config)
        {
            // PERF: We could stackalloc this if it's small enough.
            var buf = new byte[Encoding.UTF8.GetByteCount(serverName) + 1];

            Encoding.UTF8.GetBytes(serverName, 0, serverName.Length, buf, 0);
            buf[buf.Length - 1] = 0; // Null terminator.
            fixed(byte *ptr = buf)
            {
                fixed(byte *scidPtr = scid.Value.Span)
                {
                    return(NativeMethods.quiche_connect(
                               ptr,
                               scidPtr,
                               (UIntPtr)scid.Value.Length,
                               config));
                }
            }
        }
Пример #6
0
 /// <summary>
 /// Creates a new connection binding to the specified local endpoint, using the specified config and connection ID.
 /// </summary>
 /// <param name="localEndPoint">The remote endpoint to connect to</param>
 /// <param name="sourceConnectionId">The connection ID to use to identify the local end of the connection</param>
 /// <param name="config">The <see cref="QuicheConfig"/> to use.</param>
 public QuicConnection(IPEndPoint localEndPoint, QuicConnectionId sourceConnectionId, QuicheConfig config)
 {
     _config            = config;
     _localEndPoint     = localEndPoint;
     SourceConnectionId = sourceConnectionId;
 }