Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / ServiceModel / System / ServiceModel / Dispatcher / prefixendpointaddressmessagefiltertable.cs / 1 / prefixendpointaddressmessagefiltertable.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System; using System.ServiceModel.Channels; using System.ServiceModel; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.ServiceModel.Security; using System.Xml; using QName = System.ServiceModel.Dispatcher.EndpointAddressProcessor.QName; using HeaderBit = System.ServiceModel.Dispatcher.EndpointAddressProcessor.HeaderBit; using System.ServiceModel.Diagnostics; internal class PrefixEndpointAddressMessageFilterTable: EndpointAddressMessageFilterTable { UriPrefixTable toHostTable; UriPrefixTable toNoHostTable; public PrefixEndpointAddressMessageFilterTable() : base() { } protected override void InitializeLookupTables() { this.toHostTable = new UriPrefixTable (); this.toNoHostTable = new UriPrefixTable (); } public override void Add(MessageFilter filter, TFilterData data) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } Add((PrefixEndpointAddressMessageFilter)filter, data); } public override void Add(EndpointAddressMessageFilter filter, TFilterData data) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } DiagnosticUtility.DebugAssert("EndpointAddressMessageFilter cannot be added to PrefixEndpointAddressMessageFilterTable"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException("EndpointAddressMessageFilter cannot be added to PrefixEndpointAddressMessageFilterTable")); } public void Add(PrefixEndpointAddressMessageFilter filter, TFilterData data) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } this.filters.Add(filter, data); // Create the candidate byte[] mask = BuildMask(filter.HeaderLookup); Candidate can = new Candidate(filter, data, mask, filter.HeaderLookup); this.candidates.Add(filter, can); #pragma warning suppress 56506 // [....], PrefixEndpointAddressMessageFilter.Address can never be null Uri soapToAddress = filter.Address.Uri; CandidateSet cset; if (!TryMatchCandidateSet(soapToAddress, filter.IncludeHostNameInComparison, out cset)) { cset = new CandidateSet(); GetAddressTable(filter.IncludeHostNameInComparison).RegisterUri(soapToAddress, GetComparisonMode(filter.IncludeHostNameInComparison), cset); } cset.candidates.Add(can); IncrementQNameCount(cset, filter.Address); } HostNameComparisonMode GetComparisonMode(bool includeHostNameInComparison) { return includeHostNameInComparison ? HostNameComparisonMode.Exact : HostNameComparisonMode.StrongWildcard; } UriPrefixTable GetAddressTable(bool includeHostNameInComparison) { return includeHostNameInComparison ? this.toHostTable : this.toNoHostTable; } internal override bool TryMatchCandidateSet(Uri to, bool includeHostNameInComparison, out CandidateSet cset) { return GetAddressTable(includeHostNameInComparison).TryLookupUri(to, GetComparisonMode(includeHostNameInComparison), out cset); } protected override void ClearLookupTables() { this.toHostTable = new UriPrefixTable .CandidateSet>(); this.toNoHostTable = new UriPrefixTable .CandidateSet>(); } public override bool Remove(MessageFilter filter) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } PrefixEndpointAddressMessageFilter pFilter = filter as PrefixEndpointAddressMessageFilter; if (pFilter != null) { return Remove(pFilter); } return false; } public override bool Remove(EndpointAddressMessageFilter filter) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } DiagnosticUtility.DebugAssert("EndpointAddressMessageFilter cannot be removed from PrefixEndpointAddressMessageFilterTable"); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException("EndpointAddressMessageFilter cannot be removed from PrefixEndpointAddressMessageFilterTable")); } public bool Remove(PrefixEndpointAddressMessageFilter filter) { if (filter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("filter"); } if(!this.filters.Remove(filter)) { return false; } Candidate can = this.candidates[filter]; #pragma warning suppress 56506 // [....], PrefixEndpointAddressMessageFilter.Address can never be null Uri soapToAddress = filter.Address.Uri; CandidateSet cset = null; if (TryMatchCandidateSet(soapToAddress, filter.IncludeHostNameInComparison, out cset)) { if (cset.candidates.Count == 1) { GetAddressTable(filter.IncludeHostNameInComparison).UnregisterUri(soapToAddress, GetComparisonMode(filter.IncludeHostNameInComparison)); } else { DecrementQNameCount(cset, filter.Address); // Remove Candidate cset.candidates.Remove(can); } } this.candidates.Remove(filter); RebuildMasks(); return true; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BuildProvider.cs
- AttachedPropertyBrowsableWhenAttributePresentAttribute.cs
- WindowsIPAddress.cs
- ServiceObjectContainer.cs
- X509SecurityTokenProvider.cs
- LabelLiteral.cs
- WindowsListViewScroll.cs
- DataTableTypeConverter.cs
- CqlLexer.cs
- ConfigurationManagerHelperFactory.cs
- SliderAutomationPeer.cs
- nulltextcontainer.cs
- X509Certificate.cs
- Guid.cs
- GlyphCollection.cs
- SqlConnectionHelper.cs
- InputScope.cs
- DataGridViewRowCollection.cs
- UncommonField.cs
- ToolStripContentPanel.cs
- Figure.cs
- ContextMenuStrip.cs
- PageAdapter.cs
- FactoryGenerator.cs
- MiniMapControl.xaml.cs
- GraphicsPath.cs
- GridPattern.cs
- StateRuntime.cs
- NetWebProxyFinder.cs
- XmlSchemaProviderAttribute.cs
- FunctionDefinition.cs
- GridViewCommandEventArgs.cs
- SqlDependencyListener.cs
- CaseStatementProjectedSlot.cs
- EditingCommands.cs
- DataRelationPropertyDescriptor.cs
- ClientBuildManagerCallback.cs
- DecimalAnimationBase.cs
- DataControlCommands.cs
- Choices.cs
- RequestResizeEvent.cs
- GroupJoinQueryOperator.cs
- GeometryHitTestResult.cs
- Hyperlink.cs
- AssertFilter.cs
- SecurityPermission.cs
- XmlTextWriter.cs
- Menu.cs
- XmlSerializerAssemblyAttribute.cs
- SystemIPInterfaceProperties.cs
- rsa.cs
- MetaModel.cs
- AttachedProperty.cs
- KeyFrames.cs
- TextServicesCompartmentContext.cs
- ServiceChannelManager.cs
- MsmqHostedTransportConfiguration.cs
- FileNotFoundException.cs
- AsyncResult.cs
- TemplateControlParser.cs
- PathFigure.cs
- ZoneMembershipCondition.cs
- PreviewKeyDownEventArgs.cs
- PresentationSource.cs
- CompilationSection.cs
- DiscoveryOperationContextExtension.cs
- TreeNodeCollection.cs
- ToolBarTray.cs
- JulianCalendar.cs
- DataGridItemEventArgs.cs
- ComponentDesigner.cs
- CollectionContainer.cs
- GridViewHeaderRowPresenter.cs
- DataPagerCommandEventArgs.cs
- AssemblyResourceLoader.cs
- CorrelationTokenInvalidatedHandler.cs
- AuthenticationService.cs
- ActivityExecutionContext.cs
- ConnectionStringsExpressionEditor.cs
- ByValueEqualityComparer.cs
- DBNull.cs
- DbConnectionPoolIdentity.cs
- OleTxTransaction.cs
- NumberAction.cs
- OptimalTextSource.cs
- CreatingCookieEventArgs.cs
- DeflateStreamAsyncResult.cs
- ProjectionCamera.cs
- UserControlParser.cs
- WeakEventTable.cs
- GPRECTF.cs
- XmlCustomFormatter.cs
- SoapSchemaImporter.cs
- WebCodeGenerator.cs
- DecoratedNameAttribute.cs
- ClusterRegistryConfigurationProvider.cs
- FontNameConverter.cs
- SerializationFieldInfo.cs
- StringToken.cs
- StringUtil.cs