コード例 #1
0
ファイル: EndpointI.cs プロジェクト: pedia/zeroc-ice
 internal EndpointI(Instance instance, IceInternal.BasicStream s) :
     base(instance, s)
 {
     _instance = instance;
     _timeout = s.readInt();
     _compress = s.readBool();
 }
コード例 #2
0
ファイル: EndpointI.cs プロジェクト: pedia/zeroc-ice
 internal EndpointI(Instance instance) :
     base(instance)
 {
     _instance = instance;
     _timeout = instance.defaultTimeout();
     _compress = false;
 }
コード例 #3
0
ファイル: EndpointI.cs プロジェクト: externl/ice
 internal EndpointI(Instance instance, string ho, int po, EndPoint sourceAddr, int ti, string conId, bool co)
     : base(instance, ho, po, sourceAddr, conId)
 {
     _instance = instance;
     _timeout = ti;
     _compress = co;
 }
コード例 #4
0
ファイル: EndpointI.cs プロジェクト: Radulfr/zeroc-ice
 internal EndpointI(Instance instance, string ho, int po, int ti, string conId, bool co) : base(conId)
 {
     _instance = instance;
     _host = ho;
     _port = po;
     _timeout = ti;
     connectionId_ = conId;
     _compress = co;
     calcHashValue();
 }
コード例 #5
0
ファイル: AcceptorI.cs プロジェクト: bholl/zeroc-ice
        internal AcceptorI(Instance instance, string adapterName, string host, int port)
        {
            _instance = instance;
            _adapterName = adapterName;
            _logger = instance.communicator().getLogger();
            _backlog = instance.communicator().getProperties().getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);

            //
            // .NET requires that a certificate be supplied.
            //
            X509Certificate2Collection certs = instance.certs();
            if(certs.Count == 0)
            {
                Ice.SecurityException ex = new Ice.SecurityException();
                ex.reason = "IceSSL: certificate required for server endpoint";
                throw ex;
            }

            try
            {
                _addr = IceInternal.Network.getAddressForServer(host, port, _instance.protocolSupport());
                _fd = IceInternal.Network.createSocket(false, _addr.AddressFamily);
                IceInternal.Network.setBlock(_fd, false);
                IceInternal.Network.setTcpBufSize(_fd, _instance.communicator().getProperties(), _logger);
                if(IceInternal.AssemblyUtil.platform_ != IceInternal.AssemblyUtil.Platform.Windows)
                {
                    //
                    // Enable SO_REUSEADDR on Unix platforms to allow
                    // re-using the socket even if it's in the TIME_WAIT
                    // state. On Windows, this doesn't appear to be
                    // necessary and enabling SO_REUSEADDR would actually
                    // not be a good thing since it allows a second
                    // process to bind to an address even it's already
                    // bound by another process.
                    //
                    // TODO: using SO_EXCLUSIVEADDRUSE on Windows would
                    // probably be better but it's only supported by recent
                    // Windows versions (XP SP2, Windows Server 2003).
                    //
                    IceInternal.Network.setReuseAddress(_fd, true);
                }
                if(_instance.networkTraceLevel() >= 2)
                {
                    string s = "attempting to bind to ssl socket " + IceInternal.Network.addrToString(_addr);
                    _logger.trace(_instance.networkTraceCategory(), s);
                }
                _addr = IceInternal.Network.doBind(_fd, _addr);
            }
            catch(System.Exception)
            {
                _fd = null;
                throw;
            }
        }
コード例 #6
0
ファイル: ConnectorI.cs プロジェクト: bholl/zeroc-ice
        //
        // Only for use by EndpointI.
        //
        internal ConnectorI(Instance instance, string host, IPEndPoint addr, int timeout, string connectionId)
        {
            _instance = instance;
            _host = host;
            _logger = instance.communicator().getLogger();
            _addr = addr;
            _timeout = timeout;
            _connectionId = connectionId;

            _hashCode = _addr.GetHashCode();
            _hashCode = 5 * _hashCode + _timeout;
            _hashCode = 5 * _hashCode + _connectionId.GetHashCode();
        }
コード例 #7
0
ファイル: ConnectorI.cs プロジェクト: sbesson/zeroc-ice
        //
        // Only for use by EndpointI.
        //
        internal ConnectorI(Instance instance, string host, EndPoint addr, int timeout, string connectionId)
        {
            _instance = instance;
            _host = host;
            _logger = instance.communicator().getLogger();
            _addr = (IPEndPoint)addr;
            _timeout = timeout;
            _connectionId = connectionId;

            _hashCode = 5381;
            IceInternal.HashUtil.hashAdd(ref _hashCode, _addr);
            IceInternal.HashUtil.hashAdd(ref _hashCode, _timeout);
            IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId);
        }
コード例 #8
0
ファイル: PluginI.cs プロジェクト: zhangwei5095/ice
        public PluginI(Ice.Communicator communicator)
        {
            IceInternal.ProtocolPluginFacade facade = IceInternal.Util.getProtocolPluginFacade(communicator);

            _engine = new SSLEngine(facade);

            //
            // SSL based on TCP
            //
            IceInternal.EndpointFactory tcp = facade.getEndpointFactory(Ice.TCPEndpointType.value);
            if(tcp != null)
            {
                Instance instance = new Instance(_engine, Ice.SSLEndpointType.value, "ssl");
                facade.addEndpointFactory(new EndpointFactoryI(instance, tcp.clone(instance, null)));
            }
        }
コード例 #9
0
ファイル: AcceptorI.cs プロジェクト: zhangwei5095/ice
        internal AcceptorI(EndpointI endpoint, Instance instance, IceInternal.Acceptor del, string adapterName)
        {
            _endpoint = endpoint;
            _delegate = del;
            _instance = instance;
            _adapterName = adapterName;

            //
            // .NET requires that a certificate be supplied.
            //
            if(instance.certs().Count == 0)
            {
                Ice.SecurityException ex = new Ice.SecurityException();
                ex.reason = "IceSSL: certificate required for server endpoint";
                throw ex;
            }
        }
コード例 #10
0
ファイル: ConnectorI.cs プロジェクト: pedia/zeroc-ice
        //
        // Only for use by EndpointI.
        //
        internal ConnectorI(Instance instance, string host, EndPoint addr, IceInternal.NetworkProxy proxy,
                            EndPoint sourceAddr, int timeout, string conId)
        {
            _instance = instance;
            _host = host;
            _addr = (IPEndPoint)addr;
            _proxy = proxy;
            _sourceAddr = sourceAddr;
            _timeout = timeout;
            _connectionId = conId;

            _hashCode = 5381;
            IceInternal.HashUtil.hashAdd(ref _hashCode, _addr);
            if(_sourceAddr != null)
            {
                IceInternal.HashUtil.hashAdd(ref _hashCode, _sourceAddr);
            }
            IceInternal.HashUtil.hashAdd(ref _hashCode, _timeout);
            IceInternal.HashUtil.hashAdd(ref _hashCode, _connectionId);
        }
コード例 #11
0
ファイル: TransceiverI.cs プロジェクト: bholl/zeroc-ice
        //
        // Only for use by ConnectorI, AcceptorI.
        //
        internal TransceiverI(Instance instance, Socket fd, IPEndPoint addr, string host, bool connected,
                              string adapterName)
        {
            _instance = instance;
            _fd = fd;
            _addr = addr;
            _host = host;
            _adapterName = adapterName;
            _stream = null;
            _logger = instance.communicator().getLogger();
            _stats = instance.communicator().getStats();
            _desc = connected ? IceInternal.Network.fdToString(_fd) : "<not connected>";
            _state = connected ? StateNeedAuthenticate : StateNeedConnect;

            _maxSendPacketSize = IceInternal.Network.getSendBufferSize(fd);
            if(_maxSendPacketSize < 512)
            {
                _maxSendPacketSize = 0;
            }

            _maxReceivePacketSize = IceInternal.Network.getRecvBufferSize(fd);
            if(_maxReceivePacketSize < 512)
            {
                _maxReceivePacketSize = 0;
            }

            if(_adapterName != null)
            {
                //
                // Determine whether a certificate is required from the peer.
                //
                _verifyPeer =
                    _instance.communicator().getProperties().getPropertyAsIntWithDefault("IceSSL.VerifyPeer", 2);
            }
            else
            {
                _verifyPeer = 0;
            }
        }
コード例 #12
0
ファイル: TransceiverI.cs プロジェクト: Crysty-Yui/ice
        //
        // Only for use by ConnectorI, AcceptorI.
        //
        internal TransceiverI(Instance instance, IceInternal.StreamSocket stream, string hostOrAdapterName, bool incoming)
        {
            _instance = instance;
            _stream = stream;
            _incoming = incoming;
            if(_incoming)
            {
                _adapterName = hostOrAdapterName;
            }
            else
            {
                _host = hostOrAdapterName;
            }
            _sslStream = null;

            _verifyPeer = _instance.properties().getPropertyAsIntWithDefault("IceSSL.VerifyPeer", 2);

            _chain = new X509Chain(_instance.engine().useMachineContext());

            if(_instance.checkCRL() == 0)
            {
                _chain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;
            }

            X509Certificate2Collection caCerts = _instance.engine().caCerts();
            if(caCerts != null)
            {
            #if !UNITY
                //
                // We need to set this flag to be able to use a certificate authority from the extra store.
                //
                _chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
            #endif
                foreach(X509Certificate2 cert in caCerts)
                {
                    _chain.ChainPolicy.ExtraStore.Add(cert);
                }
            }
        }
コード例 #13
0
ファイル: EndpointI.cs プロジェクト: Radulfr/zeroc-ice
 internal EndpointI(Instance instance, IceInternal.BasicStream s)
 {
     _instance = instance;
     s.startReadEncaps();
     _host = s.readString();
     _port = s.readInt();
     _timeout = s.readInt();
     _compress = s.readBool();
     s.endReadEncaps();
     calcHashValue();
 }
コード例 #14
0
ファイル: EndpointI.cs プロジェクト: zhangwei5095/ice
 public IceInternal.EndpointFactory clone(IceInternal.ProtocolInstance inst,
                                          IceInternal.EndpointFactory del)
 {
     Instance instance = new Instance(_instance.engine(), inst.type(), inst.protocol());
     return new EndpointFactoryI(instance, del != null ? del : _delegate.clone(instance, null));
 }
コード例 #15
0
ファイル: EndpointI.cs プロジェクト: Radulfr/zeroc-ice
        internal EndpointI(Instance instance, string str, bool oaEndpoint) : base("")
        {
            _instance = instance;
            _host = null;
            _port = 0;
            _timeout = -1;
            _compress = false;

            char[] separators = { ' ', '\t', '\n', '\r' };
            string[] arr = str.Split(separators);

            int i = 0;
            while(i < arr.Length)
            {
                if(arr[i].Length == 0)
                {
                    i++;
                    continue;
                }

                string option = arr[i++];
                if(option.Length != 2 || option[0] != '-')
                {
                    Ice.EndpointParseException e = new Ice.EndpointParseException();
                    e.str = "expected an endpoint option but found `" + option + "' in endpoint `ssl " + str + "'";
                    throw e;
                }

                string argument = null;
                if(i < arr.Length && arr[i][0] != '-')
                {
                    argument = arr[i++];
                    if(argument[0] == '\"' && argument[argument.Length - 1] == '\"')
                    {
                        argument = argument.Substring(1, argument.Length - 2);
                    }
                }

                switch(option[1])
                {
                    case 'h':
                    {
                        if(argument == null)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException();
                            e.str = "no argument provided for -h option in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        _host = argument;
                        break;
                    }

                    case 'p':
                    {
                        if(argument == null)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException();
                            e.str = "no argument provided for -p option in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        try
                        {
                            _port = System.Int32.Parse(argument, CultureInfo.InvariantCulture);
                        }
                        catch(System.FormatException ex)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException(ex);
                            e.str = "invalid port value `" + argument + "' in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        if(_port < 0 || _port > 65535)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException();
                            e.str = "port value `" + argument + "' out of range in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        break;
                    }

                    case 't':
                    {
                        if(argument == null)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException();
                            e.str = "no argument provided for -t option in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        try
                        {
                            _timeout = System.Int32.Parse(argument, CultureInfo.InvariantCulture);
                        }
                        catch(System.FormatException ex)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException(ex);
                            e.str = "invalid timeout value `" + argument + "' in endpoint `ssl " + str + "'";
                            throw e;
                        }

                        break;
                    }

                    case 'z':
                    {
                        if(argument != null)
                        {
                            Ice.EndpointParseException e = new Ice.EndpointParseException();
                            e.str = "unexpected argument `" + argument + "' provided for -z option in `ssl " + str +
                                    "'";
                            throw e;
                        }

                        _compress = true;
                        break;
                    }

                    default:
                    {
                        parseOption(option, argument, "ssl", str);
                        break;
                    }
                }
            }

            if(_host == null)
            {
                _host = _instance.defaultHost();
            }
            else if(_host.Equals("*"))
            {
                if(oaEndpoint)
                {
                    _host = null;
                }
                else
                {
                    throw new Ice.EndpointParseException("`-h *' not valid for proxy endpoint `ssl " + str + "'");
                }
            }

            if(_host == null)
            {
                _host = "";
            }

            calcHashValue();
        }
コード例 #16
0
ファイル: EndpointI.cs プロジェクト: zhangwei5095/ice
 internal EndpointFactoryI(Instance instance, IceInternal.EndpointFactory del)
 {
     _instance = instance;
     _delegate = del;
 }
コード例 #17
0
ファイル: EndpointI.cs プロジェクト: zhangwei5095/ice
 public EndpointI_connectorsI(Instance instance, string host, IceInternal.EndpointI_connectors cb)
 {
     _instance = instance;
     _host = host;
     _callback = cb;
 }
コード例 #18
0
ファイル: PluginI.cs プロジェクト: Radulfr/zeroc-ice
 PluginI(Ice.Communicator communicator)
 {
     instance_ = new Instance(communicator);
 }
コード例 #19
0
ファイル: EndpointI.cs プロジェクト: externl/ice
 public void destroy()
 {
     _instance = null;
 }
コード例 #20
0
ファイル: EndpointI.cs プロジェクト: externl/ice
 internal EndpointFactoryI(Instance instance)
 {
     _instance = instance;
 }
コード例 #21
0
ファイル: EndpointI.cs プロジェクト: zhangwei5095/ice
 public void destroy()
 {
     _delegate.destroy();
     _instance = null;
 }
コード例 #22
0
ファイル: EndpointI.cs プロジェクト: zhangwei5095/ice
 internal EndpointI(Instance instance, IceInternal.EndpointI del)
 {
     _instance = instance;
     _delegate = del;
 }
コード例 #23
0
ファイル: ConnectorI.cs プロジェクト: zhangwei5095/ice
 //
 // Only for use by EndpointI.
 //
 internal ConnectorI(Instance instance, IceInternal.Connector del, string host)
 {
     _instance = instance;
     _delegate = del;
     _host = host;
 }