Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.ServiceModel.Discovery / System / ServiceModel / Discovery / Configuration / UdpTransportSettingsElement.cs / 1305376 / UdpTransportSettingsElement.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.ServiceModel.Discovery.Configuration
{
using System.Configuration;
using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.ServiceModel.Channels;
[Fx.Tag.XamlVisible(false)]
public sealed class UdpTransportSettingsElement : ConfigurationElement
{
ConfigurationPropertyCollection properties;
[ConfigurationProperty(ConfigurationStrings.DuplicateMessageHistoryLength, DefaultValue = DiscoveryDefaults.Udp.DuplicateMessageHistoryLength)]
[IntegerValidator(MinValue = 0, MaxValue = int.MaxValue)]
public int DuplicateMessageHistoryLength
{
get
{
return (int)base[ConfigurationStrings.DuplicateMessageHistoryLength];
}
set
{
base[ConfigurationStrings.DuplicateMessageHistoryLength] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MaxPendingMessageCount, DefaultValue = UdpConstants.Defaults.MaxPendingMessageCount)]
[IntegerValidator(MinValue = 1, MaxValue = int.MaxValue)]
public int MaxPendingMessageCount
{
get
{
return (int)base[ConfigurationStrings.MaxPendingMessageCount];
}
set
{
base[ConfigurationStrings.MaxPendingMessageCount] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MaxMulticastRetransmitCount, DefaultValue = DiscoveryDefaults.Udp.MaxMulticastRetransmitCount)]
[IntegerValidator(MinValue = 0, MaxValue = int.MaxValue)]
public int MaxMulticastRetransmitCount
{
get
{
return (int)base[ConfigurationStrings.MaxMulticastRetransmitCount];
}
set
{
base[ConfigurationStrings.MaxMulticastRetransmitCount] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MaxUnicastRetransmitCount, DefaultValue = DiscoveryDefaults.Udp.MaxUnicastRetransmitCount)]
[SuppressMessage(FxCop.Category.Naming, FxCop.Rule.IdentifiersShouldBeSpelledCorrectly, Justification = "Unicast is a valid name.")]
[IntegerValidator(MinValue = 0, MaxValue = int.MaxValue)]
public int MaxUnicastRetransmitCount
{
get
{
return (int)base[ConfigurationStrings.MaxUnicastRetransmitCount];
}
set
{
base[ConfigurationStrings.MaxUnicastRetransmitCount] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MulticastInterfaceId)]
[SuppressMessage(FxCop.Category.Configuration, FxCop.Rule.ConfigurationValidatorAttributeRule)]
public string MulticastInterfaceId
{
get
{
return (string)base[ConfigurationStrings.MulticastInterfaceId];
}
set
{
base[ConfigurationStrings.MulticastInterfaceId] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.SocketReceiveBufferSize, DefaultValue = UdpConstants.Defaults.SocketReceiveBufferSize)]
[IntegerValidator(MinValue = UdpConstants.MinReceiveBufferSize, MaxValue = int.MaxValue)]
public int SocketReceiveBufferSize
{
get
{
return (int)base[ConfigurationStrings.SocketReceiveBufferSize];
}
set
{
base[ConfigurationStrings.SocketReceiveBufferSize] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.TimeToLive, DefaultValue = UdpConstants.Defaults.TimeToLive)]
[IntegerValidator(MinValue = UdpConstants.MinTimeToLive, MaxValue = UdpConstants.MaxTimeToLive)]
public int TimeToLive
{
get
{
return (int)base[ConfigurationStrings.TimeToLive];
}
set
{
base[ConfigurationStrings.TimeToLive] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MaxReceivedMessageSize, DefaultValue = UdpConstants.Defaults.MaxReceivedMessageSize)]
[LongValidator(MinValue = 1L, MaxValue = UdpConstants.Defaults.MaxReceivedMessageSize)]
public long MaxReceivedMessageSize
{
get
{
return (long)base[ConfigurationStrings.MaxReceivedMessageSize];
}
set
{
base[ConfigurationStrings.MaxReceivedMessageSize] = value;
}
}
[ConfigurationProperty(ConfigurationStrings.MaxBufferPoolSize, DefaultValue = TransportDefaults.MaxBufferPoolSize)]
[LongValidator(MinValue = 1L, MaxValue = long.MaxValue)]
public long MaxBufferPoolSize
{
get
{
return (long)base[ConfigurationStrings.MaxBufferPoolSize];
}
set
{
base[ConfigurationStrings.MaxBufferPoolSize] = value;
}
}
protected override ConfigurationPropertyCollection Properties
{
get
{
if (this.properties == null)
{
ConfigurationPropertyCollection properties = new ConfigurationPropertyCollection();
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.DuplicateMessageHistoryLength,
typeof(int),
DiscoveryDefaults.Udp.DuplicateMessageHistoryLength,
null,
new IntegerValidator(0, int.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MaxPendingMessageCount,
typeof(int),
UdpConstants.Defaults.MaxPendingMessageCount,
null,
new IntegerValidator(1, int.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MaxMulticastRetransmitCount,
typeof(int),
DiscoveryDefaults.Udp.MaxMulticastRetransmitCount,
null,
new IntegerValidator(0, int.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MaxUnicastRetransmitCount,
typeof(int),
DiscoveryDefaults.Udp.MaxUnicastRetransmitCount,
null,
new IntegerValidator(0, int.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MulticastInterfaceId,
typeof(string),
null,
null,
null,
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.SocketReceiveBufferSize,
typeof(int),
UdpConstants.Defaults.SocketReceiveBufferSize,
null,
new IntegerValidator(UdpConstants.MinReceiveBufferSize, int.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.TimeToLive,
typeof(int),
UdpConstants.Defaults.TimeToLive,
null,
new IntegerValidator(UdpConstants.MinTimeToLive, UdpConstants.MaxTimeToLive),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MaxReceivedMessageSize,
typeof(long),
UdpConstants.Defaults.MaxReceivedMessageSize,
null,
new LongValidator(1L, UdpConstants.Defaults.MaxReceivedMessageSize),
System.Configuration.ConfigurationPropertyOptions.None));
properties.Add(
new ConfigurationProperty(
ConfigurationStrings.MaxBufferPoolSize,
typeof(long),
TransportDefaults.MaxBufferPoolSize,
null,
new LongValidator(1L, long.MaxValue),
System.Configuration.ConfigurationPropertyOptions.None));
this.properties = properties;
}
return this.properties;
}
}
internal void ApplyConfiguration(UdpTransportSettings target)
{
target.DuplicateMessageHistoryLength = this.DuplicateMessageHistoryLength;
target.MaxPendingMessageCount = this.MaxPendingMessageCount;
target.MaxMulticastRetransmitCount = this.MaxMulticastRetransmitCount;
target.MaxUnicastRetransmitCount = this.MaxUnicastRetransmitCount;
target.MulticastInterfaceId = this.MulticastInterfaceId;
target.SocketReceiveBufferSize = this.SocketReceiveBufferSize;
target.TimeToLive = this.TimeToLive;
target.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
target.MaxBufferPoolSize = this.MaxBufferPoolSize;
}
internal void InitializeFrom(UdpTransportSettings source)
{
this.DuplicateMessageHistoryLength = source.DuplicateMessageHistoryLength;
this.MaxPendingMessageCount = source.MaxPendingMessageCount;
this.MaxMulticastRetransmitCount = source.MaxMulticastRetransmitCount;
this.MaxUnicastRetransmitCount = source.MaxUnicastRetransmitCount;
this.MulticastInterfaceId = source.MulticastInterfaceId;
this.SocketReceiveBufferSize = source.SocketReceiveBufferSize;
this.TimeToLive = source.TimeToLive;
this.MaxReceivedMessageSize = source.MaxReceivedMessageSize;
this.MaxBufferPoolSize = source.MaxBufferPoolSize;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CollectionContainer.cs
- FontStyles.cs
- TextTrailingCharacterEllipsis.cs
- RuntimeHelpers.cs
- NodeLabelEditEvent.cs
- FormView.cs
- clipboard.cs
- Ipv6Element.cs
- TileBrush.cs
- SafeLibraryHandle.cs
- CompileXomlTask.cs
- SqlBulkCopy.cs
- xdrvalidator.cs
- NoResizeHandleGlyph.cs
- Int64Animation.cs
- TextEffect.cs
- CommentAction.cs
- ConfigDefinitionUpdates.cs
- FacetEnabledSchemaElement.cs
- CharacterBufferReference.cs
- HttpHostedTransportConfiguration.cs
- TextParentUndoUnit.cs
- TypefaceMap.cs
- DiagnosticEventProvider.cs
- SafeRightsManagementQueryHandle.cs
- Double.cs
- EventMappingSettingsCollection.cs
- DesignerAttribute.cs
- BaseCodeDomTreeGenerator.cs
- CopyNodeSetAction.cs
- TypeLoadException.cs
- BaseResourcesBuildProvider.cs
- Effect.cs
- RadioButtonPopupAdapter.cs
- ServiceContractListItemList.cs
- WebPartTransformerCollection.cs
- SByteConverter.cs
- DocComment.cs
- InlineCollection.cs
- NamedPermissionSet.cs
- ScopeElementCollection.cs
- CalloutQueueItem.cs
- EUCJPEncoding.cs
- GZipStream.cs
- DependentList.cs
- HwndStylusInputProvider.cs
- XmlAutoDetectWriter.cs
- HttpBrowserCapabilitiesWrapper.cs
- ApplicationCommands.cs
- BuildProviderAppliesToAttribute.cs
- ConfigurationManagerInternalFactory.cs
- Internal.cs
- ConstructorBuilder.cs
- MatrixTransform3D.cs
- UIHelper.cs
- UriExt.cs
- AtomPub10CategoriesDocumentFormatter.cs
- XmlIterators.cs
- IArgumentProvider.cs
- InvalidComObjectException.cs
- _MultipleConnectAsync.cs
- DisplayNameAttribute.cs
- SafeFileMapViewHandle.cs
- HtmlSelect.cs
- ComplexType.cs
- TimelineGroup.cs
- Journal.cs
- Dump.cs
- SQLMoneyStorage.cs
- ADMembershipUser.cs
- GestureRecognitionResult.cs
- DecodeHelper.cs
- UInt16.cs
- UrlAuthorizationModule.cs
- NamespaceCollection.cs
- Cursor.cs
- MSG.cs
- DataException.cs
- EnvelopedPkcs7.cs
- CellConstantDomain.cs
- MiniCustomAttributeInfo.cs
- _FtpDataStream.cs
- AnimatedTypeHelpers.cs
- KeyInfo.cs
- ResourceContainer.cs
- WindowsSecurityTokenAuthenticator.cs
- ActivityExecutor.cs
- GridView.cs
- listitem.cs
- QueryCacheKey.cs
- PersonalizableAttribute.cs
- ScriptControlDescriptor.cs
- ClientSession.cs
- BufferedGraphics.cs
- ZipIOModeEnforcingStream.cs
- QueryTaskGroupState.cs
- BamlWriter.cs
- DeploymentSection.cs
- CodeSubDirectory.cs
- InternalControlCollection.cs