| | | 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/> |
| | 20 | 12 | | public string DefaultName => _duplexClientTransport.DefaultName; |
| | | 13 | | |
| | | 14 | | /// <inheritdoc/> |
| | 65 | 15 | | public bool IsSslRequired(string? transportName) => _duplexClientTransport.IsSslRequired(transportName); |
| | | 16 | | |
| | | 17 | | private readonly IDuplexClientTransport _duplexClientTransport; |
| | | 18 | | private readonly SlicTransportOptions _slicTransportOptions; |
| | | 19 | | |
| | | 20 | | /// <summary>Constructs a Slic client transport.</summary> |
| | | 21 | | /// <param name="options">The options to configure the Slic transport.</param> |
| | | 22 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| | 361 | 23 | | public SlicClientTransport(SlicTransportOptions options, IDuplexClientTransport duplexClientTransport) |
| | 361 | 24 | | { |
| | 361 | 25 | | _duplexClientTransport = duplexClientTransport; |
| | 361 | 26 | | _slicTransportOptions = options; |
| | 361 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary>Constructs a Slic client transport.</summary> |
| | | 30 | | /// <param name="duplexClientTransport">The duplex client transport.</param> |
| | | 31 | | public SlicClientTransport(IDuplexClientTransport duplexClientTransport) |
| | 45 | 32 | | : this(new SlicTransportOptions(), duplexClientTransport) |
| | 45 | 33 | | { |
| | 45 | 34 | | } |
| | | 35 | | |
| | | 36 | | /// <inheritdoc/> |
| | | 37 | | public IMultiplexedConnection CreateConnection( |
| | | 38 | | TransportAddress transportAddress, |
| | | 39 | | MultiplexedConnectionOptions options, |
| | | 40 | | SslClientAuthenticationOptions? clientAuthenticationOptions) => |
| | 358 | 41 | | new SlicConnection( |
| | 358 | 42 | | _duplexClientTransport.CreateConnection( |
| | 358 | 43 | | transportAddress, |
| | 358 | 44 | | new DuplexConnectionOptions |
| | 358 | 45 | | { |
| | 358 | 46 | | MinSegmentSize = options.MinSegmentSize, |
| | 358 | 47 | | Pool = options.Pool |
| | 358 | 48 | | }, |
| | 358 | 49 | | clientAuthenticationOptions), |
| | 358 | 50 | | options, |
| | 358 | 51 | | _slicTransportOptions, |
| | 358 | 52 | | isServer: false); |
| | | 53 | | } |