Skip to content

Commit 764fec0

Browse files
committed
Add stateful SCCP connectionless service
1 parent 7834aa0 commit 764fec0

18 files changed

Lines changed: 2056 additions & 46 deletions

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ SIGTRAN.NET is currently in a **public release-candidate** track. Version
1818
Native Linux SCTP and external SCTP/M3UA peer evidence are retained and now feed
1919
the SDK readiness APIs through a common verification catalog. Stateful M3UA and
2020
M2PA runtimes are available. Full stable-product readiness remains gated on
21-
stateful SCCP/TCAP/MAP services, end-to-end independent-peer evidence,
21+
stateful TCAP/MAP services, end-to-end independent-peer evidence,
2222
operator-sized performance evidence, trusted signing, and stable release
2323
execution.
2424

@@ -69,7 +69,7 @@ The current RC engineering track focuses on:
6969
| M3UA | Codec, routing, ASP state, long-running `IMtp3Network` runtime, bounded queues, heartbeat supervision, reconnect/failover hooks, diagnostics, and external peer evidence are available. |
7070
| SCTP | Native Linux SCTP evidence validates stream id, PPID, receive metadata, reconnect, metrics, graceful shutdown, and external peer traffic. |
7171
| M2PA | RFC 4165 codec and stateful `IMtp2Link` runtime provide alignment, proving, 24-bit sequencing, acknowledgement, retrieval retention, congestion handling, processor-outage recovery, metrics, and transport replacement. Independent peer evidence remains. |
72-
| SCCP | Connectionless codec and routing foundation exists; a stateful service layer and external evidence remain. |
72+
| SCCP | Stateful `ISccpService` supports UDT/XUDT/LUDT, GT translation, routing, bounded segmentation/reassembly, UDTS return policy, metrics, cancellation, and MTP3 receive ownership. External peer evidence remains. |
7373
| TCAP | BER and transaction foundations exist; production dialogue management and external evidence remain. |
7474
| MAP | SMS codec and facade foundations exist; stateful service workflows and external evidence remain. |
7575
| Tooling | Byte-level tests, protocol diagnostics, trace comparison, and interoperability evidence are core project principles. |
@@ -156,6 +156,7 @@ Start here:
156156
- [Phase 45 native SCTP production transport](docs/PHASE45_NATIVE_SCTP_PRODUCTION_TRANSPORT.md)
157157
- [Phase 46 evidence and readiness reconciliation](docs/PHASE46_EVIDENCE_READINESS_RECONCILIATION.md)
158158
- [SCCP](docs/SCCP.md)
159+
- [Phase 49 SCCP stateful service](docs/PHASE49_SCCP_STATEFUL_SERVICE.md)
159160
- [TCAP](docs/TCAP.md)
160161
- [MAP SMS profile](docs/MAP.md)
161162
- [Interoperability and tooling](docs/INTEROPERABILITY.md)

docs/COMMERCIAL_READINESS_REPORT.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ retained manifests instead of stale hard-coded flags.
4242
- M3UA and M2PA now provide stateful runtime implementations through
4343
`IMtp3Network` and `IMtp2Link`. Independent external M2PA peer evidence remains
4444
part of the end-to-end traffic lab gate.
45-
- SCCP, TCAP, and MAP SMS require stateful service/session implementations and
46-
independent end-to-end peer evidence.
45+
- SCCP now provides a stateful UDT/XUDT/LUDT service with translation, routing,
46+
reassembly, and UDT return policy. TCAP and MAP SMS still require stateful
47+
session/workflow implementations, and the complete stack requires independent
48+
end-to-end peer evidence.
4749
- The retained benchmark is not an operator-sized multi-host capacity or soak
4850
result.
4951

docs/LAYER_CONTRACTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ IMapSmsService map = new MapSmsService(tcap, calledParty, callingParty);
5656
This keeps replacement points explicit. A production Linux SCTP transport, the
5757
provided M2PA-backed MTP2 link, or a different TCAP dialogue manager can be
5858
swapped in without changing the layers above the relevant interface.
59+
60+
`ISccpService` owns stateful connectionless data and return indications while
61+
remaining independent of a concrete M3UA runtime. Its implementation can route
62+
UDT, XUDT, and LUDT traffic over any `IMtp3Network`.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Phase 49 - SCCP Stateful Service Layer
2+
3+
Phase 49 upgrades SCCP from codec-only building blocks to a long-running
4+
connectionless service over `IMtp3Network`.
5+
6+
## Delivered Units
7+
8+
| Unit | Delivery |
9+
| --- | --- |
10+
| 1 | Stateful `ISccpService` lifecycle and receive ownership |
11+
| 2 | Bounded data and service-return queues |
12+
| 3 | Unified request and indication models for UDT, XUDT, and LUDT |
13+
| 4 | Automatic connectionless message-format selection |
14+
| 5 | Longest-prefix global-title translation to DPC and SSN |
15+
| 6 | Thread-safe application route registration and resolution |
16+
| 7 | Bounded, expiring, ordered XUDT reassembly |
17+
| 8 | Return-on-error handling for unroutable UDT traffic |
18+
| 9 | Cancellation, deterministic stop, failure state, and metrics |
19+
| 10 | Loopback traffic tests, readiness integration, and documentation |
20+
21+
## Service Flow
22+
23+
```text
24+
TCAP or application
25+
|
26+
ISccpService
27+
|
28+
SccpConnectionlessService
29+
| translation | routing | reassembly | return policy |
30+
|
31+
IMtp3Network
32+
```
33+
34+
`SccpConnectionlessService.StartAsync` creates the single owner of
35+
`IMtp3Network.ReceiveAsync`. Decoded messages are delivered to bounded channels,
36+
which apply backpressure instead of allowing unbounded allocation.
37+
38+
## Outbound Selection
39+
40+
`SccpDataRequest` can select UDT, XUDT, LUDT, or automatic mode. Automatic mode
41+
tries UDT first, uses segmented XUDT when configured and the payload fits within
42+
the 16-segment protocol limit, then falls back to LUDT.
43+
44+
When a global-title translation matches, the called party is rewritten to a
45+
route-on-subsystem address and the translated point code becomes the MTP3 DPC.
46+
Rules use deterministic longest-prefix matching.
47+
48+
## Inbound Policy
49+
50+
Inbound UDT, XUDT, and LUDT messages are decoded into
51+
`SccpDataIndication`. Segmented XUDT contexts are keyed by source point code,
52+
segmentation reference, and encoded called/calling addresses. Context count,
53+
payload size, ordering, and inactivity lifetime are bounded.
54+
55+
When routes are configured, unresolved traffic is not delivered. UDT traffic
56+
with return-on-error set is returned as UDTS with
57+
`NoTranslationForThisSpecificAddress`.
58+
59+
## Evidence Boundary
60+
61+
The executable tests validate stateful traffic and policy behavior through an
62+
independent in-process `IMtp3Network` peer. External SCCP traces, XUDTS/LUDTS
63+
coverage, and independent end-to-end MAP traffic remain part of the later
64+
traffic-lab evidence gate.

docs/PHASE49_SUMMARY.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Phase 49 Summary
2+
3+
Phase 49 is implementation-complete.
4+
5+
`SccpConnectionlessService` now owns a cancellable MTP3 receive loop and exposes
6+
stateful data and return indications through `ISccpService`. It supports UDT,
7+
segmented XUDT, LUDT, global-title translation, application routing, bounded
8+
reassembly, return-on-error handling, bounded queues, metrics, and deterministic
9+
shutdown.
10+
11+
The implementation gate is closed by build, full executable tests, and package
12+
creation. Independent SCCP peer evidence remains explicitly open for the
13+
end-to-end traffic lab.

docs/PHASE_INDEX.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ This index is the complete phase map for Sigtran.NET. It links each phase to the
5353
| 46 | Evidence and readiness reconciliation | [Phase 46 Evidence And Readiness Reconciliation](PHASE46_EVIDENCE_READINESS_RECONCILIATION.md), [Phase 46 Summary](PHASE46_SUMMARY.md) | Complete; retained SCTP/M3UA evidence is reflected by readiness APIs |
5454
| 47 | M3UA production runtime API | [Phase 47 M3UA Runtime](PHASE47_M3UA_RUNTIME.md), [Phase 47 Summary](PHASE47_SUMMARY.md), [M3UA](M3UA.md) | Complete; long-running ASP runtime implements IMtp3Network |
5555
| 48 | M2PA production path | [Phase 48 M2PA Production Path](PHASE48_M2PA_PRODUCTION_PATH.md), [Phase 48 Summary](PHASE48_SUMMARY.md), [M2PA](M2PA.md) | Implementation complete; external peer evidence pending |
56-
| 49 | SCCP stateful service layer | Planned | Pending |
56+
| 49 | SCCP stateful service layer | [Phase 49 SCCP Stateful Service](PHASE49_SCCP_STATEFUL_SERVICE.md), [Phase 49 Summary](PHASE49_SUMMARY.md), [SCCP](SCCP.md) | Implementation complete; external peer evidence pending |
5757
| 50 | TCAP dialogue manager | Planned | Pending |
5858
| 51 | MAP SMS service | Planned | Pending |
5959
| 52 | End-to-end SS7 traffic lab | Planned | Pending |
@@ -66,6 +66,6 @@ This index is the complete phase map for Sigtran.NET. It links each phase to the
6666
The retained verification catalog now reports native Linux SCTP, external SCTP
6767
peer traffic, M3UA interoperability, RC SBOM/provenance/API baseline, and
6868
prerelease publication evidence. Full product readiness remains blocked on the
69-
stateful SCCP/TCAP/MAP services, end-to-end M2PA and higher-layer
69+
stateful TCAP/MAP services, end-to-end M2PA and higher-layer
7070
independent peer traffic, operator-sized performance, production operations, a
7171
trusted release identity, and protected stable publication.

docs/SCCP.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SCCP
22

3-
Phase 3 replaces the early SCCP proof-of-concept with standards-shaped connectionless SCCP primitives.
3+
SIGTRAN.NET provides standards-shaped connectionless SCCP codecs and a stateful
4+
service over `IMtp3Network`.
45

56
## Protocol Vocabulary
67

@@ -21,13 +22,30 @@ SccpProtocolClass protocolClass = new(
2122
byte encoded = protocolClass.Encode();
2223
```
2324

24-
The current SCCP work is still a foundation for standards-based encode/decode. Interoperability-sensitive consumers should wait for the Phase 3 readiness report before treating SCCP APIs as stable.
25+
The stateful implementation is available for controlled integration. External
26+
peer trace evidence remains required before broad interoperability claims.
2527

2628
## Service Contract
2729

28-
`ISccpService` is the official SCCP service boundary consumed by TCAP. It depends on `IMtp3Network` and exposes SCCP Unitdata send/receive primitives without binding callers to a concrete MTP3 or M3UA implementation.
30+
`ISccpService` is the official SCCP service boundary consumed by TCAP. It
31+
depends on `IMtp3Network` and exposes lifecycle, UDT compatibility methods,
32+
general connectionless data requests and indications, and service-return
33+
indications.
2934

30-
`SccpConnectionlessService` implements `ISccpService` for UDT traffic over an `IMtp3Network`.
35+
`SccpConnectionlessService` owns one lower-layer receive loop. Its bounded data
36+
and return queues provide asynchronous backpressure, and `StopAsync` cancels the
37+
receive owner deterministically.
38+
39+
```csharp
40+
SccpConnectionlessService service = new(network, routingLabel);
41+
await service.StartAsync(ct);
42+
43+
await service.SendAsync(
44+
new SccpDataRequest(protocolClass, called, calling, tcapPayload),
45+
ct);
46+
47+
SccpDataIndication indication = await service.ReceiveAsync(ct);
48+
```
3149

3250
## Party Addresses
3351

@@ -111,6 +129,10 @@ SccpExtendedUnitdataMessage segmented = new(
111129
segmentation);
112130
```
113131

132+
`SccpReassemblyBuffer` validates descending remaining-segment values and bounds
133+
context count, assembled payload size, and inactivity lifetime. The stateful
134+
service uses it automatically and emits only a complete logical indication.
135+
114136
## Long Unitdata
115137

116138
`SccpLongUnitdataMessage` carries larger connectionless payloads with 16-bit pointer and length fields.
@@ -144,6 +166,11 @@ byte[] encoded = udts.Encode();
144166

145167
Use UDTS when an incoming UDT cannot be delivered and the protocol class asks for return-on-error behavior.
146168

169+
When at least one application route is configured, the stateful service rejects
170+
unresolved traffic. An unroutable UDT with return-on-error set is returned as
171+
UDTS with the original payload and reversed party addresses. Received UDTS
172+
messages are available through `ReceiveReturnAsync`.
173+
147174
## Evidence Vectors
148175

149176
`SccpEvidenceVectors.GetVectors()` exposes deterministic byte-level vectors for UDT, XUDT segmentation, LUDT pointer layout, and UDTS return-cause behavior.
@@ -172,9 +199,17 @@ if (routes.TryResolve(calledParty, out SccpRoute? route))
172199

173200
Global title routes use longest-prefix matching. SSN routes can optionally include a point code for more specific routing.
174201

202+
`SccpGlobalTitleTranslationTable` performs outbound longest-prefix translation.
203+
Each rule maps a numeric prefix to DPC and SSN and can preserve or remove the
204+
original global title. The translated DPC is applied to the outbound MTP3
205+
routing label.
206+
175207
## Readiness
176208

177-
`SccpReadiness.GetReport()` reports the current Phase 3 status. The SDK foundation is ready when MTP3 routing, party addressing, UDT/XUDT/LUDT codecs, segmentation, service messages, and routing APIs are present.
209+
`SccpReadiness.GetReport()` reports codec and stateful service capabilities. The
210+
SDK foundation is ready when MTP3 routing, party addressing, UDT/XUDT/LUDT
211+
codecs, segmentation, service messages, route APIs, stateful lifecycle,
212+
global-title translation, reassembly, and return policy are present.
178213

179214
```csharp
180215
SccpReadinessSnapshot report = SccpReadiness.GetReport();

docs/SDK_ROADMAP.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,11 @@ end-to-end traffic lab gate.
446446
route policy.
447447
- Validate UDT, XUDT, LUDT, and service-return behavior.
448448

449-
Status: Pending.
449+
Status: Implementation complete. `SccpConnectionlessService` now owns a
450+
cancellable `IMtp3Network` receive loop and exposes bounded stateful indications.
451+
It supports UDT/XUDT/LUDT selection, GT translation, application route policy,
452+
ordered bounded XUDT reassembly, UDTS return handling, metrics, and deterministic
453+
shutdown. Independent SCCP peer evidence remains in the end-to-end lab gate.
450454

451455
## Phase 50 - TCAP Dialogue Manager
452456

0 commit comments

Comments
 (0)