#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) #pragma warning disable using System; using System.IO; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls { public sealed class HeartbeatExtension { private readonly short m_mode; public HeartbeatExtension(short mode) { if (!HeartbeatMode.IsValid(mode)) throw new ArgumentException("not a valid HeartbeatMode value", "mode"); this.m_mode = mode; } public short Mode { get { return m_mode; } } /// Encode this to a . /// the to encode to. /// public void Encode(Stream output) { TlsUtilities.WriteUint8(m_mode, output); } /// Parse a from a . /// the to parse from. /// a object. /// public static HeartbeatExtension Parse(Stream input) { short mode = TlsUtilities.ReadUint8(input); if (!HeartbeatMode.IsValid(mode)) throw new TlsFatalAlert(AlertDescription.illegal_parameter); return new HeartbeatExtension(mode); } } } #pragma warning restore #endif