| | 1 | | // Copyright (c) ZeroC, Inc. |
| | 2 | |
|
| | 3 | | using IceRpc.Transports.Slic.Internal; |
| | 4 | | using System.Net.Security; |
| | 5 | |
|
| | 6 | | namespace IceRpc.Transports.Slic; |
| | 7 | |
|
| | 8 | | /// <summary>Implements <see cref="IMultiplexedClientTransport" /> using Slic over a duplex client transport.</summary> |
| | 9 | | public class SlicClientTransport : IMultiplexedClientTransport |
| | 10 | | { |
| | 11 | | /// <inheritdoc/> |
| 50 | 12 | | public string Name => _duplexClientTransport.Name; |
| | 13 | |
|
| | 14 | | private readonly IDuplexClientTransport _duplexClientTransport; |
| | 15 | | private readonly SlicTransportOptions _slicTransportOptions; |
| | 16 | |
|
| | 17 | | /// <summary>Constructs a Slic client transport.</summary> |
| | 18 | | /// <param name="options">The options to configure the Slic transport.</param> |
| | 19 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| 686 | 20 | | public SlicClientTransport(SlicTransportOptions options, IDuplexClientTransport duplexClientTransport) |
| 686 | 21 | | { |
| 686 | 22 | | _duplexClientTransport = duplexClientTransport; |
| 686 | 23 | | _slicTransportOptions = options; |
| 686 | 24 | | } |
| | 25 | |
|
| | 26 | | /// <summary>Constructs a Slic client transport.</summary> |
| | 27 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| | 28 | | public SlicClientTransport(IDuplexClientTransport duplexClientTransport) |
| 67 | 29 | | : this(new SlicTransportOptions(), duplexClientTransport) |
| 67 | 30 | | { |
| 67 | 31 | | } |
| | 32 | |
|
| | 33 | | /// <inheritdoc/> |
| | 34 | | public IMultiplexedConnection CreateConnection( |
| | 35 | | ServerAddress serverAddress, |
| | 36 | | MultiplexedConnectionOptions options, |
| | 37 | | SslClientAuthenticationOptions? clientAuthenticationOptions) => |
| 698 | 38 | | new SlicConnection( |
| 698 | 39 | | _duplexClientTransport.CreateConnection( |
| 698 | 40 | | serverAddress, |
| 698 | 41 | | new DuplexConnectionOptions |
| 698 | 42 | | { |
| 698 | 43 | | MinSegmentSize = options.MinSegmentSize, |
| 698 | 44 | | Pool = options.Pool |
| 698 | 45 | | }, |
| 698 | 46 | | clientAuthenticationOptions), |
| 698 | 47 | | options, |
| 698 | 48 | | _slicTransportOptions, |
| 698 | 49 | | isServer: false); |
| | 50 | | } |