draft-ietf-tsvwg-sctpsocket-23.txt   draft-ietf-tsvwg-sctpsocket-24.txt 
Network Working Group R. Stewart Network Working Group R. Stewart
Internet-Draft Huawei Internet-Draft Huawei
Intended status: Informational K. Poon Intended status: Informational K. Poon
Expires: January 13, 2011 Oracle Corporation Expires: April 28, 2011 Oracle Corporation
M. Tuexen M. Tuexen
Muenster Univ. of Applied Sciences Muenster Univ. of Applied Sciences
V. Yasevich V. Yasevich
HP HP
P. Lei P. Lei
Cisco Systems, Inc. Cisco Systems, Inc.
July 12, 2010 October 25, 2010
Sockets API Extensions for Stream Control Transmission Protocol (SCTP) Sockets API Extensions for Stream Control Transmission Protocol (SCTP)
draft-ietf-tsvwg-sctpsocket-23.txt draft-ietf-tsvwg-sctpsocket-24.txt
Abstract Abstract
This document describes a mapping of the Stream Control Transmission This document describes a mapping of the Stream Control Transmission
Protocol SCTP into a sockets API. The benefits of this mapping Protocol SCTP into a sockets API. The benefits of this mapping
include compatibility for TCP applications, access to new SCTP include compatibility for TCP applications, access to new SCTP
features and a consolidated error and event notification scheme. features and a consolidated error and event notification scheme.
Status of this Memo Status of this Memo
skipping to change at page 1, line 40 skipping to change at page 1, line 40
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 13, 2011. This Internet-Draft will expire on April 28, 2011.
Copyright Notice Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 3, line 19 skipping to change at page 3, line 19
3. One-to-Many Style Interface . . . . . . . . . . . . . . . . . 8 3. One-to-Many Style Interface . . . . . . . . . . . . . . . . . 8
3.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 8 3.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 8
3.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 9 3.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 11 3.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 11
3.1.4. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 11 3.1.4. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 11
3.1.5. close() . . . . . . . . . . . . . . . . . . . . . . . 13 3.1.5. close() . . . . . . . . . . . . . . . . . . . . . . . 13
3.1.6. connect() . . . . . . . . . . . . . . . . . . . . . . 14 3.1.6. connect() . . . . . . . . . . . . . . . . . . . . . . 14
3.2. Non-blocking mode . . . . . . . . . . . . . . . . . . . . 14 3.2. Non-blocking mode . . . . . . . . . . . . . . . . . . . . 14
3.3. Special considerations . . . . . . . . . . . . . . . . . . 15 3.3. Special considerations . . . . . . . . . . . . . . . . . . 15
4. One-to-One Style Interface . . . . . . . . . . . . . . . . . . 16 4. One-to-One Style Interface . . . . . . . . . . . . . . . . . . 17
4.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 17 4.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 17
4.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 17 4.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 18
4.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 18 4.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 19 4.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 19
4.1.4. accept() . . . . . . . . . . . . . . . . . . . . . . . 19 4.1.4. accept() . . . . . . . . . . . . . . . . . . . . . . . 20
4.1.5. connect() . . . . . . . . . . . . . . . . . . . . . . 20 4.1.5. connect() . . . . . . . . . . . . . . . . . . . . . . 20
4.1.6. close() . . . . . . . . . . . . . . . . . . . . . . . 21 4.1.6. close() . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.7. shutdown() . . . . . . . . . . . . . . . . . . . . . . 21 4.1.7. shutdown() . . . . . . . . . . . . . . . . . . . . . . 22
4.1.8. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 22 4.1.8. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 22
4.1.9. getpeername() . . . . . . . . . . . . . . . . . . . . 22 4.1.9. getpeername() . . . . . . . . . . . . . . . . . . . . 23
5. Data Structures . . . . . . . . . . . . . . . . . . . . . . . 23 5. Data Structures . . . . . . . . . . . . . . . . . . . . . . . 23
5.1. The msghdr and cmsghdr Structures . . . . . . . . . . . . 23 5.1. The msghdr and cmsghdr Structures . . . . . . . . . . . . 23
5.2. SCTP msg_control Structures . . . . . . . . . . . . . . . 24 5.2. SCTP msg_control Structures . . . . . . . . . . . . . . . 24
5.2.1. SCTP Initiation Structure (SCTP_INIT) . . . . . . . . 25 5.2.1. SCTP Initiation Structure (SCTP_INIT) . . . . . . . . 25
5.2.2. SCTP Header Information Structure (SCTP_SNDRCV) . . . 26 5.2.2. SCTP Header Information Structure (SCTP_SNDRCV) . . . 26
5.2.3. Extended SCTP Header Information Structure 5.2.3. Extended SCTP Header Information Structure
(SCTP_EXTRCV) . . . . . . . . . . . . . . . . . . . . 28 (SCTP_EXTRCV) . . . . . . . . . . . . . . . . . . . . 28
5.2.4. SCTP Send Information Structure (SCTP_SNDINFO) . . . . 29 5.2.4. SCTP Send Information Structure (SCTP_SNDINFO) . . . . 30
5.2.5. SCTP Receive Information Structure (SCTP_RCVINFO) . . 31 5.2.5. SCTP Receive Information Structure (SCTP_RCVINFO) . . 31
5.2.6. SCTP Next Receive Information Structure 5.2.6. SCTP Next Receive Information Structure
(SCTP_NXTINFO) . . . . . . . . . . . . . . . . . . . . 32 (SCTP_NXTINFO) . . . . . . . . . . . . . . . . . . . . 33
5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO) . . . 32 5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO) . . . 33
5.2.8. SCTP AUTH Information Structure (SCTP_AUTHINFO) . . . 33 5.2.8. SCTP AUTH Information Structure (SCTP_AUTHINFO) . . . 34
5.2.9. SCTP Destination Address Structure (IPv4) 5.2.9. SCTP Destination Address Structure (IPv4)
(SCTP_DSTADDRV4) . . . . . . . . . . . . . . . . . . . 33 (SCTP_DSTADDRV4) . . . . . . . . . . . . . . . . . . . 34
5.2.10. SCTP Destination Address Structure (IPv6) 5.2.10. SCTP Destination Address Structure (IPv6)
(SCTP_DSTADDRV6) . . . . . . . . . . . . . . . . . . . 34 (SCTP_DSTADDRV6) . . . . . . . . . . . . . . . . . . . 34
5.3. SCTP Events and Notifications . . . . . . . . . . . . . . 34 5.3. SCTP Events and Notifications . . . . . . . . . . . . . . 35
5.3.1. SCTP Notification Structure . . . . . . . . . . . . . 35 5.3.1. SCTP Notification Structure . . . . . . . . . . . . . 35
5.3.2. SCTP_ASSOC_CHANGE . . . . . . . . . . . . . . . . . . 36 5.3.2. SCTP_ASSOC_CHANGE . . . . . . . . . . . . . . . . . . 37
5.3.3. SCTP_PEER_ADDR_CHANGE . . . . . . . . . . . . . . . . 37 5.3.3. SCTP_PEER_ADDR_CHANGE . . . . . . . . . . . . . . . . 38
5.3.4. SCTP_REMOTE_ERROR . . . . . . . . . . . . . . . . . . 38 5.3.4. SCTP_REMOTE_ERROR . . . . . . . . . . . . . . . . . . 39
5.3.5. SCTP_SEND_FAILED . . . . . . . . . . . . . . . . . . . 39 5.3.5. SCTP_SEND_FAILED . . . . . . . . . . . . . . . . . . . 40
5.3.6. SCTP_SHUTDOWN_EVENT . . . . . . . . . . . . . . . . . 40 5.3.6. SCTP_SHUTDOWN_EVENT . . . . . . . . . . . . . . . . . 41
5.3.7. SCTP_ADAPTATION_INDICATION . . . . . . . . . . . . . . 41 5.3.7. SCTP_ADAPTATION_INDICATION . . . . . . . . . . . . . . 42
5.3.8. SCTP_PARTIAL_DELIVERY_EVENT . . . . . . . . . . . . . 42 5.3.8. SCTP_PARTIAL_DELIVERY_EVENT . . . . . . . . . . . . . 42
5.3.9. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 42 5.3.9. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 43
5.3.10. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 43 5.3.10. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 44
5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . . 44 5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . . 45
5.3.12. SCTP_SEND_FAILED_EVENT . . . . . . . . . . . . . . . . 44 5.3.12. SCTP_SEND_FAILED_EVENT . . . . . . . . . . . . . . . . 45
5.4. Ancillary Data Considerations and Semantics . . . . . . . 45 5.4. Ancillary Data Considerations and Semantics . . . . . . . 46
5.4.1. Multiple Items and Ordering . . . . . . . . . . . . . 45 5.4.1. Multiple Items and Ordering . . . . . . . . . . . . . 46
5.4.2. Accessing and Manipulating Ancillary Data . . . . . . 46 5.4.2. Accessing and Manipulating Ancillary Data . . . . . . 47
5.4.3. Control Message Buffer Sizing . . . . . . . . . . . . 46 5.4.3. Control Message Buffer Sizing . . . . . . . . . . . . 47
6. Common Operations for Both Styles . . . . . . . . . . . . . . 47 6. Common Operations for Both Styles . . . . . . . . . . . . . . 48
6.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . . 47 6.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . . 48
6.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 49 6.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 50
6.3. read() and write() . . . . . . . . . . . . . . . . . . . . 50 6.3. read() and write() . . . . . . . . . . . . . . . . . . . . 51
6.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 50 6.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 51
6.5. Implicit Association Setup . . . . . . . . . . . . . . . . 51 6.5. Implicit Association Setup . . . . . . . . . . . . . . . . 52
7. Socket Options . . . . . . . . . . . . . . . . . . . . . . . . 52 7. Socket Options . . . . . . . . . . . . . . . . . . . . . . . . 52
7.1. Read / Write Options . . . . . . . . . . . . . . . . . . . 54 7.1. Read / Write Options . . . . . . . . . . . . . . . . . . . 54
7.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . . 54 7.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . . 54
7.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 54 7.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 55
7.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . . 56 7.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . . 57
7.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 56 7.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 57
7.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . 57 7.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . 57
7.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 57 7.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 58
7.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 57 7.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 58
7.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . . 57 7.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . . 58
7.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 58 7.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 58
7.1.10. Set Adaptation Layer Indicator 7.1.10. Set Adaptation Layer Indicator
(SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 58 (SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 59
7.1.11. Enable/Disable Message Fragmentation 7.1.11. Enable/Disable Message Fragmentation
(SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . . 58 (SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . . 59
7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 58 7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 59
7.1.13. Set Default Send Parameters 7.1.13. Set Default Send Parameters
(SCTP_DEFAULT_SEND_PARAM) . . . . . . . . . . . . . . 61 (SCTP_DEFAULT_SEND_PARAM) . . . . . . . . . . . . . . 61
7.1.14. Set Notification and Ancillary Events (SCTP_EVENTS) . 61 7.1.14. Set Notification and Ancillary Events (SCTP_EVENTS) . 62
7.1.15. Set/Clear IPv4 Mapped Addresses 7.1.15. Set/Clear IPv4 Mapped Addresses
(SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . . 61 (SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . . 62
7.1.16. Get or Set the Maximum Fragmentation Size 7.1.16. Get or Set the Maximum Fragmentation Size
(SCTP_MAXSEG) . . . . . . . . . . . . . . . . . . . . 61 (SCTP_MAXSEG) . . . . . . . . . . . . . . . . . . . . 62
7.1.17. Get or Set the List of Supported HMAC Identifiers 7.1.17. Get or Set the List of Supported HMAC Identifiers
(SCTP_HMAC_IDENT) . . . . . . . . . . . . . . . . . . 62 (SCTP_HMAC_IDENT) . . . . . . . . . . . . . . . . . . 63
7.1.18. Get or Set the Active Shared Key 7.1.18. Get or Set the Active Shared Key
(SCTP_AUTH_ACTIVE_KEY) . . . . . . . . . . . . . . . . 63 (SCTP_AUTH_ACTIVE_KEY) . . . . . . . . . . . . . . . . 64
7.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK) . . 63 7.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK) . . 64
7.1.20. Get or Set Fragmented Interleave 7.1.20. Get or Set Fragmented Interleave
(SCTP_FRAGMENT_INTERLEAVE) . . . . . . . . . . . . . . 64 (SCTP_FRAGMENT_INTERLEAVE) . . . . . . . . . . . . . . 65
7.1.21. Set or Get the SCTP Partial Delivery Point 7.1.21. Set or Get the SCTP Partial Delivery Point
(SCTP_PARTIAL_DELIVERY_POINT) . . . . . . . . . . . . 65 (SCTP_PARTIAL_DELIVERY_POINT) . . . . . . . . . . . . 66
7.1.22. Set or Get the Use of Extended Receive Info 7.1.22. Set or Get the Use of Extended Receive Info
(SCTP_USE_EXT_RCVINFO) . . . . . . . . . . . . . . . . 66 (SCTP_USE_EXT_RCVINFO) . . . . . . . . . . . . . . . . 67
7.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF) . . 66 7.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF) . . 67
7.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST) . . . . 66 7.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST) . . . . 67
7.1.25. Set or Get the Default Context (SCTP_CONTEXT) . . . . 67 7.1.25. Set or Get the Default Context (SCTP_CONTEXT) . . . . 68
7.1.26. Enable or Disable Explicit EOR Marking 7.1.26. Enable or Disable Explicit EOR Marking
(SCTP_EXPLICIT_EOR) . . . . . . . . . . . . . . . . . 67 (SCTP_EXPLICIT_EOR) . . . . . . . . . . . . . . . . . 68
7.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT) . . . . . . 67 7.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT) . . . . . . 68
7.1.28. Set Notification Event (SCTP_EVENT) . . . . . . . . . 68 7.1.28. Set Notification Event (SCTP_EVENT) . . . . . . . . . 69
7.1.29. Enable or Disable the Delivery of SCTP_RCVINFO as 7.1.29. Enable or Disable the Delivery of SCTP_RCVINFO as
Ancillary Data (SCTP_RECVRCVINFO) . . . . . . . . . . 68 Ancillary Data (SCTP_RECVRCVINFO) . . . . . . . . . . 69
7.1.30. Enable or Disable the Delivery of SCTP_NXTINFO as 7.1.30. Enable or Disable the Delivery of SCTP_NXTINFO as
Ancillary Data (SCTP_RECVNXTINFO) . . . . . . . . . . 68 Ancillary Data (SCTP_RECVNXTINFO) . . . . . . . . . . 69
7.1.31. Set Default Send Parameters (SCTP_DEFAULT_SNDINFO) . . 68 7.1.31. Set Default Send Parameters (SCTP_DEFAULT_SNDINFO) . . 69
7.2. Read-Only Options . . . . . . . . . . . . . . . . . . . . 68 7.2. Read-Only Options . . . . . . . . . . . . . . . . . . . . 70
7.2.1. Association Status (SCTP_STATUS) . . . . . . . . . . . 69 7.2.1. Association Status (SCTP_STATUS) . . . . . . . . . . . 70
7.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . . 70 7.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . . 71
7.2.3. Get the List of Chunks the Peer Requires to be 7.2.3. Get the List of Chunks the Peer Requires to be
Authenticated (SCTP_PEER_AUTH_CHUNKS) . . . . . . . . 71 Authenticated (SCTP_PEER_AUTH_CHUNKS) . . . . . . . . 72
7.2.4. Get the List of Chunks the Local Endpoint Requires 7.2.4. Get the List of Chunks the Local Endpoint Requires
to be Authenticated (SCTP_LOCAL_AUTH_CHUNKS) . . . . . 71 to be Authenticated (SCTP_LOCAL_AUTH_CHUNKS) . . . . . 72
7.2.5. Get the Current Number of Associations 7.2.5. Get the Current Number of Associations
(SCTP_GET_ASSOC_NUMBER) . . . . . . . . . . . . . . . 72 (SCTP_GET_ASSOC_NUMBER) . . . . . . . . . . . . . . . 73
7.2.6. Get the Current Identifiers of Associations 7.2.6. Get the Current Identifiers of Associations
(SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . . 72 (SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . . 73
7.3. Write-Only Options . . . . . . . . . . . . . . . . . . . . 72 7.3. Write-Only Options . . . . . . . . . . . . . . . . . . . . 74
7.3.1. Set Peer Primary Address 7.3.1. Set Peer Primary Address
(SCTP_SET_PEER_PRIMARY_ADDR) . . . . . . . . . . . . . 72 (SCTP_SET_PEER_PRIMARY_ADDR) . . . . . . . . . . . . . 74
7.3.2. Add a Chunk That Must Be Authenticated 7.3.2. Add a Chunk That Must Be Authenticated
(SCTP_AUTH_CHUNK) . . . . . . . . . . . . . . . . . . 73 (SCTP_AUTH_CHUNK) . . . . . . . . . . . . . . . . . . 74
7.3.3. Set a Shared Key (SCTP_AUTH_KEY) . . . . . . . . . . . 73 7.3.3. Set a Shared Key (SCTP_AUTH_KEY) . . . . . . . . . . . 75
7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY) . . 74 7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY) . . 75
7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY) . . . . . . 74 7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY) . . . . . . 76
7.4. Ancillary Data and Notification Interest Options . . . . . 75 7.4. Ancillary Data and Notification Interest Options . . . . . 76
8. New Functions . . . . . . . . . . . . . . . . . . . . . . . . 78 8. New Functions . . . . . . . . . . . . . . . . . . . . . . . . 79
8.1. sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 78 8.1. sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 79
8.2. sctp_peeloff() . . . . . . . . . . . . . . . . . . . . . . 80 8.2. sctp_peeloff() . . . . . . . . . . . . . . . . . . . . . . 81
8.3. sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 80 8.3. sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 82
8.4. sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 81 8.4. sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 82
8.5. sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 81 8.5. sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 83
8.6. sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 82 8.6. sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 83
8.7. sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 82 8.7. sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 83
8.8. sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 83 8.8. sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 84
8.9. sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 84 8.9. sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 85
8.10. sctp_send() . . . . . . . . . . . . . . . . . . . . . . . 85 8.10. sctp_send() . . . . . . . . . . . . . . . . . . . . . . . 86
8.11. sctp_sendx() . . . . . . . . . . . . . . . . . . . . . . . 86 8.11. sctp_sendx() . . . . . . . . . . . . . . . . . . . . . . . 87
8.12. sctp_recvxxx() . . . . . . . . . . . . . . . . . . . . . . 87 8.12. sctp_recvv() . . . . . . . . . . . . . . . . . . . . . . . 88
8.13. sctp_sendxxx() . . . . . . . . . . . . . . . . . . . . . . 88 8.13. sctp_sendv() . . . . . . . . . . . . . . . . . . . . . . . 89
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 89 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 90
10. Security Considerations . . . . . . . . . . . . . . . . . . . 89 10. Security Considerations . . . . . . . . . . . . . . . . . . . 90
11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 89 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 91
12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 90 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1. Normative References . . . . . . . . . . . . . . . . . . . 90 12.1. Normative References . . . . . . . . . . . . . . . . . . . 91
12.2. Informative References . . . . . . . . . . . . . . . . . . 90 12.2. Informative References . . . . . . . . . . . . . . . . . . 92
Appendix A. One-to-One Style Code Example . . . . . . . . . . . . 90 Appendix A. One-to-One Style Code Example . . . . . . . . . . . . 92
Appendix B. One-to-Many Style Code Example . . . . . . . . . . . 96 Appendix B. One-to-Many Style Code Example . . . . . . . . . . . 97
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 97 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 99
1. Introduction 1. Introduction
The sockets API has provided a standard mapping of the Internet The sockets API has provided a standard mapping of the Internet
Protocol suite to many operating systems. Both TCP [RFC0793] and UDP Protocol suite to many operating systems. Both TCP [RFC0793] and UDP
[RFC0768] have benefited from this standard representation and access [RFC0768] have benefited from this standard representation and access
method across many diverse platforms. SCTP is a new protocol that method across many diverse platforms. SCTP is a new protocol that
provides many of the characteristics of TCP but also incorporates provides many of the characteristics of TCP but also incorporates
semantics more akin to UDP. This document defines a method to map semantics more akin to UDP. This document defines a method to map
the existing sockets API for use with SCTP, providing both a base for the existing sockets API for use with SCTP, providing both a base for
skipping to change at page 8, line 21 skipping to change at page 8, line 21
Whenever possible, data types from Draft 6.6 (March 1997) of POSIX Whenever possible, data types from Draft 6.6 (March 1997) of POSIX
1003.1g are used: uintN_t means an unsigned integer of exactly N bits 1003.1g are used: uintN_t means an unsigned integer of exactly N bits
(e.g. uint16_t). This document also assumes the argument data types (e.g. uint16_t). This document also assumes the argument data types
from 1003.1g when possible (e.g. the final argument to setsockopt() from 1003.1g when possible (e.g. the final argument to setsockopt()
is a size_t value). Whenever buffer sizes are specified, the POSIX is a size_t value). Whenever buffer sizes are specified, the POSIX
1003.1 size_t data type is used. 1003.1 size_t data type is used.
3. One-to-Many Style Interface 3. One-to-Many Style Interface
The one-to-many style interface has the following characteristics: In the one-to-many style interface there is a 1 to many relationship
o Outbound association setup is implicit. between sockets and associations.
o Messages are delivered in complete messages (with one notable
exception).
o There is a 1 to many relationship between socket and association.
3.1. Basic Operation 3.1. Basic Operation
A typical server in this style uses the following socket calls in A typical server in this style uses the following socket calls in
sequence to prepare an endpoint for servicing requests: sequence to prepare an endpoint for servicing requests:
o socket() o socket()
o bind() o bind()
o listen() o listen()
o recvmsg() o recvmsg()
o sendmsg() o sendmsg()
skipping to change at page 9, line 9 skipping to change at page 9, line 6
endpoint are represented with a single socket. Each association is endpoint are represented with a single socket. Each association is
assigned an association ID (type is sctp_assoc_t) so that an assigned an association ID (type is sctp_assoc_t) so that an
application can use it to differentiate between them. In some application can use it to differentiate between them. In some
implementations, the peer endpoints' addresses can also be used for implementations, the peer endpoints' addresses can also be used for
this purpose. But this is not required for performance reasons. If this purpose. But this is not required for performance reasons. If
an implementation does not support using addresses to differentiate an implementation does not support using addresses to differentiate
between different associations, the sendto() call can only be used to between different associations, the sendto() call can only be used to
setup an association implicitly. It cannot be used to send data to setup an association implicitly. It cannot be used to send data to
an established association as the association ID cannot be specified. an established association as the association ID cannot be specified.
Once as association ID is assigned to an SCTP association, that ID Once an association ID is assigned to an SCTP association, that ID
will not be reused until the application explicitly terminates the will not be reused until the application explicitly terminates the
association. The resources belonging to that association will not be association. The resources belonging to that association will not be
freed until that happens. This is similar to the close() operation freed until that happens. This is similar to the close() operation
on a normal socket. The only exception is when the SCTP_AUTOCLOSE on a normal socket. The only exception is when the SCTP_AUTOCLOSE
option (section 7.1.8) is set. In this case, after the association option (section 7.1.8) is set. In this case, after the association
is terminated gracefully and automatically, the association ID is terminated gracefully and automatically, the association ID
assigned to it can be reused. All applications using this option assigned to it can be reused. All applications using this option
should be aware of this to avoid the possible problem of sending data should be aware of this to avoid the possible problem of sending data
to an incorrect peer endpoint. to an incorrect peer endpoint.
skipping to change at page 10, line 6 skipping to change at page 9, line 51
int socket(int domain, int socket(int domain,
int type, int type,
int protocol); int protocol);
and one uses PF_INET or PF_INET6 as the domain, SOCK_SEQPACKET as the and one uses PF_INET or PF_INET6 as the domain, SOCK_SEQPACKET as the
type and IPPROTO_SCTP as the protocol. type and IPPROTO_SCTP as the protocol.
Here, SOCK_SEQPACKET indicates the creation of a one-to-many style Here, SOCK_SEQPACKET indicates the creation of a one-to-many style
socket. socket.
The function returns a socket descriptor or -1 in case of an error.
Using the PF_INET domain indicates the creation of an endpoint which Using the PF_INET domain indicates the creation of an endpoint which
can use only IPv4 addresses, while PF_INET6 creates an endpoint which can use only IPv4 addresses, while PF_INET6 creates an endpoint which
can use both IPv6 and IPv4 addresses. can use both IPv6 and IPv4 addresses.
3.1.2. bind() 3.1.2. bind()
Applications use bind() to specify which local address and port the Applications use bind() to specify which local address and port the
SCTP endpoint should associate itself with. SCTP endpoint should associate itself with.
An SCTP endpoint can be associated with multiple addresses. To do An SCTP endpoint can be associated with multiple addresses. To do
skipping to change at page 10, line 40 skipping to change at page 10, line 39
int bind(int sd, int bind(int sd,
struct sockaddr *addr, struct sockaddr *addr,
socklen_t addrlen); socklen_t addrlen);
and the arguments are and the arguments are
sd: The socket descriptor returned by socket(). sd: The socket descriptor returned by socket().
addr: The address structure (struct sockaddr_in for an IPv4 address addr: The address structure (struct sockaddr_in for an IPv4 address
or struct sockaddr_in6 for an IPv6 address, see [RFC3493]). or struct sockaddr_in6 for an IPv6 address, see [RFC3493]).
addrlen: The size of the address structure. addrlen: The size of the address structure.
It returns 0 on success and -1 in case of an error.
If sd is an IPv4 socket, the address passed must be an IPv4 address. If sd is an IPv4 socket, the address passed must be an IPv4 address.
If the sd is an IPv6 socket, the address passed can either be an IPv4 If the sd is an IPv6 socket, the address passed can either be an IPv4
or an IPv6 address. or an IPv6 address.
Applications cannot call bind() multiple times to associate multiple Applications cannot call bind() multiple times to associate multiple
addresses to an endpoint. After the first call to bind(), all addresses to an endpoint. After the first call to bind(), all
subsequent calls will return an error. subsequent calls will return an error.
If the IP address part of addr is specified as a wildcard (INADDR_ANY If the IP address part of addr is specified as a wildcard (INADDR_ANY
skipping to change at page 11, line 29 skipping to change at page 11, line 28
The function prototype is The function prototype is
int listen(int sd, int listen(int sd,
int backlog); int backlog);
and the arguments are and the arguments are
sd: The socket descriptor of the endpoint. sd: The socket descriptor of the endpoint.
backlog: If backlog is non-zero, enable listening else disable backlog: If backlog is non-zero, enable listening else disable
listening. listening.
It returns 0 on success and -1 in case of an error.
Note that one-to-many style socket consumers do not need to call Note that one-to-many style socket consumers do not need to call
accept to retrieve new associations. Calling accept() on a one-to- accept to retrieve new associations. Calling accept() on a one-to-
many style socket should return EOPNOTSUPP. Rather, new associations many style socket should return EOPNOTSUPP. Rather, new associations
are accepted automatically, and notifications of the new associations are accepted automatically, and notifications of the new associations
are delivered via recvmsg() with the SCTP_ASSOC_CHANGE event (if are delivered via recvmsg() with the SCTP_ASSOC_CHANGE event (if
these notifications are enabled). Clients will typically not call these notifications are enabled). Clients will typically not call
listen(), so that they can be assured that only actively initiated listen(), so that they can be assured that only actively initiated
associations are on the socket. Server or peer-to-peer sockets, on associations are on the socket. Server or peer-to-peer sockets, on
the other hand, will always accept new associations, so a well- the other hand, will always accept new associations, so a well-
skipping to change at page 12, line 24 skipping to change at page 12, line 24
struct msghdr *message, struct msghdr *message,
int flags); int flags);
using the arguments: using the arguments:
sd: The socket descriptor of the endpoint. sd: The socket descriptor of the endpoint.
message: Pointer to the msghdr structure which contains a single message: Pointer to the msghdr structure which contains a single
user message and possibly some ancillary data. See Section 5 for user message and possibly some ancillary data. See Section 5 for
complete description of the data structures. complete description of the data structures.
flags: No new flags are defined for SCTP at this level. See flags: No new flags are defined for SCTP at this level. See
Section 5 for SCTP specific flags used in the msghdr structure. Section 5 for SCTP specific flags used in the msghdr structure.
sendmsg() returns the number of bytes accepted by the kernel or -1 in
case of an error. recvmsg() returns the number of bytes received or
-1 in case of an error.
As described in Section 5, different types of ancillary data can be As described in Section 5, different types of ancillary data can be
sent and received along with user data. When sending, the ancillary sent and received along with user data. When sending, the ancillary
data is used to specify the sent behavior, such as the SCTP stream data is used to specify the sent behavior, such as the SCTP stream
number to use. When receiving, the ancillary data is used to number to use. When receiving, the ancillary data is used to
describe the received data, such as the SCTP stream sequence number describe the received data, such as the SCTP stream sequence number
of the message. of the message.
When sending user data with sendmsg(), the msg_name field in the When sending user data with sendmsg(), the msg_name field in the
msghdr structure will be filled with one of the transport addresses msghdr structure will be filled with one of the transport addresses
of the intended receiver. If there is no existing association of the intended receiver. If there is no existing association
between the sender and the intended receiver, the sender's SCTP stack between the sender and the intended receiver, the sender's SCTP stack
will set up a new association and then send the user data (see will set up a new association and then send the user data (see
Section 6.5 for more on implicit association setup). If sendmsg() is Section 6.5 for more on implicit association setup). If sendmsg() is
called with no data and there is no existing association, a new one called with no data and there is no existing association, a new one
will be established. The SCTP_INIT type ancillary data can be used will be established. The SCTP_INIT type ancillary data can be used
to change some of the parameters used to set up a new association. to change some of the parameters used to set up a new association.
If sendmsg() is called with NULL data, and there is no existing If sendmsg() is called with NULL data, and there is no existing
association but the SCTP_ABORT or SCTP_EOF flags are set, then -1 is association but the SCTP_ABORT or SCTP_EOF flags are set, then -1 is
retured and errno is set to EINVAL. Sending a message using returned and errno is set to EINVAL. Sending a message using
sendmsg() is atomic unless explicit EOR marking is enabled on the sendmsg() is atomic unless explicit EOR marking is enabled on the
socket specified by sd (see Section 7.1.26). socket specified by sd (see Section 7.1.26).
If a peer sends a SHUTDOWN, an SCTP_SHUTDOWN_EVENT notification will If a peer sends a SHUTDOWN, an SCTP_SHUTDOWN_EVENT notification will
be delivered if that notification has been enabled, and no more data be delivered if that notification has been enabled, and no more data
can be sent to that association. Any attempt to send more data will can be sent to that association. Any attempt to send more data will
cause sendmsg() to return with an ESHUTDOWN error. Note that the cause sendmsg() to return with an ESHUTDOWN error. Note that the
socket is still open for reading at this point so it is possible to socket is still open for reading at this point so it is possible to
retrieve notifications. retrieve notifications.
When receiving a user message with recvmsg(), the msg_name field in When receiving a user message with recvmsg(), the msg_name field in
the msghdr structure will be populated with the source transport the msghdr structure will be populated with the source transport
address of the user data. The caller of recvmsg() can use this address of the user data. The caller of recvmsg() can use this
address information to determine to which association the received address information to determine to which association the received
user message belongs. Note that if SCTP_ASSOC_CHANGE events are user message belongs. Note that if SCTP_ASSOC_CHANGE events are
disabled, applications must use the peer transport address provided disabled, applications must use the peer transport address provided
in the msg_name field by recvmsg() to perform correlation to an in the msg_name field by recvmsg() to perform correlation to an
association, since they will not have the association ID. association, since they will not have the association ID.
If all data in a single message has been delivered, MSG_EOR will be If all data in a single message has been delivered, MSG_EOR will be
set in the msg_flags field of the msghdr structure (see section set in the msg_flags field of the msghdr structure (see Section 5.1).
Section 5.1).
If the application does not provide enough buffer space to completely If the application does not provide enough buffer space to completely
receive a data message, MSG_EOR will not be set in msg_flags. receive a data message, MSG_EOR will not be set in msg_flags.
Successive reads will consume more of the same message until the Successive reads will consume more of the same message until the
entire message has been delivered, and MSG_EOR will be set. entire message has been delivered, and MSG_EOR will be set.
If the SCTP stack is running low on buffers, it may partially deliver If the SCTP stack is running low on buffers, it may partially deliver
a message. In this case, MSG_EOR will not be set, and more calls to a message. In this case, MSG_EOR will not be set, and more calls to
recvmsg() will be necessary to completely consume the message. Only recvmsg() will be necessary to completely consume the message. Only
one message at a time can be partially delivered in any stream. The one message at a time can be partially delivered in any stream. The
socket option SCTP_FRAGMENT_INTERLEAVE controls various aspects of socket option SCTP_FRAGMENT_INTERLEAVE controls various aspects of
what interlacing of messages occurs for both the one-to-one and the what interlacing of messages occurs for both the one-to-one and the
one-to-many model sockets. Please consult Section 7.1.20 for further one-to-many model sockets. Please consult Section 7.1.20 for further
details on message delivery options. details on message delivery options.
Note, if the socket is a branched-off socket that only represents one
association (see Section 3.1), the msg_name field can be used to
override the primary address when sending data.
3.1.5. close() 3.1.5. close()
Applications use close() to perform graceful shutdown (as described Applications use close() to perform graceful shutdown (as described
in Section 10.1 of [RFC4960]) on all the associations currently in Section 10.1 of [RFC4960]) on all the associations currently
represented by a one-to-many style socket. represented by a one-to-many style socket.
The function prototype is The function prototype is
int close(int sd); int close(int sd);
and the argument is and the argument is
sd: The socket descriptor of the associations to be closed. sd: The socket descriptor of the associations to be closed.
0 is returned on success and -1 in case of an error.
To gracefully shutdown a specific association represented by the one- To gracefully shutdown a specific association represented by the one-
to-many style socket, an application should use the sendmsg() call, to-many style socket, an application should use the sendmsg() call,
and include the SCTP_EOF flag. A user may optionally terminate an and include the SCTP_EOF flag. A user may optionally terminate an
association non-gracefully by sending with the SCTP_ABORT flag and association non-gracefully by sending with the SCTP_ABORT flag set
possibly passing a user specified abort code in the data field. Both and possibly passing a user specified abort code in the data field.
flags SCTP_EOF and SCTP_ABORT are passed with ancillary data (see Both flags SCTP_EOF and SCTP_ABORT are passed with ancillary data
Section 5.2.2) in the sendmsg() call. (see Section 5.2.2) in the sendmsg() call.
If sd in the close() call is a branched-off socket representing only If sd in the close() call is a branched-off socket representing only
one association, the shutdown is performed on that association only. one association, the shutdown is performed on that association only.
3.1.6. connect() 3.1.6. connect()
An application may use the connect() call in the one-to-many style to An application may use the connect() call in the one-to-many style to
initiate an association without sending data. initiate an association without sending data.
The function prototype is The function prototype is
int connect(int sd, int connect(int sd,
const struct sockaddr *nam, const struct sockaddr *nam,
socklen_t len); socklen_t len);
and the arguments are and the arguments are
sd: The socket descriptor to have a new association added to. sd: The socket descriptor to have a new association added to.
nam: The address structure (struct sockaddr_in for an IPv4 address nam: The address structure (struct sockaddr_in for an IPv4 address
or struct sockaddr_in6 for an IPv6 address, see [RFC3493]). or struct sockaddr_in6 for an IPv6 address, see [RFC3493]).
len: The size of the address. len: The size of the address.
0 is returned on success and -1 in case of an error.
Multiple connect() calls can be made on the same socket to create Multiple connect() calls can be made on the same socket to create
multiple associations. This is different from the semantics of multiple associations. This is different from the semantics of
connect() on a UDP socket. connect() on a UDP socket.
Note that SCTP allows data exchange, similar to T/TCP [RFC1644],
during the association set up phase. If an application wants to do
this, it cannot use the connect() call. Instead, it should use
sendto() or sendmsg() to initiate an association. If it uses
sendto() and it wants to change the initialization behavior, it needs
to use the SCTP_INITMSG socket option before calling sendto(). Or it
can use sendmsg() with SCTP_INIT type ancillary data to initiate an
association without calling setsockopt(). Note that the implicit
setup is supported for the one-to-many style sockets.
SCTP does not support half close semantics. This means that unlike
T/TCP, MSG_EOF should not be set in the flags parameter when calling
sendto() or sendmsg() when the call is used to initiate a connection.
MSG_EOF is not an acceptable flag with an SCTP socket.
3.2. Non-blocking mode 3.2. Non-blocking mode
Some SCTP application may wish to avoid being blocked when calling a Some SCTP application may wish to avoid being blocked when calling a
socket interface function. socket interface function.
Once a bind() and/or subsequent sctp_bindx() calls are complete on a Once a bind() and/or subsequent sctp_bindx() calls are complete on a
one-to-many style socket, an application may set the non-blocking one-to-many style socket, an application may set the non-blocking
option by a fcntl() (such as O_NONBLOCK). After setting the socket option by a fcntl() (such as O_NONBLOCK). After setting the socket
to non-blocking mode, the sendmsg() function returns immediately. to non-blocking mode, the sendmsg() function returns immediately.
The success or failure of sending the data message (with possible The success or failure of sending the data message (with possible
skipping to change at page 15, line 27 skipping to change at page 15, line 43
writeable is not the destination association of the write call. writeable is not the destination association of the write call.
Likewise select() (or poll()) for reading from a one-to-many socket Likewise select() (or poll()) for reading from a one-to-many socket
will only return an indication that one of the associations will only return an indication that one of the associations
represented by the socket has data to be read. represented by the socket has data to be read.
An application that wishes to know that a particular association is An application that wishes to know that a particular association is
ready for reading or writing should either use the one-to-one style ready for reading or writing should either use the one-to-one style
or use the sctp_peeloff() (see Section 8.2) function to separate the or use the sctp_peeloff() (see Section 8.2) function to separate the
association of interest from the one-to-many socket. association of interest from the one-to-many socket.
Note some implementations may have an extended select call such as
epoll or kqueue that may escape this limitation and allow a select on
a specific association of a one-to-many socket, but this is an
implementation specific detail that a portable application cannot
count on.
3.3. Special considerations 3.3. Special considerations
The fact that a one-to-many style socket can provide access to many The fact that a one-to-many style socket can provide access to many
SCTP associations through a single socket descriptor has important SCTP associations through a single socket descriptor has important
implications for both application programmers and system programmers implications for both application programmers and system programmers
implementing this API. A key issue is how buffer space inside the implementing this API. A key issue is how buffer space inside the
sockets layer is managed. Because this implementation detail sockets layer is managed. Because this implementation detail
directly affects how application programmers must write their code to directly affects how application programmers must write their code to
ensure correct operation and portability, this section provides some ensure correct operation and portability, this section provides some
guidance to both implementers and application programmers. guidance to both implementers and application programmers.
skipping to change at page 17, line 6 skipping to change at page 17, line 25
4. One-to-One Style Interface 4. One-to-One Style Interface
The goal of this style is to follow as closely as possible the The goal of this style is to follow as closely as possible the
current practice of using the sockets interface for a connection current practice of using the sockets interface for a connection
oriented protocol, such as TCP. This style enables existing oriented protocol, such as TCP. This style enables existing
applications using connection oriented protocols to be ported to SCTP applications using connection oriented protocols to be ported to SCTP
with very little effort. with very little effort.
One-to-one style sockets can be connected (explicitly or implicitly) One-to-one style sockets can be connected (explicitly or implicitly)
at most once, simular to TCP sockets. at most once, similar to TCP sockets.
Note that some new SCTP features and some new SCTP socket options can Note that some new SCTP features and some new SCTP socket options can
only be utilized through the use of sendmsg() and recvmsg() calls, only be utilized through the use of sendmsg() and recvmsg() calls,
see Section 4.1.8. see Section 4.1.8.
4.1. Basic Operation 4.1. Basic Operation
A typical server in one-to-one style uses the following system call A typical server in one-to-one style uses the following system call
sequence to prepare an SCTP endpoint for servicing requests: sequence to prepare an SCTP endpoint for servicing requests:
o socket() o socket()
skipping to change at page 18, line 43 skipping to change at page 19, line 15
struct sockaddr *addr, struct sockaddr *addr,
socklen_t addrlen); socklen_t addrlen);
and the arguments are and the arguments are
sd: The socket descriptor returned by socket(). sd: The socket descriptor returned by socket().
addr: The address structure (struct sockaddr_in for an IPv4 address addr: The address structure (struct sockaddr_in for an IPv4 address
or struct sockaddr_in6 for an IPv6 address, see [RFC3493]). or struct sockaddr_in6 for an IPv6 address, see [RFC3493]).
addrlen: The size of the address structure. addrlen: The size of the address structure.
If sd is an IPv4 socket, the address passed must be an IPv4 address. If sd is an IPv4 socket, the address passed must be an IPv4 address.
If the sd is an IPv6 socket, the address passed can either be an IPv4 If sd is an IPv6 socket, the address passed can either be an IPv4 or
or an IPv6 address. an IPv6 address.
Applications cannot call bind() multiple times to associate multiple Applications cannot call bind() multiple times to associate multiple
addresses to the endpoint. After the first call to bind(), all addresses to the endpoint. After the first call to bind(), all
subsequent calls will return an error. subsequent calls will return an error.
If the IP address part of addr is specified as a wildcard (INADDR_ANY If the IP address part of addr is specified as a wildcard (INADDR_ANY
for an IPv4 address, or as IN6ADDR_ANY_INIT or in6addr_any for an for an IPv4 address, or as IN6ADDR_ANY_INIT or in6addr_any for an
IPv6 address), the operating system will associate the endpoint with IPv6 address), the operating system will associate the endpoint with
an optimal address set of the available interfaces. If the IPv4 an optimal address set of the available interfaces. If the IPv4
sin_port or IPv6 sin6_port is set to 0, the operating system will sin_port or IPv6 sin6_port is set to 0, the operating system will
choose an ephemeral port for the endpoint. choose an ephemeral port for the endpoint.
If a bind() is not called prior to the connect() call, the system If a bind() is not called prior to the connect() call, the system
picks an ephemeral port and will choose an address set equivalent to picks an ephemeral port and will choose an address set equivalent to
binding with a wildcard address. One of these addresses will be the binding with a wildcard address. One of these addresses will be the
primary address for the association. This automatically enables the primary address for the association. This automatically enables the
multi-homing capability of SCTP. multi-homing capability of SCTP.
The completion of this bind() process does not ready the SCTP The completion of this bind() process does not allow the SCTP
endpoint to accept inbound SCTP association requests. Until a endpoint to accept inbound SCTP association requests. Until a
listen() system call, described below, is performed on the socket, listen() system call, described below, is performed on the socket,
the SCTP endpoint will promptly reject an inbound SCTP INIT request the SCTP endpoint will promptly reject an inbound SCTP INIT request
with an SCTP ABORT. with an SCTP ABORT.
4.1.3. listen() 4.1.3. listen()
Applications use listen() to ready the SCTP endpoint for accepting Applications use listen() to allow the SCTP endpoint to accept
inbound associations. inbound associations.
The function prototype is The function prototype is
int listen(int sd, int listen(int sd,
int backlog); int backlog);
and the arguments are and the arguments are
sd: the socket descriptor of the SCTP endpoint. sd: the socket descriptor of the SCTP endpoint.
backlog: this specifies the max number of outstanding associations backlog: this specifies the max number of outstanding associations
allowed in the socket's accept queue. These are the associations allowed in the socket's accept queue. These are the associations
that have finished the four-way initiation handshake (see Section that have finished the four-way initiation handshake (see Section
5 of [RFC4960]) and are in the ESTABLISHED state. Note, a backlog 5 of [RFC4960]) and are in the ESTABLISHED state. Note, a backlog
of '0' indicates that the caller no longer wishes to receive new of '0' indicates that the caller no longer wishes to receive new
associations. associations.
It returns 0 on success an -1 in case of an error.
4.1.4. accept() 4.1.4. accept()
Applications use the accept() call to remove an established SCTP Applications use the accept() call to remove an established SCTP
association from the accept queue of the endpoint. A new socket association from the accept queue of the endpoint. A new socket
descriptor will be returned from accept() to represent the newly descriptor will be returned from accept() to represent the newly
formed association. formed association.
The function prototype is The function prototype is
int accept(int sd, int accept(int sd,
struct sockaddr *addr, struct sockaddr *addr,
socklen_t *addrlen); socklen_t *addrlen);
and the arguments are and the arguments are
sd: The listening socket descriptor. sd: The listening socket descriptor.
addr: On return, addr (struct sockaddr_in for an IPv4 address or addr: On return, addr (struct sockaddr_in for an IPv4 address or
struct sockaddr_in6 for an IPv6 address, see [RFC3493]) will struct sockaddr_in6 for an IPv6 address, see [RFC3493]) will
contain the primary address of the peer endpoint. contain the primary address of the peer endpoint.
addrlen: On return, addrlen will contain the size of addr. addrlen: On return, addrlen will contain the size of addr.
The functions returns the socket descriptor for the newly formed The function returns the socket descriptor for the newly formed
association. association on success and -1 in case of an error.
4.1.5. connect() 4.1.5. connect()
Applications use connect() to initiate an association to a peer. Applications use connect() to initiate an association to a peer.
The function prototype is The function prototype is
int connect(int sd, int connect(int sd,
const struct sockaddr *addr, const struct sockaddr *addr,
socklen_t addrlen); socklen_t addrlen);
skipping to change at page 20, line 28 skipping to change at page 21, line 4
The function prototype is The function prototype is
int connect(int sd, int connect(int sd,
const struct sockaddr *addr, const struct sockaddr *addr,
socklen_t addrlen); socklen_t addrlen);
and the arguments are and the arguments are
sd: The socket descriptor of the endpoint. sd: The socket descriptor of the endpoint.
addr: The peer's (struct sockaddr_in for an IPv4 address or struct addr: The peer's (struct sockaddr_in for an IPv4 address or struct
sockaddr_in6 for an IPv6 address, see [RFC3493]) address. sockaddr_in6 for an IPv6 address, see [RFC3493]) address.
addrlen: The size of the address. addrlen: The size of the address.
It returns 0 on success and -1 on error.
This operation corresponds to the ASSOCIATE primitive described in This operation corresponds to the ASSOCIATE primitive described in
section 10.1 of [RFC4960]. Section 10.1 of [RFC4960].
The number of outbound streams the new association has is stack The number of outbound streams the new association has is stack
dependent. Applications can use the SCTP_INITMSG option described in dependent. Applications can use the SCTP_INITMSG option described in
Section 7.1.3 should be used before connecting to change the number Section 7.1.3 before connecting to change the number of outbound
of outbound streams. streams.
If a bind() is not called prior to the connect() call, the system If a bind() is not called prior to the connect() call, the system
picks an ephemeral port and will choose an address set equivalent to picks an ephemeral port and will choose an address set equivalent to
binding with INADDR_ANY and IN6ADDR_ANY_INIT for IPv4 and IPv6 socket binding with INADDR_ANY and IN6ADDR_ANY_INIT for IPv4 and IPv6 socket
respectively. One of the addresses will be the primary address for respectively. One of the addresses will be the primary address for
the association. This automatically enables the multi-homing the association. This automatically enables the multi-homing
capability of SCTP. capability of SCTP.
Note that SCTP allows data exchange, similar to T/TCP [RFC1644], Note that SCTP allows data exchange, similar to T/TCP [RFC1644],
during the association set up phase. If an application wants to do during the association set up phase. If an application wants to do
this, it cannot use the connect() call. Instead, it should use this, it cannot use the connect() call. Instead, it should use
sendto() or sendmsg() to initiate an association. If it uses sendto() or sendmsg() to initiate an association. If it uses
sendto() and it wants to change the initialization behavior, it needs sendto() and it wants to change the initialization behavior, it needs
to use the SCTP_INITMSG socket option before calling sendto(). Or it to use the SCTP_INITMSG socket option before calling sendto(). Or it
can use sendmsg() with SCTP_INIT type ancillary data to initiate an can use sendmsg() with SCTP_INIT type ancillary data to initiate an
association without doing the setsockopt(). Note that the implicit association without calling setsockopt(). Note that the implicit
setup is supported for the one-to-many style sockets. setup is supported for the one-to-one style sockets.
SCTP does not support half close semantics. This means that unlike SCTP does not support half close semantics. This means that unlike
T/TCP, MSG_EOF should not be set in the flags parameter when calling T/TCP, MSG_EOF should not be set in the flags parameter when calling
sendto() or sendmsg() when the call is used to initiate a connection. sendto() or sendmsg() when the call is used to initiate a connection.
MSG_EOF is not an acceptable flag with an SCTP socket. MSG_EOF is not an acceptable flag with an SCTP socket.
4.1.6. close() 4.1.6. close()
Applications use close() to gracefully close down an association. Applications use close() to gracefully close down an association.
The function prototype is The function prototype is
int close(int sd); int close(int sd);
and the argument is and the argument is
sd: The socket descriptor of the association to be closed. sd: The socket descriptor of the association to be closed.
It returns 0 on success and -1 in case of an error.
After an application calls close() on a socket descriptor, no further After an application calls close() on a socket descriptor, no further
socket operations will succeed on that descriptor. socket operations will succeed on that descriptor.
4.1.7. shutdown() 4.1.7. shutdown()
SCTP differs from TCP in that it does not have half closed semantics. SCTP differs from TCP in that it does not have half closed semantics.
Hence the shutdown() call for SCTP is an approximation of the TCP Hence the shutdown() call for SCTP is an approximation of the TCP
shutdown() call, and solves some different problems. Full TCP- shutdown() call, and solves some different problems. Full TCP-
compatibility is not provided, so developers porting TCP applications compatibility is not provided, so developers porting TCP applications
skipping to change at page 21, line 49 skipping to change at page 22, line 29
and the arguments are and the arguments are
sd: The socket descriptor of the association to be closed. sd: The socket descriptor of the association to be closed.
how: Specifies the type of shutdown. The values are as follows: how: Specifies the type of shutdown. The values are as follows:
SHUT_RD: Disables further receive operations. No SCTP protocol SHUT_RD: Disables further receive operations. No SCTP protocol
action is taken. action is taken.
SHUT_WR: Disables further send operations, and initiates the SCTP SHUT_WR: Disables further send operations, and initiates the SCTP
shutdown sequence. shutdown sequence.
SHUT_RDWR: Disables further send and receive operations and SHUT_RDWR: Disables further send and receive operations and
initiates the SCTP shutdown sequence. initiates the SCTP shutdown sequence.
It returns 0 on success and -1 in case of an error.
The major difference between SCTP and TCP shutdown() is that SCTP The major difference between SCTP and TCP shutdown() is that SCTP
SHUT_WR initiates immediate and full protocol shutdown, whereas TCP SHUT_WR initiates immediate and full protocol shutdown, whereas TCP
SHUT_WR causes TCP to go into the half closed state. SHUT_RD behaves SHUT_WR causes TCP to go into the half closed state. SHUT_RD behaves
the same for SCTP as TCP. The purpose of SCTP SHUT_WR is to close the same for SCTP as TCP. The purpose of SCTP SHUT_WR is to close
the SCTP association while still leaving the socket descriptor open. the SCTP association while still leaving the socket descriptor open.
This allows the caller to receive back any data which SCTP is unable This allows the caller to receive back any data which SCTP is unable
to deliver (see Section 5.3.5 for more information) and receive event to deliver (see Section 5.3.5 for more information) and receive event
notifications. notifications.
To perform the ABORT operation described in [RFC4960] section 10.1, To perform the ABORT operation described in [RFC4960] Section 10.1,
an application can use the socket option SO_LINGER. It is described an application can use the socket option SO_LINGER. It is described
in Section 7.1.4. in Section 7.1.4.
4.1.8. sendmsg() and recvmsg() 4.1.8. sendmsg() and recvmsg()
With a one-to-one style socket, the application can also use With a one-to-one style socket, the application can also use
sendmsg() and recvmsg() to transmit data to and receive data from its sendmsg() and recvmsg() to transmit data to and receive data from its
peer. The semantics is similar to those used in the one-to-many peer. The semantics is similar to those used in the one-to-many
style (section Section 3.1.3), with the following differences: style (see Section 3.1.3), with the following differences:
1. When sending, the msg_name field in the msghdr is not used to 1. When sending, the msg_name field in the msghdr is not used to
specify the intended receiver, rather it is used to indicate a specify the intended receiver, rather it is used to indicate a
preferred peer address if the sender wishes to discourage the preferred peer address if the sender wishes to discourage the
stack from sending the message to the primary address of the stack from sending the message to the primary address of the
receiver. If the socket is connected and the transport address receiver. If the socket is connected and the transport address
given is not part of the current association, the data will not given is not part of the current association, the data will not
be sent and an SCTP_SEND_FAILED event will be delivered to the be sent and an SCTP_SEND_FAILED event will be delivered to the
application if send failure events are enabled. application if send failure events are enabled.
2. Using sendmsg() on a non-connected one-to-one style socket for 2. Using sendmsg() on a non-connected one-to-one style socket for
implicit connection setup may or may not work depending on the implicit connection setup may or may not work depending on the
SCTP implementation. SCTP implementation.
4.1.9. getpeername() 4.1.9. getpeername()
Applications use getpeername() to retrieve the primary socket address Applications use getpeername() to retrieve the primary socket address
of the peer. This call is for TCP compatibility, and is not multi- of the peer. This call is for TCP compatibility, and is not multi-
homed. It does not work with one-to-many style sockets. See homed. It may not work with one-to-many style sockets depending on
Section 8.3 for a multi-homed/one-to-many style version of the call. the implementation. See Section 8.3 for a multi-homed style version
of the call.
The function prototype is The function prototype is
int getpeername(int sd, int getpeername(int sd,
struct sockaddr *address, struct sockaddr *address,
socklen_t *len); socklen_t *len);
and the arguments are: and the arguments are:
sd: The socket descriptor to be queried. sd: The socket descriptor to be queried.
address: On return, the peer primary address is stored in this address: On return, the peer primary address is stored in this
buffer. If the socket is an IPv4 socket, the address will be buffer. If the socket is an IPv4 socket, the address will be
IPv4. If the socket is an IPv6 socket, the address will be either IPv4. If the socket is an IPv6 socket, the address will be either
an IPv6 or IPv4 address. an IPv6 or IPv4 address.
len: The caller should set the length of address here. On return, len: The caller should set the length of address here. On return,
this is set to the length of the returned address. this is set to the length of the returned address.
It returns 0 on success and -1 in case of an error.
If the actual length of the address is greater than the length of the If the actual length of the address is greater than the length of the
supplied sockaddr structure, the stored address will be truncated. supplied sockaddr structure, the stored address will be truncated.
5. Data Structures 5. Data Structures
This section discusses important data structures which are specific This section discusses important data structures which are specific
to SCTP and are used with sendmsg() and recvmsg() calls to control to SCTP and are used with sendmsg() and recvmsg() calls to control
SCTP endpoint operations and to access ancillary information and SCTP endpoint operations and to access ancillary information and
notifications. notifications.
skipping to change at page 24, line 6 skipping to change at page 24, line 31
socklen_t cmsg_len; /* #bytes, including this header */ socklen_t cmsg_len; /* #bytes, including this header */
int cmsg_level; /* originating protocol */ int cmsg_level; /* originating protocol */
int cmsg_type; /* protocol-specific type */ int cmsg_type; /* protocol-specific type */
/* followed by unsigned char cmsg_data[]; */ /* followed by unsigned char cmsg_data[]; */
}; };
In the msghdr structure, the usage of msg_name has been discussed in In the msghdr structure, the usage of msg_name has been discussed in
previous sections (see Section 3.1.3 and Section 4.1.8). previous sections (see Section 3.1.3 and Section 4.1.8).
The scatter/gather buffers, or I/O vectors (pointed to by the msg_iov The scatter/gather buffers, or I/O vectors (pointed to by the msg_iov
field) are treated as a single SCTP data chunk, rather than multiple field) are treated by SCTP as a single user message for both
chunks, for both sendmsg() and recvmsg(). sendmsg() and recvmsg().
The msg_flags are not used when sending a message with sendmsg(). The msg_flags are not used when sending a message with sendmsg().
If a notification has arrived, recvmsg() will return the notification If a notification has arrived, recvmsg() will return the notification
with the MSG_NOTIFICATION flag set in msg_flags. If the with the MSG_NOTIFICATION flag set in msg_flags. If the
MSG_NOTIFICATION flag is not set, recvmsg() will return data. See MSG_NOTIFICATION flag is not set, recvmsg() will return data. See
Section 5.3 for more information about notifications. Section 5.3 for more information about notifications.
If all portions of a data frame or notification have been read, If all portions of a data frame or notification have been read,
recvmsg() will return with MSG_EOR set in msg_flags. recvmsg() will return with MSG_EOR set in msg_flags.
skipping to change at page 26, line 48 skipping to change at page 27, line 31
is returned and the call fails. is returned and the call fails.
sinfo_ssn: For recvmsg() this value contains the stream sequence sinfo_ssn: For recvmsg() this value contains the stream sequence
number that the remote endpoint placed in the DATA chunk. For number that the remote endpoint placed in the DATA chunk. For
fragmented messages this is the same number for all deliveries of fragmented messages this is the same number for all deliveries of
the message (if more than one recvmsg() is needed to read the the message (if more than one recvmsg() is needed to read the
message). The sendmsg() call will ignore this parameter. message). The sendmsg() call will ignore this parameter.
sinfo_flags: This field may contain any of the following flags and sinfo_flags: This field may contain any of the following flags and
is composed of a bitwise OR of these values. is composed of a bitwise OR of these values.
recvmsg() flags: recvmsg() flags:
SCTP_UNORDERED: This flag is present when the message was sent SCTP_UNORDERED: This flag is present when the message was sent
non-ordered. un-ordered.
sendmsg() flags: sendmsg() flags:
SCTP_UNORDERED: This flag requests the un-ordered delivery of SCTP_UNORDERED: This flag requests the un-ordered delivery of
the message. If this flag is clear the datagram is the message. If this flag is clear the datagram is
considered an ordered send. considered an ordered send.
SCTP_ADDR_OVER: This flag, in the one-to-many style, requests SCTP_ADDR_OVER: This flag, in the one-to-many style, requests
the SCTP stack to override the primary destination address the SCTP stack to override the primary destination address
with the address found with the sendto/sendmsg call. with the address found with the sendto/sendmsg call.
SCTP_ABORT: Setting this flag causes the specified association SCTP_ABORT: Setting this flag causes the specified association
to abort by sending an ABORT message to the peer (one-to- to abort by sending an ABORT message to the peer (one-to-
many style only). The ABORT chunk will contain an error many style only). The ABORT chunk will contain an error
skipping to change at page 27, line 46 skipping to change at page 28, line 28
upper layer if an error occurs on the send of a message and is upper layer if an error occurs on the send of a message and is
retrieved with each undelivered message (Note: if an endpoint has retrieved with each undelivered message (Note: if an endpoint has
done multiple sends, all of which fail, multiple different done multiple sends, all of which fail, multiple different
sinfo_context values will be returned. One with each user data sinfo_context values will be returned. One with each user data
message). message).
sinfo_pr_value: The meaning of this field depends on the PR-SCTP sinfo_pr_value: The meaning of this field depends on the PR-SCTP
policy specified by the sinfo_pr_policy field. It is ignored when policy specified by the sinfo_pr_policy field. It is ignored when
SCTP_PR_SCTP_NONE is specified. In case of SCTP_PR_SCTP_TTL the SCTP_PR_SCTP_NONE is specified. In case of SCTP_PR_SCTP_TTL the
lifetime is specified. lifetime is specified.
sinfo_tsn: For the receiving side, this field holds a TSN that was sinfo_tsn: For the receiving side, this field holds a TSN that was
assigned to one of the SCTP Data Chunks. assigned to one of the SCTP Data Chunks. For the sending side it
is ignored.
sinfo_cumtsn: This field will hold the current cumulative TSN as sinfo_cumtsn: This field will hold the current cumulative TSN as
known by the underlying SCTP layer. Note this field is ignored known by the underlying SCTP layer. Note this field is ignored
when sending. when sending.
sinfo_assoc_id: The association handle field, sinfo_assoc_id, holds sinfo_assoc_id: The association handle field, sinfo_assoc_id, holds
the identifier for the association announced in the SCTP_COMM_UP the identifier for the association announced in the SCTP_COMM_UP
notification. All notifications for a given association have the notification. All notifications for a given association have the
same identifier. Ignored for one-to-one style sockets. same identifier. Ignored for one-to-one style sockets.
An sctp_sndrcvinfo item always corresponds to the data in msg_iov. An sctp_sndrcvinfo item always corresponds to the data in msg_iov.
5.2.3. Extended SCTP Header Information Structure (SCTP_EXTRCV) 5.2.3. Extended SCTP Header Information Structure (SCTP_EXTRCV)
This cmsghdr structure specifies SCTP options for SCTP header This cmsghdr structure specifies SCTP options for SCTP header
skipping to change at page 31, line 48 skipping to change at page 32, line 33
rcv_sid: The SCTP stack places the message's stream number in this rcv_sid: The SCTP stack places the message's stream number in this
value. value.
rcv_ssn: This value contains the stream sequence number that the rcv_ssn: This value contains the stream sequence number that the
remote endpoint placed in the DATA chunk. For fragmented messages remote endpoint placed in the DATA chunk. For fragmented messages
this is the same number for all deliveries of the message (if more this is the same number for all deliveries of the message (if more
than one recvmsg() is needed to read the message). than one recvmsg() is needed to read the message).
rcv_flags: This field may contain any of the following flags and is rcv_flags: This field may contain any of the following flags and is
composed of a bitwise OR of these values. composed of a bitwise OR of these values.
SCTP_UNORDERED: This flag is present when the message was sent SCTP_UNORDERED: This flag is present when the message was sent
non-ordered. un-ordered.
rcv_ppid: This value is the same information that was passed by the rcv_ppid: This value is the same information that was passed by the
upper layer in the peer application. Please note that the SCTP upper layer in the peer application. Please note that the SCTP
stack performs no byte order modification of this field. For stack performs no byte order modification of this field. For
example, if the DATA chunk has to contain a given value in network example, if the DATA chunk has to contain a given value in network
byte order, the SCTP user has to perform the htonl() computation. byte order, the SCTP user has to perform the htonl() computation.
rcv_tsn: This field holds a TSN that was assigned to one of the SCTP rcv_tsn: This field holds a TSN that was assigned to one of the SCTP
Data Chunks. Data Chunks.
rcv_cumtsn: This field will hold the current cumulative TSN as known rcv_cumtsn: This field will hold the current cumulative TSN as known
by the underlying SCTP layer. by the underlying SCTP layer.
rcv_assoc_id: The association handle field, sinfo_assoc_id, holds rcv_assoc_id: The association handle field, sinfo_assoc_id, holds
the identifier for the association announced in the SCTP_COMM_UP the identifier for the association announced in the SCTP_COMM_UP
notification. All notifications for a given association have the notification. All notifications for a given association have the
same identifier. Ignored for one-to-one style sockets. same identifier. Ignored for one-to-one style sockets.
A sctp_rcvinfo item always corresponds to the data in msg_iov. An sctp_rcvinfo item always corresponds to the data in msg_iov.
5.2.6. SCTP Next Receive Information Structure (SCTP_NXTINFO) 5.2.6. SCTP Next Receive Information Structure (SCTP_NXTINFO)
This cmsghdr structure describes SCTP receive information of the next This cmsghdr structure describes SCTP receive information of the next
message which will be delivered through recvmsg() if this information message which will be delivered through recvmsg() if this information
is already available when delivering the current message. is already available when delivering the current message.
It uses the same structure as the SCTP Receive Information Structure. It uses the same structure as the SCTP Receive Information Structure.
To enable the delivery of this information an application must use To enable the delivery of this information an application must use
skipping to change at page 34, line 6 skipping to change at page 34, line 40
This cmsghdr structure specifies SCTP options for sendmsg(). This cmsghdr structure specifies SCTP options for sendmsg().
+--------------+----------------+----------------+ +--------------+----------------+----------------+
| cmsg_level | cmsg_type | cmsg_data[] | | cmsg_level | cmsg_type | cmsg_data[] |
+--------------+----------------+----------------+ +--------------+----------------+----------------+
| IPPROTO_SCTP | SCTP_DSTADDRV4 | struct in_addr | | IPPROTO_SCTP | SCTP_DSTADDRV4 | struct in_addr |
+--------------+----------------+----------------+ +--------------+----------------+----------------+
This ancillary data can be used to provide more than one destination This ancillary data can be used to provide more than one destination
address to sendmsg(). It can be used to implement sctp_sendxxx() address to sendmsg(). It can be used to implement sctp_sendv() using
using send_msg(). send_msg().
5.2.10. SCTP Destination Address Structure (IPv6) (SCTP_DSTADDRV6) 5.2.10. SCTP Destination Address Structure (IPv6) (SCTP_DSTADDRV6)
This cmsghdr structure specifies SCTP options for sendmsg(). This cmsghdr structure specifies SCTP options for sendmsg().
+--------------+----------------+-----------------+ +--------------+----------------+-----------------+
| cmsg_level | cmsg_type | cmsg_data[] | | cmsg_level | cmsg_type | cmsg_data[] |
+--------------+----------------+-----------------+ +--------------+----------------+-----------------+
| IPPROTO_SCTP | SCTP_DSTADDRV6 | struct in6_addr | | IPPROTO_SCTP | SCTP_DSTADDRV6 | struct in6_addr |
+--------------+----------------+-----------------+ +--------------+----------------+-----------------+
This ancillary data can be used to provide more than one destination This ancillary data can be used to provide more than one destination
address to sendmsg(). It can be used to implement sctp_sendxxx() address to sendmsg(). It can be used to implement sctp_sendv() using
using send_msg(). send_msg().
5.3. SCTP Events and Notifications 5.3. SCTP Events and Notifications
An SCTP application may need to understand and process events and An SCTP application may need to understand and process events and
errors that happen on the SCTP stack. These events include network errors that happen on the SCTP stack. These events include network
status changes, association startups, remote operational errors and status changes, association startups, remote operational errors and
undeliverable messages. All of these can be essential for the undeliverable messages. All of these can be essential for the
application. application.
When an SCTP application layer does a recvmsg() the message read is When an SCTP application layer does a recvmsg() the message read is
skipping to change at page 37, line 4 skipping to change at page 37, line 43
sac_flags: Currently unused. sac_flags: Currently unused.
sac_length: This field is the total length of the notification data, sac_length: This field is the total length of the notification data,
including the notification header. including the notification header.
sac_state: This field holds one of a number of values that sac_state: This field holds one of a number of values that
communicate the event that happened to the association. They communicate the event that happened to the association. They
include: include:
SCTP_COMM_UP: A new association is now ready and data may be SCTP_COMM_UP: A new association is now ready and data may be
exchanged with this peer. When an association has been exchanged with this peer. When an association has been
established successfully, this notification should be the first established successfully, this notification should be the first
one. one.
SCTP_COMM_LOST: The association has failed. The association is SCTP_COMM_LOST: The association has failed. The association is
now in the closed state. If SEND FAILED notifications are now in the closed state. If SEND_FAILED notifications are
turned on, a SCTP_COMM_LOST is accompanied by a series of turned on, an SCTP_COMM_LOST is accompanied by a series of
SCTP_SEND_FAILED events, one for each outstanding message. SCTP_SEND_FAILED_EVENT events, one for each outstanding
message.
SCTP_RESTART: SCTP has detected that the peer has restarted. SCTP_RESTART: SCTP has detected that the peer has restarted.
SCTP_SHUTDOWN_COMP: The association has gracefully closed. SCTP_SHUTDOWN_COMP: The association has gracefully closed.
SCTP_CANT_STR_ASSOC: The association failed to setup. If non SCTP_CANT_STR_ASSOC: The association failed to setup. If non
blocking mode is set and data was sent (on a one-to-many style blocking mode is set and data was sent (on a one-to-many style
socket), a SCTP_CANT_STR_ASSOC is accompanied by a series of socket), an SCTP_CANT_STR_ASSOC is accompanied by a series of
SCTP_SEND_FAILED events, one for each outstanding message. SCTP_SEND_FAILED_EVENT events, one for each outstanding
message.
sac_error: If the state was reached due to an error condition (e.g. sac_error: If the state was reached due to an error condition (e.g.
SCTP_COMM_LOST) any relevant error information is available in SCTP_COMM_LOST) any relevant error information is available in
this field. This corresponds to the protocol error codes defined this field. This corresponds to the protocol error codes defined
in [RFC4960]. in [RFC4960].
sac_outbound_streams: sac_outbound_streams:
sac_inbound_streams: The maximum number of streams allowed in each sac_inbound_streams: The maximum number of streams allowed in each
direction are available in sac_outbound_streams and sac_inbound direction are available in sac_outbound_streams and sac_inbound
streams. streams.
sac_assoc_id: The association id field holds the identifier for the sac_assoc_id: The association id field holds the identifier for the
association. All notifications for a given association have the association. All notifications for a given association have the
same association identifier. For a one-to-one style socket, this same association identifier. For a one-to-one style socket, this
field is ignored. field is ignored.
sac_info: If the sac_state is SCTP_COMM_LOST and an ABORT chunk was sac_info: If the sac_state is SCTP_COMM_LOST and an ABORT chunk was
received for this association, sac_info[] contains the complete received for this association, sac_info[] contains the complete
ABORT chunk as defined in the SCTP specification [RFC4960] section ABORT chunk as defined in the SCTP specification [RFC4960] Section
3.3.7. If the sac_state is SCTP_COMM_UP or SCTP_RESTART, sac_info 3.3.7. If the sac_state is SCTP_COMM_UP or SCTP_RESTART, sac_info
may contain an array of uint8_t describing the features that the may contain an array of uint8_t describing the features that the
current association supports. Features may include current association supports. Features may include
SCTP_ASSOC_SUPPORTS_PR: Both endpoints support the protocol SCTP_ASSOC_SUPPORTS_PR: Both endpoints support the protocol
extension described in [RFC3758]. extension described in [RFC3758].
SCTP_ASSOC_SUPPORTS_AUTH: Both endpoints support the protocol SCTP_ASSOC_SUPPORTS_AUTH: Both endpoints support the protocol
extension described in [RFC4895]. extension described in [RFC4895].
SCTP_ASSOC_SUPPORTS_ASCONF: Both endpoints support the protocol SCTP_ASSOC_SUPPORTS_ASCONF: Both endpoints support the protocol
extension described in [RFC5061]. extension described in [RFC5061].
SCTP_ASSOC_SUPPORTS_MULTIBUF: For a one-to-many style socket, the SCTP_ASSOC_SUPPORTS_MULTIBUF: For a one-to-many style socket, the
skipping to change at page 39, line 27 skipping to change at page 40, line 25
sre_flags: Currently unused. sre_flags: Currently unused.
sre_length: This field is the total length of the notification data, sre_length: This field is the total length of the notification data,
including the notification header and the contents of sre_data. including the notification header and the contents of sre_data.
sre_error: This value represents one of the Operational Error causes sre_error: This value represents one of the Operational Error causes
defined in the SCTP specification, in network byte order. defined in the SCTP specification, in network byte order.
sre_assoc_id: The association id field holds the identifier for the sre_assoc_id: The association id field holds the identifier for the
association. All notifications for a given association have the association. All notifications for a given association have the
same association identifier. For a one-to-one style socket, this same association identifier. For a one-to-one style socket, this
field is ignored. field is ignored.
sre_data: This contains the ERROR chunk as defined in the SCTP sre_data: This contains the ERROR chunk as defined in the SCTP
specification [RFC4960] section 3.3.10. specification [RFC4960] Section 3.3.10.
5.3.5. SCTP_SEND_FAILED 5.3.5. SCTP_SEND_FAILED
Please note that this notification is deprecated. Please note that this notification is deprecated. Use
SCTP_SEND_FAILED_EVENT instead.
If SCTP cannot deliver a message, it can return back the message as a If SCTP cannot deliver a message, it can return back the message as a
notification if the SCTP_SEND_FAILED event is enabled. The notification if the SCTP_SEND_FAILED event is enabled. The
notification has the following format: notification has the following format:
struct sctp_send_failed { struct sctp_send_failed {
uint16_t ssf_type; uint16_t ssf_type;
uint16_t ssf_flags; uint16_t ssf_flags;
uint32_t ssf_length; uint32_t ssf_length;
uint32_t ssf_error; uint32_t ssf_error;
skipping to change at page 40, line 4 skipping to change at page 40, line 47
uint16_t ssf_type; uint16_t ssf_type;
uint16_t ssf_flags; uint16_t ssf_flags;
uint32_t ssf_length; uint32_t ssf_length;
uint32_t ssf_error; uint32_t ssf_error;
struct sctp_sndrcvinfo ssf_info; struct sctp_sndrcvinfo ssf_info;
sctp_assoc_t ssf_assoc_id; sctp_assoc_t ssf_assoc_id;
uint8_t ssf_data[]; uint8_t ssf_data[];
}; };
ssf_type: It should be SCTP_SEND_FAILED. ssf_type: It should be SCTP_SEND_FAILED.
ssf_flags: The flag value will take one of the following values: ssf_flags: The flag value will take one of the following values:
SCTP_DATA_UNSENT: Indicates that the data was never put on the SCTP_DATA_UNSENT: Indicates that the data was never put on the
wire. wire.
SCTP_DATA_SENT: Indicates that the data was put on the wire. SCTP_DATA_SENT: Indicates that the data was put on the wire.
Note that this does not necessarily mean that the data was (or Note that this does not necessarily mean that the data was (or
was not) successfully delivered. was not) successfully delivered.
ssf_length: This field is the total length of the notification data, ssf_length: This field is the total length of the notification data,
including the notification header and the payload in ssf_data. including the notification header and the payload in ssf_data.
ssf_error: This value represents the reason why the send failed, and ssf_error: This value represents the reason why the send failed, and
if set, will be an SCTP protocol error code as defined in if set, will be an SCTP protocol error code as defined in
[RFC4960] section 3.3.10. [RFC4960] Section 3.3.10.
ssf_info: The send information associated with the undelivered ssf_info: The send information associated with the undelivered
message. The ssf_info.sinfo_flags field will also contain an message. The ssf_info.sinfo_flags field will also contain an
indication if the beginning of the message and/or end of the indication if the beginning of the message and/or end of the
message is present. In cases where no data has been sent on the message is present. In cases where no data has been sent on the
wire, this field will have or'ed in the value SCTP_DATA_NOT_FRAG, wire, this field will have or'ed-in the value SCTP_DATA_NOT_FRAG,
which is a composition of both a "BEGIN" and "END" fragmentation which is a composition of both a "BEGIN" and "END" fragmentation
bit. In cases where only part of the data has been sent, this bit. In cases where only part of the data has been sent, this
field will have or'ed in the value SCTP_DATA_LAST_FRAG, which field will have or'ed in the value SCTP_DATA_LAST_FRAG, which
corresponds to the "END" bit. Note that the message itself may be corresponds to the "END" bit. Note that the message itself may be
more than one chunk. If the ssf_info.sinfo_flags field holds more than one chunk. If the ssf_info.sinfo_flags field holds
neither of these two values then a piece that has been fragmented neither of these two values then a piece that has been fragmented
and sent but not acknowledged is present. This piece is from an and sent but not acknowledged is present. This piece is from an
unspecified position in the message and the application can make unspecified position in the message and the application can make
no assumptions about the data itself. Applications wanting to no assumptions about the data itself. Applications wanting to
examine a recovered message should look for the examine a recovered message should look for the
skipping to change at page 43, line 41 skipping to change at page 44, line 31
auth_keynumber anymore. auth_keynumber anymore.
auth_assoc_id: The association id field holds the identifier for the auth_assoc_id: The association id field holds the identifier for the
association. All notifications for a given association have the association. All notifications for a given association have the
same association identifier. For a one-to-one style socket this same association identifier. For a one-to-one style socket this
field is ignored. field is ignored.
5.3.10. SCTP_SENDER_DRY_EVENT 5.3.10. SCTP_SENDER_DRY_EVENT
When the SCTP implementation has no user data anymore to send or When the SCTP implementation has no user data anymore to send or
retransmit, this notification is given to the user. If the user retransmit, this notification is given to the user. If the user
subscribes to this event and SCTP has at this point of time no user subscribes to this event and SCTP has no user data to send or
data to send or retransmit, this notification is also given to the retransmit at this point of time, this notification is also given to
user. the user.
struct sctp_sender_dry_event { struct sctp_sender_dry_event {
uint16_t sender_dry_type; uint16_t sender_dry_type;
uint16_t sender_dry_flags; uint16_t sender_dry_flags;
uint32_t sender_dry_length; uint32_t sender_dry_length;
sctp_assoc_t sender_dry_assoc_id; sctp_assoc_t sender_dry_assoc_id;
}; };
sender_dry_type: It should be SCTP_SENDER_DRY_EVENT. sender_dry_type: It should be SCTP_SENDER_DRY_EVENT.
sender_dry_flags: Currently unused. sender_dry_flags: Currently unused.
sender_dry_length: This field is the total length of the sender_dry_length: This field is the total length of the
notification data, including the notification header. It will notification data, including the notification header. It will
generally be sizeof(struct sctp_sender_dry_event). generally be sizeof(struct sctp_sender_dry_event).
sender_dry_assoc_id: The association id field holds the identifier
for the association. All notifications for a given association
have the same association identifier. For a one-to-one style
socket this field is ignored.
5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT 5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT
Notifications, when subscribed to, are reliable. They are always Notifications, when subscribed to, are reliable. They are always
delivered as long as there is space in the socket receive buffer. delivered as long as there is space in the socket receive buffer.
However, if an implementation experiences a notification storm, it However, if an implementation experiences a notification storm, it
may run out of socket buffer space. When this occurs it may wish to may run out of socket buffer space. When this occurs it may wish to
disable notifications. If the implementation chooses to do this, it disable notifications. If the implementation chooses to do this, it
will append a final notification SCTP_NOTIFICATIONS_STOPPED_EVENT. will append a final notification SCTP_NOTIFICATIONS_STOPPED_EVENT.
This notification is an union sctp_notification, where only the This notification is a union sctp_notification, where only the struct
struct sctp_tlv (see the union above) is used. That merely has this sctp_tlv (see the union above) is used. It only contains this type
type in the sn_type field, the sn_length field set to the sizeof an in the sn_type field, the sn_length field set to the sizeof an
sctp_tlv structure and the sn_flags set to 0. If an application sctp_tlv structure and the sn_flags set to 0. If an application
receives this notification, it will need to resubscribe to any receives this notification, it will need to resubscribe to any
notifications of interest to it, except for the data io event. notifications of interest to it, except for the data io event.
An endpoint is automatically subscribed to this event as soon as it An endpoint is automatically subscribed to this event as soon as it
is subscribed to any event other than data io events. is subscribed to any event other than data io events.
5.3.12. SCTP_SEND_FAILED_EVENT 5.3.12. SCTP_SEND_FAILED_EVENT
If SCTP cannot deliver a message, it can return back the message as a If SCTP cannot deliver a message, it can return back the message as a
skipping to change at page 45, line 4 skipping to change at page 45, line 43
uint32_t ssf_error; uint32_t ssf_error;
struct sctp_sndinfo ssf_info; struct sctp_sndinfo ssf_info;
sctp_assoc_t ssf_assoc_id; sctp_assoc_t ssf_assoc_id;
uint8_t ssf_data[]; uint8_t ssf_data[];
}; };
ssf_type: It should be SCTP_SEND_FAILED_EVENT. ssf_type: It should be SCTP_SEND_FAILED_EVENT.
ssf_flags: The flag value will take one of the following values: ssf_flags: The flag value will take one of the following values:
SCTP_DATA_UNSENT: Indicates that the data was never put on the SCTP_DATA_UNSENT: Indicates that the data was never put on the
wire. wire.
SCTP_DATA_SENT: Indicates that the data was put on the wire. SCTP_DATA_SENT: Indicates that the data was put on the wire.
Note that this does not necessarily mean that the data was (or Note that this does not necessarily mean that the data was (or
was not) successfully delivered. was not) successfully delivered.
ssf_length: This field is the total length of the notification data, ssf_length: This field is the total length of the notification data,
including the notification header and the payload in ssf_data. including the notification header and the payload in ssf_data.
ssf_error: This value represents the reason why the send failed, and ssf_error: This value represents the reason why the send failed, and
if set, will be an SCTP protocol error code as defined in if set, will be an SCTP protocol error code as defined in
[RFC4960] section 3.3.10. [RFC4960] Section 3.3.10.
ssf_info: The send information associated with the undelivered ssf_info: The send information associated with the undelivered
message. The ssf_info.snd_flags field will also contain an message. The ssf_info.snd_flags field will also contain an
indication if the beginning of the message and/or end of the indication if the beginning of the message and/or end of the
message is present. In cases where no data has been sent on the message is present. In cases where no data has been sent on the
wire, this field will have or'ed in the value SCTP_DATA_NOT_FRAG, wire, this field will have or'ed in the value SCTP_DATA_NOT_FRAG,
which is a composition of both a "BEGIN" and "END" fragmentation which is a composition of both a "BEGIN" and "END" fragmentation
bit. In cases where only part of the data has been sent, this bit. In cases where only part of the data has been sent, this
field will have or'ed in the value SCTP_DATA_LAST_FRAG, which field will have or'ed in the value SCTP_DATA_LAST_FRAG, which
corresponds to the "END" bit. Note that the message itself may be corresponds to the "END" bit. Note that the message itself may be
more than one chunk. If the ssf_info.snd_flags field holds more than one chunk. If the ssf_info.snd_flags field holds
skipping to change at page 49, line 24 skipping to change at page 50, line 15
implementation. recv() and recvfrom() cannot distinguish message implementation. recv() and recvfrom() cannot distinguish message
boundaries. boundaries.
In receiving, if the buffer supplied is not large enough to hold a In receiving, if the buffer supplied is not large enough to hold a
complete message, the receive call acts like a stream socket and complete message, the receive call acts like a stream socket and
returns as much data as will fit in the buffer. returns as much data as will fit in the buffer.
Note, the send() and recv() calls may not be used for a one-to-many Note, the send() and recv() calls may not be used for a one-to-many
style socket. style socket.
Note, if an application calls a send function with no user data and Note, if an application calls a send() or sendto() function with no
no ancillary data the SCTP implementation should reject the request user data the SCTP implementation should reject the request with an
with an appropriate error message. An implementation is not allowed appropriate error message. An implementation is not allowed to send
to send a DATA chunk with no user data [RFC4960]. a DATA chunk with no user data [RFC4960].
6.2. setsockopt() and getsockopt() 6.2. setsockopt() and getsockopt()
Applications use setsockopt() and getsockopt() to set or retrieve Applications use setsockopt() and getsockopt() to set or retrieve
socket options. Socket options are used to change the default socket options. Socket options are used to change the default
behavior of socket calls. They are described in Section 7. behavior of socket calls. They are described in Section 7.
The function prototypes are The function prototypes are
int getsockopt(int sd, int getsockopt(int sd,
skipping to change at page 50, line 10 skipping to change at page 50, line 49
const void *optval, const void *optval,
socklen_t optlen); socklen_t optlen);
and the arguments are and the arguments are
sd: The socket descriptor. sd: The socket descriptor.
level: Set to IPPROTO_SCTP for all SCTP options. level: Set to IPPROTO_SCTP for all SCTP options.
optname: The option name. optname: The option name.
optval: The buffer to store the value of the option. optval: The buffer to store the value of the option.
optlen: The size of the buffer (or the length of the option optlen: The size of the buffer (or the length of the option
returned). returned).
They return 0 on success and -1 in case of an error.
All socket options set on a one-to-one style listening socket also All socket options set on a one-to-one style listening socket also
apply to all accepted sockets. For one-to-many style sockets often a apply to all accepted sockets. For one-to-many style sockets often a
socket option will pass a structure that includes an assoc_id field. socket option will pass a structure that includes an assoc_id field.
This field can be filled with the association id of a particular This field can be filled with the association id of a particular
association and unless otherwise specified can be filled with one of association and unless otherwise specified can be filled with one of
the following constants: the following constants:
SCTP_FUTURE_ASSOC: Specifies that only future associations created SCTP_FUTURE_ASSOC: Specifies that only future associations created
after this socket option will be affected by this call. after this socket option will be affected by this call.
SCTP_CURRENT_ASSOC: Specifies that only currently existing SCTP_CURRENT_ASSOC: Specifies that only currently existing
skipping to change at page 50, line 31 skipping to change at page 51, line 23
will still receive the previous default value. will still receive the previous default value.
SCTP_ALL_ASSOC: Specifies that all current and future associations SCTP_ALL_ASSOC: Specifies that all current and future associations
will be affected by this call. will be affected by this call.
6.3. read() and write() 6.3. read() and write()
Applications can use read() and write() to send and receive data to Applications can use read() and write() to send and receive data to
and from a peer. They have the same semantics as send() and recv() and from a peer. They have the same semantics as send() and recv()
except that the flags parameter cannot be used. except that the flags parameter cannot be used.
Note, these calls, when used in the one-to-many style, should only be
used with branched off socket descriptors (see Section 8.2).
6.4. getsockname() 6.4. getsockname()
Applications use getsockname() to retrieve the locally-bound socket Applications use getsockname() to retrieve the locally-bound socket
address of the specified socket. This is especially useful if the address of the specified socket. This is especially useful if the
caller let SCTP choose a local port. This call is for single homed caller let SCTP choose a local port. This call is for single homed
endpoints. It does not work well with multi-homed endpoints. See endpoints. It does not work well with multi-homed endpoints. See
Section 8.5 for a multi-homed version of the call. Section 8.5 for a multi-homed version of the call.
The function prototype is The function prototype is
skipping to change at page 51, line 11 skipping to change at page 51, line 45
socklen_t *len); socklen_t *len);
and the arguments are and the arguments are
sd: The socket descriptor to be queried. sd: The socket descriptor to be queried.
address: On return, one locally bound address (chosen by the SCTP address: On return, one locally bound address (chosen by the SCTP
stack) is stored in this buffer. If the socket is an IPv4 socket, stack) is stored in this buffer. If the socket is an IPv4 socket,
the address will be IPv4. If the socket is an IPv6 socket, the the address will be IPv4. If the socket is an IPv6 socket, the
address will be either an IPv6 or IPv4 address. address will be either an IPv6 or IPv4 address.
len: The caller should set the length of the address here. On len: The caller should set the length of the address here. On
return, this is set to the length of the returned address. return, this is set to the length of the returned address.
It returns 0 on success and -1 in case of an error.
If the actual length of the address is greater than the length of the If the actual length of the address is greater than the length of the
supplied sockaddr structure, the stored address will be truncated. supplied sockaddr structure, the stored address will be truncated.
If the socket has not been bound to a local name, the value stored in If the socket has not been bound to a local name, the value stored in
the object pointed to by address is unspecified. the object pointed to by address is unspecified.
6.5. Implicit Association Setup 6.5. Implicit Association Setup
Once the bind() call is complete, the application can begin sending The application can begin sending and receiving data using the
and receiving data using the sendmsg()/recvmsg() or sendto()/ sendmsg()/recvmsg() or sendto()/recvfrom() calls, without going
recvfrom() calls, without going through any explicit association through any explicit association setup procedures (i.e., no connect()
setup procedures (i.e., no connect() calls required). calls required).
Whenever sendmsg() or sendto() is called and the SCTP stack at the Whenever sendmsg() or sendto() is called and the SCTP stack at the
sender finds that no association exists between the sender and the sender finds that no association exists between the sender and the
intended receiver (identified by the address passed either in the intended receiver (identified by the address passed either in the
msg_name field of msghdr structure in the sendmsg() call or the msg_name field of msghdr structure in the sendmsg() call or the
dest_addr field in the sendto() call), the SCTP stack will dest_addr field in the sendto() call), the SCTP stack will
automatically setup an association to the intended receiver. automatically setup an association to the intended receiver.
Upon the successful association setup an SCTP_COMM_UP notification Upon the successful association setup an SCTP_COMM_UP notification
will be dispatched to the socket at both the sender and receiver will be dispatched to the socket at both the sender and receiver
side. This notification can be read by the recvmsg() system call side. This notification can be read by the recvmsg() system call
(see Section 3.1.3). (see Section 3.1.3).
Note, if the SCTP stack at the sender side supports bundling, the Note, if the SCTP stack at the sender side supports bundling, the
first user message may be bundled with the COOKIE ECHO message first user message may be bundled with the COOKIE ECHO message
[RFC4960]. [RFC4960].
When the SCTP stack sets up a new association implicitly, the When the SCTP stack sets up a new association implicitly, the
SCTP_INIT type ancillary data may also be passed along (see SCTP_INIT type ancillary data may also be passed along (see
Section 5.2.1 for details of the data structures) to change some Section 5.2.1 for details of the data structures) to change some
parameters used in setting up new association. parameters used in setting up a new association.
If this information is not present in the sendmsg() call, or if the If this information is not present in the sendmsg() call, or if the
implicit association setup is triggered by a sendto() call, the implicit association setup is triggered by a sendto() call, the
default association initialization parameters will be used. These default association initialization parameters will be used. These
default association parameters may be set with respective default association parameters may be set with respective
setsockopt() calls or be left to the system defaults. setsockopt() calls or be left to the system defaults.
Implicit association setup cannot be initiated by send() calls. Implicit association setup cannot be initiated by send() calls.
7. Socket Options 7. Socket Options
skipping to change at page 53, line 34 skipping to change at page 54, line 23
sctp_opt_info() returns 0 on success, or on failure returns -1 and sctp_opt_info() returns 0 on success, or on failure returns -1 and
sets errno to the appropriate error code. sets errno to the appropriate error code.
All options that support specific settings on an association by All options that support specific settings on an association by
filling in either an association id variable or a sockaddr_storage filling in either an association id variable or a sockaddr_storage
should also support the setting of the same value for the entire should also support the setting of the same value for the entire
endpoint (i.e. future associations). To accomplish this the endpoint (i.e. future associations). To accomplish this the
following logic is used when setting one of these options: following logic is used when setting one of these options:
o If an address is specified via a sockaddr_storage that is included o If an address is specified via a sockaddr_storage that is included
in the structure, the address is used to lookup the association in the structure, the address is used to lookup the association,
and the settings are applied to the specific address (if and the settings are applied to the specific address (if
appropriate) or to the entire association. appropriate) or to the entire association.
o If an association identification is filled in but not a o If an association identification is filled in but not a
sockaddr_storage (if present), the association is found using the sockaddr_storage (if present), the association is found using the
association identification and the settings should be applied to association identification and the settings should be applied to
the specified association (since a specific address is not the specified association (since a specific address is not
specified). Note this also applies to options that hold an specified). Note this also applies to options that hold an
association identification in their structure but do not have a association identification in their structure but do not have a
sockaddr_storage field. sockaddr_storage field.
o If neither the sockaddr_storage nor association identification is o If neither the sockaddr_storage nor association identification is
skipping to change at page 54, line 29 skipping to change at page 55, line 18
uint32_t srto_max; uint32_t srto_max;
uint32_t srto_min; uint32_t srto_min;
}; };
srto_initial: This contains the initial RTO value. srto_initial: This contains the initial RTO value.
srto_max and srto_min: These contain the maximum and minimum bounds srto_max and srto_min: These contain the maximum and minimum bounds
for all RTOs. for all RTOs.
srto_assoc_id: This parameter is ignored for one-to-one style srto_assoc_id: This parameter is ignored for one-to-one style
sockets. For one-to-many style sockets the application may fill sockets. For one-to-many style sockets the application may fill
in an association identification or SCTP_FUTURE_ASSOC. It is an in an association identification or SCTP_FUTURE_ASSOC. It is an
error to use SCTP_{CURRENT|ALL}_ASSOC in srto_asssoc_id. error to use SCTP_{CURRENT|ALL}_ASSOC in srto_assoc_id.
All times are given in milliseconds. A value of 0, when modifying All times are given in milliseconds. A value of 0, when modifying
the parameters, indicates that the current value should not be the parameters, indicates that the current value should not be
changed. changed.
To access or modify these parameters, the application should call To access or modify these parameters, the application should call
getsockopt() or setsockopt() respectively with the option name getsockopt() or setsockopt() respectively with the option name
SCTP_RTOINFO. SCTP_RTOINFO.
7.1.2. Association Parameters (SCTP_ASSOCINFO) 7.1.2. Association Parameters (SCTP_ASSOCINFO)
skipping to change at page 55, line 17 skipping to change at page 55, line 49
uint16_t sasoc_asocmaxrxt; uint16_t sasoc_asocmaxrxt;
uint16_t sasoc_number_peer_destinations; uint16_t sasoc_number_peer_destinations;
uint32_t sasoc_peer_rwnd; uint32_t sasoc_peer_rwnd;
uint32_t sasoc_local_rwnd; uint32_t sasoc_local_rwnd;
uint32_t sasoc_cookie_life; uint32_t sasoc_cookie_life;
}; };
sasoc_assoc_id: This parameter is ignored for one-to-one style sasoc_assoc_id: This parameter is ignored for one-to-one style
sockets. For one-to-many style sockets the application may fill sockets. For one-to-many style sockets the application may fill
in an association identification or SCTP_FUTURE_ASSOC. It is an in an association identification or SCTP_FUTURE_ASSOC. It is an
error to use SCTP_{CURRENT|ALL}_ASSOC in sasoc_asssoc_id. error to use SCTP_{CURRENT|ALL}_ASSOC in sasoc_assoc_id.
sasoc_asocmaxrxt: This contains the maximum retransmission attempts sasoc_asocmaxrxt: This contains the maximum retransmission attempts
to make for the association. to make for the association.
sasoc_number_peer_destinations: This is the number of destination sasoc_number_peer_destinations: This is the number of destination
addresses that the peer has. addresses that the peer has.
sasoc_peer_rwnd: This holds the current value of the peers rwnd sasoc_peer_rwnd: This holds the current value of the peers rwnd
(reported in the last SACK) minus any outstanding data (i.e. data (reported in the last SACK) minus any outstanding data (i.e. data
in flight). in flight).
sasoc_local_rwnd: This holds the last reported rwnd that was sent to sasoc_local_rwnd: This holds the last reported rwnd that was sent to
the peer. the peer.
sasoc_cookie_life: This is the association's cookie life value used sasoc_cookie_life: This is the association's cookie life value used
skipping to change at page 55, line 52 skipping to change at page 56, line 39
To access or modify these parameters, the application should call To access or modify these parameters, the application should call
getsockopt() or setsockopt() respectively with the option name getsockopt() or setsockopt() respectively with the option name
SCTP_ASSOCINFO. SCTP_ASSOCINFO.
The maximum number of retransmissions before an address is considered The maximum number of retransmissions before an address is considered
unreachable is also tunable, but is address-specific, so it is unreachable is also tunable, but is address-specific, so it is
covered in a separate option. If an application attempts to set the covered in a separate option. If an application attempts to set the
value of the association maximum retransmission parameter to more value of the association maximum retransmission parameter to more
than the sum of all maximum retransmission parameters, setsockopt() than the sum of all maximum retransmission parameters, setsockopt()
may return an error. The reason for this, from [RFC4960] section may return an error. The reason for this, from [RFC4960] Section
8.2: 8.2:
Note: When configuring the SCTP endpoint, the user should avoid Note: When configuring the SCTP endpoint, the user should avoid
having the value of 'Association.Max.Retrans' (sasoc_maxrt in this having the value of 'Association.Max.Retrans' (sasoc_maxrxt in this
option) larger than the summation of the 'Path.Max.Retrans' (see option) larger than the summation of the 'Path.Max.Retrans' (see
Section 7.1.2 on spp_pathmaxrxt) of all the destination addresses for Section 7.1.2 on spp_pathmaxrxt) of all the destination addresses for
the remote endpoint. Otherwise, all the destination addresses may the remote endpoint. Otherwise, all the destination addresses may
become inactive while the endpoint still considers the peer endpoint become inactive while the endpoint still considers the peer endpoint
reachable. reachable.
7.1.3. Initialization Parameters (SCTP_INITMSG) 7.1.3. Initialization Parameters (SCTP_INITMSG)
Applications can specify protocol parameters for the default Applications can specify protocol parameters for the default
association initialization. The structure used to access and modify association initialization. The structure used to access and modify
skipping to change at page 58, line 18 skipping to change at page 59, line 10
the association's primary. The enclosed address must be one of the the association's primary. The enclosed address must be one of the
association peer's addresses. association peer's addresses.
The following structure is used to make a set peer primary request: The following structure is used to make a set peer primary request:
struct sctp_setprim { struct sctp_setprim {
sctp_assoc_t ssp_assoc_id; sctp_assoc_t ssp_assoc_id;
struct sockaddr_storage ssp_addr; struct sockaddr_storage ssp_addr;
}; };
ssp_addr: The address to set as primary. ssp_addr: The address to set as primary. No wildcard address is
allowed.
ssp_assoc_id: This parameter is ignored for one-to-one style ssp_assoc_id: This parameter is ignored for one-to-one style
sockets. For one-to-many style sockets it identifies the sockets. For one-to-many style sockets it identifies the
association for this request. Note that the special sctp_assoc_t association for this request. Note that the special sctp_assoc_t
SCTP_{FUTURE|ALL|CURRENT}_ASSOC are not allowed. SCTP_{FUTURE|ALL|CURRENT}_ASSOC are not allowed.
7.1.10. Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) 7.1.10. Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
Requests that the local endpoint set the specified Adaptation Layer Requests that the local endpoint set the specified Adaptation Layer
Indication parameter for all future INIT and INIT-ACK exchanges. Indication parameter for all future INIT and INIT-ACK exchanges.
skipping to change at page 58, line 42 skipping to change at page 59, line 35
uint32_t ssb_adaptation_ind; uint32_t ssb_adaptation_ind;
}; };
ssb_adaptation_ind: The adaptation layer indicator that will be ssb_adaptation_ind: The adaptation layer indicator that will be
included in any outgoing Adaptation Layer Indication parameter. included in any outgoing Adaptation Layer Indication parameter.
7.1.11. Enable/Disable Message Fragmentation (SCTP_DISABLE_FRAGMENTS) 7.1.11. Enable/Disable Message Fragmentation (SCTP_DISABLE_FRAGMENTS)
This option is a on/off flag and is passed as an integer where a non- This option is a on/off flag and is passed as an integer where a non-
zero is on and a zero is off. If enabled no SCTP message zero is on and a zero is off. If enabled no SCTP message
fragmentation will be performed. Instead, if a message being sent fragmentation will be performed. If disabled, if a message being
exceeds the current PMTU size, the message will not be sent and sent exceeds the current PMTU size, the message will not be sent and
instead an error will be indicated to the user. instead an error will be indicated to the user.
7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) 7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS)
Applications can enable or disable heartbeats for any peer address of Applications can enable or disable heartbeats for any peer address of
an association, modify an address's heartbeat interval, force a an association, modify an address's heartbeat interval, force a
heartbeat to be sent immediately, and adjust the address's maximum heartbeat to be sent immediately, and adjust the address's maximum
number of retransmissions sent before an address is considered number of retransmissions sent before an address is considered
unreachable. unreachable.
skipping to change at page 59, line 33 skipping to change at page 60, line 30
spp_address: This specifies which address is of interest. If a spp_address: This specifies which address is of interest. If a
wildcard address is provided it applies to all current and future wildcard address is provided it applies to all current and future
paths. paths.
spp_hbinterval: This contains the value of the heartbeat interval, spp_hbinterval: This contains the value of the heartbeat interval,
in milliseconds (HB.Interval in [RFC4960]). Note that unless the in milliseconds (HB.Interval in [RFC4960]). Note that unless the
spp_flag is set to SPP_HB_ENABLE the value of this field is spp_flag is set to SPP_HB_ENABLE the value of this field is
ignored. Note also that a value of zero indicates the current ignored. Note also that a value of zero indicates the current
setting should be left unchanged. To set an actual value of zero setting should be left unchanged. To set an actual value of zero
the use of the flag SPP_HB_TIME_IS_ZERO should be used. Even when the use of the flag SPP_HB_TIME_IS_ZERO should be used. Even when
it is set to 0, it does not mean that SCTP will continuously send it is set to 0, it does not mean that SCTP will continuously send
out heartbeat since the actual interval also includes a the out heartbeat since the actual interval also includes the current
current RTO and jitter (see Section 8.3 in [RFC4960]). RTO and jitter (see Section 8.3 in [RFC4960]).
spp_pathmaxrxt: This contains the maximum number of retransmissions spp_pathmaxrxt: This contains the maximum number of retransmissions
before this address shall be considered unreachable. Note that a before this address shall be considered unreachable. Note that a
value of zero indicates the current setting should be left value of zero indicates the current setting should be left
unchanged. unchanged.
spp_ipv6_flowlabel: This field is used in conjunction with the spp_ipv6_flowlabel: This field is used in conjunction with the
SPP_IPV6_FLOWLABEL flag. This setting has precedence over any SPP_IPV6_FLOWLABEL flag. This setting has precedence over any
IPv6 layer setting. IPv6 layer setting.
spp_ipv4_tos: This field is used in conjunction with the spp_ipv4_tos: This field is used in conjunction with the
SPP_IPV4_TOS flag. This setting has precedence over any IPv4 SPP_IPV4_TOS flag. This setting has precedence over any IPv4
layer setting. layer setting.
skipping to change at page 60, line 44 skipping to change at page 61, line 40
SPP_IPV4_TOS: Setting this flag enables the setting of the IPV4 SPP_IPV4_TOS: Setting this flag enables the setting of the IPV4
TOS value associated with either the association or a specific TOS value associated with either the association or a specific
address. The value is obtained in the spp_ipv4_tos field. address. The value is obtained in the spp_ipv4_tos field.
Upon retrieval, this flag will be set to indicate that the Upon retrieval, this flag will be set to indicate that the
spp_ipv4_tos field has a valid value returned. If a specific spp_ipv4_tos field has a valid value returned. If a specific
destination address is set when called (in the spp_address destination address is set when called (in the spp_address
field) then that specific destination address' TOS value is field) then that specific destination address' TOS value is
returned. If just an association is specified then the returned. If just an association is specified then the
association default TOS is returned. If neither an association association default TOS is returned. If neither an association
nor an destination is specified, then the sockets default TOS nor a destination is specified, then the sockets default TOS is
is returned. returned.
To read or modify these parameters, the application should call To read or modify these parameters, the application should call
sctp_opt_info() with the SCTP_PEER_ADDR_PARAMS option. sctp_opt_info() with the SCTP_PEER_ADDR_PARAMS option.
7.1.13. Set Default Send Parameters (SCTP_DEFAULT_SEND_PARAM) 7.1.13. Set Default Send Parameters (SCTP_DEFAULT_SEND_PARAM)
Please note that this options is deprecated. Section 7.1.31 should Please note that this options is deprecated. Section 7.1.31 should
be used instead. be used instead.
Applications that wish to use the sendto() system call may wish to Applications that wish to use the sendto() system call may wish to
specify a default set of parameters that would normally be supplied specify a default set of parameters that would normally be supplied
through the inclusion of ancillary data. This socket option allows through the inclusion of ancillary data. This socket option allows
such an application to set the default sctp_sndrcvinfo structure. such an application to set the default sctp_sndrcvinfo structure.
The application that wishes to use this socket option simply passes The application that wishes to use this socket option simply passes
the sctp_sndrcvinfo structure defined in Section 5.2.2 to this call. the sctp_sndrcvinfo structure defined in Section 5.2.2 to this call.
The input parameters accepted by this call include sinfo_stream, The input parameters accepted by this call include sinfo_stream,
sinfo_flags, sinfo_ppid, sinfo_context, sinfo_pr_policy and sinfo_flags, sinfo_ppid, sinfo_context, sinfo_pr_policy and
sinfo_pr_value. The sinfo_flags is composed of a bitwise OR of sinfo_pr_value. The sinfo_flags is composed of a bitwise OR of
SCTP_UNORDERED, SCTP_EOF, and SCTP_SENDALL. The sinfo_assoc_id field SCTP_UNORDERED, SCTP_EOF, and SCTP_SENDALL. The sinfo_assoc_id field
specifies the association to apply the parameters to. In a one-to- specifies the association to apply the parameters to. For a one-to-
many style sockets any of the predefined constants are also allowed many style socket any of the predefined constants are also allowed in
in this field. The field is ignored on the one-to-one style. this field. The field is ignored on the one-to-one style.
7.1.14. Set Notification and Ancillary Events (SCTP_EVENTS) 7.1.14. Set Notification and Ancillary Events (SCTP_EVENTS)
This socket option is used to specify various notifications and This socket option is used to specify various notifications and
ancillary data the user wishes to receive. Please see Section 7.4 ancillary data the user wishes to receive. Please see Section 7.4
for a full description of this option and its usage. Note that this for a full description of this option and its usage. Note that this
option is considered deprecated and present for backward option is considered deprecated and present for backward
compatibility. New applications should use the SCTP_SET_EVENT compatibility. New applications should use the SCTP_SET_EVENT
option. See Section 7.4 for a full description of that option as option. See Section 7.4 for a full description of that option as
well. well.
7.1.15. Set/Clear IPv4 Mapped Addresses (SCTP_I_WANT_MAPPED_V4_ADDR) 7.1.15. Set/Clear IPv4 Mapped Addresses (SCTP_I_WANT_MAPPED_V4_ADDR)
This socket option is a boolean flag which turns on or off the This socket option is a boolean flag which turns on or off the
mapping of IPv4 addresses. If this option is turned on and the mapping of IPv4 addresses. If this option is turned on, then IPv4
socket is type PF_INET6, then IPv4 addresses will be mapped to V6 addresses will be mapped to V6 representation. If this option is
representation. If this option is turned off, then no mapping will turned off, then no mapping will be done of V4 addresses and a user
be done of V4 addresses and a user will receive both PF_INET6 and will receive both PF_INET6 and PF_INET type addresses on the socket.
PF_INET type addresses on the socket. See [RFC3542] for more details See [RFC3542] for more details on mapped V6 addresses.
on mapped V6 addresses.
If this socket option is used on a socket of type PF_INET an error is
returned.
By default this option is turned off and expects an integer to be By default this option is turned off and expects an integer to be
passed where non-zero turns on the option and zero turns off the passed where non-zero turns on the option and zero turns off the
option. option.
7.1.16. Get or Set the Maximum Fragmentation Size (SCTP_MAXSEG) 7.1.16. Get or Set the Maximum Fragmentation Size (SCTP_MAXSEG)
This option will get or set the maximum size to put in any outgoing This option will get or set the maximum size to put in any outgoing
SCTP DATA chunk. If a message is larger than this size it will be SCTP DATA chunk. If a message is larger than this size it will be
fragmented by SCTP into the specified size. Note that the underlying fragmented by SCTP into the specified size. Note that the underlying
skipping to change at page 62, line 22 skipping to change at page 63, line 17
The following structure is used to access and modify this parameter: The following structure is used to access and modify this parameter:
struct sctp_assoc_value { struct sctp_assoc_value {
sctp_assoc_t assoc_id; sctp_assoc_t assoc_id;
uint32_t assoc_value; uint32_t assoc_value;
}; };
assoc_id: This parameter is ignored for one-to-one style sockets. assoc_id: This parameter is ignored for one-to-one style sockets.
For one-to-many style sockets this parameter indicates which For one-to-many style sockets this parameter indicates which
association the user is performing an action upon. It is an error association the user is performing an action upon. It is an error
to use SCTP_{CURRENT|ALL}_ASSOC in sasoc_asssoc_id. to use SCTP_{CURRENT|ALL}_ASSOC in assoc_id.
assoc_value: This parameter specifies the maximum size in bytes. assoc_value: This parameter specifies the maximum size in bytes.
7.1.17. Get or Set the List of Supported HMAC Identifiers 7.1.17. Get or Set the List of Supported HMAC Identifiers
(SCTP_HMAC_IDENT) (SCTP_HMAC_IDENT)
This option gets or sets the list of HMAC algorithms that the local This option gets or sets the list of HMAC algorithms that the local
endpoint requires the peer to use. endpoint requires the peer to use.
The following structure is used to get or set these identifiers: The following structure is used to get or set these identifiers:
skipping to change at page 63, line 42 skipping to change at page 64, line 41
indicated shared key identifier for all messages being given to an indicated shared key identifier for all messages being given to an
SCTP implementation via a send call after the setsockopt() call until SCTP implementation via a send call after the setsockopt() call until
changed again. Therefore, the SCTP implementation must not bundle changed again. Therefore, the SCTP implementation must not bundle
user messages which should be authenticated using different shared user messages which should be authenticated using different shared
key identifiers. key identifiers.
Initially the key with key identifier 0 is the active key. Initially the key with key identifier 0 is the active key.
7.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK) 7.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK)
This option will affect the way delayed acks are performed. This This option will affect the way delayed sacks are performed. This
option allows the application to get or set the delayed ack time, in option allows the application to get or set the delayed sack time, in
milliseconds. It also allows changing the delayed ack frequency. milliseconds. It also allows changing the delayed sack frequency.
Changing the frequency to 1 disables the delayed sack algorithm. Changing the frequency to 1 disables the delayed sack algorithm.
Note that if sack_delay or sack_freq are 0 when setting this option, Note that if sack_delay or sack_freq are 0 when setting this option,
the current values will remain unchanged. the current values will remain unchanged.
The following structure is used to access and modify these The following structure is used to access and modify these
parameters: parameters:
struct sctp_sack_info { struct sctp_sack_info {
sctp_assoc_t sack_assoc_id; sctp_assoc_t sack_assoc_id;
uint32_t sack_delay; uint32_t sack_delay;
uint32_t sack_freq; uint32_t sack_freq;
}; };
sack_assoc_id: This parameter is ignored for one-to-one style sack_assoc_id: This parameter is ignored for one-to-one style
sockets. For one-to-many style sockets this parameter indicates sockets. For one-to-many style sockets this parameter indicates
which association the user is performing an action upon. The which association the user is performing an action upon. The
special SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used. special SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used.
sack_delay: This parameter contains the number of milliseconds that sack_delay: This parameter contains the number of milliseconds that
the user is requesting the delayed ACK timer to be set to. Note the user is requesting the delayed SACK timer to be set to. Note
that this value is defined in the standard to be between 200 and that this value is defined in the standard to be between 200 and
500 milliseconds. 500 milliseconds.
sack_freq: This parameter contains the number of packets that must sack_freq: This parameter contains the number of packets that must
be received before a sack is sent without waiting for the delay be received before a sack is sent without waiting for the delay
timer to expire. The default value is 2, setting this value to 1 timer to expire. The default value is 2, setting this value to 1
will disable the delayed sack algorithm. will disable the delayed sack algorithm.
7.1.20. Get or Set Fragmented Interleave (SCTP_FRAGMENT_INTERLEAVE) 7.1.20. Get or Set Fragmented Interleave (SCTP_FRAGMENT_INTERLEAVE)
Fragmented interleave controls how the presentation of messages Fragmented interleave controls how the presentation of messages
skipping to change at page 65, line 15 skipping to change at page 66, line 15
level 2: Allows complete interleaving of messages. This level level 2: Allows complete interleaving of messages. This level
requires that the sender carefully observes not only the peer requires that the sender carefully observes not only the peer
association identification (or address) but must also pay careful association identification (or address) but must also pay careful
attention to the stream number. With this option enabled a attention to the stream number. With this option enabled a
partially delivered message may begin being delivered for partially delivered message may begin being delivered for
association "X" stream "Y" and the next subsequent receive may association "X" stream "Y" and the next subsequent receive may
return a message from association "X" stream "Z". Note that no return a message from association "X" stream "Z". Note that no
other messages would be delivered for association "X" stream "Y" other messages would be delivered for association "X" stream "Y"
until all of stream "Y"'s partially delivered message was read. until all of stream "Y"'s partially delivered message was read.
Note that this option also affects the one-to-one model. Also Note that this option also affects the one-to-one model. Also
note that for the one-to-many model not only may another streams note that for the one-to-many model not only another stream's
message from the same association be delivered from the next message from the same association may be delivered upon the next
receive, some other associations message may be delivered upon the receive, some other association's message may be delivered upon
next receive. the next receive.
An implementation should default the one-to-many model to level 1. An implementation should default the one-to-many model to level 1.
The reason for this is that otherwise it is possible that a peer The reason for this is that otherwise it is possible that a peer
could begin sending a partial message and thus block all other peers could begin sending a partial message and thus block all other peers
from sending data. However a setting of level 2 requires the from sending data. However a setting of level 2 requires the
application to not only be aware of the association (via the application to not only be aware of the association (via the
association id or peer's address) but also the stream number. The association id or peer's address) but also the stream number. The
stream number is not present unless the user has subscribed to the stream number is not present unless the user has subscribed to the
sctp_data_io_events (see Section 7.4). This is also why we recommend sctp_data_io_events (see Section 7.4). This is also why we recommend
that the one-to-one model be defaulted to level 0 (level 1 for the that the one-to-one model be defaulted to level 0 (level 1 for the
skipping to change at page 66, line 14 skipping to change at page 67, line 14
call as long as the user provided buffer is large enough to hold the call as long as the user provided buffer is large enough to hold the
message. message.
7.1.22. Set or Get the Use of Extended Receive Info 7.1.22. Set or Get the Use of Extended Receive Info
(SCTP_USE_EXT_RCVINFO) (SCTP_USE_EXT_RCVINFO)
This option will enable or disable the use of the extended version of This option will enable or disable the use of the extended version of
the sctp_sndrcvinfo structure. If this option is disabled, then the the sctp_sndrcvinfo structure. If this option is disabled, then the
normal sctp_sndrcvinfo structure is returned in all receive message normal sctp_sndrcvinfo structure is returned in all receive message
calls. If this option is enabled then the sctp_extrcvinfo structure calls. If this option is enabled then the sctp_extrcvinfo structure
is returned in all receive message calls. This option is present for is returned in all receive message calls. The default is off.
compatibility with older applications and is deprecated. Future
applications should use SCTP_NXTINFO to retrieve this same
information via ancillary data.
Note that the sctp_extrcvinfo structure is never used in any send Note that the sctp_extrcvinfo structure is never used in any send
call. call.
This option is present for compatibility with older applications and
is deprecated. Future applications should use SCTP_NXTINFO to
retrieve this same information via ancillary data.
7.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF) 7.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF)
This option will enable or disable the use of the automatic This option will enable or disable the use of the automatic
generation of ASCONF chunks to add and delete addresses to an generation of ASCONF chunks to add and delete addresses to an
existing association. Note that this option has two caveats namely: existing association. Note that this option has two caveats namely:
a) it only affects sockets that are bound to all addresses on the a) it only affects sockets that are bound to all addresses on the
machine, and b) the system administrator may have an overriding machine, and b) the system administrator may have an overriding
control that turns the ASCONF feature off no matter what setting the control that turns the ASCONF feature off no matter what setting the
socket option may have. socket option may have.
7.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST) 7.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST)
This option will allow a user to change the maximum burst of packets This option will allow a user to change the maximum burst of packets
that can be emitted by this association. Note that the default value that can be emitted by this association. Note that the default value
is 4, and some implementations may restrict this setting so that it is 4, and some implementations may restrict this setting so that it
can only be lowered. can only be lowered to positive values.
To set or get this option the user fills in the following structure: To set or get this option the user fills in the following structure:
struct sctp_assoc_value { struct sctp_assoc_value {
sctp_assoc_t assoc_id; sctp_assoc_t assoc_id;
uint32_t assoc_value; uint32_t assoc_value;
}; };
assoc_id: This parameter is ignored for one-to-one style sockets. assoc_id: This parameter is ignored for one-to-one style sockets.
For one-to-many style sockets this parameter indicates which For one-to-many style sockets this parameter indicates which
association the user is performing an action upon. The special association the user is performing an action upon. The special
SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used. SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used.
assoc_value: This parameter contains the maximum burst. assoc_value: This parameter contains the maximum burst. Setting the
value to 0 disables burst mitigation.
7.1.25. Set or Get the Default Context (SCTP_CONTEXT) 7.1.25. Set or Get the Default Context (SCTP_CONTEXT)
The context field in the sctp_sndrcvinfo structure is normally only The context field in the sctp_sndrcvinfo structure is normally only
used when a failed message is retrieved holding the value that was used when a failed message is retrieved holding the value that was
sent down on the actual send call. This option allows the setting of sent down on the actual send call. This option allows the setting of
a default context on an association basis that will be received on a default context on an association basis that will be received on
reading messages from the peer. This is especially helpful in the reading messages from the peer. This is especially helpful in the
one-to-many model for an application to keep some reference to an one-to-many model for an application to keep some reference to an
internal state machine that is processing messages on the internal state machine that is processing messages on the
skipping to change at page 67, line 41 skipping to change at page 68, line 42
assoc_value: This parameter contains the context. assoc_value: This parameter contains the context.
7.1.26. Enable or Disable Explicit EOR Marking (SCTP_EXPLICIT_EOR) 7.1.26. Enable or Disable Explicit EOR Marking (SCTP_EXPLICIT_EOR)
This boolean flag is used to enable or disable explicit end of record This boolean flag is used to enable or disable explicit end of record
(EOR) marking. When this option is enabled, a user may make multiple (EOR) marking. When this option is enabled, a user may make multiple
send system calls to send a record and must indicate that they are send system calls to send a record and must indicate that they are
finished sending a particular record by including the SCTP_EOR flag. finished sending a particular record by including the SCTP_EOR flag.
If this boolean flag is disabled then each individual send system If this boolean flag is disabled then each individual send system
call is considered to have an SCTP_EOR indicator set on it implicitly call is considered to have an SCTP_EOR indicator set on it implicitly
without the user having to explicitly add this flag. without the user having to explicitly add this flag. The default is
off.
7.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT) 7.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT)
This option only supports one-to-one style SCTP sockets. If used on This option only supports one-to-one style SCTP sockets. If used on
a one-to-many style SCTP socket an error is indicated. a one-to-many style SCTP socket an error is indicated.
This setsockopt() call must not be used after calling bind() or This setsockopt() call must not be used after calling bind() or
sctp_bindx() for a one-to-one style SCTP socket. If using bind() or sctp_bindx() for a one-to-one style SCTP socket. If using bind() or
sctp_bindx() on a socket with the SCTP_REUSE_PORT option, all other sctp_bindx() on a socket with the SCTP_REUSE_PORT option, all other
SCTP sockets bound to the same port must have set the SCTP sockets bound to the same port must have set the
skipping to change at page 68, line 44 skipping to change at page 69, line 46
Applications that wish to use the sendto() system call may wish to Applications that wish to use the sendto() system call may wish to
specify a default set of parameters that would normally be supplied specify a default set of parameters that would normally be supplied
through the inclusion of ancillary data. This socket option allows through the inclusion of ancillary data. This socket option allows
such an application to set the default sctp_sndrcvinfo structure. such an application to set the default sctp_sndrcvinfo structure.
The application that wishes to use this socket option simply passes The application that wishes to use this socket option simply passes
the sctp_sndinfo structure defined in Section 5.2.4 to this call. the sctp_sndinfo structure defined in Section 5.2.4 to this call.
The input parameters accepted by this call include snd_sid, The input parameters accepted by this call include snd_sid,
snd_flags, snd_ppid, snd_context. The snd_flags is composed of a snd_flags, snd_ppid, snd_context. The snd_flags is composed of a
bitwise OR of SCTP_UNORDERED, SCTP_EOF, and SCTP_SENDALL. The bitwise OR of SCTP_UNORDERED, SCTP_EOF, and SCTP_SENDALL. The
snd_assoc_id field specifies the association to apply the parameters snd_assoc_id field specifies the association to apply the parameters
to. In a one-to-many style sockets any of the predefined constants to. For a one-to-many style socket any of the predefined constants
are also allowed in this field. The field is ignored on the one-to- are also allowed in this field. The field is ignored on the one-to-
one style. one style.
7.2. Read-Only Options 7.2. Read-Only Options
The options defined in this subsection are read-only. Using this The options defined in this subsection are read-only. Using this
option in a setsockopt() call will result in an error indicating option in a setsockopt() call will result in an error indicating
EOPNOTSUPP. EOPNOTSUPP.
7.2.1. Association Status (SCTP_STATUS) 7.2.1. Association Status (SCTP_STATUS)
skipping to change at page 69, line 32 skipping to change at page 70, line 37
uint16_t sstat_outstrms; uint16_t sstat_outstrms;
uint32_t sstat_fragmentation_point; uint32_t sstat_fragmentation_point;
struct sctp_paddrinfo sstat_primary; struct sctp_paddrinfo sstat_primary;
}; };
sstat_assoc_id: This parameter is ignored for one-to-one style sstat_assoc_id: This parameter is ignored for one-to-one style
sockets. For one-to-many style sockets it holds the identifier sockets. For one-to-many style sockets it holds the identifier
for the association. All notifications for a given association for the association. All notifications for a given association
have the same association identifier. The special SCTP_{FUTURE| have the same association identifier. The special SCTP_{FUTURE|
CURRENT|ALL}_ASSOC cannot be used. CURRENT|ALL}_ASSOC cannot be used.
sstat_state: This contains the association's current state one of sstat_state: This contains the association's current state, i.e. one
the following values: of the following values:
* SCTP_CLOSED * SCTP_CLOSED
* SCTP_BOUND * SCTP_BOUND
* SCTP_LISTEN * SCTP_LISTEN
* SCTP_COOKIE_WAIT * SCTP_COOKIE_WAIT
* SCTP_COOKIE_ECHOED * SCTP_COOKIE_ECHOED
* SCTP_ESTABLISHED * SCTP_ESTABLISHED
* SCTP_SHUTDOWN_PENDING * SCTP_SHUTDOWN_PENDING
* SCTP_SHUTDOWN_SENT * SCTP_SHUTDOWN_SENT
* SCTP_SHUTDOWN_RECEIVED * SCTP_SHUTDOWN_RECEIVED
* SCTP_SHUTDOWN_ACK_SENT * SCTP_SHUTDOWN_ACK_SENT
skipping to change at page 71, line 19 skipping to change at page 72, line 21
window. window.
spinfo_srtt: This contains the peer address' current smoothed round- spinfo_srtt: This contains the peer address' current smoothed round-
trip time calculation in milliseconds. trip time calculation in milliseconds.
spinfo_rto: This contains the peer address' current retransmission spinfo_rto: This contains the peer address' current retransmission
timeout value in milliseconds. timeout value in milliseconds.
spinfo_mtu: The current P-MTU of this address. spinfo_mtu: The current P-MTU of this address.
7.2.3. Get the List of Chunks the Peer Requires to be Authenticated 7.2.3. Get the List of Chunks the Peer Requires to be Authenticated
(SCTP_PEER_AUTH_CHUNKS) (SCTP_PEER_AUTH_CHUNKS)
This option gets a list of chunk types (see [RFC4960] for a specified This option gets a list of chunk types (see [RFC4960]) for a
association that the peer requires to be received authenticated only. specified association that the peer requires to be received
authenticated only.
The following structure is used to access these parameters: The following structure is used to access these parameters:
struct sctp_authchunks { struct sctp_authchunks {
sctp_assoc_t gauth_assoc_id; sctp_assoc_t gauth_assoc_id;
uint32_t gauth_number_of_chunks uint32_t gauth_number_of_chunks
uint8_t gauth_chunks[]; uint8_t gauth_chunks[];
}; };
gauth_assoc_id: This parameter indicates for which association the gauth_assoc_id: This parameter indicates for which association the
skipping to change at page 72, line 20 skipping to change at page 73, line 27
the local endpoint is requesting to be authenticated. the local endpoint is requesting to be authenticated.
7.2.5. Get the Current Number of Associations (SCTP_GET_ASSOC_NUMBER) 7.2.5. Get the Current Number of Associations (SCTP_GET_ASSOC_NUMBER)
This option gets the current number of associations that are attached This option gets the current number of associations that are attached
to a one-to-many style socket. The option value is an uint32_t. to a one-to-many style socket. The option value is an uint32_t.
Note that this number is only a snap shot. This means that the Note that this number is only a snap shot. This means that the
number of associations may have changed when the caller gets back the number of associations may have changed when the caller gets back the
option result. option result.
For a one-to-one style socket, this socket option results in an
error.
7.2.6. Get the Current Identifiers of Associations 7.2.6. Get the Current Identifiers of Associations
(SCTP_GET_ASSOC_ID_LIST) (SCTP_GET_ASSOC_ID_LIST)
This option gets the current list of SCTP association identifiers of This option gets the current list of SCTP association identifiers of
the SCTP associations handled by a one-to-many style socket. the SCTP associations handled by a one-to-many style socket.
The option value has the structure The option value has the structure
struct sctp_assoc_ids { struct sctp_assoc_ids {
uint32_t gaids_number_of_ids; uint32_t gaids_number_of_ids;
skipping to change at page 72, line 41 skipping to change at page 73, line 51
}; };
The caller must provide a large enough buffer to hold all association The caller must provide a large enough buffer to hold all association
identifiers. If the buffer is too small, an error must be returned. identifiers. If the buffer is too small, an error must be returned.
The user can use the SCTP_GET_ASSOC_NUMBER socket option to get an The user can use the SCTP_GET_ASSOC_NUMBER socket option to get an
idea how large the buffer has to be. gaids_number_of_ids gives the idea how large the buffer has to be. gaids_number_of_ids gives the
number of elements in the array gaids_assoc_id. Note also that the number of elements in the array gaids_assoc_id. Note also that the
some or all of sctp_assoc_t returned in the array may become invalid some or all of sctp_assoc_t returned in the array may become invalid
by the time the caller gets back the result. by the time the caller gets back the result.
For a one-to-one style socket, this socket option results in an
error.
7.3. Write-Only Options 7.3. Write-Only Options
The options defined in this subsection are write-only. Using this The options defined in this subsection are write-only. Using this
option in a getsockopt() or sctp_opt_info() call will result in an option in a getsockopt() or sctp_opt_info() call will result in an
error indicating EOPNOTSUPP. error indicating EOPNOTSUPP.
7.3.1. Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) 7.3.1. Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
Requests that the peer marks the enclosed address as the association Requests that the peer marks the enclosed address as the association
primary (see [RFC5061]). The enclosed address must be one of the primary (see [RFC5061]). The enclosed address must be one of the
skipping to change at page 79, line 45 skipping to change at page 81, line 8
additional addresses with an endpoint after calling bind(). Or use additional addresses with an endpoint after calling bind(). Or use
sctp_bindx(SCTP_BINDX_REM_ADDR) to remove some addresses a listening sctp_bindx(SCTP_BINDX_REM_ADDR) to remove some addresses a listening
socket is associated with, so that no new association accepted will socket is associated with, so that no new association accepted will
be associated with these addresses. If the endpoint supports dynamic be associated with these addresses. If the endpoint supports dynamic
address reconfiguration an SCTP_BINDX_REM_ADDR or SCTP_BINDX_ADD_ADDR address reconfiguration an SCTP_BINDX_REM_ADDR or SCTP_BINDX_ADD_ADDR
may cause an endpoint to send the appropriate message to the peer to may cause an endpoint to send the appropriate message to the peer to
change the peer's address lists. change the peer's address lists.
Adding and removing addresses from a connected association is an Adding and removing addresses from a connected association is an
optional functionality. Implementations that do not support this optional functionality. Implementations that do not support this
functionality should return EOPNOTSUPP. functionality should return -1 and set errno to EOPNOTSUPP.
sctp_bindx() can be called on an already bound socket or on an sctp_bindx() can be called on an already bound socket or on an
unbound socket. If the socket is unbound and the first port number unbound socket. If the socket is unbound and the first port number
in the addrs is zero, the kernel will choose a port number. All port in the addrs is zero, the kernel will choose a port number. All port
numbers after the first one being 0 must also be zero. If the first numbers after the first one being 0 must also be zero. If the first
port number is not zero, the following port numbers must be zero or port number is not zero, the following port numbers must be zero or
have the same value as the first one. For an already bound socket, have the same value as the first one. For an already bound socket,
all port numbers provided must be the bound one or 0. all port numbers provided must be the bound one or 0.
sctp_bindx() is an atomic operation. Therefore, the binding will be sctp_bindx() is an atomic operation. Therefore, the binding will be
skipping to change at page 82, line 29 skipping to change at page 83, line 43
sctp_getladdrs() returns -1, and the value of *addrs is undefined. sctp_getladdrs() returns -1, and the value of *addrs is undefined.
8.6. sctp_freeladdrs() 8.6. sctp_freeladdrs()
sctp_freeladdrs() frees all resources allocated by sctp_getladdrs(). sctp_freeladdrs() frees all resources allocated by sctp_getladdrs().
The function prototype is The function prototype is
void sctp_freeladdrs(struct sockaddr *addrs); void sctp_freeladdrs(struct sockaddr *addrs);
and addrs is the array of peer addresses returned by and addrs is the array of local addresses returned by
sctp_getladdrs(). sctp_getladdrs().
8.7. sctp_sendmsg() 8.7. sctp_sendmsg()
This function is deprecated, sctp_sendv() should be used instead.
An implementation may provide a library function (or possibly system An implementation may provide a library function (or possibly system
call) to assist the user with the advanced features of SCTP. call) to assist the user with the advanced features of SCTP.
The function prototype is The function prototype is
ssize_t sctp_sendmsg(int sd, ssize_t sctp_sendmsg(int sd,
const void *msg, const void *msg,
size_t len, size_t len,
const struct sockaddr *to, const struct sockaddr *to,
socklen_t tolen, socklen_t tolen,
skipping to change at page 83, line 27 skipping to change at page 84, line 41
Sending a message using sctp_sendmsg() is atomic (unless explicit EOR Sending a message using sctp_sendmsg() is atomic (unless explicit EOR
marking is enabled on the socket specified by sd). marking is enabled on the socket specified by sd).
Using sctp_sendmsg() on a non-connected one-to-one style socket for Using sctp_sendmsg() on a non-connected one-to-one style socket for
implicit connection setup may or may not work depending on the SCTP implicit connection setup may or may not work depending on the SCTP
implementation. implementation.
8.8. sctp_recvmsg() 8.8. sctp_recvmsg()
This function is deprecated. This function is deprecated, sctp_recvv() should be used instead.
An implementation may provide a library function (or possibly system An implementation may provide a library function (or possibly system
call) to assist the user with the advanced features of SCTP. Note call) to assist the user with the advanced features of SCTP. Note
that in order for the sctp_sndrcvinfo structure to be filled in by that in order for the sctp_sndrcvinfo structure to be filled in by
sctp_recvmsg() the caller must enable the sctp_data_io_events with sctp_recvmsg() the caller must enable the sctp_data_io_events with
the SCTP_EVENTS option. Note that the setting of the the SCTP_EVENTS option. Note that the setting of the
SCTP_USE_EXT_RCVINFO will affect this function as well, causing the SCTP_USE_EXT_RCVINFO will affect this function as well, causing the
sctp_sndrcvinfo information to be extended. sctp_sndrcvinfo information to be extended.
The function prototype is The function prototype is
skipping to change at page 85, line 15 skipping to change at page 86, line 22
addrcnt: The number of addresses in the array. addrcnt: The number of addresses in the array.
id: An output parameter that if passed in as a non-NULL will return id: An output parameter that if passed in as a non-NULL will return
the association identification for the newly created association the association identification for the newly created association
(if successful). (if successful).
The call returns 0 on success or -1 if an error occurred. The The call returns 0 on success or -1 if an error occurred. The
variable errno is then set appropriately. variable errno is then set appropriately.
8.10. sctp_send() 8.10. sctp_send()
This function is deprecated. This function is deprecated, sctp_sendv() should be used instead.
An implementation may provide another alternative function or system An implementation may provide another alternative function or system
call to assist an application with the sending of data without the call to assist an application with the sending of data without the
use of the CMSG header structures. use of the CMSG header structures.
The function prototype is The function prototype is
ssize_t sctp_send(int sd, ssize_t sctp_send(int sd,
const void *msg, const void *msg,
size_t len, size_t len,
const struct sctp_sndrcvinfo *sinfo, const struct sctp_sndrcvinfo *sinfo,
int flags); int flags);
and the arguments are and the arguments are
sd: The socket descriptor. sd: The socket descriptor.
msg: The message to be sent. msg: The message to be sent.
len: The length of the message. len: The length of the message.
sinfo: A pointer to an sctp_sndrcvinfo structure used as described sinfo: A pointer to an sctp_sndrcvinfo structure used as described
in Section 5.2.2 for a sendmsg call. in Section 5.2.2 for a sendmsg() call.
flags: The same flags as used by the sendmsg() call flags (e.g. flags: The same flags as used by the sendmsg() call flags (e.g.
MSG_DONTROUTE). MSG_DONTROUTE).
The call returns the number of bytes sent, or -1 if an error The call returns the number of bytes sent, or -1 if an error
occurred. The variable errno is then set appropriately. occurred. The variable errno is then set appropriately.
This function call may also be used to terminate an association using This function call may also be used to terminate an association using
an association identification by setting the sinfo.sinfo_flags to an association identification by setting the sinfo.sinfo_flags to
SCTP_EOF and the sinfo.sinfo_assoc_id to the association that needs SCTP_EOF and the sinfo.sinfo_assoc_id to the association that needs
to be terminated. In such a case the len of the message would be to be terminated. In such a case the len of the message can be zero.
zero.
Using sctp_send() on a non-connected one-to-one style socket for Using sctp_send() on a non-connected one-to-one style socket for
implicit connection setup may or may not work depending on the SCTP implicit connection setup may or may not work depending on the SCTP
implementation. implementation.
Sending a message using sctp_send() is atomic unless explicit EOR Sending a message using sctp_send() is atomic unless explicit EOR
marking is enabled on the socket specified by sd. marking is enabled on the socket specified by sd.
8.11. sctp_sendx() 8.11. sctp_sendx()
This function is deprecated. This function is deprecated, sctp_sendv() should be used instead.
An implementation may provide another alternative function or system An implementation may provide another alternative function or system
call to assist an application with the sending of data without the call to assist an application with the sending of data without the
use of the CMSG header structures that also gives a list of use of the CMSG header structures that also gives a list of
addresses. The list of addresses is provided for implicit addresses. The list of addresses is provided for implicit
association setup. In such a case the list of addresses serves the association setup. In such a case the list of addresses serves the
same purpose as the addresses given in sctp_connectx() (see same purpose as the addresses given in sctp_connectx() (see
Section 8.9). Section 8.9).
The function prototype is The function prototype is
skipping to change at page 86, line 40 skipping to change at page 87, line 47
len: The length of the message. len: The length of the message.
addrs: is an array of addresses. addrs: is an array of addresses.
addrcnt: The number of addresses in the array. addrcnt: The number of addresses in the array.
sinfo: A pointer to a sctp_sndrcvinfo structure used as described in sinfo: A pointer to a sctp_sndrcvinfo structure used as described in
Section 5.2.2 for a sendmsg() call. Section 5.2.2 for a sendmsg() call.
flags: The same flags as used by the sendmsg() call flags (e.g. flags: The same flags as used by the sendmsg() call flags (e.g.
MSG_DONTROUTE). MSG_DONTROUTE).
The call returns the number of bytes sent, or -1 if an error The call returns the number of bytes sent, or -1 if an error
occurred. The variable errno is then set appropriately. occurred. The variable errno is then set appropriately.
Note that on return from this call the sinfo structure will have Note that in case of implicit connection setup, on return from this
changed in that the sinfo_assoc_id will be filled in with the new call the sinfo_assoc_id field of the sinfo structure will contain the
association id. new association id.
This function call may also be used to terminate an association using This function call may also be used to terminate an association using
an association identification by setting the sinfo.sinfo_flags to an association identification by setting the sinfo.sinfo_flags to
SCTP_EOF and the sinfo.sinfo_assoc_id to the association that needs SCTP_EOF and the sinfo.sinfo_assoc_id to the association that needs
to be terminated. In such a case the len of the message would be to be terminated. In such a case the len of the message would be
zero. zero.
Sending a message using sctp_send() is atomic unless explicit EOR Sending a message using sctp_send() is atomic unless explicit EOR
marking is enabled on the socket specified by sd. marking is enabled on the socket specified by sd.
Using sctp_sendx() on a non-connected one-to-one style socket for Using sctp_sendx() on a non-connected one-to-one style socket for
implicit connection setup may or may not work depending on the SCTP implicit connection setup may or may not work depending on the SCTP
implementation. implementation.
8.12. sctp_recvxxx() 8.12. sctp_recvv()
An implementation may provide a library function (or possibly system An implementation may provide a library function (or possibly system
call) to assist the user with the advanced features of SCTP. Note call) to assist the user with the advanced features of SCTP. Note
that in order for the sctp_recvinfo structure to be filled in by that in order for the sctp_recvinfo structure to be filled in by
sctp_recvxxx() the caller must set the SCTP_RECVRCVINFO and sctp_recvv() the caller must set the SCTP_RECVRCVINFO and
SCTP_RECVNXTINFO socket option. SCTP_RECVNXTINFO socket option.
The function prototype is The function prototype is
struct sctp_recvinfo { struct sctp_recvinfo {
uint16_t recv_version; uint16_t recv_version;
uint16_t recv_length; uint16_t recv_length;
uint32_t recv_flags;
struct sctp_rcvinfo recv_rcvinfo; struct sctp_rcvinfo recv_rcvinfo;
struct sctp_rcvinfo recv_nxtinfo; struct sctp_rcvinfo recv_nxtinfo;
}; };
ssize_t sctp_recvxxx(int sd, ssize_t sctp_recvv(int sd,
void *msg, const struct iovec *msg_iov,
size_t len, size_t msg_iovlen,
struct sockaddr *from, struct sockaddr *from,
socklen_t *fromlen socklen_t *fromlen
struct sctp_recvinfo *info struct sctp_recvinfo *info
int *msg_flags); int *msg_flags);
and the arguments are and the arguments are
sd: The socket descriptor. sd: The socket descriptor.
msg: The message buffer to be filled. msg_iov: The scatter buffer. Not more than one user message is
len: The length of the message buffer. provided.
msg_iovlen: The number of elements in msg_iov.
from: A pointer to an address to be filled with the sender of this from: A pointer to an address to be filled with the sender of this
messages address. message's address.
fromlen: An in/out parameter describing the from length. fromlen: An in/out parameter describing the from length.
info: A pointer to an sctp_recvinfo structure to be filled upon info: A pointer to an sctp_recvinfo structure to be filled upon
receipt of the message. receipt of the message. The recv_length field is the length of
the struct sctp_recvinfo. The recv_version for the structure as
defined in this document is 1. If the sctp_recvinfo is valid, the
recv_flags field indicates if the recv_rcvinfo or recv_rcvinfo is
valid. The recv_flags field holds a bit wise or of
SCTP_RECV_RCVINFO_VALID and SCTP_RECV_NXTINFO_VALID.
msg_flags: A pointer to an integer to be filled with any message msg_flags: A pointer to an integer to be filled with any message
flags (e.g. MSG_NOTIFICATION). Note that this field is an in-out flags (e.g. MSG_NOTIFICATION). Note that this field is an in-out
field. Options for the receive may also be passed into the value field. Options for the receive may also be passed into the value
(e.g. MSG_PEEK). On return from the call, the msg_flags value (e.g. MSG_PEEK). On return from the call, the msg_flags value
will be different than what was sent in to the call. If will be different than what was sent in to the call. If
implemented via a recvmsg() call, the msg_flags should only implemented via a recvmsg() call, the msg_flags should only
contain the value of the flags from the recvmsg() call. contain the value of the flags from the recvmsg() call.
The call returns the number of bytes received, or -1 if an error The call returns the number of bytes received, or -1 if an error
occurred. The variable errno is then set appropriately. occurred. The variable errno is then set appropriately.
8.13. sctp_sendxxx() 8.13. sctp_sendv()
An implementation may provide another alternative function or system An implementation may provide another alternative function or system
call to assist an application with the sending of data without the call to assist an application with the sending of data without the
use of the CMSG header structures that also gives a list of use of the CMSG header structures that also gives a list of
addresses. The list of addresses is provided for implicit addresses. The list of addresses is provided for implicit
association setup. In such a case the list of addresses serves the association setup. In such a case the list of addresses serves the
same purpose as the addresses given in sctp_connectx() (see same purpose as the addresses given in sctp_connectx() (see
Section 8.9). Section 8.9).
The function prototype is The function prototype is
struct sctp_sendinfo { struct sctp_sendinfo {
uint16_t send_version; uint16_t send_version;
uint16_t send_length; uint16_t send_length;
uint32_t send_flags;
struct sctp_sndinfo send_sndinfo; struct sctp_sndinfo send_sndinfo;
struct sctp_prinfo send_prinfo; struct sctp_prinfo send_prinfo;
struct sctp_authinfo send_authinfo; struct sctp_authinfo send_authinfo;
}; };
ssize_t sctp_sendxxx(int sd, ssize_t sctp_sendv(int sd,
const void *msg, const struct iovec *msg_iov,
size_t len, size_t msg_iovlen,
struct sockaddr *addrs, struct sockaddr *addrs,
int addrcnt, int addrcnt,
struct sctp_sendinfo *info, struct sctp_sendinfo *info,
int flags); int flags);
and the arguments are: and the arguments are:
sd: The socket descriptor. sd: The socket descriptor.
msg: The message to be sent. msg_iov: The gather buffer. It is treated as at most one single
len: The length of the message. user message.
msg_iovlen: The number of elements in msg_iov.
addrs: is an array of addresses. addrs: is an array of addresses.
addrcnt: The number of addresses in the array. addrcnt: The number of addresses in the array.
sinfo: A pointer to a sctp_sendinfo structure. info: A pointer to a sctp_sendinfo structure. The send_length field
is the length of the struct sctp_sendinfo. The send_version for
the structure as defined in this document is 1. If the
sctp_sendinfo is valid, the send_flags field indicates if the
send_sndinfo, send_prinfo or send_authinfo is valid. The
send_flags field holds a bit wise or of SCTP_SEND_SNDINFO_VALID,
SCTP_SEND_PRINFO_VALID and SCTP_SEND_AUTHINFO_VALID.
flags: The same flags as used by the sendmsg() call flags (e.g. flags: The same flags as used by the sendmsg() call flags (e.g.
MSG_DONTROUTE). MSG_DONTROUTE).
The call returns the number of bytes sent, or -1 if an error The call returns the number of bytes sent, or -1 if an error
occurred. The variable errno is then set appropriately. occurred. The variable errno is then set appropriately.
Note that on return from this call the sinfo structure will have Note that in case of implicit connection setup, on return from this
changed in that the send_sndinfo.snd_sid will be filled in with the call the send_sndinfo.snd_assoc_id will contain the new association
new association id. id.
This function call may also be used to terminate an association using This function call may also be used to terminate an association using
an association identification by setting the send_sndinfo.snd_flags an association identification by setting the send_sndinfo.snd_flags
to SCTP_EOF and the send_sndinfo.snd_sid to the association that to SCTP_EOF and the send_sndinfo.snd_sid to the association that
needs to be terminated. In such a case the len of the message would needs to be terminated. In such a case the len of the message would
be zero. be zero.
Sending a message using sctp_sendxxx() is atomic unless explicit EOR Sending a message using sctp_sendv() is atomic unless explicit EOR
marking is enabled on the socket specified by sd. marking is enabled on the socket specified by sd.
Using sctp_sendxxx() on a non-connected one-to-one style socket for Using sctp_sendv() on a non-connected one-to-one style socket for
implicit connection setup may or may not work depending on the SCTP implicit connection setup may or may not work depending on the SCTP
implementation. implementation.
9. IANA Considerations 9. IANA Considerations
This document requires no actions from IANA. This document requires no actions from IANA.
10. Security Considerations 10. Security Considerations
Many TCP and UDP implementations reserve port numbers below 1024 for Many TCP and UDP implementations reserve port numbers below 1024 for
 End of changes. 149 change blocks. 
256 lines changed or deleted 321 lines changed or added

This html diff was produced by rfcdiff 1.40. The latest version is available from http://tools.ietf.org/tools/rfcdiff/