Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Net / System / Net / TransportContext.cs / 1305376 / TransportContext.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Security; using System.Security.Authentication.ExtendedProtection; namespace System.Net { public abstract class TransportContext { public abstract ChannelBinding GetChannelBinding(ChannelBindingKind kind); } internal class ConnectStreamContext : TransportContext { internal ConnectStreamContext(ConnectStream connectStream) { GlobalLog.Assert(connectStream != null, "ConnectStreamContext..ctor(): Not expecting a null connectStream!"); this.connectStream = connectStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return connectStream.GetChannelBinding(kind); } private ConnectStream connectStream; } internal class SslStreamContext : TransportContext { internal SslStreamContext(SslStream sslStream) { GlobalLog.Assert(sslStream != null, "SslStreamContext..ctor(): Not expecting a null sslStream!"); this.sslStream = sslStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return sslStream.GetChannelBinding(kind); } private SslStream sslStream; } internal class HttpListenerRequestContext : TransportContext { internal HttpListenerRequestContext(HttpListenerRequest request) { GlobalLog.Assert(request != null, "HttpListenerRequestContext..ctor(): Not expecting a null request!"); this.request = request; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) { throw new NotSupportedException(SR.GetString( SR.net_listener_invalid_cbt_type, kind.ToString())); } return request.GetChannelBinding(); } private HttpListenerRequest request; } // Holds a cached Endpoint binding to be reused by HttpWebRequest preauthentication internal class CachedTransportContext : TransportContext { internal CachedTransportContext(ChannelBinding binding) { this.binding = binding; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) return null; return binding; } private ChannelBinding binding; } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System.Net.Security; using System.Security.Authentication.ExtendedProtection; namespace System.Net { public abstract class TransportContext { public abstract ChannelBinding GetChannelBinding(ChannelBindingKind kind); } internal class ConnectStreamContext : TransportContext { internal ConnectStreamContext(ConnectStream connectStream) { GlobalLog.Assert(connectStream != null, "ConnectStreamContext..ctor(): Not expecting a null connectStream!"); this.connectStream = connectStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return connectStream.GetChannelBinding(kind); } private ConnectStream connectStream; } internal class SslStreamContext : TransportContext { internal SslStreamContext(SslStream sslStream) { GlobalLog.Assert(sslStream != null, "SslStreamContext..ctor(): Not expecting a null sslStream!"); this.sslStream = sslStream; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { return sslStream.GetChannelBinding(kind); } private SslStream sslStream; } internal class HttpListenerRequestContext : TransportContext { internal HttpListenerRequestContext(HttpListenerRequest request) { GlobalLog.Assert(request != null, "HttpListenerRequestContext..ctor(): Not expecting a null request!"); this.request = request; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) { throw new NotSupportedException(SR.GetString( SR.net_listener_invalid_cbt_type, kind.ToString())); } return request.GetChannelBinding(); } private HttpListenerRequest request; } // Holds a cached Endpoint binding to be reused by HttpWebRequest preauthentication internal class CachedTransportContext : TransportContext { internal CachedTransportContext(ChannelBinding binding) { this.binding = binding; } public override ChannelBinding GetChannelBinding(ChannelBindingKind kind) { if (kind != ChannelBindingKind.Endpoint) return null; return binding; } private ChannelBinding binding; } } // 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
- TextTreeInsertUndoUnit.cs
- CompilerGlobalScopeAttribute.cs
- XmlSchemaCompilationSettings.cs
- EmptyStringExpandableObjectConverter.cs
- StringConcat.cs
- TextRangeBase.cs
- GPPOINT.cs
- SizeChangedInfo.cs
- Calendar.cs
- PropertyGridEditorPart.cs
- HtmlTableCellCollection.cs
- AsymmetricKeyExchangeDeformatter.cs
- MessageDecoder.cs
- RecognitionEventArgs.cs
- Size3D.cs
- TimelineClockCollection.cs
- Pair.cs
- InlineObject.cs
- SQLString.cs
- ExpressionBuilderCollection.cs
- HyperLinkColumn.cs
- HtmlInputSubmit.cs
- CustomServiceCredentials.cs
- DateTimeParse.cs
- HtmlEmptyTagControlBuilder.cs
- OleDbException.cs
- PermissionListSet.cs
- CssTextWriter.cs
- SqlGatherProducedAliases.cs
- CodeDOMUtility.cs
- HtmlWindowCollection.cs
- RuntimeConfigLKG.cs
- Type.cs
- ProviderConnectionPointCollection.cs
- CodeGenerationManager.cs
- ScopeCompiler.cs
- WindowCollection.cs
- MatrixAnimationUsingKeyFrames.cs
- CommandField.cs
- TempFiles.cs
- DataGridTextBox.cs
- XPathDocumentIterator.cs
- AuthenticatedStream.cs
- DistinctQueryOperator.cs
- RectValueSerializer.cs
- FontWeights.cs
- StructuredTypeEmitter.cs
- BitmapData.cs
- XmlReaderSettings.cs
- DataPagerFieldItem.cs
- _ContextAwareResult.cs
- FixedTextPointer.cs
- CodeDOMUtility.cs
- CaseStatementSlot.cs
- DecimalAnimationUsingKeyFrames.cs
- PersistChildrenAttribute.cs
- InvokeMethod.cs
- mansign.cs
- FrameworkElement.cs
- baseshape.cs
- SoundPlayerAction.cs
- RewritingValidator.cs
- Viewport2DVisual3D.cs
- SystemIPGlobalStatistics.cs
- SafeSerializationManager.cs
- AutomationIdentifierGuids.cs
- UpdateEventArgs.cs
- ParameterToken.cs
- ConfigXmlWhitespace.cs
- TrustLevel.cs
- MulticastIPAddressInformationCollection.cs
- KeyValueInternalCollection.cs
- DataGridRelationshipRow.cs
- ScriptingScriptResourceHandlerSection.cs
- DelegateSerializationHolder.cs
- Main.cs
- Point3DKeyFrameCollection.cs
- ConfigurationElementProperty.cs
- METAHEADER.cs
- DataTrigger.cs
- BufferAllocator.cs
- ProcessHostServerConfig.cs
- GeneratedContractType.cs
- TypeConverter.cs
- XmlSortKeyAccumulator.cs
- DataContractSet.cs
- InternalConfigSettingsFactory.cs
- NavigateEvent.cs
- StatusBarDrawItemEvent.cs
- DataGrid.cs
- RequestSecurityToken.cs
- MimeTypeMapper.cs
- FormViewUpdateEventArgs.cs
- EventSinkHelperWriter.cs
- DataReaderContainer.cs
- Exceptions.cs
- FontDriver.cs
- WeakReferenceList.cs
- EditorPart.cs
- XamlInterfaces.cs