Exemple #1
0
		public TlsException (Alert alert, string message)
			: base (message)
		{
			this.alert = alert;
		}
		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);
			}
		}
Exemple #3
0
		public TlsException (Alert alert)
			: this (alert, alert.Description.ToString())
		{
		}