|
| 1 | +namespace sigtran.net.Core.Utilities; |
| 2 | + |
| 3 | +/// <summary> |
| 4 | +/// Identifies an operating system family for native SCTP support planning. |
| 5 | +/// </summary> |
| 6 | +public enum SigtranOperatingSystemFamily |
| 7 | +{ |
| 8 | + /// <summary>Linux operating systems.</summary> |
| 9 | + Linux, |
| 10 | + |
| 11 | + /// <summary>Windows operating systems.</summary> |
| 12 | + Windows, |
| 13 | + |
| 14 | + /// <summary>macOS operating systems.</summary> |
| 15 | + MacOS |
| 16 | +} |
| 17 | + |
| 18 | +/// <summary> |
| 19 | +/// Identifies native SCTP support status. |
| 20 | +/// </summary> |
| 21 | +public enum SigtranNativeSctpSupportStatus |
| 22 | +{ |
| 23 | + /// <summary>The SDK exposes contracts only.</summary> |
| 24 | + ContractOnly, |
| 25 | + |
| 26 | + /// <summary>The platform requires lab verification.</summary> |
| 27 | + VerificationRequired, |
| 28 | + |
| 29 | + /// <summary>The platform is verified for production use.</summary> |
| 30 | + ProductionVerified |
| 31 | +} |
| 32 | + |
| 33 | +/// <summary> |
| 34 | +/// Describes native SCTP support for one operating system family. |
| 35 | +/// </summary> |
| 36 | +public sealed class SigtranNativeSctpSupportEntry |
| 37 | +{ |
| 38 | + /// <summary>Creates a native SCTP support entry.</summary> |
| 39 | + /// <param name="operatingSystem">The operating system family.</param> |
| 40 | + /// <param name="status">The support status.</param> |
| 41 | + /// <param name="notes">The support notes.</param> |
| 42 | + public SigtranNativeSctpSupportEntry( |
| 43 | + SigtranOperatingSystemFamily operatingSystem, |
| 44 | + SigtranNativeSctpSupportStatus status, |
| 45 | + string notes) |
| 46 | + { |
| 47 | + OperatingSystem = operatingSystem; |
| 48 | + Status = status; |
| 49 | + Notes = string.IsNullOrWhiteSpace(notes) ? throw new ArgumentException("Support notes are required.", nameof(notes)) : notes; |
| 50 | + } |
| 51 | + |
| 52 | + /// <summary>The operating system family.</summary> |
| 53 | + public SigtranOperatingSystemFamily OperatingSystem { get; } |
| 54 | + |
| 55 | + /// <summary>The support status.</summary> |
| 56 | + public SigtranNativeSctpSupportStatus Status { get; } |
| 57 | + |
| 58 | + /// <summary>The support notes.</summary> |
| 59 | + public string Notes { get; } |
| 60 | +} |
| 61 | + |
| 62 | +/// <summary> |
| 63 | +/// Provides native SCTP support planning data. |
| 64 | +/// </summary> |
| 65 | +public static class SigtranNativeSctpSupport |
| 66 | +{ |
| 67 | + private static readonly SigtranNativeSctpSupportEntry[] Entries = |
| 68 | + [ |
| 69 | + new(SigtranOperatingSystemFamily.Linux, SigtranNativeSctpSupportStatus.VerificationRequired, "Target platform for native SCTP lab verification."), |
| 70 | + new(SigtranOperatingSystemFamily.Windows, SigtranNativeSctpSupportStatus.ContractOnly, "Use the transport contract or development TCP adapter until a verified SCTP provider is selected."), |
| 71 | + new(SigtranOperatingSystemFamily.MacOS, SigtranNativeSctpSupportStatus.ContractOnly, "No production native SCTP claim is made.") |
| 72 | + ]; |
| 73 | + |
| 74 | + /// <summary>Returns the native SCTP support matrix.</summary> |
| 75 | + /// <returns>The native SCTP support entries.</returns> |
| 76 | + public static IReadOnlyList<SigtranNativeSctpSupportEntry> GetSupportMatrix() |
| 77 | + { |
| 78 | + return Entries.ToArray(); |
| 79 | + } |
| 80 | + |
| 81 | + /// <summary>Returns whether every platform entry is production verified.</summary> |
| 82 | + /// <returns>True when all entries are production verified; otherwise false.</returns> |
| 83 | + public static bool IsProductionVerified() |
| 84 | + { |
| 85 | + return Entries.All(static entry => entry.Status == SigtranNativeSctpSupportStatus.ProductionVerified); |
| 86 | + } |
| 87 | +} |
0 commit comments