public CompatibilityLayer(SocketController controller, SecurityOptions options) { m_Buffer = new byte[0]; m_MinVersion = GetMinProtocol(options.Protocol); m_MaxVersion = GetMaxProtocol(options.Protocol); this.handshakeMonitor = new SslTlsHandshakeMonitor(); HandshakeLayer layer = null; if (m_MinVersion.GetVersionInt() == 30) { // SSL 3.0 if (options.Entity == ConnectionEnd.Client) { layer = new Ssl3ClientHandshakeLayer(null, options); m_MinLayer = new RecordLayer(controller, layer as ClientHandshakeLayer); this.handshakeMonitor.Attach(controller.Parent, layer as ClientHandshakeLayer); } else { layer = new Ssl3ServerHandshakeLayer(null, options); m_MinLayer = new RecordLayer(controller, layer as ServerHandshakeLayer); this.handshakeMonitor.Attach(controller.Parent, layer as ServerHandshakeLayer); } } else { // TLS 1.0 if (options.Entity == ConnectionEnd.Client) { layer = new Tls1ClientHandshakeLayer(null, options); m_MinLayer = new RecordLayer(controller, layer as ClientHandshakeLayer); this.handshakeMonitor.Attach(controller.Parent, layer as ClientHandshakeLayer); } else { layer = new Tls1ServerHandshakeLayer(null, options); m_MinLayer = new RecordLayer(controller, layer as ServerHandshakeLayer); this.handshakeMonitor.Attach(controller.Parent, layer as ServerHandshakeLayer); } } m_MinLayer.HandshakeLayer.RecordLayer = m_MinLayer; m_Options = options; }