diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-02-01 17:09:49 +0000 |
commit | abada90e3f84dc703b8ddc9efcbed8a946fadead (patch) | |
tree | 2c6f9dccd510ea97cb927a7bd635422efaae547a /cs/src/IceSSL/Util.cs | |
parent | removing trace message (diff) | |
download | ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2 ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip |
Expanded tabs into spaces
Diffstat (limited to 'cs/src/IceSSL/Util.cs')
-rwxr-xr-x | cs/src/IceSSL/Util.cs | 354 |
1 files changed, 177 insertions, 177 deletions
diff --git a/cs/src/IceSSL/Util.cs b/cs/src/IceSSL/Util.cs index 2ea9c74495f..2e566565a34 100755 --- a/cs/src/IceSSL/Util.cs +++ b/cs/src/IceSSL/Util.cs @@ -20,190 +20,190 @@ namespace IceSSL // public sealed class ConnectionInfo { - // - // The certificate chain. This may be null if the peer did not - // supply a certificate. The peer's certificate (if any) is the - // first one in the chain. - // - public System.Security.Cryptography.X509Certificates.X509Certificate2[] certs; - - // - // The name of the negotiated cipher. - // - public string cipher; - - // - // The local TCP/IP host & port. - // - public System.Net.IPEndPoint localAddr; - - // - // The remote TCP/IP host & port. - // - public System.Net.IPEndPoint remoteAddr; - - // - // If the connection is incoming this bool is true, false - // otherwise. - // - public bool incoming; - - // - // The name of the object adapter that hosts this endpoint, if - // any. - // - public string adapterName; + // + // The certificate chain. This may be null if the peer did not + // supply a certificate. The peer's certificate (if any) is the + // first one in the chain. + // + public System.Security.Cryptography.X509Certificates.X509Certificate2[] certs; + + // + // The name of the negotiated cipher. + // + public string cipher; + + // + // The local TCP/IP host & port. + // + public System.Net.IPEndPoint localAddr; + + // + // The remote TCP/IP host & port. + // + public System.Net.IPEndPoint remoteAddr; + + // + // If the connection is incoming this bool is true, false + // otherwise. + // + public bool incoming; + + // + // The name of the object adapter that hosts this endpoint, if + // any. + // + public string adapterName; } public class ConnectionInvalidException : Ice.LocalException { - #region Slice data members - - public string reason; - - #endregion - - #region Constructors - - private static readonly string _dflt = "ConnectionInvalidException"; - - public ConnectionInvalidException() : base(_dflt) - { - } - - public ConnectionInvalidException(string m__) : base(m__) - { - } - - public ConnectionInvalidException(System.Exception ex__) : base(_dflt, ex__) - { - } - - public ConnectionInvalidException(string m__, System.Exception ex__) : base(m__, ex__) - { - } - - #endregion - - #region Object members - - public override int GetHashCode() - { - int h__ = 0; - if((object)reason != null) - { - h__ = 5 * h__ + reason.GetHashCode(); - } - return h__; - } - - public override bool Equals(object other__) - { - if(other__ == null) - { - return false; - } - if(object.ReferenceEquals(this, other__)) - { - return true; - } - if(!(other__ is ConnectionInvalidException)) - { - return false; - } - if(reason == null) - { - if(((ConnectionInvalidException)other__).reason != null) - { - return false; - } - } - else - { - if(!reason.Equals(((ConnectionInvalidException)other__).reason)) - { - return false; - } - } - return true; - } - - #endregion - - #region Comparison members - - public static bool operator==(ConnectionInvalidException lhs__, ConnectionInvalidException rhs__) - { - return Equals(lhs__, rhs__); - } - - public static bool operator!=(ConnectionInvalidException lhs__, ConnectionInvalidException rhs__) - { - return !Equals(lhs__, rhs__); - } - - #endregion + #region Slice data members + + public string reason; + + #endregion + + #region Constructors + + private static readonly string _dflt = "ConnectionInvalidException"; + + public ConnectionInvalidException() : base(_dflt) + { + } + + public ConnectionInvalidException(string m__) : base(m__) + { + } + + public ConnectionInvalidException(System.Exception ex__) : base(_dflt, ex__) + { + } + + public ConnectionInvalidException(string m__, System.Exception ex__) : base(m__, ex__) + { + } + + #endregion + + #region Object members + + public override int GetHashCode() + { + int h__ = 0; + if((object)reason != null) + { + h__ = 5 * h__ + reason.GetHashCode(); + } + return h__; + } + + public override bool Equals(object other__) + { + if(other__ == null) + { + return false; + } + if(object.ReferenceEquals(this, other__)) + { + return true; + } + if(!(other__ is ConnectionInvalidException)) + { + return false; + } + if(reason == null) + { + if(((ConnectionInvalidException)other__).reason != null) + { + return false; + } + } + else + { + if(!reason.Equals(((ConnectionInvalidException)other__).reason)) + { + return false; + } + } + return true; + } + + #endregion + + #region Comparison members + + public static bool operator==(ConnectionInvalidException lhs__, ConnectionInvalidException rhs__) + { + return Equals(lhs__, rhs__); + } + + public static bool operator!=(ConnectionInvalidException lhs__, ConnectionInvalidException rhs__) + { + return !Equals(lhs__, rhs__); + } + + #endregion } public sealed class Util { - public static ConnectionInfo getConnectionInfo(Ice.Connection connection) - { - Ice.ConnectionI con = (Ice.ConnectionI)connection; - Debug.Assert(con != null); - - // - // Lock the connection directly. This is done because the only - // thing that prevents the transceiver from being closed during - // the duration of the invocation is the connection. - // - lock(con) - { - IceInternal.Transceiver transceiver = con.getTransceiver(); - if(transceiver == null) - { - ConnectionInvalidException ex = new ConnectionInvalidException(); - ex.reason = "connection closed"; - throw ex; - } - - try - { - TransceiverI sslTransceiver = (TransceiverI)transceiver; - return sslTransceiver.getConnectionInfo(); - } - catch(InvalidCastException) - { - ConnectionInvalidException e = new ConnectionInvalidException(); - e.reason = "not ssl connection"; - throw e; - } - } - } - - public static X509Certificate2 createCertificate(string certPEM) - { - char[] chars = certPEM.ToCharArray(); - byte[] bytes = new byte[chars.Length]; - for(int i = 0; i < chars.Length; ++i) - { - bytes[i] = (byte)chars[i]; - } - return new X509Certificate2(bytes); - } - - internal static ConnectionInfo - populateConnectionInfo(System.Net.Security.SslStream stream, System.Net.Sockets.Socket fd, - X509Certificate2[] certs, string adapterName, bool incoming) - { - ConnectionInfo info = new ConnectionInfo(); - info.certs = certs; - info.cipher = stream.CipherAlgorithm.ToString(); - info.localAddr = (System.Net.IPEndPoint)fd.LocalEndPoint; - info.remoteAddr = (System.Net.IPEndPoint)fd.RemoteEndPoint; - info.incoming = incoming; - info.adapterName = adapterName; - return info; - } + public static ConnectionInfo getConnectionInfo(Ice.Connection connection) + { + Ice.ConnectionI con = (Ice.ConnectionI)connection; + Debug.Assert(con != null); + + // + // Lock the connection directly. This is done because the only + // thing that prevents the transceiver from being closed during + // the duration of the invocation is the connection. + // + lock(con) + { + IceInternal.Transceiver transceiver = con.getTransceiver(); + if(transceiver == null) + { + ConnectionInvalidException ex = new ConnectionInvalidException(); + ex.reason = "connection closed"; + throw ex; + } + + try + { + TransceiverI sslTransceiver = (TransceiverI)transceiver; + return sslTransceiver.getConnectionInfo(); + } + catch(InvalidCastException) + { + ConnectionInvalidException e = new ConnectionInvalidException(); + e.reason = "not ssl connection"; + throw e; + } + } + } + + public static X509Certificate2 createCertificate(string certPEM) + { + char[] chars = certPEM.ToCharArray(); + byte[] bytes = new byte[chars.Length]; + for(int i = 0; i < chars.Length; ++i) + { + bytes[i] = (byte)chars[i]; + } + return new X509Certificate2(bytes); + } + + internal static ConnectionInfo + populateConnectionInfo(System.Net.Security.SslStream stream, System.Net.Sockets.Socket fd, + X509Certificate2[] certs, string adapterName, bool incoming) + { + ConnectionInfo info = new ConnectionInfo(); + info.certs = certs; + info.cipher = stream.CipherAlgorithm.ToString(); + info.localAddr = (System.Net.IPEndPoint)fd.LocalEndPoint; + info.remoteAddr = (System.Net.IPEndPoint)fd.RemoteEndPoint; + info.incoming = incoming; + info.adapterName = adapterName; + return info; + } } } |