HeartbeatMode.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls
  5. {
  6. /*
  7. * RFC 6520
  8. */
  9. public abstract class HeartbeatMode
  10. {
  11. public const short peer_allowed_to_send = 1;
  12. public const short peer_not_allowed_to_send = 2;
  13. public static string GetName(short heartbeatMode)
  14. {
  15. switch (heartbeatMode)
  16. {
  17. case peer_allowed_to_send:
  18. return "peer_allowed_to_send";
  19. case peer_not_allowed_to_send:
  20. return "peer_not_allowed_to_send";
  21. default:
  22. return "UNKNOWN";
  23. }
  24. }
  25. public static string GetText(short heartbeatMode)
  26. {
  27. return GetName(heartbeatMode) + "(" + heartbeatMode + ")";
  28. }
  29. public static bool IsValid(short heartbeatMode)
  30. {
  31. return heartbeatMode >= peer_allowed_to_send && heartbeatMode <= peer_not_allowed_to_send;
  32. }
  33. }
  34. }
  35. #pragma warning restore
  36. #endif