internal override bool IsMatch(BindingElement b) { if (!base.IsMatch(b)) { return(false); } ConnectionOrientedTransportBindingElement connection = b as ConnectionOrientedTransportBindingElement; if (connection == null) { return(false); } if (_connectionBufferSize != connection._connectionBufferSize) { return(false); } if (_maxBufferSize != connection._maxBufferSize) { return(false); } if (_transferMode != connection._transferMode) { return(false); } return(true); }
internal ConnectionOrientedTransportChannelFactory(ConnectionOrientedTransportBindingElement bindingElement, BindingContext context, string connectionPoolGroupName, TimeSpan idleTimeout, int maxOutboundConnectionsPerEndpoint, bool supportsImpersonationDuringAsyncOpen) : base(bindingElement, context) { if ((bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered) && (bindingElement.MaxReceivedMessageSize > 0x7fffffffL)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", System.ServiceModel.SR.GetString("MaxReceivedMessageSizeMustBeInIntegerRange"))); } this.connectionBufferSize = bindingElement.ConnectionBufferSize; this.connectionPoolGroupName = connectionPoolGroupName; this.exposeConnectionProperty = bindingElement.ExposeConnectionProperty; this.idleTimeout = idleTimeout; this.maxBufferSize = bindingElement.MaxBufferSize; this.maxOutboundConnectionsPerEndpoint = maxOutboundConnectionsPerEndpoint; this.maxOutputDelay = bindingElement.MaxOutputDelay; this.transferMode = bindingElement.TransferMode; Collection <StreamUpgradeBindingElement> collection = context.BindingParameters.FindAll <StreamUpgradeBindingElement>(); if (collection.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("MultipleStreamUpgradeProvidersInParameters"))); } if ((collection.Count == 1) && this.SupportsUpgrade(collection[0])) { this.upgrade = collection[0].BuildClientStreamUpgradeProvider(context); context.BindingParameters.Remove <StreamUpgradeBindingElement>(); this.securityCapabilities = collection[0].GetProperty <ISecurityCapabilities>(context); this.flowIdentity = supportsImpersonationDuringAsyncOpen; } }
private void VerifyTransportMode(BindingContext context) { TransferMode transferMode; TransportBindingElement element = context.RemainingBindingElements.Find <TransportBindingElement>(); if ((element != null) && element.ManualAddressing) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ManualAddressingNotSupported"))); } ConnectionOrientedTransportBindingElement element2 = element as ConnectionOrientedTransportBindingElement; HttpTransportBindingElement element3 = element as HttpTransportBindingElement; if (element2 != null) { transferMode = element2.TransferMode; } else if (element3 != null) { transferMode = element3.TransferMode; } else { transferMode = TransferMode.Buffered; } if (transferMode != TransferMode.Buffered) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("TransferModeNotSupported", new object[] { transferMode, base.GetType().Name }))); } }
internal ConnectionOrientedTransportBindingElement(ConnectionOrientedTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { _connectionBufferSize = elementToBeCloned._connectionBufferSize; _exposeConnectionProperty = elementToBeCloned._exposeConnectionProperty; _maxBufferSize = elementToBeCloned._maxBufferSize; _maxBufferSizeInitialized = elementToBeCloned._maxBufferSizeInitialized; _transferMode = elementToBeCloned._transferMode; }
protected ConnectionOrientedTransportChannelListener(ConnectionOrientedTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, bindingElement.HostNameComparisonMode) { if (bindingElement.TransferMode == TransferMode.Buffered) { if (bindingElement.MaxReceivedMessageSize > int.MaxValue) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", SR.GetString(SR.MaxReceivedMessageSizeMustBeInIntegerRange))); } if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.GetString(SR.MaxBufferSizeMustMatchMaxReceivedMessageSize)); } } else { if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", SR.GetString(SR.MaxBufferSizeMustNotExceedMaxReceivedMessageSize)); } } this.connectionBufferSize = bindingElement.ConnectionBufferSize; this.exposeConnectionProperty = bindingElement.ExposeConnectionProperty; this.InheritBaseAddressSettings = bindingElement.InheritBaseAddressSettings; this.channelInitializationTimeout = bindingElement.ChannelInitializationTimeout; this.maxBufferSize = bindingElement.MaxBufferSize; this.maxPendingConnections = bindingElement.MaxPendingConnections; this.maxOutputDelay = bindingElement.MaxOutputDelay; this.maxPendingAccepts = bindingElement.MaxPendingAccepts; this.transferMode = bindingElement.TransferMode; Collection <StreamUpgradeBindingElement> upgradeBindingElements = context.BindingParameters.FindAll <StreamUpgradeBindingElement>(); if (upgradeBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MultipleStreamUpgradeProvidersInParameters))); } else if ((upgradeBindingElements.Count == 1) && this.SupportsUpgrade(upgradeBindingElements[0])) { this.upgrade = upgradeBindingElements[0].BuildServerStreamUpgradeProvider(context); this.ownUpgrade = true; context.BindingParameters.Remove <StreamUpgradeBindingElement>(); this.securityCapabilities = upgradeBindingElements[0].GetProperty <ISecurityCapabilities>(context); } }
internal ConnectionOrientedTransportBindingElement( ConnectionOrientedTransportBindingElement other) : base(other) { connection_buf_size = other.connection_buf_size; max_buf_size = other.max_buf_size; max_pending_conn = other.max_pending_conn; max_pending_accepts = other.max_pending_accepts; host_cmp_mode = other.host_cmp_mode; max_output_delay = other.max_output_delay; transfer_mode = other.transfer_mode; }
internal override bool IsMatch(BindingElement b) { if (!base.IsMatch(b)) { return(false); } ConnectionOrientedTransportBindingElement connection = b as ConnectionOrientedTransportBindingElement; if (connection == null) { return(false); } if (this.connectionBufferSize != connection.connectionBufferSize) { return(false); } if (this.hostNameComparisonMode != connection.hostNameComparisonMode) { return(false); } if (this.inheritBaseAddressSettings != connection.inheritBaseAddressSettings) { return(false); } if (this.channelInitializationTimeout != connection.channelInitializationTimeout) { return(false); } if (this.maxBufferSize != connection.maxBufferSize) { return(false); } if (this.maxPendingConnections != connection.maxPendingConnections) { return(false); } if (this.maxOutputDelay != connection.maxOutputDelay) { return(false); } if (this.maxPendingAccepts != connection.maxPendingAccepts) { return(false); } if (this.transferMode != connection.transferMode) { return(false); } return(true); }
internal ConnectionOrientedTransportBindingElement(ConnectionOrientedTransportBindingElement elementToBeCloned) : base(elementToBeCloned) { this.connectionBufferSize = elementToBeCloned.connectionBufferSize; this.exposeConnectionProperty = elementToBeCloned.exposeConnectionProperty; this.hostNameComparisonMode = elementToBeCloned.hostNameComparisonMode; this.inheritBaseAddressSettings = elementToBeCloned.InheritBaseAddressSettings; this.channelInitializationTimeout = elementToBeCloned.ChannelInitializationTimeout; this.maxBufferSize = elementToBeCloned.maxBufferSize; this.maxBufferSizeInitialized = elementToBeCloned.maxBufferSizeInitialized; this.maxPendingConnections = elementToBeCloned.maxPendingConnections; this.maxOutputDelay = elementToBeCloned.maxOutputDelay; this.maxPendingAccepts = elementToBeCloned.maxPendingAccepts; this.transferMode = elementToBeCloned.transferMode; }
internal ConnectionOrientedTransportChannelFactory( ConnectionOrientedTransportBindingElement bindingElement, BindingContext context, string connectionPoolGroupName, TimeSpan idleTimeout, int maxOutboundConnectionsPerEndpoint, bool supportsImpersonationDuringAsyncOpen) : base(bindingElement, context) { if (bindingElement.TransferMode == TransferMode.Buffered && bindingElement.MaxReceivedMessageSize > int.MaxValue) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", SR.MaxReceivedMessageSizeMustBeInIntegerRange)); } _connectionBufferSize = bindingElement.ConnectionBufferSize; _connectionPoolGroupName = connectionPoolGroupName; _exposeConnectionProperty = bindingElement.ExposeConnectionProperty; _idleTimeout = idleTimeout; _maxBufferSize = bindingElement.MaxBufferSize; _maxOutboundConnectionsPerEndpoint = maxOutboundConnectionsPerEndpoint; _maxOutputDelay = bindingElement.MaxOutputDelay; _transferMode = bindingElement.TransferMode; Collection <StreamUpgradeBindingElement> upgradeBindingElements = context.BindingParameters.FindAll <StreamUpgradeBindingElement>(); if (upgradeBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.MultipleStreamUpgradeProvidersInParameters)); } else if ((upgradeBindingElements.Count == 1) && this.SupportsUpgrade(upgradeBindingElements[0])) { _upgrade = upgradeBindingElements[0].BuildClientStreamUpgradeProvider(context); context.BindingParameters.Remove <StreamUpgradeBindingElement>(); _securityCapabilities = upgradeBindingElements[0].GetProperty <ISecurityCapabilities>(context); // flow the identity only if the channel factory supports impersonating during an async open AND // there is the binding is configured with security _flowIdentity = supportsImpersonationDuringAsyncOpen; } // We explicitly declare this type and all derived types support // async open/close. We currently must do this because the NET Native // toolchain does not recognize this type was granted Reflection degree. // Is it safe to do this only because this is an internal type and no // derived type is public or exposed in contract. SupportsAsyncOpenClose = true; }
internal ConnectionOrientedTransportChannelFactory( ConnectionOrientedTransportBindingElement bindingElement, BindingContext context, string connectionPoolGroupName, TimeSpan idleTimeout, int maxOutboundConnectionsPerEndpoint, bool supportsImpersonationDuringAsyncOpen) : base(bindingElement, context) { if (bindingElement.TransferMode == TransferMode.Buffered && bindingElement.MaxReceivedMessageSize > int.MaxValue) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", SR.MaxReceivedMessageSizeMustBeInIntegerRange)); } _connectionBufferSize = bindingElement.ConnectionBufferSize; _connectionPoolGroupName = connectionPoolGroupName; _exposeConnectionProperty = bindingElement.ExposeConnectionProperty; _idleTimeout = idleTimeout; _maxBufferSize = bindingElement.MaxBufferSize; _maxOutboundConnectionsPerEndpoint = maxOutboundConnectionsPerEndpoint; _maxOutputDelay = bindingElement.MaxOutputDelay; _transferMode = bindingElement.TransferMode; Collection <StreamUpgradeBindingElement> upgradeBindingElements = context.BindingParameters.FindAll <StreamUpgradeBindingElement>(); if (upgradeBindingElements.Count > 1) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.MultipleStreamUpgradeProvidersInParameters)); } else if ((upgradeBindingElements.Count == 1) && this.SupportsUpgrade(upgradeBindingElements[0])) { _upgrade = upgradeBindingElements[0].BuildClientStreamUpgradeProvider(context); context.BindingParameters.Remove <StreamUpgradeBindingElement>(); _securityCapabilities = upgradeBindingElements[0].GetProperty <ISecurityCapabilities>(context); // flow the identity only if the channel factory supports impersonating during an async open AND // there is the binding is configured with security _flowIdentity = supportsImpersonationDuringAsyncOpen; } }
private void VerifyTransportMode(BindingContext context) { TransportBindingElement transportElement = context.RemainingBindingElements.Find <TransportBindingElement>(); // Verify ManualAdderssing is turned off. if ((transportElement != null) && (transportElement.ManualAddressing)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR.ManualAddressingNotSupported)); } ConnectionOrientedTransportBindingElement connectionElement = transportElement as ConnectionOrientedTransportBindingElement; HttpTransportBindingElement httpElement = transportElement as HttpTransportBindingElement; // Verify TransportMode is Buffered. TransferMode transportTransferMode; if (connectionElement != null) { transportTransferMode = connectionElement.TransferMode; } else if (httpElement != null) { transportTransferMode = httpElement.TransferMode; } else { // Not one of the elements we can check, we have to assume TransferMode.Buffered. transportTransferMode = TransferMode.Buffered; } if (transportTransferMode != TransferMode.Buffered) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError( new InvalidOperationException(SR.Format(SR.TransferModeNotSupported, transportTransferMode, GetType().Name))); } }