| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Security.Authentication.ExtendedProtection; |
| | | 6 | | using CoreWCF.Configuration; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Channels |
| | | 9 | | { |
| | | 10 | | public class UnixDomainSocketTransportBindingElement : ConnectionOrientedTransportBindingElement |
| | | 11 | | { |
| | | 12 | | private int _listenBacklog; |
| | | 13 | | private ExtendedProtectionPolicy _extendedProtectionPolicy; |
| | | 14 | | |
| | 7 | 15 | | public UnixDomainSocketTransportBindingElement() : base() |
| | | 16 | | { |
| | 7 | 17 | | _listenBacklog = UnixDomainTransportDefaults.GetListenBacklog(); |
| | 7 | 18 | | _extendedProtectionPolicy = ChannelBindingUtility.DefaultPolicy; |
| | 7 | 19 | | } |
| | 56 | 20 | | protected UnixDomainSocketTransportBindingElement(UnixDomainSocketTransportBindingElement elementToBeCloned) : b |
| | | 21 | | { |
| | 56 | 22 | | _listenBacklog = elementToBeCloned._listenBacklog; |
| | 56 | 23 | | } |
| | | 24 | | |
| | | 25 | | public int ListenBacklog |
| | | 26 | | { |
| | | 27 | | get |
| | | 28 | | { |
| | 0 | 29 | | return _listenBacklog; |
| | | 30 | | } |
| | | 31 | | |
| | | 32 | | set |
| | | 33 | | { |
| | 0 | 34 | | if (value <= 0) |
| | | 35 | | { |
| | 0 | 36 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val |
| | 0 | 37 | | SRCommon.ValueMustBePositive)); |
| | | 38 | | } |
| | | 39 | | |
| | 0 | 40 | | _listenBacklog = value; |
| | 0 | 41 | | } |
| | | 42 | | } |
| | | 43 | | |
| | | 44 | | public override string Scheme |
| | | 45 | | { |
| | 17 | 46 | | get { return "net.uds"; } |
| | | 47 | | } |
| | | 48 | | |
| | | 49 | | /// <summary> |
| | | 50 | | /// TODO : check the scheme |
| | | 51 | | /// </summary> |
| | 0 | 52 | | protected override string WsdlTransportUri => "http://schemas.microsoft.com/soap/uds"; |
| | | 53 | | |
| | | 54 | | public override BindingElement Clone() |
| | | 55 | | { |
| | 56 | 56 | | return new UnixDomainSocketTransportBindingElement(this); |
| | | 57 | | } |
| | | 58 | | |
| | | 59 | | public override T GetProperty<T>(BindingContext context) |
| | | 60 | | { |
| | 8 | 61 | | if (context == null) |
| | | 62 | | { |
| | 0 | 63 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context)); |
| | | 64 | | } |
| | 8 | 65 | | else if (typeof(T) == typeof(ITransportCompressionSupport)) |
| | | 66 | | { |
| | 0 | 67 | | return (T)(object)new TransportCompressionSupportHelper(); |
| | | 68 | | } |
| | | 69 | | else |
| | | 70 | | { |
| | 8 | 71 | | return base.GetProperty<T>(context); |
| | | 72 | | } |
| | | 73 | | } |
| | | 74 | | |
| | | 75 | | public override IServiceDispatcher BuildServiceDispatcher<TChannel>(BindingContext context, IServiceDispatcher i |
| | | 76 | | { |
| | 3 | 77 | | return innerDispatcher; |
| | | 78 | | } |
| | | 79 | | } |
| | | 80 | | } |