コード例 #1
0
        protected override void InitializeFrom(System.ServiceModel.Channels.BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
            {
                throw new ArgumentNullException("binding");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            this.HostName    = rabbind.HostName;
            this.Port        = rabbind.Port;
            this.Password    = rabbind.ConnectionFactory.Password;
            this.Username    = rabbind.ConnectionFactory.UserName;
            this.VirtualHost = rabbind.ConnectionFactory.VirtualHost;
        }
コード例 #2
0
        public override void ApplyConfiguration(System.ServiceModel.Channels.BindingElement bindingElement)
        {
            // Base configuration
            base.ApplyConfiguration(bindingElement);

            // Now process the own configuration
            SwaEncodingBindingElement Binding = (SwaEncodingBindingElement)bindingElement;

            PropertyInformationCollection PropertyInfos = ElementInformation.Properties;

            if (PropertyInfos["innerMessageEncoding"].ValueOrigin != PropertyValueOrigin.Default)
            {
                switch (this.InnerMessageEncoding)
                {
                case "textMessageEncoding":
                    Binding.InnerBindingElement = new TextMessageEncodingBindingElement();
                    break;

                case "binaryMessageEncoding":
                    Binding.InnerBindingElement = new BinaryMessageEncodingBindingElement();
                    break;

                default:
                    throw new ConfigurationErrorsException("Inner message encoding can be binary or text, only!");
                }
            }
        }
コード例 #3
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }
            MtomMessageEncodingBindingElement mtom = b as MtomMessageEncodingBindingElement;

            if (mtom == null)
            {
                return(false);
            }
            if (_maxReadPoolSize != mtom.MaxReadPoolSize)
            {
                return(false);
            }
            if (_maxWritePoolSize != mtom.MaxWritePoolSize)
            {
                return(false);
            }

            // compare XmlDictionaryReaderQuotas
            if (_readerQuotas.MaxStringContentLength != mtom.ReaderQuotas.MaxStringContentLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxArrayLength != mtom.ReaderQuotas.MaxArrayLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxBytesPerRead != mtom.ReaderQuotas.MaxBytesPerRead)
            {
                return(false);
            }
            if (_readerQuotas.MaxDepth != mtom.ReaderQuotas.MaxDepth)
            {
                return(false);
            }
            if (_readerQuotas.MaxNameTableCharCount != mtom.ReaderQuotas.MaxNameTableCharCount)
            {
                return(false);
            }

            if (_maxBufferSize != mtom.MaxBufferSize)
            {
                return(false);
            }

            if (this.WriteEncoding.EncodingName != mtom.WriteEncoding.EncodingName)
            {
                return(false);
            }
            if (!this.MessageVersion.IsMatch(mtom.MessageVersion))
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
 internal override bool IsMatch(BindingElement b)
 {
     if (b == null)
     {
         return(false);
     }
     return(b is InternalDuplexBindingElement);
 }
コード例 #5
0
        private BindingElement RemoveNextElement()
        {
            BindingElement element = this.remainingBindingElements.Remove <BindingElement>();

            if (element == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("NoChannelBuilderAvailable", new object[] { this.binding.Name, this.binding.Namespace })));
            }
            return(element);
        }
コード例 #6
0
        public override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            TextMessageEncodingBindingElement text = b as TextMessageEncodingBindingElement;

            if (text == null)
            {
                return(false);
            }
            if (_maxReadPoolSize != text.MaxReadPoolSize)
            {
                return(false);
            }
            if (_maxWritePoolSize != text.MaxWritePoolSize)
            {
                return(false);
            }

            // compare XmlDictionaryReaderQuotas
            if (_readerQuotas.MaxStringContentLength != text.ReaderQuotas.MaxStringContentLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxArrayLength != text.ReaderQuotas.MaxArrayLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxBytesPerRead != text.ReaderQuotas.MaxBytesPerRead)
            {
                return(false);
            }
            if (_readerQuotas.MaxDepth != text.ReaderQuotas.MaxDepth)
            {
                return(false);
            }
            if (_readerQuotas.MaxNameTableCharCount != text.ReaderQuotas.MaxNameTableCharCount)
            {
                return(false);
            }

            if (this.WriteEncoding.WebName != text.WriteEncoding.WebName)
            {
                return(false);
            }
            if (!this.MessageVersion.IsMatch(text.MessageVersion))
            {
                return(false);
            }

            return(true);
        }
コード例 #7
0
        private BindingElement RemoveNextElement()
        {
            BindingElement element = _remainingBindingElements.Remove <BindingElement>();

            if (element != null)
            {
                return(element);
            }
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.Format(
                                                                                                        SR.NoChannelBuilderAvailable, _binding.Name, _binding.Namespace)));
        }
コード例 #8
0
        public override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            BinaryMessageEncodingBindingElement binary = b as BinaryMessageEncodingBindingElement;

            if (binary == null)
            {
                return(false);
            }
            if (_maxReadPoolSize != binary.MaxReadPoolSize)
            {
                return(false);
            }
            if (_maxWritePoolSize != binary.MaxWritePoolSize)
            {
                return(false);
            }

            // compare XmlDictionaryReaderQuotas
            if (_readerQuotas.MaxStringContentLength != binary.ReaderQuotas.MaxStringContentLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxArrayLength != binary.ReaderQuotas.MaxArrayLength)
            {
                return(false);
            }
            if (_readerQuotas.MaxBytesPerRead != binary.ReaderQuotas.MaxBytesPerRead)
            {
                return(false);
            }
            if (_readerQuotas.MaxDepth != binary.ReaderQuotas.MaxDepth)
            {
                return(false);
            }
            if (_readerQuotas.MaxNameTableCharCount != binary.ReaderQuotas.MaxNameTableCharCount)
            {
                return(false);
            }

            if (this.MaxSessionSize != binary.MaxSessionSize)
            {
                return(false);
            }
            if (this.CompressionFormat != binary.CompressionFormat)
            {
                return(false);
            }
            return(true);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public T GetInnerProperty <T> () where T : class
        {
            bool restore = PrepareElements();

            try {
                BindingElement e = DequeueBindingElement(false);
                return(e == null ? default(T) : e.GetProperty <T> (this));
            } finally {
                if (restore)
                {
                    elements = empty_collection;
                }
            }
        }
コード例 #11
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            CompositeDuplexBindingElement element = b as CompositeDuplexBindingElement;

            if (element == null)
            {
                return(false);
            }
            return(this.clientBaseAddress == element.clientBaseAddress);
        }
コード例 #12
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }
            TextMessageEncodingBindingElement element = b as TextMessageEncodingBindingElement;

            if (element == null)
            {
                return(false);
            }
            if (this.maxReadPoolSize != element.MaxReadPoolSize)
            {
                return(false);
            }
            if (this.maxWritePoolSize != element.MaxWritePoolSize)
            {
                return(false);
            }
            if (this.readerQuotas.MaxStringContentLength != element.ReaderQuotas.MaxStringContentLength)
            {
                return(false);
            }
            if (this.readerQuotas.MaxArrayLength != element.ReaderQuotas.MaxArrayLength)
            {
                return(false);
            }
            if (this.readerQuotas.MaxBytesPerRead != element.ReaderQuotas.MaxBytesPerRead)
            {
                return(false);
            }
            if (this.readerQuotas.MaxDepth != element.ReaderQuotas.MaxDepth)
            {
                return(false);
            }
            if (this.readerQuotas.MaxNameTableCharCount != element.ReaderQuotas.MaxNameTableCharCount)
            {
                return(false);
            }
            if (this.WriteEncoding.EncodingName != element.WriteEncoding.EncodingName)
            {
                return(false);
            }
            if (!this.MessageVersion.IsMatch(element.MessageVersion))
            {
                return(false);
            }
            return(true);
        }
コード例 #13
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            SslStreamSecurityBindingElement element = b as SslStreamSecurityBindingElement;

            if (element == null)
            {
                return(false);
            }
            return(this.requireClientCertificate == element.requireClientCertificate);
        }
コード例 #14
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            PrivacyNoticeBindingElement element = b as PrivacyNoticeBindingElement;

            if (element == null)
            {
                return(false);
            }
            return((this.url == element.url) && (this.version == element.version));
        }
コード例 #15
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            PrivacyNoticeBindingElement privacy = b as PrivacyNoticeBindingElement;

            if (privacy == null)
            {
                return(false);
            }
            return(this.url == privacy.url && this.version == privacy.version);
        }
コード例 #16
0
        internal override bool IsMatch(BindingElement b)
#endif
        {
            if (b == null)
            {
                return(false);
            }
            PrivacyNoticeBindingElement noticeBindingElement = b as PrivacyNoticeBindingElement;

            if (noticeBindingElement == null || !(this.url == noticeBindingElement.url))
            {
                return(false);
            }
            return(this.version == noticeBindingElement.version);
        }
コード例 #17
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            SslStreamSecurityBindingElement ssl = b as SslStreamSecurityBindingElement;

            if (ssl == null)
            {
                return(false);
            }

            return(RequireClientCertificate == ssl.RequireClientCertificate && _sslProtocols == ssl._sslProtocols);
        }
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }

            MessageEncodingBindingElement encoding = b as MessageEncodingBindingElement;

            if (encoding == null)
            {
                return(false);
            }

            return(true);
        }
コード例 #19
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }

            CompositeDuplexBindingElement duplex = b as CompositeDuplexBindingElement;

            if (duplex == null)
            {
                return(false);
            }

            return(_clientBaseAddress == duplex._clientBaseAddress);
        }
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            ReliableSessionBindingElement session = b as ReliableSessionBindingElement;

            if (session == null)
            {
                return(false);
            }
            if (this.acknowledgementInterval != session.acknowledgementInterval)
            {
                return(false);
            }
            if (this.flowControlEnabled != session.flowControlEnabled)
            {
                return(false);
            }
            if (this.inactivityTimeout != session.inactivityTimeout)
            {
                return(false);
            }
            if (this.maxPendingChannels != session.maxPendingChannels)
            {
                return(false);
            }
            if (this.maxRetryCount != session.maxRetryCount)
            {
                return(false);
            }
            if (this.maxTransferWindowSize != session.maxTransferWindowSize)
            {
                return(false);
            }
            if (this.ordered != session.ordered)
            {
                return(false);
            }
            if (this.reliableMessagingVersion != session.reliableMessagingVersion)
            {
                return(false);
            }

            return(true);
        }
コード例 #21
0
ファイル: BindingContext.cs プロジェクト: pmq20/mono_forked
        BindingElement DequeueBindingElement(bool raiseError)
        {
            if (RemainingBindingElements.Count == 0)
            {
                if (raiseError)
                {
                    throw new InvalidOperationException("There is no more available binding element.");
                }
                else
                {
                    return(null);
                }
            }
            BindingElement el = RemainingBindingElements [0];

            RemainingBindingElements.RemoveAt(0);
            return(el);
        }
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            WindowsStreamSecurityBindingElement element = b as WindowsStreamSecurityBindingElement;

            if (element == null)
            {
                return(false);
            }
            if (this.protectionLevel != element.protectionLevel)
            {
                return(false);
            }
            return(true);
        }
コード例 #23
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }
            NamedPipeTransportBindingElement element = b as NamedPipeTransportBindingElement;

            if (element == null)
            {
                return(false);
            }
            if (!this.ConnectionPoolSettings.IsMatch(element.ConnectionPoolSettings))
            {
                return(false);
            }
            return(true);
        }
コード例 #24
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            WindowsStreamSecurityBindingElement security = b as WindowsStreamSecurityBindingElement;

            if (security == null)
            {
                return(false);
            }
            if (_protectionLevel != security._protectionLevel)
            {
                return(false);
            }

            return(true);
        }
コード例 #25
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            UdpTransportBindingElement udpTransport = b as UdpTransportBindingElement;

            if (udpTransport == null)
            {
                return(false);
            }

            if (this.DuplicateMessageHistoryLength != udpTransport.DuplicateMessageHistoryLength)
            {
                return(false);
            }

            if (this.MaxPendingMessagesTotalSize != udpTransport.MaxPendingMessagesTotalSize)
            {
                return(false);
            }

            if (!String.Equals(this.MulticastInterfaceId, udpTransport.MulticastInterfaceId, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            if (!this.RetransmissionSettings.IsMatch(udpTransport.RetransmissionSettings))
            {
                return(false);
            }

            if (this.TimeToLive != udpTransport.TimeToLive)
            {
                return(false);
            }

            return(true);
        }
コード例 #26
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            TcpTransportBindingElement tcp = b as TcpTransportBindingElement;

            if (tcp == null)
            {
                return(false);
            }

            if (!ConnectionPoolSettings.IsMatch(tcp.ConnectionPoolSettings))
            {
                return(false);
            }

            return(true);
        }
コード例 #27
0
        // Create the binding using user specified config. The stacking is
        // BinaryMessageEncoder/TCP
        void CreateBinding()
        {
            Collection <BindingElement> bindingElements = new Collection <BindingElement>();
            BindingElement security = this.config.SecurityManager.GetSecurityBindingElement();

            if (security != null)
            {
                bindingElements.Add(security);
            }

            TcpTransportBindingElement transport = new TcpTransportBindingElement();

            transport.MaxReceivedMessageSize = this.config.MaxReceivedMessageSize;
            transport.MaxBufferPoolSize      = this.config.MaxBufferPoolSize;
            transport.TeredoEnabled          = true;

            MessageEncodingBindingElement encoder = null;

            if (messageHandler != null)
            {
                encoder = messageHandler.EncodingBindingElement;
            }

            if (encoder == null)
            {
                BinaryMessageEncodingBindingElement bencoder = new BinaryMessageEncodingBindingElement();
                this.config.ReaderQuotas.CopyTo(bencoder.ReaderQuotas);
                bindingElements.Add(bencoder);
            }
            else
            {
                bindingElements.Add(encoder);
            }

            bindingElements.Add(transport);

            this.binding = new CustomBinding(bindingElements);
            this.binding.ReceiveTimeout = TimeSpan.MaxValue;
        }
コード例 #28
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }
            TransportBindingElement transport = b as TransportBindingElement;

            if (transport == null)
            {
                return(false);
            }
            if (this.maxBufferPoolSize != transport.MaxBufferPoolSize)
            {
                return(false);
            }
            if (this.maxReceivedMessageSize != transport.MaxReceivedMessageSize)
            {
                return(false);
            }
            return(true);
        }
コード例 #29
0
        internal override bool IsMatch(BindingElement b)
        {
            if (!base.IsMatch(b))
            {
                return(false);
            }

            TcpTransportBindingElement tcp = b as TcpTransportBindingElement;

            if (tcp == null)
            {
                return(false);
            }

            if (this.listenBacklog != tcp.listenBacklog)
            {
                return(false);
            }
            if (this.portSharingEnabled != tcp.portSharingEnabled)
            {
                return(false);
            }
            if (this.teredoEnabled != tcp.teredoEnabled)
            {
                return(false);
            }
            if (!this.connectionPoolSettings.IsMatch(tcp.connectionPoolSettings))
            {
                return(false);
            }

            if (!ChannelBindingUtility.AreEqual(this.ExtendedProtectionPolicy, tcp.ExtendedProtectionPolicy))
            {
                return(false);
            }

            return(true);
        }
コード例 #30
0
        internal override bool IsMatch(BindingElement b)
        {
            if (b == null)
            {
                return(false);
            }

            ContextBindingElement other = b as ContextBindingElement;

            if (other == null)
            {
                return(false);
            }

            if (this.ClientCallbackAddress != other.ClientCallbackAddress)
            {
                return(false);
            }

            if (this.ContextExchangeMechanism != other.ContextExchangeMechanism)
            {
                return(false);
            }

            if (this.ContextManagementEnabled != other.ContextManagementEnabled)
            {
                return(false);
            }

            if (this.ProtectionLevel != other._protectionLevel)
            {
                return(false);
            }

            return(true);
        }