Example #1
0
        void OnMessageCallback(int write_p, int version, int content_type, IntPtr buf, int size)
        {
            try {
                if (enableDebugging)
                {
                    Debug("MESSAGE CALLBACK: {0} {1:x} {2:x} {3:x} {4:x}", write_p, version, content_type, size, buf.ToInt32());
                }

                var buffer = new byte [size];
                Marshal.Copy(buf, buffer, 0, size);
                if (enableDebugging)
                {
                    Debug("MESSAGE", buffer);
                }

                if ((ContentType)content_type == ContentType.Alert)
                {
                    var alert = new Alert((AlertLevel)buffer [0], (AlertDescription)buffer [1]);
                    if (enableDebugging || !alert.IsWarning)
                    {
                        Debug("ALERT: {0}", alert);
                    }
                    lastAlert = new TlsException(alert);
                }
            } catch (Exception ex) {
                Debug("EXCEPTION IN MESSAGE CALLBACK: {0}", ex);
            }
        }
Example #2
0
		void OnError (TlsException error)
		{
			LastError = error;
			if (eventSink != null)
				eventSink.Error (error);
		}
Example #3
0
		byte[] OnError (TlsException error)
		{
			LastError = error;
			if (eventSink != null)
				eventSink.Error (error);

			#if INSTRUMENTATION
			if (HasInstrument (HandshakeInstrumentType.DontSendAlerts))
				return null;
			#endif

			if (negotiationHandler == null || !negotiationHandler.CanSendAlert)
				return null;

			try {
				return CreateAlert (error.Alert);
			} catch {
				return null;
			}
		}