Пример #1
0
 private PeerTransportBindingElement(PeerTransportBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.listenIPAddress = elementToBeCloned.listenIPAddress;
     this.port            = elementToBeCloned.port;
     this.resolverSet     = elementToBeCloned.resolverSet;
     this.resolver        = elementToBeCloned.resolver;
     this.peerSecurity    = new PeerSecuritySettings(elementToBeCloned.Security);
 }
 private PeerTransportBindingElement(
     PeerTransportBindingElement other)
     : base(other)
 {
     max_recv_message_size = other.max_recv_message_size;
     port = other.port;
     other.security.CopyTo(security);
 }
Пример #3
0
        public PeerDuplexChannel(IPeerChannelManager listener)
            : base((ChannelListenerBase)listener)
        {
            binding       = listener.Source;
            this.resolver = listener.Resolver;
            info          = new TcpChannelInfo(binding, listener.MessageEncoder, null);     // FIXME: fill properties correctly.

            node = new PeerNodeImpl(((ChannelListenerBase)listener).Uri.Host, listener.Source.ListenIPAddress, listener.Source.Port);
        }
Пример #4
0
        public PeerDuplexChannel(IPeerChannelManager factory, EndpointAddress address, Uri via, PeerResolver resolver)
            : base((ChannelFactoryBase)factory, address, via)
        {
            binding       = factory.Source;
            this.resolver = factory.Resolver;
            info          = new TcpChannelInfo(binding, factory.MessageEncoder, null);     // FIXME: fill properties correctly.

            // It could be opened even with empty list of PeerNodeAddresses.
            // So, do not create PeerNode per PeerNodeAddress, but do it with PeerNodeAddress[].
            node = new PeerNodeImpl(RemoteAddress.Uri.Host, factory.Source.ListenIPAddress, factory.Source.Port);
        }
Пример #5
0
 public PeerChannelFactory(PeerTransportBindingElement source, BindingContext ctx)
 {
     this.source = source;
     foreach (BindingElement be in ctx.RemainingBindingElements)
     {
         MessageEncodingBindingElement mbe = be as MessageEncodingBindingElement;
         if (mbe != null)
         {
             encoder = CreateEncoder <TChannel> (mbe);
             break;
         }
     }
     if (encoder == null)
     {
         encoder = new BinaryMessageEncoder();
     }
 }
Пример #6
0
 public PeerChannelListener(PeerTransportBindingElement source,
                            BindingContext context)
     : base(context)
 {
     this.source = source;
     foreach (BindingElement be in context.Binding.Elements)
     {
         MessageEncodingBindingElement mbe = be as MessageEncodingBindingElement;
         if (mbe != null)
         {
             MessageEncoder = CreateEncoder <TChannel> (mbe);
             break;
         }
     }
     if (MessageEncoder == null)
     {
         MessageEncoder = new BinaryMessageEncoder();
     }
 }
        static TransportBindingElement CreateTransportBindingElements(string transportUri, PolicyConversionContext policyContext)
        {
            TransportBindingElement transportBindingElement = null;

            // Try and Create TransportBindingElement
            switch (transportUri)
            {
            case TransportPolicyConstants.HttpTransportUri:
                transportBindingElement = GetHttpTransportBindingElement(policyContext);
                break;

            case TransportPolicyConstants.TcpTransportUri:
                transportBindingElement = new TcpTransportBindingElement();
                break;

            case TransportPolicyConstants.NamedPipeTransportUri:
                transportBindingElement = new NamedPipeTransportBindingElement();
                break;

            case TransportPolicyConstants.MsmqTransportUri:
                transportBindingElement = new MsmqTransportBindingElement();
                break;

            case TransportPolicyConstants.PeerTransportUri:
#pragma warning disable 0618
                transportBindingElement = new PeerTransportBindingElement();
#pragma warning restore 0618
                break;

            case TransportPolicyConstants.WebSocketTransportUri:
                HttpTransportBindingElement httpTransport = GetHttpTransportBindingElement(policyContext);
                httpTransport.WebSocketSettings.TransportUsage = WebSocketTransportUsage.Always;
                httpTransport.WebSocketSettings.SubProtocol    = WebSocketTransportSettings.SoapSubProtocol;
                transportBindingElement = httpTransport;
                break;

            default:
                // There may be another registered converter that can handle this transport.
                break;
            }

            return(transportBindingElement);
        }
        internal PeerChannelFactory(PeerTransportBindingElement bindingElement, BindingContext context, PeerResolver peerResolver) : base(bindingElement, context)
        {
            this.listenIPAddress = bindingElement.ListenIPAddress;
            this.port            = bindingElement.Port;
            this.resolver        = peerResolver;
            this.readerQuotas    = new XmlDictionaryReaderQuotas();
            BinaryMessageEncodingBindingElement element = context.Binding.Elements.Find <BinaryMessageEncodingBindingElement>();

            if (element != null)
            {
                element.ReaderQuotas.CopyTo(this.readerQuotas);
            }
            else
            {
                EncoderDefaults.ReaderQuotas.CopyTo(this.readerQuotas);
            }
            this.securityManager      = PeerSecurityManager.Create(bindingElement.Security, context, this.readerQuotas);
            this.securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context);
        }
 public PeerChannelListener(PeerTransportBindingElement bindingElement, BindingContext context, PeerResolver peerResolver) : base(bindingElement, context, peerResolver)
 {
 }