internal ConnectionOrientedTransportChannelFactory(Microsoft.ServiceBus.Channels.ConnectionOrientedTransportBindingElement bindingElement, BindingContext context, string connectionPoolGroupName, TimeSpan idleTimeout, int maxOutboundConnectionsPerEndpoint) : base(bindingElement, context)
        {
            if (bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered && bindingElement.MaxReceivedMessageSize > (long)2147483647)
            {
                throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", Microsoft.ServiceBus.SR.GetString(Resources.MaxReceivedMessageSizeMustBeInIntegerRange, new object[0])));
            }
            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> streamUpgradeBindingElements = context.BindingParameters.FindAll <StreamUpgradeBindingElement>();

            if (streamUpgradeBindingElements.Count > 1)
            {
                throw Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(Microsoft.ServiceBus.SR.GetString(Resources.MultipleStreamUpgradeProvidersInParameters, new object[0])));
            }
            if (streamUpgradeBindingElements.Count == 1)
            {
                this.upgrade = streamUpgradeBindingElements[0].BuildClientStreamUpgradeProvider(context);
                context.BindingParameters.Remove <StreamUpgradeBindingElement>();
                this.securityCapabilities = streamUpgradeBindingElements[0].GetProperty <ISecurityCapabilities>(context);
            }
        }
        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;
            }
        }
 protected HttpTransportBindingElement(HttpTransportBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.allowCookies               = elementToBeCloned.allowCookies;
     this.authenticationScheme       = elementToBeCloned.authenticationScheme;
     this.bypassProxyOnLocal         = elementToBeCloned.bypassProxyOnLocal;
     this.decompressionEnabled       = elementToBeCloned.decompressionEnabled;
     this.hostNameComparisonMode     = elementToBeCloned.hostNameComparisonMode;
     this.inheritBaseAddressSettings = elementToBeCloned.InheritBaseAddressSettings;
     this.keepAliveEnabled           = elementToBeCloned.keepAliveEnabled;
     this.maxBufferSize              = elementToBeCloned.maxBufferSize;
     this.maxBufferSizeInitialized   = elementToBeCloned.maxBufferSizeInitialized;
     this.method       = elementToBeCloned.method;
     this.proxyAddress = elementToBeCloned.proxyAddress;
     this.proxyAuthenticationScheme = elementToBeCloned.proxyAuthenticationScheme;
     this.realm        = elementToBeCloned.realm;
     this.transferMode = elementToBeCloned.transferMode;
     this.unsafeConnectionNtlmAuthentication = elementToBeCloned.unsafeConnectionNtlmAuthentication;
     this.useDefaultWebProxy       = elementToBeCloned.useDefaultWebProxy;
     this.webProxy                 = elementToBeCloned.webProxy;
     this.extendedProtectionPolicy = elementToBeCloned.ExtendedProtectionPolicy;
     if (elementToBeCloned.anonymousUriPrefixMatcher != null)
     {
         this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(elementToBeCloned.anonymousUriPrefixMatcher);
     }
 }
 public override void CopyFrom(ServiceModelExtensionElement from)
 {
     base.CopyFrom(from);
     Microsoft.ServiceBus.Configuration.ConnectionOrientedTransportElement connectionOrientedTransportElement = (Microsoft.ServiceBus.Configuration.ConnectionOrientedTransportElement)from;
     this.ConnectionBufferSize = connectionOrientedTransportElement.ConnectionBufferSize;
     this.MaxBufferSize        = connectionOrientedTransportElement.MaxBufferSize;
     this.TransferMode         = connectionOrientedTransportElement.TransferMode;
 }
 internal ConnectionOrientedTransportBindingElement()
 {
     this.connectionBufferSize         = 65536;
     this.hostNameComparisonMode       = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
     this.channelInitializationTimeout = Microsoft.ServiceBus.Channels.ConnectionOrientedTransportDefaults.ChannelInitializationTimeout;
     this.maxBufferSize         = 65536;
     this.maxPendingConnections = 10;
     this.maxOutputDelay        = Microsoft.ServiceBus.Channels.ConnectionOrientedTransportDefaults.MaxOutputDelay;
     this.maxPendingAccepts     = 1;
     this.transferMode          = System.ServiceModel.TransferMode.Buffered;
 }
 internal ConnectionOrientedTransportBindingElement(Microsoft.ServiceBus.Channels.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;
 }
 private void InitializeFrom(TcpRelayTransportBindingElement transport, BinaryMessageEncodingBindingElement encoding)
 {
     Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.DebugAssert(transport != null, "Invalid (null) transport value.");
     Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.DebugAssert(encoding != null, "Invalid (null) encoding value.");
     this.MaxBufferPoolSize      = transport.MaxBufferPoolSize;
     this.MaxBufferSize          = transport.MaxBufferSize;
     this.MaxConnections         = transport.MaxPendingConnections;
     this.ListenBacklog          = transport.ListenBacklog;
     this.MaxReceivedMessageSize = transport.MaxReceivedMessageSize;
     this.TransferMode           = transport.TransferMode;
     this.transport.TransportProtectionEnabled = transport.TransportProtectionEnabled;
     this.ConnectionMode = transport.ConnectionMode;
     this.ReaderQuotas   = encoding.ReaderQuotas;
 }
Beispiel #8
0
 protected HttpRelayTransportBindingElement(HttpRelayTransportBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.allowCookies                  = elementToBeCloned.allowCookies;
     this.HostNameComparisonMode        = elementToBeCloned.HostNameComparisonMode;
     this.keepAliveEnabled              = elementToBeCloned.keepAliveEnabled;
     this.maxBufferSize                 = elementToBeCloned.maxBufferSize;
     this.maxBufferSizeInitialized      = elementToBeCloned.maxBufferSizeInitialized;
     this.proxyAddress                  = elementToBeCloned.proxyAddress;
     this.proxyAuthenticationScheme     = elementToBeCloned.proxyAuthenticationScheme;
     this.transferMode                  = elementToBeCloned.transferMode;
     this.useDefaultWebProxy            = elementToBeCloned.useDefaultWebProxy;
     this.relayClientAuthenticationType = elementToBeCloned.relayClientAuthenticationType;
     this.IsDynamic = elementToBeCloned.IsDynamic;
 }
Beispiel #9
0
        public HttpRelayTransportBindingElement(Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType)
        {
            HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();

            this.allowCookies                  = httpTransportBindingElement.AllowCookies;
            this.keepAliveEnabled              = httpTransportBindingElement.KeepAliveEnabled;
            this.maxBufferSize                 = httpTransportBindingElement.MaxBufferSize;
            this.proxyAuthenticationScheme     = httpTransportBindingElement.ProxyAuthenticationScheme;
            this.proxyAddress                  = httpTransportBindingElement.ProxyAddress;
            this.transferMode                  = httpTransportBindingElement.TransferMode;
            this.useDefaultWebProxy            = httpTransportBindingElement.UseDefaultWebProxy;
            this.relayClientAuthenticationType = relayClientAuthenticationType;
            this.IsDynamic = true;
        }
        protected override void InitializeFrom(Binding binding)
        {
            base.InitializeFrom(binding);
            NetTcpRelayBinding netTcpRelayBinding = (NetTcpRelayBinding)binding;

            this.ConnectionMode         = netTcpRelayBinding.ConnectionMode;
            this.TransferMode           = netTcpRelayBinding.TransferMode;
            this.MaxBufferPoolSize      = netTcpRelayBinding.MaxBufferPoolSize;
            this.MaxBufferSize          = netTcpRelayBinding.MaxBufferSize;
            this.MaxConnections         = netTcpRelayBinding.MaxConnections;
            this.MaxReceivedMessageSize = netTcpRelayBinding.MaxReceivedMessageSize;
            this.ListenBacklog          = netTcpRelayBinding.ListenBacklog;
            this.ReliableSession.InitializeFrom(netTcpRelayBinding.ReliableSession);
            this.Security.InitializeFrom(netTcpRelayBinding.Security);
            this.ReaderQuotas.InitializeFrom(netTcpRelayBinding.ReaderQuotas);
            this.IsDynamic = netTcpRelayBinding.IsDynamic;
        }
 public HttpTransportBindingElement()
 {
     this.allowCookies           = false;
     this.authenticationScheme   = AuthenticationSchemes.Anonymous;
     this.bypassProxyOnLocal     = false;
     this.decompressionEnabled   = true;
     this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
     this.keepAliveEnabled       = true;
     this.maxBufferSize          = 0x10000;
     this.method = string.Empty;
     this.proxyAuthenticationScheme = AuthenticationSchemes.Anonymous;
     this.proxyAddress = null;
     this.realm        = "";
     this.transferMode = System.ServiceModel.TransferMode.Buffered;
     this.unsafeConnectionNtlmAuthentication = false;
     this.useDefaultWebProxy       = true;
     this.webProxy                 = null;
     this.extendedProtectionPolicy = ChannelBindingUtility.DefaultPolicy;
 }
        protected ConnectionOrientedTransportChannelListener(ConnectionOrientedTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, bindingElement.HostNameComparisonMode)
        {
            if (bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered)
            {
                if (bindingElement.MaxReceivedMessageSize > 0x7fffffffL)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", System.ServiceModel.SR.GetString("MaxReceivedMessageSizeMustBeInIntegerRange")));
                }
                if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustMatchMaxReceivedMessageSize"));
                }
            }
            else if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustNotExceedMaxReceivedMessageSize"));
            }
            this.connectionBufferSize         = bindingElement.ConnectionBufferSize;
            this.exposeConnectionProperty     = bindingElement.ExposeConnectionProperty;
            base.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> 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].BuildServerStreamUpgradeProvider(context);
                this.ownUpgrade = true;
                context.BindingParameters.Remove <StreamUpgradeBindingElement>();
                this.securityCapabilities = collection[0].GetProperty <ISecurityCapabilities>(context);
            }
        }
 public HttpChannelListener(HttpTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory(), bindingElement.HostNameComparisonMode)
 {
     if (bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered)
     {
         if (bindingElement.MaxReceivedMessageSize > 0x7fffffffL)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", System.ServiceModel.SR.GetString("MaxReceivedMessageSizeMustBeInIntegerRange")));
         }
         if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustMatchMaxReceivedMessageSize"));
         }
     }
     else if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustNotExceedMaxReceivedMessageSize"));
     }
     if ((bindingElement.AuthenticationScheme == AuthenticationSchemes.Basic) && (bindingElement.ExtendedProtectionPolicy.PolicyEnforcement == PolicyEnforcement.Always))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("ExtendedProtectionPolicyBasicAuthNotSupported")));
     }
     this.authenticationScheme       = bindingElement.AuthenticationScheme;
     this.keepAliveEnabled           = bindingElement.KeepAliveEnabled;
     base.InheritBaseAddressSettings = bindingElement.InheritBaseAddressSettings;
     this.maxBufferSize = bindingElement.MaxBufferSize;
     this.method        = bindingElement.Method;
     this.realm         = bindingElement.Realm;
     this.transferMode  = bindingElement.TransferMode;
     this.unsafeConnectionNtlmAuthentication = bindingElement.UnsafeConnectionNtlmAuthentication;
     this.credentialProvider       = context.BindingParameters.Find <SecurityCredentialsManager>();
     this.acceptor                 = new TransportReplyChannelAcceptor(this);
     this.securityCapabilities     = bindingElement.GetProperty <ISecurityCapabilities>(context);
     this.extendedProtectionPolicy = GetPolicyWithDefaultSpnCollection(bindingElement.ExtendedProtectionPolicy, this.authenticationScheme, base.HostNameComparisonModeInternal, base.Uri, out this.usingDefaultSpnList);
     if (bindingElement.AnonymousUriPrefixMatcher != null)
     {
         this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(bindingElement.AnonymousUriPrefixMatcher);
     }
 }