Skip to content

Commit e5f9031

Browse files
committed
Add native SCTP platform probe
1 parent 57a5cdb commit e5f9031

6 files changed

Lines changed: 152 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The first production milestone is M3UA over a transport abstraction. SCCP, TCAP,
4545
| Observability | Phase 7 profile added for commercial metrics, trace categories, and health signals |
4646
| Deployment profiles | Phase 7 profiles added for commercial Linux and local development use |
4747
| Phase 7 status | Commercialization foundation complete; commercial production remains blocked on native SCTP verification, external lab evidence, signing, and SBOM |
48+
| Native SCTP implementation | Phase 8 started: Linux SCTP socket probe added using `SocketType.Seqpacket` and IP protocol number `132`; full production readiness still requires native transport completion and lab verification |
4849

4950
## Requirements
5051

@@ -129,6 +130,7 @@ if (!M3uaTypedMessageParser.TryParseSignallingCongestion(
129130
- [Phase 6 Summary](docs/PHASE6_SUMMARY.md)
130131
- [Phase 7 Commercialization](docs/PHASE7_COMMERCIALIZATION.md)
131132
- [Phase 7 Summary](docs/PHASE7_SUMMARY.md)
133+
- [Phase 8 Native SCTP](docs/PHASE8_NATIVE_SCTP.md)
132134
- [Continuous Integration](docs/CI.md)
133135
- [SCTP Transport](docs/SCTP_TRANSPORT.md)
134136
- [Compatibility policy](docs/COMPATIBILITY.md)
@@ -149,6 +151,7 @@ The roadmap is intentionally conservative:
149151
5. Harden MAP SMS with external interoperability vectors and operator-profile validation.
150152
6. Use completed interoperability tooling to run external lab validation, native SCTP verification, and release automation hardening.
151153
7. Complete commercial readiness gates and publish governed release candidates.
154+
8. Complete Linux native SCTP transport and verification.
152155

153156
## License
154157

docs/PHASE8_NATIVE_SCTP.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Phase 8 Native SCTP
2+
3+
Phase 8 implements the native SCTP production transport path, starting with Linux.
4+
5+
## Platform Probe
6+
7+
`NativeSctpPlatform.Probe()` checks whether the current runtime can create an SCTP socket.
8+
9+
```csharp
10+
NativeSctpPlatformCapability capability = NativeSctpPlatform.Probe();
11+
bool canCreateSocket = capability.CanCreateSocket;
12+
```
13+
14+
The SDK uses Linux `IPPROTO_SCTP` protocol number `132` with `SocketType.Seqpacket`. Windows and macOS remain contract-only until a verified production provider is selected.
15+
16+
The probe is intentionally separate from readiness. Socket creation is necessary, but production readiness also requires metadata handling, lifecycle integration, integration tests, and external interoperability evidence.

docs/SCTP_TRANSPORT.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,9 @@ The remaining production gate is explicit: native SCTP implementation and intero
118118
## Phase 7 Native SCTP Matrix
119119

120120
`SigtranNativeSctpSupport.GetSupportMatrix()` records native SCTP support claims for commercial release planning. Linux is marked as verification required, while Windows and macOS are contract-only until a production provider is selected and verified.
121+
122+
## Phase 8 Native SCTP Probe
123+
124+
`NativeSctpPlatform.Probe()` checks whether the current runtime can create a Linux SCTP socket using `SocketType.Seqpacket` and IP protocol number `132`.
125+
126+
The probe does not mark the transport production-ready by itself. It is the first native SCTP implementation gate.

docs/SDK_ROADMAP.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ Status: SDK foundation is complete for trace formatting, conformance vector inve
8080

8181
Status: SDK foundation is complete for commercial readiness gates, native SCTP support matrix, external interoperability evidence tracking, release candidate manifests, package governance, security policy, compatibility policy, observability profile, deployment profiles, and Phase 7 status reporting. Internal release readiness is available; commercial production readiness remains blocked until native SCTP verification, external interoperability evidence, package signing, and SBOM automation are complete.
8282

83+
## Phase 8 - Native SCTP Production Transport
84+
85+
- Probe Linux native SCTP socket creation using `SocketType.Seqpacket` and IP protocol number `132`.
86+
- Add native SCTP socket factory, connector, listener, send/receive path, lifecycle events, health snapshots, and reconnect integration.
87+
- Add Linux-focused integration test hooks that can run when SCTP kernel support is available.
88+
- Keep Windows and macOS contract-only until a verified provider is selected.
89+
90+
Status: Phase 8 has started with a native SCTP platform probe. Production readiness remains blocked until the full native transport path and Linux interoperability verification are complete.
91+
8392
## Recommended First Deliverable
8493

8594
The first useful SDK release should be an alpha package focused on M3UA over a transport abstraction:

src/sigtran.net.Tests/Program.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
Run("SIGTRAN observability profile exposes commercial signals", SigtranObservabilityProfileExposesCommercialSignals);
3131
Run("SIGTRAN deployment profiles expose commercial and development gates", SigtranDeploymentProfilesExposeCommercialAndDevelopmentGates);
3232
Run("SIGTRAN phase 7 status summarizes commercialization foundation", SigtranPhase7StatusSummarizesCommercializationFoundation);
33+
Run("Native SCTP platform probe reports socket creation capability", NativeSctpPlatformProbeReportsSocketCreationCapability);
3334
Run("TCAP BER element encodes short and long lengths", TcapBerElementEncodesShortAndLongLengths);
3435
Run("TCAP transaction identifiers use BER context tags", TcapTransactionIdentifiersUseBerContextTags);
3536
Run("TCAP BER Invoke component round-trips", TcapBerInvokeComponentRoundTrips);
@@ -390,6 +391,27 @@ static void SigtranPhase7StatusSummarizesCommercializationFoundation()
390391
Assert(SigtranPhase7Status.Describe().Contains("commercialReady=False", StringComparison.Ordinal), SigtranPhase7Status.Describe());
391392
}
392393

394+
static void NativeSctpPlatformProbeReportsSocketCreationCapability()
395+
{
396+
AssertEqual(132, NativeSctpPlatform.IpProtocolSctp, "native SCTP protocol number");
397+
AssertEqual(SocketType.Seqpacket, NativeSctpPlatform.SctpSocketType, "native SCTP socket type");
398+
399+
NativeSctpPlatformCapability capability = NativeSctpPlatform.Probe();
400+
401+
if (OperatingSystem.IsLinux())
402+
{
403+
Assert(
404+
capability.Status is NativeSctpPlatformStatus.SocketCreationSupported or NativeSctpPlatformStatus.SocketCreationUnavailable,
405+
capability.Describe());
406+
}
407+
else
408+
{
409+
AssertEqual(NativeSctpPlatformStatus.UnsupportedOperatingSystem, capability.Status, "native SCTP unsupported OS status");
410+
}
411+
412+
Assert(capability.Describe().Contains("nativeSctp", StringComparison.Ordinal), capability.Describe());
413+
}
414+
393415
static void TcapBerElementEncodesShortAndLongLengths()
394416
{
395417
Span<byte> shortBuffer = stackalloc byte[8];
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
using System.Net.Sockets;
2+
using System.Runtime.InteropServices;
3+
4+
namespace sigtran.net.Layers.SCTP;
5+
6+
/// <summary>
7+
/// Identifies native SCTP platform capability status.
8+
/// </summary>
9+
public enum NativeSctpPlatformStatus
10+
{
11+
/// <summary>The operating system is not a supported native SCTP target.</summary>
12+
UnsupportedOperatingSystem,
13+
14+
/// <summary>The operating system is supported, but socket creation failed.</summary>
15+
SocketCreationUnavailable,
16+
17+
/// <summary>The operating system supports creating an SCTP socket.</summary>
18+
SocketCreationSupported
19+
}
20+
21+
/// <summary>
22+
/// Describes native SCTP platform capability.
23+
/// </summary>
24+
public sealed class NativeSctpPlatformCapability
25+
{
26+
/// <summary>Creates a native SCTP platform capability result.</summary>
27+
/// <param name="status">The capability status.</param>
28+
/// <param name="reason">The diagnostic reason.</param>
29+
public NativeSctpPlatformCapability(NativeSctpPlatformStatus status, string reason)
30+
{
31+
Status = status;
32+
Reason = string.IsNullOrWhiteSpace(reason) ? throw new ArgumentException("Native SCTP capability reason is required.", nameof(reason)) : reason;
33+
}
34+
35+
/// <summary>The capability status.</summary>
36+
public NativeSctpPlatformStatus Status { get; }
37+
38+
/// <summary>The diagnostic reason.</summary>
39+
public string Reason { get; }
40+
41+
/// <summary>Whether native SCTP socket creation is supported.</summary>
42+
public bool CanCreateSocket => Status == NativeSctpPlatformStatus.SocketCreationSupported;
43+
44+
/// <summary>Formats a compact capability summary.</summary>
45+
/// <returns>The capability summary.</returns>
46+
public string Describe()
47+
{
48+
return $"nativeSctp status={Status} canCreateSocket={CanCreateSocket} reason={Reason}";
49+
}
50+
}
51+
52+
/// <summary>
53+
/// Provides native SCTP platform constants and capability probing.
54+
/// </summary>
55+
public static class NativeSctpPlatform
56+
{
57+
/// <summary>The Linux IPPROTO_SCTP protocol number.</summary>
58+
public const int IpProtocolSctp = 132;
59+
60+
/// <summary>The socket type used by SCTP one-to-one style associations.</summary>
61+
public const SocketType SctpSocketType = SocketType.Seqpacket;
62+
63+
/// <summary>Gets the protocol type value used when creating native SCTP sockets.</summary>
64+
public static ProtocolType SctpProtocolType => (ProtocolType)IpProtocolSctp;
65+
66+
/// <summary>Returns whether the current operating system is the supported native SCTP target.</summary>
67+
/// <returns>True on Linux; otherwise false.</returns>
68+
public static bool IsSupportedOperatingSystem()
69+
{
70+
return OperatingSystem.IsLinux();
71+
}
72+
73+
/// <summary>Probes whether a native SCTP socket can be created.</summary>
74+
/// <returns>The native SCTP platform capability.</returns>
75+
public static NativeSctpPlatformCapability Probe()
76+
{
77+
if (!IsSupportedOperatingSystem())
78+
{
79+
return new(NativeSctpPlatformStatus.UnsupportedOperatingSystem, RuntimeInformation.OSDescription);
80+
}
81+
82+
try
83+
{
84+
using Socket socket = new(AddressFamily.InterNetwork, SctpSocketType, SctpProtocolType);
85+
return new(NativeSctpPlatformStatus.SocketCreationSupported, "SCTP socket creation succeeded.");
86+
}
87+
catch (SocketException ex)
88+
{
89+
return new(NativeSctpPlatformStatus.SocketCreationUnavailable, ex.SocketErrorCode.ToString());
90+
}
91+
catch (PlatformNotSupportedException ex)
92+
{
93+
return new(NativeSctpPlatformStatus.SocketCreationUnavailable, ex.Message);
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)