Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -0,0 +1,12 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.Channels
{
static class ByteStreamConfigurationStrings
{
internal const string ReaderQuotas = "readerQuotas";
internal const string BindingElementType = "bindingElementType";
}
}

View File

@@ -0,0 +1,137 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.Configuration;
using System.Runtime;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
using System.Xml;
using System.Diagnostics.CodeAnalysis;
public sealed partial class ByteStreamMessageEncodingElement : BindingElementExtensionElement
{
public ByteStreamMessageEncodingElement()
{
}
[SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationPropertyAttributeRule, Justification = "this property not a configuration property")]
public override Type BindingElementType
{
get { return typeof(ByteStreamMessageEncodingBindingElement); }
}
[ConfigurationProperty(ByteStreamConfigurationStrings.ReaderQuotas)]
public XmlDictionaryReaderQuotasElement ReaderQuotas
{
get { return (XmlDictionaryReaderQuotasElement)base[ByteStreamConfigurationStrings.ReaderQuotas]; }
}
public override void ApplyConfiguration(BindingElement bindingElement)
{
base.ApplyConfiguration(bindingElement);
ByteStreamMessageEncodingBindingElement binding = (ByteStreamMessageEncodingBindingElement)bindingElement;
this.ApplyConfiguration(binding.ReaderQuotas);
}
public override void CopyFrom(ServiceModelExtensionElement from)
{
base.CopyFrom(from);
ByteStreamMessageEncodingElement source = (ByteStreamMessageEncodingElement)from;
this.CopyFrom(source.ReaderQuotas);
}
protected internal override void InitializeFrom(BindingElement bindingElement)
{
base.InitializeFrom(bindingElement);
ByteStreamMessageEncodingBindingElement element = (ByteStreamMessageEncodingBindingElement)bindingElement;
this.InitializeFrom(element.ReaderQuotas);
}
protected internal override BindingElement CreateBindingElement()
{
ByteStreamMessageEncodingBindingElement binding = new ByteStreamMessageEncodingBindingElement();
this.ApplyConfiguration(binding);
return binding;
}
void ApplyConfiguration(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
{
throw FxTrace.Exception.ArgumentNull("readerQuotas");
}
XmlDictionaryReaderQuotasElement oldQuotas = this.ReaderQuotas;
if (oldQuotas.MaxDepth != 0)
{
readerQuotas.MaxDepth = oldQuotas.MaxDepth;
}
if (oldQuotas.MaxStringContentLength != 0)
{
readerQuotas.MaxStringContentLength = oldQuotas.MaxStringContentLength;
}
if (oldQuotas.MaxArrayLength != 0)
{
readerQuotas.MaxArrayLength = oldQuotas.MaxArrayLength;
}
if (oldQuotas.MaxBytesPerRead != 0)
{
readerQuotas.MaxBytesPerRead = oldQuotas.MaxBytesPerRead;
}
if (oldQuotas.MaxNameTableCharCount != 0)
{
readerQuotas.MaxNameTableCharCount = oldQuotas.MaxNameTableCharCount;
}
}
void InitializeFrom(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
{
throw FxTrace.Exception.ArgumentNull("readerQuotas");
}
XmlDictionaryReaderQuotasElement thisQuotas = this.ReaderQuotas;
// Can't call thisQuotas.InitializeFrom() because it's internal to System.ServiceModel.dll, so we duplicate the logic
if (readerQuotas.MaxDepth != EncoderDefaults.MaxDepth && readerQuotas.MaxDepth != 0)
{
thisQuotas.MaxDepth = readerQuotas.MaxDepth;
}
if (readerQuotas.MaxStringContentLength != EncoderDefaults.MaxStringContentLength && readerQuotas.MaxStringContentLength != 0)
{
thisQuotas.MaxStringContentLength = readerQuotas.MaxStringContentLength;
}
if (readerQuotas.MaxArrayLength != EncoderDefaults.MaxArrayLength && readerQuotas.MaxArrayLength != 0)
{
thisQuotas.MaxArrayLength = readerQuotas.MaxArrayLength;
}
if (readerQuotas.MaxBytesPerRead != EncoderDefaults.MaxBytesPerRead && readerQuotas.MaxBytesPerRead != 0)
{
thisQuotas.MaxBytesPerRead = readerQuotas.MaxBytesPerRead;
}
if (readerQuotas.MaxNameTableCharCount != EncoderDefaults.MaxNameTableCharCount && readerQuotas.MaxNameTableCharCount != 0)
{
thisQuotas.MaxNameTableCharCount = readerQuotas.MaxNameTableCharCount;
}
}
void CopyFrom(XmlDictionaryReaderQuotasElement readerQuotas)
{
XmlDictionaryReaderQuotasElement thisQuotas = this.ReaderQuotas;
thisQuotas.MaxDepth = readerQuotas.MaxDepth;
thisQuotas.MaxStringContentLength = readerQuotas.MaxStringContentLength;
thisQuotas.MaxArrayLength = readerQuotas.MaxArrayLength;
thisQuotas.MaxBytesPerRead = readerQuotas.MaxBytesPerRead;
thisQuotas.MaxNameTableCharCount = readerQuotas.MaxNameTableCharCount;
}
}
}

View File

@@ -0,0 +1,135 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
// This code was produced by a tool, ConfigPropertyGenerator.exe, by reflecting over
// System.ServiceModel.Channels, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
// Please add this file to the project that built the assembly.
// Doing so will provide better performance for retrieving the ConfigurationElement Properties.
// If compilation errors occur, make sure that the Properties property has not
// already been provided. If it has, decide if you want the version produced by
// this tool or by the developer.
// If build errors result, make sure the config class is marked with the partial keyword.
// To regenerate a new Properties.cs after changes to the configuration OM for
// this assembly, simply run Indigo\Suites\Configuration\Infrastructure\ConfigPropertyGenerator.
// If any changes affect this file, the suite will fail. Instructions on how to
// update Properties.cs will be included in the tests output file (ConfigPropertyGenerator.out).
using System.Configuration;
using System.Globalization;
// configType.Name: UdpBindingElement
namespace System.ServiceModel.Configuration
{
public partial class UdpBindingElement
{
ConfigurationPropertyCollection properties;
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.properties == null)
{
ConfigurationPropertyCollection properties = base.Properties;
properties.Add(new ConfigurationProperty("duplicateMessageHistoryLength", typeof(System.Int32), 0, null, new System.Configuration.IntegerValidator(0, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxBufferPoolSize", typeof(System.Int64), (long)524288, null, new System.Configuration.LongValidator(0, 9223372036854775807, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxRetransmitCount", typeof(System.Int32), 0, null, new System.Configuration.IntegerValidator(0, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxPendingMessagesTotalSize", typeof(System.Int64), (long)0, null, new System.Configuration.LongValidator(0, 9223372036854775807, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxReceivedMessageSize", typeof(System.Int64), (long)65536, null, new System.Configuration.LongValidator(1, 9223372036854775807, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("multicastInterfaceId", typeof(System.String), string.Empty, null, new System.Configuration.StringValidator(0, 2147483647, null), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("readerQuotas", typeof(System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement), null, null, null, System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("textEncoding", typeof(System.Text.Encoding), "utf-8", new System.ServiceModel.Configuration.EncodingConverter(), null, System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("timeToLive", typeof(System.Int32), 1, null, new System.Configuration.IntegerValidator(0, 255, false), System.Configuration.ConfigurationPropertyOptions.None));
this.properties = properties;
}
return this.properties;
}
}
}
}
// configType.Name: ByteStreamMessageEncodingElement
namespace System.ServiceModel.Configuration
{
public sealed partial class ByteStreamMessageEncodingElement
{
ConfigurationPropertyCollection properties;
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.properties == null)
{
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(new ConfigurationProperty("readerQuotas", typeof(System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement), null, null, null, System.Configuration.ConfigurationPropertyOptions.None));
this.properties = properties;
}
return this.properties;
}
}
}
}
// configType.Name: SoapUdpTransportElement
namespace System.ServiceModel.Configuration
{
public sealed partial class UdpTransportElement
{
ConfigurationPropertyCollection properties;
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.properties == null)
{
ConfigurationPropertyCollection properties = base.Properties;
properties.Add(new ConfigurationProperty("duplicateMessageHistoryLength", typeof(System.Int32), 0, null, new System.Configuration.IntegerValidator(0, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxPendingMessagesTotalSize", typeof(System.Int64), (long)0, null, new System.Configuration.LongValidator(0, 9223372036854775807, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("multicastInterfaceId", typeof(System.String), string.Empty, null, new System.Configuration.StringValidator(0, 2147483647, null), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("socketReceiveBufferSize", typeof(System.Int32), 65536, null, new System.Configuration.IntegerValidator(1, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("timeToLive", typeof(System.Int32), 1, null, new System.Configuration.IntegerValidator(0, 255, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("retransmissionSettings", typeof(System.ServiceModel.Configuration.UdpRetransmissionSettingsElement), null, null, null, System.Configuration.ConfigurationPropertyOptions.None));
this.properties = properties;
}
return this.properties;
}
}
}
}
// configType.Name: UdpRetransmissionSettingsElement
namespace System.ServiceModel.Configuration
{
public sealed partial class UdpRetransmissionSettingsElement
{
ConfigurationPropertyCollection properties;
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.properties == null)
{
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(new ConfigurationProperty("delayLowerBound", typeof(System.TimeSpan), System.TimeSpan.Parse("00:00:00.050", CultureInfo.InvariantCulture), new System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter(), new System.ServiceModel.Configuration.TimeSpanOrInfiniteValidator(System.TimeSpan.Parse("00:00:00", CultureInfo.InvariantCulture), System.TimeSpan.Parse("24.20:31:23.6470000", CultureInfo.InvariantCulture)), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("delayUpperBound", typeof(System.TimeSpan), System.TimeSpan.Parse("00:00:00.250", CultureInfo.InvariantCulture), new System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter(), new System.ServiceModel.Configuration.TimeSpanOrInfiniteValidator(System.TimeSpan.Parse("00:00:00", CultureInfo.InvariantCulture), System.TimeSpan.Parse("24.20:31:23.6470000", CultureInfo.InvariantCulture)), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxDelayPerRetransmission", typeof(System.TimeSpan), System.TimeSpan.Parse("00:00:00.500", CultureInfo.InvariantCulture), new System.ServiceModel.Configuration.TimeSpanOrInfiniteConverter(), new System.ServiceModel.Configuration.TimeSpanOrInfiniteValidator(System.TimeSpan.Parse("00:00:00", CultureInfo.InvariantCulture), System.TimeSpan.Parse("24.20:31:23.6470000", CultureInfo.InvariantCulture)), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxMulticastRetransmitCount", typeof(System.Int32), 0, null, new System.Configuration.IntegerValidator(0, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(new ConfigurationProperty("maxUnicastRetransmitCount", typeof(System.Int32), 0, null, new System.Configuration.IntegerValidator(0, 2147483647, false), System.Configuration.ConfigurationPropertyOptions.None));
this.properties = properties;
}
return this.properties;
}
}
}
}

View File

@@ -0,0 +1,14 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
public class UdpBindingCollectionElement : StandardBindingCollectionElement<UdpBinding, UdpBindingElement>
{
internal static UdpBindingCollectionElement GetBindingCollectionElement()
{
return (UdpBindingCollectionElement)ConfigurationHelpers.GetBindingCollectionElement(UdpTransportConfigurationStrings.UdpBindingElementName);
}
}
}

View File

@@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.ComponentModel;
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Channels;
using System.Text;
public partial class UdpBindingElement : StandardBindingElement
{
public UdpBindingElement(string name)
: base(name)
{
}
public UdpBindingElement()
: this(null)
{
}
protected override Type BindingElementType
{
get { return typeof(UdpBinding); }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.DuplicateMessageHistoryLength, DefaultValue = UdpConstants.Defaults.DuplicateMessageHistoryLength)]
[IntegerValidator(MinValue = 0)]
public int DuplicateMessageHistoryLength
{
get { return (int)base[UdpTransportConfigurationStrings.DuplicateMessageHistoryLength]; }
set { base[UdpTransportConfigurationStrings.DuplicateMessageHistoryLength] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxBufferPoolSize, DefaultValue = TransportDefaults.MaxBufferPoolSize)]
[LongValidator(MinValue = 0)]
public long MaxBufferPoolSize
{
get { return (long)base[UdpTransportConfigurationStrings.MaxBufferPoolSize]; }
set { base[UdpTransportConfigurationStrings.MaxBufferPoolSize] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxRetransmitCount, DefaultValue = UdpConstants.Defaults.MaxRetransmitCount)]
[IntegerValidator(MinValue = 0)]
public int MaxRetransmitCount
{
get { return (int)base[UdpTransportConfigurationStrings.MaxRetransmitCount]; }
set { base[UdpTransportConfigurationStrings.MaxRetransmitCount] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize, DefaultValue = UdpConstants.Defaults.DefaultMaxPendingMessagesTotalSize)]
[LongValidator(MinValue = UdpConstants.MinPendingMessagesTotalSize)]
public long MaxPendingMessagesTotalSize
{
get { return (long)base[UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize]; }
set { base[UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize] = value; }
}
// Min value has to be 1, because it's 1 in the TransportBindingElement
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxReceivedMessageSize, DefaultValue = UdpConstants.Defaults.MaxReceivedMessageSize)]
[LongValidator(MinValue = 1)]
public long MaxReceivedMessageSize
{
get { return (long)this[UdpTransportConfigurationStrings.MaxReceivedMessageSize]; }
set { this[UdpTransportConfigurationStrings.MaxReceivedMessageSize] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MulticastInterfaceId, DefaultValue = UdpConstants.Defaults.MulticastInterfaceId)]
[StringValidator()]
public string MulticastInterfaceId
{
get { return (string)base[UdpTransportConfigurationStrings.MulticastInterfaceId]; }
set { base[UdpTransportConfigurationStrings.MulticastInterfaceId] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.ReaderQuotas)]
public XmlDictionaryReaderQuotasElement ReaderQuotas
{
get { return (XmlDictionaryReaderQuotasElement)base[UdpTransportConfigurationStrings.ReaderQuotas]; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.TextEncoding, DefaultValue = UdpConstants.Defaults.EncodingString)]
[TypeConverter(typeof(EncodingConverter))]
[SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule, Justification = "this property not a configuration property")]
public Encoding TextEncoding
{
get { return (Encoding)base[UdpTransportConfigurationStrings.TextEncoding]; }
set { base[UdpTransportConfigurationStrings.TextEncoding] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.TimeToLive, DefaultValue = UdpConstants.Defaults.TimeToLive)]
[IntegerValidator(MinValue = UdpConstants.MinTimeToLive, MaxValue = UdpConstants.MaxTimeToLive)]
public int TimeToLive
{
get { return (int)base[UdpTransportConfigurationStrings.TimeToLive]; }
set { base[UdpTransportConfigurationStrings.TimeToLive] = value; }
}
protected internal override void InitializeFrom(Binding binding)
{
base.InitializeFrom(binding);
UdpBinding udpBinding = (UdpBinding)binding;
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DuplicateMessageHistoryLength, udpBinding.DuplicateMessageHistoryLength);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxBufferPoolSize, udpBinding.MaxBufferPoolSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxRetransmitCount, udpBinding.MaxRetransmitCount);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize, udpBinding.MaxPendingMessagesTotalSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxReceivedMessageSize, udpBinding.MaxReceivedMessageSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MulticastInterfaceId, udpBinding.MulticastInterfaceId);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.TimeToLive, udpBinding.TimeToLive);
}
protected override void OnApplyConfiguration(Binding binding)
{
UdpBinding udpBinding = (UdpBinding)binding;
udpBinding.DuplicateMessageHistoryLength = this.DuplicateMessageHistoryLength;
udpBinding.MaxBufferPoolSize = this.MaxBufferPoolSize;
udpBinding.MaxRetransmitCount = this.MaxRetransmitCount;
udpBinding.MaxPendingMessagesTotalSize = this.MaxPendingMessagesTotalSize;
udpBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
udpBinding.MulticastInterfaceId = this.MulticastInterfaceId;
udpBinding.TimeToLive = this.TimeToLive;
}
}
}

View File

@@ -0,0 +1,85 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.ComponentModel;
using System.Configuration;
using System.Runtime;
using System.ServiceModel.Channels;
public sealed partial class UdpRetransmissionSettingsElement : ServiceModelConfigurationElement
{
public UdpRetransmissionSettingsElement()
{
}
internal void ApplyConfiguration(UdpRetransmissionSettings udpRetransmissionSettings)
{
udpRetransmissionSettings.DelayLowerBound = this.DelayLowerBound;
udpRetransmissionSettings.DelayUpperBound = this.DelayUpperBound;
udpRetransmissionSettings.MaxDelayPerRetransmission = this.MaxDelayPerRetransmission;
udpRetransmissionSettings.MaxMulticastRetransmitCount = this.MaxMulticastRetransmitCount;
udpRetransmissionSettings.MaxUnicastRetransmitCount = this.MaxUnicastRetransmitCount;
}
internal void InitializeFrom(UdpRetransmissionSettings udpRetransmissionSettings)
{
if (udpRetransmissionSettings == null)
{
throw FxTrace.Exception.ArgumentNull("udpRetransmissionSettings");
}
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DelayLowerBound, udpRetransmissionSettings.DelayLowerBound);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DelayUpperBound, udpRetransmissionSettings.DelayUpperBound);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxDelayPerRetransmission, udpRetransmissionSettings.MaxDelayPerRetransmission);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxMulticastRetransmitCount, udpRetransmissionSettings.MaxMulticastRetransmitCount);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxUnicastRetransmitCount, udpRetransmissionSettings.MaxUnicastRetransmitCount);
}
[ConfigurationProperty(UdpTransportConfigurationStrings.DelayLowerBound, DefaultValue = UdpConstants.Defaults.DelayLowerBound)]
[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[ServiceModelTimeSpanValidator(MinValueString = UdpConstants.TimeSpanZero)]
public TimeSpan DelayLowerBound
{
get { return (TimeSpan)base[UdpTransportConfigurationStrings.DelayLowerBound]; }
set { base[UdpTransportConfigurationStrings.DelayLowerBound] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.DelayUpperBound, DefaultValue = UdpConstants.Defaults.DelayUpperBound)]
[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[ServiceModelTimeSpanValidator(MinValueString = UdpConstants.TimeSpanZero)]
public TimeSpan DelayUpperBound
{
get { return (TimeSpan)base[UdpTransportConfigurationStrings.DelayUpperBound]; }
set { base[UdpTransportConfigurationStrings.DelayUpperBound] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxDelayPerRetransmission, DefaultValue = UdpConstants.Defaults.MaxDelayPerRetransmission)]
[TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[ServiceModelTimeSpanValidator(MinValueString = UdpConstants.TimeSpanZero)]
public TimeSpan MaxDelayPerRetransmission
{
get { return (TimeSpan)base[UdpTransportConfigurationStrings.MaxDelayPerRetransmission]; }
set { base[UdpTransportConfigurationStrings.MaxDelayPerRetransmission] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxMulticastRetransmitCount, DefaultValue = UdpConstants.Defaults.MaxMulticastRetransmitCount)]
[IntegerValidator(MinValue = 0)]
public int MaxMulticastRetransmitCount
{
get { return (int)base[UdpTransportConfigurationStrings.MaxMulticastRetransmitCount]; }
set { base[UdpTransportConfigurationStrings.MaxMulticastRetransmitCount] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxUnicastRetransmitCount, DefaultValue = UdpConstants.Defaults.MaxUnicastRetransmitCount)]
[IntegerValidator(MinValue = 0)]
public int MaxUnicastRetransmitCount
{
get { return (int)base[UdpTransportConfigurationStrings.MaxUnicastRetransmitCount]; }
set { base[UdpTransportConfigurationStrings.MaxUnicastRetransmitCount] = value; }
}
}
}

View File

@@ -0,0 +1,32 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
static class UdpTransportConfigurationStrings
{
// UDP transport settings
internal const string DuplicateMessageHistoryLength = "duplicateMessageHistoryLength";
internal const string MaxPendingMessagesTotalSize = "maxPendingMessagesTotalSize";
internal const string MaxReceivedMessageSize = "maxReceivedMessageSize";
internal const string MaxBufferPoolSize = "maxBufferPoolSize";
internal const string MulticastInterfaceId = "multicastInterfaceId";
internal const string SocketReceiveBufferSize = "socketReceiveBufferSize";
internal const string TimeToLive = "timeToLive";
// UDP retransmission settings
internal const string RetransmissionSettings = "retransmissionSettings";
internal const string DelayLowerBound = "delayLowerBound";
internal const string DelayUpperBound = "delayUpperBound";
internal const string MaxDelayPerRetransmission = "maxDelayPerRetransmission";
internal const string MaxMulticastRetransmitCount = "maxMulticastRetransmitCount";
internal const string MaxUnicastRetransmitCount = "maxUnicastRetransmitCount";
// BasicUdpBinding strings
internal const string UdpBindingElementName = "udpBinding";
internal const string MaxRetransmitCount = "maxRetransmitCount";
internal const string ReaderQuotas = "readerQuotas";
internal const string TextEncoding = "textEncoding";
}
}

View File

@@ -0,0 +1,106 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Configuration
{
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Channels;
public sealed partial class UdpTransportElement : TransportElement
{
public UdpTransportElement() : base()
{
}
public override void ApplyConfiguration(BindingElement bindingElement)
{
base.ApplyConfiguration(bindingElement);
UdpTransportBindingElement udpTransportBindingElement = (UdpTransportBindingElement)bindingElement;
udpTransportBindingElement.DuplicateMessageHistoryLength = this.DuplicateMessageHistoryLength;
udpTransportBindingElement.MaxPendingMessagesTotalSize = this.MaxPendingMessagesTotalSize;
udpTransportBindingElement.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
udpTransportBindingElement.MulticastInterfaceId = this.MulticastInterfaceId;
this.RetransmissionSettings.ApplyConfiguration(udpTransportBindingElement.RetransmissionSettings);
udpTransportBindingElement.SocketReceiveBufferSize = this.SocketReceiveBufferSize;
udpTransportBindingElement.TimeToLive = this.TimeToLive;
}
protected internal override void InitializeFrom(BindingElement bindingElement)
{
base.InitializeFrom(bindingElement);
UdpTransportBindingElement udpTransportBindingElement = (UdpTransportBindingElement)bindingElement;
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.DuplicateMessageHistoryLength, udpTransportBindingElement.DuplicateMessageHistoryLength);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize, udpTransportBindingElement.MaxPendingMessagesTotalSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MaxReceivedMessageSize, udpTransportBindingElement.MaxReceivedMessageSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.MulticastInterfaceId, udpTransportBindingElement.MulticastInterfaceId);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.SocketReceiveBufferSize, udpTransportBindingElement.SocketReceiveBufferSize);
this.SetPropertyValueIfNotDefaultValue(UdpTransportConfigurationStrings.TimeToLive, udpTransportBindingElement.TimeToLive);
this.RetransmissionSettings.InitializeFrom(udpTransportBindingElement.RetransmissionSettings);
}
[SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationPropertyAttributeRule, Justification = "this property not a configuration property")]
public override Type BindingElementType
{
get { return typeof(UdpTransportBindingElement); }
}
protected override TransportBindingElement CreateDefaultBindingElement()
{
return new UdpTransportBindingElement();
}
[ConfigurationProperty(UdpTransportConfigurationStrings.DuplicateMessageHistoryLength, DefaultValue = UdpConstants.Defaults.DuplicateMessageHistoryLength)]
[IntegerValidator(MinValue = 0)]
public int DuplicateMessageHistoryLength
{
get { return (int)base[UdpTransportConfigurationStrings.DuplicateMessageHistoryLength]; }
set { base[UdpTransportConfigurationStrings.DuplicateMessageHistoryLength] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize, DefaultValue = UdpConstants.Defaults.DefaultMaxPendingMessagesTotalSize)]
[LongValidator(MinValue = UdpConstants.MinPendingMessagesTotalSize)]
public long MaxPendingMessagesTotalSize
{
get { return (long)base[UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize]; }
set { base[UdpTransportConfigurationStrings.MaxPendingMessagesTotalSize] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.MulticastInterfaceId, DefaultValue = UdpConstants.Defaults.MulticastInterfaceId)]
[StringValidator()]
public string MulticastInterfaceId
{
get { return (string)base[UdpTransportConfigurationStrings.MulticastInterfaceId]; }
set { base[UdpTransportConfigurationStrings.MulticastInterfaceId] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.SocketReceiveBufferSize, DefaultValue = UdpConstants.Defaults.SocketReceiveBufferSize)]
[IntegerValidator(MinValue = UdpConstants.MinReceiveBufferSize)]
public int SocketReceiveBufferSize
{
get { return (int)base[UdpTransportConfigurationStrings.SocketReceiveBufferSize]; }
set { base[UdpTransportConfigurationStrings.SocketReceiveBufferSize] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.TimeToLive, DefaultValue = UdpConstants.Defaults.TimeToLive)]
[IntegerValidator(MinValue = UdpConstants.MinTimeToLive, MaxValue = UdpConstants.MaxTimeToLive)]
public int TimeToLive
{
get { return (int)base[UdpTransportConfigurationStrings.TimeToLive]; }
set { base[UdpTransportConfigurationStrings.TimeToLive] = value; }
}
[ConfigurationProperty(UdpTransportConfigurationStrings.RetransmissionSettings)]
[SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule, Justification = "there's no validator for UdpRetransmissionSettingsElement")]
public UdpRetransmissionSettingsElement RetransmissionSettings
{
get { return (UdpRetransmissionSettingsElement)base[UdpTransportConfigurationStrings.RetransmissionSettings]; }
set { base[UdpTransportConfigurationStrings.RetransmissionSettings] = value; }
}
}
}