Skip to main content

10. Interface with Upper Layer

This chapter defines the interface services between SCTP and the Upper Layer Protocol (ULP). These are abstract interfaces; actual implementations may vary by operating system.

10.1. ULP-to-SCTP

ULP uses the following primitives to send commands and data to SCTP:

10.1.1. Initialize

Format: INITIALIZE([local port], [local eligible address list])

Purpose: Initialize an SCTP endpoint.

Parameters:

  • local port: Local port number (optional)
  • local eligible address list: List of local eligible addresses (optional)

Result:

  • Success: Returns local endpoint handle
  • Failure: Returns error code

Description:

- Allocate resources for SCTP endpoint
- Bind to specified local port and addresses
- If no port specified, system auto-assigns
- If no addresses specified, use all available local addresses

10.1.2. Associate

Format: ASSOCIATE(local SCTP instance name, destination transport addr, outbound stream count)

Purpose: Request establishment of new association with remote SCTP endpoint.

Required Parameters:

  • local SCTP instance name: Local SCTP instance name
  • destination transport addr: Destination transport address (IP address and port)
  • outbound stream count: Requested number of outbound streams

Optional Parameters:

  • destination transport addr list: List of destination transport addresses (for multihoming)
  • stream payload protocol identifier: Stream payload protocol identifier

Result:

  • COMMUNICATION UP: Association successfully established
  • COMMUNICATION LOST: Association establishment failed

Description:

1. Generate INIT chunk
2. Start T1-init timer
3. Send INIT to destination address
4. Wait for INIT ACK
5. Send COOKIE ECHO
6. Wait for COOKIE ACK
7. Enter ESTABLISHED state

10.1.3. Send

Format: SEND(association id, buffer address, byte count [,context] [,stream id] [,life time] [,destination transport address] [,unordered flag] [,no-bundle flag] [,payload protocol-id])

Purpose: Pass user message to SCTP for transmission.

Required Parameters:

  • association id: Association identifier
  • buffer address: Buffer address
  • byte count: Byte count

Optional Parameters:

  • context: User context (for error reporting)
  • stream id: Stream identifier (default 0)
  • life time: Message lifetime (milliseconds)
  • destination transport address: Destination transport address
  • unordered flag: Unordered delivery flag
  • no-bundle flag: No-bundle flag
  • payload protocol-id: Payload protocol ID

Result:

  • Success: Message accepted for transmission
  • Failure: Returns error code

Description:

- Segment user data into DATA chunks
- Assign according to stream ID and SSN
- If lifetime specified, discard on timeout
- Default to primary destination address

10.1.4. Shutdown

Format: SHUTDOWN(association id)

Purpose: Gracefully close association.

Required Parameters:

  • association id: Association identifier

Result:

  • SHUTDOWN COMPLETE: Shutdown successful
  • COMMUNICATION LOST: Shutdown failed

Description:

1. Stop accepting new user data
2. Complete transmission of all unsent data
3. Wait for all data to be acknowledged
4. Send SHUTDOWN chunk
5. Wait for SHUTDOWN ACK
6. Send SHUTDOWN COMPLETE
7. Destroy TCB

10.1.5. Abort

Format: ABORT(association id [,Upper Layer Abort Reason])

Purpose: Immediately terminate association.

Required Parameters:

  • association id: Association identifier

Optional Parameters:

  • Upper Layer Abort Reason: Upper layer abort reason

Result:

  • COMMUNICATION LOST: Association aborted

Description:

1. Send ABORT chunk (with reason)
2. Discard all unsent and unacknowledged data
3. Destroy TCB
4. Report COMMUNICATION LOST to ULP

10.1.6. Set Primary

Format: SET PRIMARY(association id, destination transport address)

Purpose: Set primary destination address.

Required Parameters:

  • association id: Association identifier
  • destination transport address: Destination transport address

Result:

  • Success: Primary address updated
  • Failure: Address not in association's peer address list

Description:

- Change current primary destination address
- Used for traffic engineering or failure recovery
- Address must be valid peer address in association

10.1.7. Receive

Format: RECEIVE(association id, buffer address, buffer size)

Purpose: Receive data from SCTP.

Required Parameters:

  • association id: Association identifier
  • buffer address: Receive buffer address
  • buffer size: Buffer size

Return Values:

  • byte count: Number of bytes received
  • stream id: Stream identifier
  • stream sequence number: Stream sequence number
  • partial flag: Partial delivery flag
  • delivery number: Delivery number
  • transport address: Source transport address

Description:

- Extract user message from receive queue
- May block if no data available (implementation-dependent)
- Deliver in order by stream ID and SSN (unless unordered)

10.1.8. Status

Format: STATUS(association id)

Purpose: Query current association status.

Required Parameters:

  • association id: Association identifier

Return Values:

  • association connection state: Association connection state
  • destination transport address list: Destination transport address list
  • destination transport address reachability states: Destination transport address reachability states
  • current receiver window size: Current receiver window size
  • current congestion window sizes: Current congestion window sizes
  • number of outbound streams: Number of outbound streams
  • number of inbound streams: Number of inbound streams
  • primary path: Primary path

10.1.9. Change Heartbeat

Format: CHANGE HEARTBEAT(association id, destination transport address, new state [,interval])

Purpose: Enable or disable heartbeat for specific destination address.

Required Parameters:

  • association id: Association identifier
  • destination transport address: Destination transport address
  • new state: New state (enable/disable)

Optional Parameters:

  • interval: Heartbeat interval (milliseconds)

10.1.10. Request Heartbeat

Format: REQUEST HEARTBEAT(association id, destination transport address)

Purpose: Request heartbeat to be sent to specific destination address.

Required Parameters:

  • association id: Association identifier
  • destination transport address: Destination transport address

Use:

  • Test reachability of specific path
  • Update path RTT estimate

10.1.11. Get SRTT Report

Format: GET SRTT REPORT(association id, destination transport address)

Purpose: Get SRTT (Smoothed Round-Trip Time) for specific destination address.

Return Values:

  • srtt: Current SRTT value
  • last update time: Last update time

10.1.12. Set Failure Threshold

Format: SET FAILURE THRESHOLD(association id, destination transport address, failure threshold)

Purpose: Set path failure threshold.

Parameters:

  • association id: Association identifier
  • destination transport address: Destination transport address
  • failure threshold: Failure threshold

10.1.13. Set Protocol Parameters

Format: SET PROTOCOL PARAMETERS(association id, [,destination transport address,] protocol parameter list)

Purpose: Set SCTP protocol parameters.

Settable Parameters:

  • RTO.Initial: Initial retransmission timeout
  • RTO.Min: Minimum retransmission timeout
  • RTO.Max: Maximum retransmission timeout
  • RTO.Alpha: Alpha value for SRTT estimator
  • RTO.Beta: Beta value for SRTT estimator
  • Max.Burst: Maximum burst size
  • Association.Max.Retrans: Association maximum retransmissions
  • Path.Max.Retrans: Path maximum retransmissions
  • Valid.Cookie.Life: Valid cookie lifetime
  • SACK.Delay: SACK delay

10.1.14. Destroy SCTP Instance

Format: DESTROY(local SCTP instance name)

Purpose: Destroy SCTP instance.

Description:

1. Abort all active associations
2. Release all resources
3. Unbind ports and addresses

10.2. SCTP-to-ULP

SCTP uses the following primitives to report events to ULP:

10.2.1. COMMUNICATION UP

Format: COMMUNICATION UP(association id, destination transport address list, outbound stream count, inbound stream count)

Trigger Conditions:

  • New association successfully established (ASSOCIATE completed)
  • New association accepted as passive side (received INIT and completed four-way handshake)

Parameters:

  • association id: Newly established association identifier
  • destination transport address list: Peer address list
  • outbound stream count: Negotiated number of outbound streams
  • inbound stream count: Negotiated number of inbound streams

10.2.2. DATA ARRIVE

Format: DATA ARRIVE(association id, stream id, stream sequence number, flags, payload protocol identifier, user data)

Trigger Conditions:

  • User data received from peer

Parameters:

  • association id: Association identifier
  • stream id: Stream identifier
  • stream sequence number: Stream sequence number
  • flags: Flags (e.g., unordered flag)
  • payload protocol identifier: Payload protocol identifier
  • user data: User data

Description:

- Notify ULP that new data is available
- ULP should use RECEIVE primitive to retrieve data
- Data delivered in order by stream ID and SSN (unless unordered)

10.2.3. COMMUNICATION LOST

Format: COMMUNICATION LOST(association id, status)

Trigger Conditions:

  • Association failed or aborted
  • Peer endpoint failure detected
  • ABORT chunk received
  • SHUTDOWN failed

Parameters:

  • association id: Association identifier
  • status: Failure reason
    • Association exceeded maximum retransmissions: Exceeded maximum retransmissions
    • Peer sent ABORT: Peer sent ABORT
    • Peer unexpectedly closed: Peer unexpectedly closed
    • Resources unavailable: Resources unavailable

10.2.4. COMMUNICATION ERROR

Format: COMMUNICATION ERROR(association id, error info)

Trigger Conditions:

  • Recoverable communication error detected
  • ERROR chunk received
  • Path failure (but association still active)

Parameters:

  • association id: Association identifier
  • error info: Error information

10.2.5. RESTART

Format: RESTART(association id, peer's new tag)

Trigger Conditions:

  • Peer endpoint restart detected

Parameters:

  • association id: Association identifier
  • peer's new tag: Peer's new tag

Description:

- Notify ULP that peer has restarted
- ULP should decide how to handle (re-establish or terminate)
- May need to resynchronize application layer state

10.2.6. SHUTDOWN COMPLETE

Format: SHUTDOWN COMPLETE(association id)

Trigger Conditions:

  • Graceful shutdown process successfully completed

Parameters:

  • association id: Association identifier

Description:

- Association successfully closed
- All data reliably delivered
- TCB destroyed

10.2.7. SEND FAILURE

Format: SEND FAILURE(association id, data retrieval id, cause code, context)

Trigger Conditions:

  • Data failed to transmit for some reason
  • Maximum retransmissions reached
  • Message lifetime expired

Parameters:

  • association id: Association identifier
  • data retrieval id: Data retrieval identifier
  • cause code: Failure cause code
  • context: User context (from SEND primitive)

Cause Codes:

  • Message expired: Message expired
  • Association aborted: Association aborted
  • Send failed: Send failed

10.2.8. NETWORK STATUS CHANGE

Format: NETWORK STATUS CHANGE(association id, destination transport address, new status)

Trigger Conditions:

  • Destination transport address status changed
  • Path became active or inactive

Parameters:

  • association id: Association identifier
  • destination transport address: Destination transport address
  • new status: New status
    • Active: Path now available
    • Inactive: Path now unavailable
    • Unconfirmed: Path unconfirmed

Summary

SCTP's ULP interface provides:

  1. Complete Association Management: Initialize, establish, close, abort
  2. Flexible Data Transmission: Support for multi-stream, ordered/unordered, lifetime
  3. Path Management: Heartbeat, failure detection, primary path selection
  4. Status Monitoring: Query association status, network status change notifications
  5. Parameter Configuration: Runtime adjustment of protocol parameters

Best Practices:

  • Properly handle all SCTP-to-ULP notifications
  • Use stream IDs for logical data separation
  • Set reasonable message lifetimes
  • Monitor network status changes and respond
  • Prefer graceful shutdown over forced abort