AlertLevel.cs 780 B

123456789101112131415161718192021222324252627282930313233
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. namespace Org.BouncyCastle.Crypto.Tls
  3. {
  4. /// <summary>
  5. /// RFC 5246 7.2
  6. /// </summary>
  7. public abstract class AlertLevel
  8. {
  9. public const byte warning = 1;
  10. public const byte fatal = 2;
  11. public static string GetName(byte alertDescription)
  12. {
  13. switch (alertDescription)
  14. {
  15. case warning:
  16. return "warning";
  17. case fatal:
  18. return "fatal";
  19. default:
  20. return "UNKNOWN";
  21. }
  22. }
  23. public static string GetText(byte alertDescription)
  24. {
  25. return GetName(alertDescription) + "(" + alertDescription + ")";
  26. }
  27. }
  28. }
  29. #endif