draft-ietf-tsvwg-sctpsocket-21.txt   draft-ietf-tsvwg-sctpsocket-22.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: August 5, 2010 Sun Microsystems, Inc. Expires: September 8, 2010 Sun Microsystems, Inc.
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.
February 1, 2010 March 7, 2010
Sockets API Extensions for Stream Control Transmission Protocol (SCTP) Sockets API Extensions for Stream Control Transmission Protocol (SCTP)
draft-ietf-tsvwg-sctpsocket-21.txt draft-ietf-tsvwg-sctpsocket-22.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 46 skipping to change at page 1, line 46
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."
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt. http://www.ietf.org/ietf/1id-abstracts.txt.
The list of Internet-Draft Shadow Directories can be accessed at The list of Internet-Draft Shadow Directories can be accessed at
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
This Internet-Draft will expire on August 5, 2010. This Internet-Draft will expire on September 8, 2010.
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
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
skipping to change at page 3, line 21 skipping to change at page 3, line 21
3.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 8 3.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 9 3.1.2. bind() . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.3. listen() . . . . . . . . . . . . . . . . . . . . . . . 10
3.1.4. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 10 3.1.4. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 10
3.1.5. close() . . . . . . . . . . . . . . . . . . . . . . . 12 3.1.5. close() . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.6. connect() . . . . . . . . . . . . . . . . . . . . . . 13 3.1.6. connect() . . . . . . . . . . . . . . . . . . . . . . 13
3.2. Implicit Association Setup . . . . . . . . . . . . . . . . 13 3.2. Implicit Association Setup . . . . . . . . . . . . . . . . 13
3.3. Non-blocking mode . . . . . . . . . . . . . . . . . . . . 14 3.3. Non-blocking mode . . . . . . . . . . . . . . . . . . . . 14
3.4. Special considerations . . . . . . . . . . . . . . . . . . 15 3.4. Special considerations . . . . . . . . . . . . . . . . . . 15
4. One-to-One Style Interface . . . . . . . . . . . . . . . . . . 16 4. One-to-One Style Interface . . . . . . . . . . . . . . . . . . 16
4.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 17 4.1. Basic Operation . . . . . . . . . . . . . . . . . . . . . 16
4.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 17 4.1.1. socket() . . . . . . . . . . . . . . . . . . . . . . . 17
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() . . . . . . . . . . . . . . . . . . . . . . . 19
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() . . . . . . . . . . . . . . . . . . . . . . 21
4.1.8. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 22 4.1.8. sendmsg() and recvmsg() . . . . . . . . . . . . . . . 22
4.1.9. getpeername() . . . . . . . . . . . . . . . . . . . . 22 4.1.9. getpeername() . . . . . . . . . . . . . . . . . . . . 22
5. Data Structures . . . . . . . . . . . . . . . . . . . . . . . 23 5. Data Structures . . . . . . . . . . . . . . . . . . . . . . . 23
skipping to change at page 3, line 47 skipping to change at page 3, line 47
(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) . . . . 29
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) . . . . . . . . . . . . . . . . . . . . 32
5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO) . . . 32 5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO) . . . 32
5.2.8. SCTP AUTH Information Structure (SCTP_AUTHINFO) . . . 33 5.2.8. SCTP AUTH Information Structure (SCTP_AUTHINFO) . . . 33
5.3. SCTP Events and Notifications . . . . . . . . . . . . . . 33 5.3. SCTP Events and Notifications . . . . . . . . . . . . . . 33
5.3.1. SCTP Notification Structure . . . . . . . . . . . . . 34 5.3.1. SCTP Notification Structure . . . . . . . . . . . . . 34
5.3.2. SCTP_ASSOC_CHANGE . . . . . . . . . . . . . . . . . . 35 5.3.2. SCTP_ASSOC_CHANGE . . . . . . . . . . . . . . . . . . 35
5.3.3. SCTP_PEER_ADDR_CHANGE . . . . . . . . . . . . . . . . 36 5.3.3. SCTP_PEER_ADDR_CHANGE . . . . . . . . . . . . . . . . 37
5.3.4. SCTP_REMOTE_ERROR . . . . . . . . . . . . . . . . . . 37 5.3.4. SCTP_REMOTE_ERROR . . . . . . . . . . . . . . . . . . 38
5.3.5. SCTP_SEND_FAILED . . . . . . . . . . . . . . . . . . . 38 5.3.5. SCTP_SEND_FAILED . . . . . . . . . . . . . . . . . . . 38
5.3.6. SCTP_SHUTDOWN_EVENT . . . . . . . . . . . . . . . . . 39 5.3.6. SCTP_SHUTDOWN_EVENT . . . . . . . . . . . . . . . . . 39
5.3.7. SCTP_ADAPTATION_INDICATION . . . . . . . . . . . . . . 40 5.3.7. SCTP_ADAPTATION_INDICATION . . . . . . . . . . . . . . 40
5.3.8. SCTP_PARTIAL_DELIVERY_EVENT . . . . . . . . . . . . . 40 5.3.8. SCTP_PARTIAL_DELIVERY_EVENT . . . . . . . . . . . . . 41
5.3.9. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 41 5.3.9. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 41
5.3.10. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 42 5.3.10. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 42
5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . . 43 5.3.11. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . . 43
5.4. Ancillary Data Considerations and Semantics . . . . . . . 43 5.4. Ancillary Data Considerations and Semantics . . . . . . . 43
5.4.1. Multiple Items and Ordering . . . . . . . . . . . . . 43 5.4.1. Multiple Items and Ordering . . . . . . . . . . . . . 43
5.4.2. Accessing and Manipulating Ancillary Data . . . . . . 43 5.4.2. Accessing and Manipulating Ancillary Data . . . . . . 43
5.4.3. Control Message Buffer Sizing . . . . . . . . . . . . 44 5.4.3. Control Message Buffer Sizing . . . . . . . . . . . . 44
6. Common Operations for Both Styles . . . . . . . . . . . . . . 45 6. Common Operations for Both Styles . . . . . . . . . . . . . . 45
6.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . . 45 6.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . . 45
6.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 47 6.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 47
6.3. read() and write() . . . . . . . . . . . . . . . . . . . . 48 6.3. read() and write() . . . . . . . . . . . . . . . . . . . . 48
6.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 48 6.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 48
7. Socket Options . . . . . . . . . . . . . . . . . . . . . . . . 48 7. Socket Options . . . . . . . . . . . . . . . . . . . . . . . . 49
7.1. Read / Write Options . . . . . . . . . . . . . . . . . . . 50 7.1. Read / Write Options . . . . . . . . . . . . . . . . . . . 50
7.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . . 50 7.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . . 50
7.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 51 7.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 51
7.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . . 52 7.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . . 53
7.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 53 7.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 53
7.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . 53 7.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . 53
7.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 53 7.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 54
7.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 54 7.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 54
7.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . . 54 7.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . . 54
7.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 54 7.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 54
7.1.10. Set Adaptation Layer Indicator 7.1.10. Set Adaptation Layer Indicator
(SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 55 (SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 55
7.1.11. Enable/Disable Message Fragmentation 7.1.11. Enable/Disable Message Fragmentation
(SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . . 55 (SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . . 55
7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 55 7.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 55
7.1.13. Set Default Send Parameters 7.1.13. Set Default Send Parameters
(SCTP_DEFAULT_SEND_PARAM) . . . . . . . . . . . . . . 58 (SCTP_DEFAULT_SEND_PARAM) . . . . . . . . . . . . . . 58
skipping to change at page 5, line 28 skipping to change at page 5, line 28
7.2.6. Get the Current Identifiers of Associations 7.2.6. Get the Current Identifiers of Associations
(SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . . 68 (SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . . 68
7.3. Write-Only Options . . . . . . . . . . . . . . . . . . . . 69 7.3. Write-Only Options . . . . . . . . . . . . . . . . . . . . 69
7.3.1. Set Peer Primary Address 7.3.1. Set Peer Primary Address
(SCTP_SET_PEER_PRIMARY_ADDR) . . . . . . . . . . . . . 69 (SCTP_SET_PEER_PRIMARY_ADDR) . . . . . . . . . . . . . 69
7.3.2. Add a Chunk That Must Be Authenticated 7.3.2. Add a Chunk That Must Be Authenticated
(SCTP_AUTH_CHUNK) . . . . . . . . . . . . . . . . . . 69 (SCTP_AUTH_CHUNK) . . . . . . . . . . . . . . . . . . 69
7.3.3. Set a Shared Key (SCTP_AUTH_KEY) . . . . . . . . . . . 70 7.3.3. Set a Shared Key (SCTP_AUTH_KEY) . . . . . . . . . . . 70
7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY) . . 70 7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY) . . 70
7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY) . . . . . . 71 7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY) . . . . . . 71
7.4. Ancillary Data and Notification Interest Options . . . . . 72 7.4. Ancillary Data and Notification Interest Options . . . . . 71
8. New Functions . . . . . . . . . . . . . . . . . . . . . . . . 75 8. New Functions . . . . . . . . . . . . . . . . . . . . . . . . 74
8.1. sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 75 8.1. sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 75
8.2. sctp_peeloff() . . . . . . . . . . . . . . . . . . . . . . 76 8.2. sctp_peeloff() . . . . . . . . . . . . . . . . . . . . . . 76
8.3. sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 77 8.3. sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 77
8.4. sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 77 8.4. sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 77
8.5. sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 78 8.5. sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 78
8.6. sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 78 8.6. sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 78
8.7. sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 79 8.7. sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 78
8.8. sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 79 8.8. sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 79
8.9. sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 80 8.9. sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 80
8.10. sctp_send() . . . . . . . . . . . . . . . . . . . . . . . 81 8.10. sctp_send() . . . . . . . . . . . . . . . . . . . . . . . 81
8.11. sctp_sendx() . . . . . . . . . . . . . . . . . . . . . . . 82 8.11. sctp_sendx() . . . . . . . . . . . . . . . . . . . . . . . 82
8.12. sctp_getaddrlen() . . . . . . . . . . . . . . . . . . . . 83 8.12. sctp_getaddrlen() . . . . . . . . . . . . . . . . . . . . 83
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 83 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 83
10. Security Considerations . . . . . . . . . . . . . . . . . . . 83 10. Security Considerations . . . . . . . . . . . . . . . . . . . 83
11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 84
12. Normative References . . . . . . . . . . . . . . . . . . . . . 84 12. Normative References . . . . . . . . . . . . . . . . . . . . . 84
Appendix A. One-to-One Style Code Example . . . . . . . . . . . . 85 Appendix A. One-to-One Style Code Example . . . . . . . . . . . . 85
skipping to change at page 6, line 38 skipping to change at page 6, line 38
connection-oriented in nature, and it does not support broadcast connection-oriented in nature, and it does not support broadcast
or multicast communications, as UDP does. or multicast communications, as UDP does.
3. Support a one-to-one style interface: This interface supports a 3. Support a one-to-one style interface: This interface supports a
similar semantics as sockets for connection-oriented protocols, similar semantics as sockets for connection-oriented protocols,
such as TCP. A one-to-one style SCTP socket should only control such as TCP. A one-to-one style SCTP socket should only control
one SCTP association. One purpose of defining this interface is one SCTP association. One purpose of defining this interface is
to allow existing applications built on other connection-oriented to allow existing applications built on other connection-oriented
protocols be ported to use SCTP with very little effort. And protocols be ported to use SCTP with very little effort. And
developers familiar with those semantics can easily adapt to developers familiar with those semantics can easily adapt to
SCTP. Another purpose is to make sure that existing mechanisms SCTP. Another purpose is to make sure that existing mechanisms
in most operating systems to deal with socket, such as select(), in most operating systems dealing with sockets, such as select(),
should continue to work with this style of socket. Extensions should continue to work with this style of socket. Extensions
are added to this mapping to provide mechanisms to exploit new are added to this mapping to provide mechanisms to exploit new
features of SCTP. features of SCTP.
Goals 2 and 3 are not compatible, so in this document we define two Goals 2 and 3 are not compatible, so in this document we define two
modes of mapping, namely the one-to-many style mapping and the one- modes of mapping, namely the one-to-many style mapping and the one-
to-one style mapping. These two modes share some common data to-one style mapping. These two modes share some common data
structures and operations, but will require the use of two different structures and operations, but will require the use of two different
application programming styles. Note that all new SCTP features can application programming styles. Note that all new SCTP features can
be used with both styles of socket. The decision on which one to use be used with both styles of socket. The decision on which one to use
skipping to change at page 9, line 12 skipping to change at page 9, line 12
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.
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 the SCTP Applications use bind() to specify which local address and port the
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
this, sctp_bindx() is introduced in Section 8.1 to help applications this, sctp_bindx() is introduced in Section 8.1 to help applications
do the job of associating multiple addresses. do the job of associating multiple addresses. But note that an
endpoint can only be associated with one local port.
These addresses associated with a socket are the eligible transport These addresses associated with a socket are the eligible transport
addresses for the endpoint to send and receive data. The endpoint addresses for the endpoint to send and receive data. The endpoint
will also present these addresses to its peers during the association will also present these addresses to its peers during the association
initialization process, see [RFC4960]. initialization process, see [RFC4960].
After calling bind(), if the endpoint wishes to accept new After calling bind(), if the endpoint wishes to accept new
associations on the socket, it must call listen() (see associations on the socket, it must call listen() (see
Section 3.1.3). Section 3.1.3).
The function prototype of bind() is The function prototype of bind() is
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 or struct addr: The address structure (struct sockaddr_in for an IPv4 address
sockaddr_in6, 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 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 addr is specified as a wildcard (INADDR_ANY for an IPv4 address, If the IP address part of addr is specified as a wildcard (INADDR_ANY
or as IN6ADDR_ANY_INIT or in6addr_any for an IPv6 address), the for an IPv4 address, or as IN6ADDR_ANY_INIT or in6addr_any for an
operating system will associate the endpoint with an optimal address IPv6 address), the operating system will associate the endpoint with
set of the available interfaces. 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
choose an ephemeral port for the endpoint.
If a bind() is not called prior to a sendmsg() call that initiates a If a bind() is not called prior to a sendmsg() call that initiates a
new association, the system picks an ephemeral port and will choose new association, the system picks an ephemeral port and will choose
an address set equivalent to binding with a wildcard address. One of an address set equivalent to binding with a wildcard address. One of
those addresses will be the primary address for the association. those addresses will be the primary address for the association.
This automatically enables the multi-homing capability of SCTP. This automatically enables the multi-homing capability of SCTP.
3.1.3. listen() 3.1.3. listen()
By default, new associations are not accepted for one-to-many style By default, a one-to-many style socket does not accept new
sockets. An application uses listen() to mark a socket as being able association requests. An application uses listen() to mark a socket
to accept new associations. as being able to accept new 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 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.
skipping to change at page 11, line 20 skipping to change at page 11, line 23
ssize_t recvmsg(int sd, ssize_t recvmsg(int sd,
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.
As we will see in Section 5, along with the user data, the ancillary As described in Section 5, different types of ancillary data can be
data field is used to carry the sctp_sndrcvinfo and/or the sent and received along with user data. When sending, the ancillary
sctp_initmsg structures to perform various SCTP functions including data is used to specify the sent behavior, such as the SCTP stream
specifying options for sending each user message. Those options, number to use. When receiving, the ancillary data is used to
depending on whether sending or receiving, include stream number, describe the received data, such as the SCTP stream sequence number
stream sequence number, various flags, context and payload protocol of the message.
Id, etc.
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 association existing 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 3.2 for more on implicit association setup). If an SCTP_INIT Section 3.2 for more on implicit association setup). If sendmsg() is
cmsg structure is used with NULL data, an association will be called with no data and there is no existing assocation, a new one
established using the parameters from the struct sctp_initmsg will be established. The SCTP_INIT type ancillary data can be used
structure. If no SCTP_INIT cmsg structure is used in combination to change some of the parameters used to set up a new association.
with NULL data, an association is established using the default If sendmsg() is called with NULL data, and there is no existing
parameters. If NULL data is used, no association exists and the association but the SCTP_ABORT or SCTP_EOF flags are set, then -1 is
SCTP_ABORT or SCTP_EOF flags are present, then -1 must be returned retured and errno is set to EINVAL. Sending a message using
and an errno should be set to something like EDONOTBESTUPID. Sending sendmsg() is atomic unless explicit EOR marking is enabled on the
a message using sendmsg() is atomic unless explicit EOR marking is socket specified by sd (see Section 7.1.26).
enabled on the socket specified by sd.
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
skipping to change at page 13, line 24 skipping to change at page 13, line 24
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 (either struct sockaddr_in or struct nam: The address structure (struct sockaddr_in for an IPv4 address
sockaddr_in6 defined in [RFC3493]). or struct sockaddr_in6 for an IPv6 address, see [RFC3493]).
len: The size of the address. len: The size of the address.
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.
3.2. Implicit Association Setup 3.2. Implicit Association Setup
Implicit association setup applies only to one-to-many style sockets. Implicit association setup applies only to one-to-many style sockets.
For one-to-one style sockets implicit association setup must not be For one-to-one style sockets implicit association setup must not be
skipping to change at page 14, line 12 skipping to change at page 14, line 12
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, it first When the SCTP stack sets up a new association implicitly, the
consults the sctp_initmsg structure, which is passed along within the SCTP_INIT type ancillary data may also be passed along (see
ancillary data in the sendmsg() call (see Section 5.2.1 for details Section 5.2.1 for details of the data structures) to change some
of the data structures), for any special options to be used on the parameters used in setting up new association.
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()/recv() Implicit association setup cannot be initiated by send() calls.
calls.
3.3. Non-blocking mode 3.3. Non-blocking mode
Some SCTP users might want to avoid blocking when they call socket Some SCTP users might want to avoid blocking when they call socket
interface function. interface function.
Once all bind() calls are complete on a one-to-many style socket, the Once a bind() and/or subsequent sctp_bindx() calls are complete on a
application must set the non-blocking option by a fcntl() (such as one-to-many style socket, an application may set the non-blocking
O_NONBLOCK), after which the sendmsg() function returns immediately, option by a fcntl() (such as O_NONBLOCK). After setting the socket
and the success or failure of the data message (and possible to non-blocking mode, the sendmsg() function returns immediately.
SCTP_INITMSG parameters) will be signaled by the SCTP_ASSOC_CHANGE The success or failure of sending the data message (with possible
event with SCTP_COMM_UP or CANT_START_ASSOC. If user data could not SCTP_INITMSG ancillary data) will be signaled by the
be sent (due to a CANT_START_ASSOC), the sender will also receive an SCTP_ASSOC_CHANGE event with SCTP_COMM_UP or CANT_START_ASSOC. If
SCTP_SEND_FAILED event. Events can be received by the user calling user data could not be sent (due to a CANT_START_ASSOC), the sender
recvmsg(). A server (having called listen()) is also notified of an will also receive an SCTP_SEND_FAILED event. Events can be received
association up event by the reception of an SCTP_ASSOC_CHANGE with by the user calling recvmsg(). A server (having called listen()) is
SCTP_COMM_UP via the calling of recvmsg() and possibly the reception also notified of an association up event by the reception of an
of the first data message. SCTP_ASSOC_CHANGE with SCTP_COMM_UP via the calling of recvmsg() and
possibly the reception of the first data message.
In order to shutdown the association gracefully, the user must call In order to shutdown the association gracefully, the user must call
sendmsg() with no data and with the SCTP_EOF flag set. The function sendmsg() with no data and with the SCTP_EOF flag set. The function
returns immediately, and completion of the graceful shutdown is returns immediately, and completion of the graceful shutdown is
indicated by an SCTP_ASSOC_CHANGE notification of type indicated by an SCTP_ASSOC_CHANGE notification of type
SHUTDOWN_COMPLETE (see Section 5.3.2). Note that this can also be SHUTDOWN_COMPLETE (see Section 5.3.2). Note that this can also be
done using the sctp_send() call described in Section 8.10. done using the sctp_send() call described in Section 8.10.
An application is recommended to use caution when using select() (or An application is recommended to use caution when using select() (or
poll()) for writing on a one-to-many style socket. The reason being poll()) for writing on a one-to-many style socket. The reason being
skipping to change at page 15, line 33 skipping to change at page 15, line 31
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.
An important feature that SCTP shares with TCP is flow control: An important feature that SCTP shares with TCP is flow control.
specifically, a sender may not send data faster than the receiver can Specifically, a sender may not send data faster than the receiver can
consume it. consume it.
For TCP, flow control is typically provided for in the sockets API as For TCP, flow control is typically provided for in the sockets API as
follows. If the reader stops reading, the sender queues messages in follows. If the reader stops reading, the sender queues messages in
the socket layer until it uses all of its socket buffer space the socket layer until it uses all of its socket buffer space
allocation creating a "stalled connection". Further attempts to allocation creating a "stalled connection". Further attempts to
write to the socket will block or return the error EAGAIN or write to the socket will block or return the error EAGAIN or
EWOULDBLOCK for a non-blocking socket. At some point, either the EWOULDBLOCK for a non-blocking socket. At some point, either the
connection is closed, or the receiver begins to read again freeing connection is closed, or the receiver begins to read again freeing
space in the output queue. space in the output queue.
skipping to change at page 16, line 47 skipping to change at page 16, line 46
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.
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. Also note that some socket interfaces may not be see Section 4.1.8.
able to bundle DATA chunks with the COOKIE chunk when using this
interface style.
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()
o bind() o bind()
o listen() o listen()
o accept() o accept()
The accept() call blocks until a new association is set up. It The accept() call blocks until a new association is set up. It
returns with a new socket descriptor. The server then uses the new returns with a new socket descriptor. The server then uses the new
socket descriptor to communicate with the client, using recv() and socket descriptor to communicate with the client, using recv() and
send() calls to get requests and send back responses. send() calls to get requests and send back responses.
skipping to change at page 17, line 28 skipping to change at page 17, line 24
Then it calls Then it calls
o close() o close()
to terminate the association. to terminate the association.
A typical client uses the following system call sequence to setup an A typical client uses the following system call sequence to setup an
association with a server to request services: association with a server to request services:
o socket() o socket()
o connect() o connect()
After returning from connect(), the client uses send() and recv() After returning from connect(), the client uses send()/sendmsg() and
calls to send out requests and receive responses from the server. recv()/recvmsg() calls to send out requests and receive responses
from the server.
The client calls The client calls
o close() o close()
to terminate this association when done. to terminate this association when done.
4.1.1. socket() 4.1.1. socket()
Applications call socket() to create a socket descriptor to represent Applications call socket() to create a socket descriptor to represent
an SCTP endpoint. an SCTP endpoint.
skipping to change at page 18, line 9 skipping to change at page 18, line 7
Here, SOCK_STREAM indicates the creation of a one-to-one style Here, SOCK_STREAM indicates the creation of a one-to-one style
socket. socket.
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.
4.1.2. bind() 4.1.2. bind()
Applications use bind() to pass an address to be associated with an Applications use bind() to specify which local address and port the
SCTP endpoint to the system. bind() allows only either a single SCTP endpoint should associate itself with.
address or a IPv4 or IPv6 wildcard address to be bound. An SCTP
endpoint can be associated with multiple addresses. To do this, An SCTP endpoint can be associated with multiple addresses. To do
sctp_bindx() is introduced in Section 8.1 to help applications do the this, sctp_bindx() is introduced in Section 8.1 to help applications
job of associating multiple addresses. do the job of associating multiple addresses. But note that an
endpoint can only be associated with one local port.
These addresses associated with a socket are the eligible transport These addresses associated with a socket are the eligible transport
addresses for the endpoint to send and receive data. The endpoint addresses for the endpoint to send and receive data. The endpoint
will also present these addresses to its peers during the association will also present these addresses to its peers during the association
initialization process, see [RFC4960]. initialization process, see [RFC4960].
The function prototype of bind() is The function prototype of bind() is
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 or struct addr: The address structure (struct sockaddr_in for an IPv4 address
sockaddr_in6, 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.
Otherwise, i.e., the sd is an IPv6 socket, the address passed can If the sd is an IPv6 socket, the address passed can either be an IPv4
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 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 addr is specified as a wildcard (INADDR_ANY for an IPv4 address, If the IP address part of addr is specified as a wildcard (INADDR_ANY
or as IN6ADDR_ANY_INIT or in6addr_any for an IPv6 address), the for an IPv4 address, or as IN6ADDR_ANY_INIT or in6addr_any for an
operating system will associate the endpoint with an optimal address IPv6 address), the operating system will associate the endpoint with
set of the available interfaces. 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
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 those addresses will be the binding with a wildcard address. One of those 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 ready 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,
skipping to change at page 19, line 45 skipping to change at page 19, line 45
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, will contain the primary address of the peer addr: On return, addr (struct sockaddr_in for an IPv4 address or
endpoint. struct sockaddr_in6 for an IPv6 address, see [RFC3493]) will
addrlen: On return, will contain the size of addr. contain the primary address of the peer endpoint.
addrlen: On return, addrlen will contain the size of addr.
The functions returns the socket descriptor for the newly formed The functions returns the socket descriptor for the newly formed
association. association.
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);
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 address. addr: The peer's (struct sockaddr_in for an IPv4 address or struct
sockaddr_in6 for an IPv6 address, see [RFC3493]) address.
addrlen: The size of the address. addrlen: The size of the address.
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].
By default, the new association created has only one outbound stream. The number of outbound streams the new association has is stack
The SCTP_INITMSG option described in Section 7.1.3 should be used dependent. Applications can use the SCTP_INITMSG option described in
before connecting to change the number of outbound streams. Section 7.1.3 should be used before connecting to change the number
of outbound 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 those addresses will be the primary address for respectively. One of those 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 SCTP_INIT type sendmsg() to initiate an association without can use sendmsg() with SCTP_INIT type ancillary data to initiate an
doing the setsockopt(). Note that some sockets implementations may association without doing the setsockopt(). Note that the implicit
not support the sending of data to initiate an association with the setup is supported for the one-to-many style sockets.
one-to-one style (implementations that do not support T/TCP normally
have this restriction).
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.
skipping to change at page 21, line 48 skipping to change at page 21, line 48
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.
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.
so that the caller can receive back any data SCTP was unable to This allows the caller to receive back any data which SCTP is unable
deliver (see Section 5.3.5 for more information). to deliver (see Section 5.3.5 for more information) and receive event
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
skipping to change at page 24, line 15 skipping to change at page 24, line 15
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.
5.2. SCTP msg_control Structures 5.2. SCTP msg_control Structures
A key element of all SCTP-specific socket extensions is the use of A key element of all SCTP specific socket extensions is the use of
ancillary data to specify and access SCTP-specific data via the ancillary data to specify and access SCTP specific data via the
struct msghdr's msg_control member used in sendmsg() and recvmsg(). struct msghdr's msg_control member used in sendmsg() and recvmsg().
Fine-grained control over initialization and sending parameters are Fine-grained control over initialization and sending parameters are
handled with ancillary data. handled with ancillary data.
Each ancillary data item is proceeded by a struct cmsghdr (see Each ancillary data item is proceeded by a struct cmsghdr (see
Section 5.1), which defines the function and purpose of the data Section 5.1), which defines the function and purpose of the data
contained in the cmsg_data[] member. contained in the cmsg_data[] member.
By default on either style socket, SCTP will pass no ancillary data; By default on either style socket, SCTP will pass no ancillary data;
Specific ancillary data items can be enabled with socket options Specific ancillary data items can be enabled with socket options
skipping to change at page 28, line 12 skipping to change at page 28, line 12
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
information about a received message via recvmsg(). Note that this information about a received message via recvmsg(). Note that this
structure is an extended version of SCTP_SNDRCV (see Section 5.2.2) structure is an extended version of SCTP_SNDRCV (see Section 5.2.2)
and will only be received if the user has set the socket option and will only be received if the user has set the socket option
SCTP_USE_EXT_RCVINFO to true in addition to any event subscription SCTP_USE_EXT_RCVINFO to true in addition to any event subscription
needed to receive ancillary data. Note that next message data is not needed to receive ancillary data. See Section 7.1.22 on this socket
valid unless the current message is completely read, i.e. the MSG_EOR option. Note that next message data is not valid unless the current
is set, in other words if you have more data to read from the current message is completely read, i.e. the MSG_EOR is set, in other words
message then no next message information will be available. if the application has more data to read from the current message
then no next message information will be available.
SCTP_NXTINFO described in Section 5.2.6 should be used when possible, SCTP_NXTINFO described in Section 5.2.6 should be used when possible,
since SCTP_EXTRCV is considered deprecated. since SCTP_EXTRCV is considered deprecated.
+--------------+-------------+------------------------+ +--------------+-------------+------------------------+
| cmsg_level | cmsg_type | cmsg_data[] | | cmsg_level | cmsg_type | cmsg_data[] |
+--------------+-------------+------------------------+ +--------------+-------------+------------------------+
| IPPROTO_SCTP | SCTP_EXTRCV | struct sctp_extrcvinfo | | IPPROTO_SCTP | SCTP_EXTRCV | struct sctp_extrcvinfo |
+--------------+-------------+------------------------+ +--------------+-------------+------------------------+
skipping to change at page 31, line 10 skipping to change at page 31, line 17
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_sndinfo item always corresponds to the data in msg_iov. An sctp_sndinfo item always corresponds to the data in msg_iov.
5.2.5. SCTP Receive Information Structure (SCTP_RCVINFO) 5.2.5. SCTP Receive Information Structure (SCTP_RCVINFO)
This cmsghdr structure describes SCTP header information about a This cmsghdr structure describes SCTP header information about a
received message through recvmsg(). received message through recvmsg().
To receive this information you must subscribe to the SCTP_RCV_EVENT To receive this information an application must subscribe to the
using the SCTP_EVENT option. SCTP_RCV_EVENT using the SCTP_EVENT option (see Section 5.4.
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
| cmsg_level | cmsg_type | cmsg_data[] | | cmsg_level | cmsg_type | cmsg_data[] |
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
| IPPROTO_SCTP | SCTP_RCVINFO | struct sctp_rcvinfo | | IPPROTO_SCTP | SCTP_RCVINFO | struct sctp_rcvinfo |
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
Here is the definition of the sctp_rcvinfo structure: Here is the definition of the sctp_rcvinfo structure:
struct sctp_rcvinfo { struct sctp_rcvinfo {
skipping to change at page 32, line 21 skipping to change at page 32, line 28
A sctp_rcvinfo item always corresponds to the data in msg_iov. A 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 available. It uses the same structure as the SCTP Receive is available. It uses the same structure as the SCTP Receive
Information Structure. Information Structure.
To receive this information you must subscribe to the SCTP_NXT_EVENT To receive this information an application must subscribe to the
using the SCTP_EVENT option. SCTP_NXT_EVENT using the SCTP_EVENT option (see Section 5.4).
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
| cmsg_level | cmsg_type | cmsg_data[] | | cmsg_level | cmsg_type | cmsg_data[] |
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
| IPPROTO_SCTP | SCTP_NXTINFO | struct sctp_rcvinfo | | IPPROTO_SCTP | SCTP_NXTINFO | struct sctp_rcvinfo |
+--------------+--------------+---------------------+ +--------------+--------------+---------------------+
5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO) 5.2.7. SCTP PR-SCTP Information Structure (SCTP_PRINFO)
This cmsghdr structure specifies SCTP options for sendmsg(). This cmsghdr structure specifies SCTP options for sendmsg().
skipping to change at page 33, line 32 skipping to change at page 33, line 36
Here is the definition of the sctp_authinfo structure: Here is the definition of the sctp_authinfo structure:
struct sctp_authinfo { struct sctp_authinfo {
uint16_t auth_keyid; uint16_t auth_keyid;
}; };
auth_keyid: This specifies the shared key identifier used for auth_keyid: This specifies the shared key identifier used for
sending the user message. sending the user message.
An sctp_authinfo item always corresponds to the data in msg_iov. An sctp_authinfo item always corresponds to the data in msg_iov.
Please note that the SCTP implementation must not bundle user
messages which should be authenticated using different shared key
identifiers.
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 36, line 43 skipping to change at page 37, line 4
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 features that the current association may contain an array of features that the current association
supports. Features may include supports. Features may include
SCTP_PR: Both endpoints support the protocol extension described SCTP_PR: Both endpoints support the protocol extension described
in [RFC3758]. in [RFC3758].
SCTP_AUTH: Both endpoints support the protocol extension SCTP_AUTH: Both endpoints support the protocol extension
described in [RFC4895]. described in [RFC4895].
SCTP_ASCONF: Both endpoints support the protocol extension SCTP_ASCONF: Both endpoints support the protocol extension
described in [RFC5061]. described in [RFC5061].
SCTP_MULTIBUF: For a one-to-many style socket, the local SCTP_MULTIBUF: For a one-to-many style socket, the local
endpoints use separate send and/or receive buffers for each endpoints use separate send and/or receive buffers for each
SCTP association. SCTP association.
5.3.3. SCTP_PEER_ADDR_CHANGE 5.3.3. SCTP_PEER_ADDR_CHANGE
When a destination address of a multi-homed peer encounters a change When a destination address of a multi-homed peer encounters a state
a peer address change event is sent. The information has the change a peer address change event is sent. The notification has the
following structure: following format:
struct sctp_paddr_change { struct sctp_paddr_change {
uint16_t spc_type; uint16_t spc_type;
uint16_t spc_flags; uint16_t spc_flags;
uint32_t spc_length; uint32_t spc_length;
struct sockaddr_storage spc_aaddr; struct sockaddr_storage spc_aaddr;
uint32_t spc_state; uint32_t spc_state;
uint32_t spc_error; uint32_t spc_error;
sctp_assoc_t spc_assoc_id; sctp_assoc_t spc_assoc_id;
} }
skipping to change at page 37, line 49 skipping to change at page 38, line 12
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.4. SCTP_REMOTE_ERROR 5.3.4. SCTP_REMOTE_ERROR
A remote peer may send an Operational Error message to its peer. A remote peer may send an Operational Error message to its peer.
This message indicates a variety of error conditions on an This message indicates a variety of error conditions on an
association. The entire ERROR chunk as it appears on the wire is association. The entire ERROR chunk as it appears on the wire is
included in an SCTP_REMOTE_ERROR event. Please refer to the SCTP included in an SCTP_REMOTE_ERROR event. Please refer to the SCTP
specification [RFC4960] and any extensions for a list of possible specification [RFC4960] and any extensions for a list of possible
error formats. SCTP error notifications have the format: error formats. An SCTP error notification has the following format:
struct sctp_remote_error { struct sctp_remote_error {
uint16_t sre_type; uint16_t sre_type;
uint16_t sre_flags; uint16_t sre_flags;
uint32_t sre_length; uint32_t sre_length;
uint16_t sre_error; uint16_t sre_error;
sctp_assoc_t sre_assoc_id; sctp_assoc_t sre_assoc_id;
uint8_t sre_data[]; uint8_t sre_data[];
}; };
skipping to change at page 38, line 29 skipping to change at page 38, line 38
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
If SCTP cannot deliver a message it may return the message as a If SCTP cannot deliver a message, it can return back the message as a
notification. notification if the SCTP_SEND_FAILED event is enabled. The
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;
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[];
}; };
skipping to change at page 41, line 21 skipping to change at page 41, line 26
uint32_t pdapi_seq; uint32_t pdapi_seq;
sctp_assoc_t pdapi_assoc_id; sctp_assoc_t pdapi_assoc_id;
}; };
pdapi_type: It should be SCTP_PARTIAL_DELIVERY_EVENT. pdapi_type: It should be SCTP_PARTIAL_DELIVERY_EVENT.
pdapi_flags: Currently unused. pdapi_flags: Currently unused.
pdapi_length: This field is the total length of the notification pdapi_length: This field is the total length of the notification
data, including the notification header. It will generally be data, including the notification header. It will generally be
sizeof(struct sctp_pdapi_event). sizeof(struct sctp_pdapi_event).
pdapi_indication: This field holds the indication being sent to the pdapi_indication: This field holds the indication being sent to the
application. Possible values include: application. Currently there is only one defined value:
SCTP_PARTIAL_DELIVERY_ABORTED: This notification indicates that SCTP_PARTIAL_DELIVERY_ABORTED: This indicates that the partial
the partial delivery of a user message has been aborted. delivery of a user message has been aborted.
pdapi_stream: This field holds the stream on which the partial pdapi_stream: This field holds the stream on which the partial
delivery event happened. delivery event happened.
pdapi_seq: This field holds the stream sequence number which was pdapi_seq: This field holds the stream sequence number which was
partially delivered. being partially delivered.
pdapi_assoc_id: The association id field holds the identifier for pdapi_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 the same association identifier. For a one-to-one style socket
this field is ignored. this field is ignored.
5.3.9. SCTP_AUTHENTICATION_EVENT 5.3.9. SCTP_AUTHENTICATION_EVENT
When a receiver is using authentication this message will provide [RFC4895] defines an extension to authenticate SCTP messages. The
notifications regarding new keys being made active as well as errors. following notification is used to report different events relating to
the use of this extension.
struct sctp_authkey_event { struct sctp_authkey_event {
uint16_t auth_type; uint16_t auth_type;
uint16_t auth_flags; uint16_t auth_flags;
uint32_t auth_length; uint32_t auth_length;
uint16_t auth_keynumber; uint16_t auth_keynumber;
uint16_t auth_altkeynumber; uint16_t auth_altkeynumber;
uint32_t auth_indication; uint32_t auth_indication;
sctp_assoc_t auth_assoc_id; sctp_assoc_t auth_assoc_id;
}; };
skipping to change at page 41, line 47 skipping to change at page 42, line 4
struct sctp_authkey_event { struct sctp_authkey_event {
uint16_t auth_type; uint16_t auth_type;
uint16_t auth_flags; uint16_t auth_flags;
uint32_t auth_length; uint32_t auth_length;
uint16_t auth_keynumber; uint16_t auth_keynumber;
uint16_t auth_altkeynumber; uint16_t auth_altkeynumber;
uint32_t auth_indication; uint32_t auth_indication;
sctp_assoc_t auth_assoc_id; sctp_assoc_t auth_assoc_id;
}; };
auth_type: It should be SCTP_AUTHENTICATION_EVENT. auth_type: It should be SCTP_AUTHENTICATION_EVENT.
auth_flags: Currently unused. auth_flags: Currently unused.
auth_length: This field is the total length of the notification auth_length: This field is the total length of the notification
data, including the notification header. It will generally be data, including the notification header. It will generally be
sizeof (struct sctp_authkey_event). sizeof (struct sctp_authkey_event).
auth_keynumber: This field holds the keynumber set by the user for auth_keynumber: This field holds the keynumber for the affected key
the effected key. If more than one key is involved, this will indicated in the event (depends on auth_indication). If more than
contain one of the keys involved in the notification. one key is involved, this will contain one of the keys involved in
the notification.
auth_altkeynumber: This field holds an alternate keynumber which is auth_altkeynumber: This field holds an alternate keynumber which is
used by some notifications. used by some notifications.
auth_indication: This field holds the error or indication being auth_indication: This field holds the error or indication being
reported. The following values are currently defined: reported. The following values are currently defined:
SCTP_AUTH_NEWKEY: This report indicates that a new key has been SCTP_AUTH_NEWKEY: This report indicates that a new key has been
made active (used for the first time by the peer) and is now made active (used for the first time by the peer) and is now
the active key. The auth_keynumber field holds the user the active key. The auth_keynumber field holds the user
specified key number. specified key number.
SCTP_AUTH_NO_AUTH: This report indicates that the peer does not SCTP_AUTH_NO_AUTH: This report indicates that the peer does not
support SCTP-AUTH. support SCTP AUTH as defined in [RFC4895].
SCTP_AUTH_FREE_KEY: This report indicates that the SCTP SCTP_AUTH_FREE_KEY: This report indicates that the SCTP
implementation will not use the key identifier specified in implementation will not use the key identifier specified in
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
skipping to change at page 43, line 13 skipping to change at page 43, line 17
generally be sizeof(struct sctp_sender_dry_event). generally be sizeof(struct sctp_sender_dry_event).
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 empty sctp_tlv (see the union above), that This notification is an union sctp_notification, where only the
merely has this type in the sn_type field, the sn_length field set to struct sctp_tlv (see the union above) is used. That merely has this
the sizeof an sctp_tlv structure and the sn_flags set to 0. If an type in the sn_type field, the sn_length field set to the sizeof an
application receives this notification, it will need to resubscribe sctp_tlv structure and the sn_flags set to 0. If an application
to any notifications of interest to it. receives this notification, it will need to resubscribe to any
notifications of interest to it, except for the data io event.
An endpoint is automatically subscribed to this event as soon as it
is subscribed to any event other than data io events.
5.4. Ancillary Data Considerations and Semantics 5.4. Ancillary Data Considerations and Semantics
Programming with ancillary socket data contains some subtleties and Programming with ancillary socket data contains some subtleties and
pitfalls, which are discussed below. pitfalls, which are discussed below.
5.4.1. Multiple Items and Ordering 5.4.1. Multiple Items and Ordering
Multiple ancillary data items may be included in any call to Multiple ancillary data items may be included in any call to
sendmsg() or recvmsg(); these may include multiple SCTP or non-SCTP sendmsg() or recvmsg(); these may include multiple SCTP or non-SCTP
items, or both. items, or both.
The ordering of ancillary data items (either by SCTP or another The ordering of ancillary data items (either by SCTP or another
protocol) is not significant and is implementation-dependent, so protocol) is not significant and is implementation-dependent, so
applications must not depend on any ordering. applications must not depend on any ordering.
SCTP_SNDRCV items must always correspond to the data in the msghdr's SCTP_SNDRCV/SCTP_SNDINFO/SCTP_RCVINFO type ancillary data always
msg_iov member. There can be only a single SCTP_SNDRCV info for each correspond to the data in the msghdr's msg_iov member. There can be
sendmsg() or recvmsg() call. only one single such type ancillary data for each sendmsg() or
recvmsg() call.
5.4.2. Accessing and Manipulating Ancillary Data 5.4.2. Accessing and Manipulating Ancillary Data
Applications can infer the presence of data or ancillary data by Applications can infer the presence of data or ancillary data by
examining the msg_iovlen and msg_controllen msghdr members, examining the msg_iovlen and msg_controllen msghdr members,
respectively. respectively.
Implementations may have different padding requirements for ancillary Implementations may have different padding requirements for ancillary
data, so portable applications should make use of the macros data, so portable applications should make use of the macros
CMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_SPACE, and CMSG_LEN. See CMSG_FIRSTHDR, CMSG_NXTHDR, CMSG_DATA, CMSG_SPACE, and CMSG_LEN. See
[RFC3542] and your SCTP implementation's documentation for more [RFC3542] and the SCTP implementation's documentation for more
information. The following is an example, from [RFC3542], information. The following is an example, from [RFC3542],
demonstrating the use of these macros to access ancillary data: demonstrating the use of these macros to access ancillary data:
struct msghdr msg; struct msghdr msg;
struct cmsghdr *cmsgptr; struct cmsghdr *cmsgptr;
/* fill in msg */ /* fill in msg */
/* call recvmsg() */ /* call recvmsg() */
skipping to change at page 44, line 24 skipping to change at page 44, line 31
if (cmsgptr->cmsg_level == ... && cmsgptr->cmsg_type == ... ) { if (cmsgptr->cmsg_level == ... && cmsgptr->cmsg_type == ... ) {
u_char *ptr; u_char *ptr;
ptr = CMSG_DATA(cmsgptr); ptr = CMSG_DATA(cmsgptr);
/* process data pointed to by ptr */ /* process data pointed to by ptr */
} }
} }
5.4.3. Control Message Buffer Sizing 5.4.3. Control Message Buffer Sizing
The information conveyed via SCTP_SNDRCV events will often be The information conveyed via SCTP_SNDRCV/SCTP_SNDINFO/SCTP_RCVINFO
fundamental to the correct and sane operation of the sockets ancillary data will often be fundamental to the correct and sane
application. This is particularly true of the one-to-many semantics, operation of the sockets application. This is particularly true of
but also of the one-to-one semantics. For example, if an application the one-to-many semantics, but also of the one-to-one semantics. For
needs to send and receive data on different SCTP streams, SCTP_SNDRCV example, if an application needs to send and receive data on
events are indispensable. different SCTP streams, SCTP_SNDRCV/SCTP_SNDINFO/SCTP_RCVINFO
ancillary data is indispensable.
Given that some ancillary data is critical, and that multiple Given that some ancillary data is critical, and that multiple
ancillary data items may appear in any order, applications should be ancillary data items may appear in any order, applications should be
carefully written to always provide a large enough buffer to contain carefully written to always provide a large enough buffer to contain
all possible ancillary data that can be presented by recvmsg(). If all possible ancillary data that can be presented by recvmsg(). If
the buffer is too small, and crucial data is truncated, it may pose a the buffer is too small, and crucial data is truncated, it may pose a
fatal error condition. fatal error condition.
Thus, it is essential that applications be able to deterministically Thus, it is essential that applications be able to deterministically
calculate the maximum required buffer size to pass to recvmsg(). One calculate the maximum required buffer size to pass to recvmsg(). One
skipping to change at page 47, line 46 skipping to change at page 48, line 4
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).
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 effected 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
associations will be effected by this call, future associations associations will be affected by this call, future associations
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 effected 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 Note, these calls, when used in the one-to-many style, should only be
used with branched off socket descriptors (see Section 8.2). 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 chose 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
int getsockname(int sd, int getsockname(int sd,
struct sockaddr *address, struct sockaddr *address,
socklen_t *len); socklen_t *len);
and the arguments are and the arguments are
skipping to change at page 49, line 6 skipping to change at page 49, line 13
the object pointed to by address is unspecified. the object pointed to by address is unspecified.
7. Socket Options 7. Socket Options
The following sub-section describes various SCTP level socket options The following sub-section describes various SCTP level socket options
that are common to both styles. SCTP associations can be multi- that are common to both styles. SCTP associations can be multi-
homed. Therefore, certain option parameters include a homed. Therefore, certain option parameters include a
sockaddr_storage structure to select which peer address the option sockaddr_storage structure to select which peer address the option
should be applied to. should be applied to.
For the one-to-many style sockets, an sctp_assoc_t structure For the one-to-many style sockets, an sctp_assoc_t (association ID)
(association ID) is used to identify the association instance that parameter is used to identify the association instance that the
the operation affects. So it must be set when using this style. operation affects. So it must be set when using this style.
For the one-to-one style sockets and branched off one-to-many style For the one-to-one style sockets and branched off one-to-many style
sockets (see Section 8.2) this association ID parameter is ignored. sockets (see Section 8.2) this association ID parameter is ignored.
Note that socket or IP level options are set or retrieved per socket. Note that socket or IP level options are set or retrieved per socket.
This means that for one-to-many style sockets, those options will be This means that for one-to-many style sockets, those options will be
applied to all associations belonging to the socket. And for one-to- applied to all associations (similar to using SCTP_ALL_ASSOC as the
one style, those options will be applied to all peer addresses of the association ID) belonging to the socket. And for one-to-one style,
those options will be applied to all peer addresses of the
association controlled by the socket. Applications should be very association controlled by the socket. Applications should be very
careful in setting those options. careful in setting those options.
For some IP stacks getsockopt() is read-only; so a new interface will For some IP stacks getsockopt() is read-only; so a new interface will
be needed when information must be passed both into and out of the be needed when information must be passed both into and out of the
SCTP stack. The syntax for sctp_opt_info() is SCTP stack. The syntax for sctp_opt_info() is
int sctp_opt_info(int sd, int sctp_opt_info(int sd,
sctp_assoc_t id, sctp_assoc_t id,
int opt, int opt,
void *arg, void *arg,
socklen_t *size); socklen_t *size);
The sctp_opt_info() call is a replacement for getsockopt() only and The sctp_opt_info() call is a replacement for getsockopt() only and
will not set any options associated with the specified socket. A will not set any options associated with the specified socket. A
setsockopt() must be used to set any writeable option. setsockopt() must be used to set any writeable option.
For one-to-many style sockets, id specifies the association to query. For one-to-many style sockets, id specifies the association to query.
For one-to-one style sockets, id is ignored. For one-to-one style sockets, id is ignored. Note that
SCTP_CURRENT_ASSOC and SCTP_ALL_ASSOC cannot be used here. Using
them will result in an error (returning -1 and errno set to EINVAL).
SCTP_FUTURE_ASSOC can be used to query information for future
associations.
The field opt specifies which SCTP socket option to get. It can get The field opt specifies which SCTP socket option to get. It can get
any socket option currently supported that requests information any socket option currently supported that requests information
(either read/write options or read only) such as: (either read/write options or read only) such as:
SCTP_RTOINFO SCTP_RTOINFO
SCTP_ASSOCINFO SCTP_ASSOCINFO
SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM
SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR
SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS
SCTP_STATUS SCTP_STATUS
SCTP_CONTEXT SCTP_CONTEXT
SCTP_AUTH_ACTIVE_KEY SCTP_AUTH_ACTIVE_KEY
SCTP_PEER_AUTH_CHUNKS SCTP_PEER_AUTH_CHUNKS
skipping to change at page 50, line 27 skipping to change at page 50, line 36
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 entire 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
set, i.e. the sockaddr_storage is set to all 0 (INADDR_ANY) and set, i.e. the sockaddr_storage is set to all 0 (INADDR_ANY) and
the association identification is SCTP_FUTURE_ASSOC, the settings the association identification is SCTP_FUTURE_ASSOC, the settings
are a default and to be applied to the endpoint. are a default and to be applied to the endpoint.
7.1. Read / Write Options 7.1. Read / Write Options
skipping to change at page 51, line 4 skipping to change at page 51, line 13
information on how these parameters are used in RTO calculation. information on how these parameters are used in RTO calculation.
The following structure is used to access and modify these The following structure is used to access and modify these
parameters: parameters:
struct sctp_rtoinfo { struct sctp_rtoinfo {
sctp_assoc_t srto_assoc_id; sctp_assoc_t srto_assoc_id;
uint32_t srto_initial; uint32_t srto_initial;
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 one of the predefined in an association identification or SCTP_FUTURE_ASSOC. It is an
constants. error to use SCTP_{CURRENT|ALL}_ASSOC in srto_asssoc_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 51, line 40 skipping to change at page 52, line 4
parameters: parameters:
struct sctp_assocparams { struct sctp_assocparams {
sctp_assoc_t sasoc_assoc_id; sctp_assoc_t sasoc_assoc_id;
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 one of the predefined in an association identification or SCTP_FUTURE_ASSOC. It is an
constants. error to use SCTP_{CURRENT|ALL}_ASSOC in sasoc_asssoc_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
when issuing cookies. when issuing cookies.
The values of the sasoc_peer_rwnd is meaningless when examining The values of the sasoc_peer_rwnd is meaningless when examining
endpoint information. endpoint information.
skipping to change at page 52, line 39 skipping to change at page 52, line 46
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' larger than the having the value of 'Association.Max.Retrans' (sasoc_maxrt in this
summation of the 'Path.Max.Retrans' of all the destination addresses option) larger than the summation of the 'Path.Max.Retrans' (see
for the remote endpoint. Otherwise, all the destination addresses Section 7.1.2 on spp_pathmaxrxt) of all the destination addresses for
may become inactive while the endpoint still considers the peer the remote endpoint. Otherwise, all the destination addresses may
endpoint reachable. become inactive while the endpoint still considers the peer endpoint
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
these parameters is defined in Section 5.2.1. The option name these parameters is defined in Section 5.2.1. The option name
argument to setsockopt() and getsockopt() is SCTP_INITMSG. argument to setsockopt() and getsockopt() is SCTP_INITMSG.
Setting initialization parameters is effective only on an unconnected Setting initialization parameters is effective only on an unconnected
socket (for one-to-many style sockets only future associations are socket (for one-to-many style sockets only future associations are
effected by the change). With one-to-one style sockets, this option affected by the change). With one-to-one style sockets, this option
is inherited by sockets derived from a listening socket. is inherited by sockets derived from a listening socket.
7.1.4. SO_LINGER 7.1.4. SO_LINGER
An application can use this option to perform the SCTP ABORT An application can use this option to perform the SCTP ABORT
primitive. This option affects all associations related to the primitive. This option affects all associations related to the
socket. socket.
The linger option structure is: The linger option structure is:
skipping to change at page 53, line 30 skipping to change at page 53, line 39
To enable the option, set l_onoff to 1. If the l_linger value is set To enable the option, set l_onoff to 1. If the l_linger value is set
to 0, calling close() is the same as the ABORT primitive. If the to 0, calling close() is the same as the ABORT primitive. If the
value is set to a negative value, the setsockopt() call will return value is set to a negative value, the setsockopt() call will return
an error. If the value is set to a positive value linger_time, the an error. If the value is set to a positive value linger_time, the
close() can be blocked for at most linger_time ms. If the graceful close() can be blocked for at most linger_time ms. If the graceful
shutdown phase does not finish during this period, close() will shutdown phase does not finish during this period, close() will
return but the graceful shutdown phase will continue in the system. return but the graceful shutdown phase will continue in the system.
Note, this is a socket level option NOT an SCTP level option. So Note, this is a socket level option NOT an SCTP level option. So
when setting SO_LINGER you must specify a level of SOL_SOCKET in the when setting SO_LINGER an application must specify a level of
setsockopt() call. SOL_SOCKET in the setsockopt() call.
7.1.5. SCTP_NODELAY 7.1.5. SCTP_NODELAY
Turn on/off any Nagle-like algorithm. This means that packets are Turn on/off any Nagle-like algorithm. This means that packets are
generally sent as soon as possible and no unnecessary delays are generally sent as soon as possible and no unnecessary delays are
introduced, at the cost of more packets in the network. Expects an introduced, at the cost of more packets in the network. Expects an
integer boolean flag. Turning this option on disables any Nagle-like integer boolean flag. Turning this option on disables any Nagle-like
algorithm. algorithm.
7.1.6. SO_RCVBUF 7.1.6. SO_RCVBUF
skipping to change at page 55, line 4 skipping to change at page 55, line 11
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.
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 predefined constants association for this request. Note that the special sctp_assoc_t
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.
The following structure is used to access and modify this parameter: The following structure is used to access and modify this parameter:
struct sctp_setadaptation { struct sctp_setadaptation {
uint32_t ssb_adaptation_ind; uint32_t ssb_adaptation_ind;
skipping to change at page 56, line 4 skipping to change at page 56, line 15
struct sctp_paddrparams { struct sctp_paddrparams {
sctp_assoc_t spp_assoc_id; sctp_assoc_t spp_assoc_id;
struct sockaddr_storage spp_address; struct sockaddr_storage spp_address;
uint32_t spp_hbinterval; uint32_t spp_hbinterval;
uint16_t spp_pathmaxrxt; uint16_t spp_pathmaxrxt;
uint32_t spp_pathmtu; uint32_t spp_pathmtu;
uint32_t spp_flags; uint32_t spp_flags;
uint32_t spp_ipv6_flowlabel; uint32_t spp_ipv6_flowlabel;
uint8_t spp_ipv4_tos; uint8_t spp_ipv4_tos;
}; };
spp_assoc_id: This parameter is ignored for one-to-one style spp_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 query. Note that the predefined constants association for this query. Note that the predefined constants
are NOT allowed. are NOT allowed.
spp_address: This specifies which address is of interest. spp_address: This specifies which address is of interest. If a
wildcard address is provided it applies to all current and future
paths.
spp_hbinterval: This contains the value of the heartbeat interval, spp_hbinterval: This contains the value of the heartbeat interval,
in milliseconds. Note that unless the spp_flag is set to in milliseconds (HB.Interval in [RFC4960]). Note that unless the
SPP_HB_ENABLE the value of this field is ignored. Note also that spp_flag is set to SPP_HB_ENABLE the value of this field is
a value of zero indicates the current setting should be left ignored. Note also that a value of zero indicates the current
unchanged. To set an actual value of zero the use of the flag setting should be left unchanged. To set an actual value of zero
SPP_HB_TIME_IS_ZERO should be used. 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
out heartbeat since the actual interval also includes a the
current 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_pathmtu: When Path MTU discovery is disabled the value specified spp_pathmtu: When Path MTU discovery is disabled the value specified
here will be the "fixed" path MTU (i.e. the value of the spp_flags here will be the "fixed" path MTU (i.e. the value of the spp_flags
field must include the flag SPP_PMTUD_DISABLE). Note that if the field must include the flag SPP_PMTUD_DISABLE). Note also that
spp_address field is empty then all destinations for this this option cannot be set on the endpoint, but must be set on each
association will have this fixed path MTU set upon them. If an individual association. Also, when disabling PMTU discovery, the
address is specified, then only that address will be effected. implementation may disallow this behavior if the "fixed" path MTU
Note also that this option cannot be set on the endpoint, but must is below the constant value SCTP_SMALLEST_PMTU.
be set on each individual association. Also, when disabling PMTU
discovery, the implementation may disallow this behavior if the
"fixed" path MTU is below the constant value SCTP_SMALLEST_PMTU.
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. SPP_IPV6_FLOWLABEL flag.
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. SPP_IPV4_TOS flag.
spp_flags: These flags are used to control various features on an spp_flags: These flags are used to control various features on an
association. The flag field is a bit mask which may contain zero association. The flag field is a bit mask which may contain zero
or more of the following options: or more of the following options:
SPP_HB_ENABLE: Enable heartbeats on the specified address. Note
that if the address field is empty all addresses for the SPP_HB_ENABLE: Enable heartbeats on the specified address.
association have heartbeats enabled upon them.
SPP_HB_DISABLE: Disable heartbeats on the specified address. SPP_HB_DISABLE: Disable heartbeats on the specified address.
Note that if the address field is empty all addresses for the Note that SPP_HB_ENABLE and SPP_HB_DISABLE are mutually
association will have their heartbeats disabled. Note also exclusive, only one of these two should be specified. Enabling
that SPP_HB_ENABLE and SPP_HB_DISABLE are mutually exclusive, both fields will have undetermined results.
only one of these two should be specified. Enabling both
fields will have undetermined results.
SPP_HB_DEMAND: Request a user initiated heartbeat to be made SPP_HB_DEMAND: Request a user initiated heartbeat to be made
immediately. immediately. This must not be used in conjunction with a
wildcard address.
SPP_HB_TIME_IS_ZERO: Specifies that the time for heartbeat delay SPP_HB_TIME_IS_ZERO: Specifies that the time for heartbeat delay
is to be set to the value of 0 milliseconds. is to be set to the value of 0 milliseconds.
SPP_PMTUD_ENABLE: This field will enable PMTU discovery upon the SPP_PMTUD_ENABLE: This field will enable PMTU discovery upon the
specified address. Note that if the address field is empty specified address.
then all addresses on the association are effected.
SPP_PMTUD_DISABLE: This field will disable PMTU discovery upon SPP_PMTUD_DISABLE: This field will disable PMTU discovery upon
the specified address. Note that if the address field is empty the specified address. Note that if the address field is empty
then all addresses on the association are effected. Note also then all addresses on the association are affected. Note also
that SPP_PMTUD_ENABLE and SPP_PMTUD_DISABLE are mutually that SPP_PMTUD_ENABLE and SPP_PMTUD_DISABLE are mutually
exclusive. Enabling both will have undetermined results. exclusive. Enabling both will have undetermined results.
SPP_IPV6_FLOWLABEL: Setting this flag enables the setting of the SPP_IPV6_FLOWLABEL: Setting this flag enables the setting of the
IPV6 flowlabel value associated with either the association or IPV6 flowlabel value. The value is obtained in the
the specific address. If the address field is filled in, then
the specific destination address has this value set upon it.
If the association is specified, but not the address, then the
flowlabel value is set for any future destination addresses
that may be added. The value is obtained in the
spp_ipv6_flowlabel field. spp_ipv6_flowlabel field.
Upon retrieval, this flag will be set to indicate that the Upon retrieval, this flag will be set to indicate that the
spp_ipv6_flowlabel field has a valid value returned. If a spp_ipv6_flowlabel field has a valid value returned. If a
specific destination address is set (in the spp_address field) specific destination address is set (in the spp_address field),
when called then the value returned is that of the address. If then the value returned is that of the address. If just an
just an association is specified (and no address) then the association is specified (and no address), then the
association's default flowlabel is returned. If neither an association's default flowlabel is returned. If neither an
association nor a destination is specified, then the socket's association nor a destination is specified, then the socket's
default flowlabel is returned. For non IPv6 sockets, this flag default flowlabel is returned. For non IPv6 sockets, this flag
will be left cleared. will be left cleared.
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. If the address field is filled in, then the specific address. The value is obtained in the spp_ipv4_tos field.
destination address has this value set upon it. If the
association is specified, but not the address, then the TOS
value is set for any future destination addresses that may be
added. 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 an destination is specified, then the sockets default TOS
is returned. For non IPv4 sockets, this flag will be left is returned.
cleared.
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)
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.
skipping to change at page 58, line 52 skipping to change at page 58, line 52
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
SCTP implementation may fragment into smaller sized chunks when the SCTP implementation may fragment into smaller sized chunks when the
PMTU of the underlying association is smaller than the value set by PMTU of the underlying association is smaller than the value set by
the user. The default value for this option is '0' which indicates the user. The default value for this option is '0' which indicates
the user is NOT limiting fragmentation and only the PMTU will effect the user is NOT limiting fragmentation and only the PMTU will affect
SCTP's choice of DATA chunk size. Note also that values set larger SCTP's choice of DATA chunk size. Note also that values set larger
than the maximum size of an IP datagram will effectively let SCTP than the maximum size of an IP datagram will effectively let SCTP
control fragmentation (i.e. the same as setting this option to 0). control fragmentation (i.e. the same as setting this option to 0).
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. Note that any association the user is performing an action upon. It is an error
of the predefined constants are also allowed in this field. to use SCTP_{CURRENT|ALL}_ASSOC in sasoc_asssoc_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:
struct sctp_hmacalgo { struct sctp_hmacalgo {
uint32_t shmac_number_of_idents; uint32_t shmac_number_of_idents;
uint16_t shmac_idents[]; uint16_t shmac_idents[];
}; };
shmac_number_of_idents: This field gives the number of elements shmac_number_of_idents: This field gives the number of elements
present in the array shmac_idents. present in the array shmac_idents.
shmac_idents: This parameter contains an array of HMAC Identifiers shmac_idents: This parameter contains an array of HMAC identifiers
that the local endpoint is requesting the peer to use, in priority that the local endpoint is requesting the peer to use, in priority
order. The following identifiers are valid: order. The following identifiers are valid:
* SCTP_AUTH_HMAC_ID_SHA1 * SCTP_AUTH_HMAC_ID_SHA1
* SCTP_AUTH_HMAC_ID_SHA256 * SCTP_AUTH_HMAC_ID_SHA256
Note that the list supplied must include SCTP_AUTH_HMAC_ID_SHA1 and Note that the list supplied must include SCTP_AUTH_HMAC_ID_SHA1 and
may include any of the other values in its preferred order (lowest may include any of the other values in its preferred order (lowest
list position has the highest preference in algorithm selection). list position has the highest preference in algorithm selection).
Note also that the lack of SCTP_AUTH_HMAC_ID_SHA1, or the inclusion Note also that the lack of SCTP_AUTH_HMAC_ID_SHA1, or the inclusion
of an unknown HMAC identifier (including optional identifiers unknown of an unknown HMAC identifier (including optional identifiers unknown
skipping to change at page 60, line 18 skipping to change at page 60, line 18
the association shared key. the association shared key.
The following structure is used to access and modify these The following structure is used to access and modify these
parameters: parameters:
struct sctp_authkeyid { struct sctp_authkeyid {
sctp_assoc_t scact_assoc_id; sctp_assoc_t scact_assoc_id;
uint16_t scact_keynumber; uint16_t scact_keynumber;
}; };
scact_assoc_id: This parameter, if non-zero, indicates the scact_assoc_id: This parameter sets the active key of the specified
association that the shared key identifier is set active upon. association. The special SCTP_{FUTURE|CURRENT|ALL}_ASSOC can be
Note that if this element contains zero, then the activation used. For one-to-one sockets, this parameter is ignored. Note,
applies to the endpoint and all future associations will use the however, that this option will set the active key on the
specified shared key identifier. For one-to-one sockets, this association if the socket is connected, otherwise this will set
parameter is ignored. Note, however, that this option will set the default active key for the endpoint.
the active key on the association if the socket is connected,
otherwise this will set the default active key for the endpoint.
scact_keynumber: This parameter is the shared key identifier which scact_keynumber: This parameter is the shared key identifier which
the application is requesting to become the active shared key to the application is requesting to become the active shared key to
be used for sending authenticated chunks. The key identifier must be used for sending authenticated chunks. The key identifier must
correspond to an existing shared key. Note that shared key correspond to an existing shared key. Note that shared key
identifier '0' defaults to a null key. identifier '0' defaults to a null key.
When used with setsockopt() the SCTP implementation must use the When used with setsockopt() the SCTP implementation must use the
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 effect the way delayed acks are performed. This This option will affect the way delayed acks are performed. This
option allows you to get or set the delayed ack time, in option allows the application to get or set the delayed ack time, in
milliseconds. It also allows changing the delayed ack frequency. milliseconds. It also allows changing the delayed ack frequency.
Changing the frequency to 1 disables the delayed sack algorithm. If Changing the frequency to 1 disables the delayed sack algorithm.
the sack_assoc_id is 0, then this sets or gets the endpoints default Note that if sack_delay or sack_freq are 0 when setting this option,
values. If the sack_assoc_id field is non-zero, then the set or get the current values will remain unchanged.
effects the specified association for the one-to-many model (the
assoc_id field is ignored by the one-to-one model). Note that if
sack_delay or sack_freq are 0 when setting this option, 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. Note which association the user is performing an action upon. The
that any of the predefined constants may also be used for one-to- special SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used.
many style sockets.
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 ACK 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
occurs for the message receiver. There are three levels of fragment occurs for the message receiver. There are three levels of fragment
interleave defined. Two of the levels effect the one-to-one model, interleave defined. Two of the levels affect the one-to-one model,
while the one-to-many model is effected by all three levels. while the one-to-many model is affected by all three levels.
This option takes an integer value. It can be set to a value of 0, 1 This option takes an integer value. It can be set to a value of 0, 1
or 2. Attempting to set this level to other values will return an or 2. Attempting to set this level to other values will return an
error. error.
Setting the three levels provides the following receiver Setting the three levels provides the following receiver
interactions: interactions:
level 0: Prevents the interleaving of any messages. This means that level 0: Prevents the interleaving of any messages. This means that
when a partial delivery begins, no other messages will be received when a partial delivery begins, no other messages will be received
skipping to change at page 62, line 18 skipping to change at page 62, line 14
messages from association "X" from being delivered. messages from association "X" from being delivered.
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 effects 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 may another streams
message from the same association be delivered from the next message from the same association be delivered from the next
receive, some other associations message may be delivered upon the receive, some other associations message may be delivered upon the
next receive. 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
skipping to change at page 62, line 50 skipping to change at page 62, line 46
may also be interleaved with partially delivered messages. may also be interleaved with partially delivered messages.
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) (SCTP_PARTIAL_DELIVERY_POINT)
This option will set or get the SCTP partial delivery point. This This option will set or get the SCTP partial delivery point. This
point is the size of a message where the partial delivery API will be point is the size of a message where the partial delivery API will be
invoked to help free up rwnd space for the peer. Setting this to a invoked to help free up rwnd space for the peer. Setting this to a
lower value will cause partial deliveries to happen more often. The lower value will cause partial deliveries to happen more often. The
call's argument is an integer that sets or gets the partial delivery call's argument is an integer that sets or gets the partial delivery
point. Note also that the call will fail if the user attempts to set point in bytes. Note also that the call will fail if the user
this value larger than the socket receive buffer size. attempts to set this value larger than the socket receive buffer
size.
Note that any single message having a length smaller than or equal to Note that any single message having a length smaller than or equal to
the SCTP partial delivery point will be delivered in one single read the SCTP partial delivery point will be delivered in one single read
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
skipping to change at page 63, line 30 skipping to change at page 63, line 27
information via ancillary data. 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.
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 effects 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.
skipping to change at page 64, line 4 skipping to change at page 63, line 45
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 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. Note that any association the user is performing an action upon. The special
of the predefined constants may be used for one-to-many style SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used.
sockets.
assoc_value: This parameter contains the maximum burst. assoc_value: This parameter contains the maximum burst.
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
association. Note that the setting of this value only effects association. Note that the setting of this value only affects
received messages from the peer and does not effect the value that is received messages from the peer and does not affect the value that is
saved with outbound messages. saved with outbound messages.
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. Note that any association the user is performing an action upon. The special
of the predefined constants may be used for one-to-many style SCTP_{FUTURE|CURRENT|ALL}_ASSOC can also be used.
sockets.
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
skipping to change at page 66, line 4 skipping to change at page 65, line 44
sctp_assoc_t sstat_assoc_id; sctp_assoc_t sstat_assoc_id;
int32_t sstat_state; int32_t sstat_state;
uint32_t sstat_rwnd; uint32_t sstat_rwnd;
uint16_t sstat_unackdata; uint16_t sstat_unackdata;
uint16_t sstat_penddata; uint16_t sstat_penddata;
uint16_t sstat_instrms; uint16_t sstat_instrms;
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. Note that the one-to-many have the same association identifier. The special SCTP_{FUTURE|
predefined constants may not be used with this option. 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 one of
the following values: 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
sstat_rwnd: This contains the association peer's current receiver sstat_rwnd: This contains the association peer's current receiver
window size. window size.
sstat_unackdata: This is the number of unacked data chunks. sstat_unackdata: This is the number of unacked data chunks.
sstat_penddata: This is the number of data chunks pending receipt. sstat_penddata: This is the number of data chunks pending receipt.
sstat_primary: This is information on the current primary peer
address.
sstat_instrms: The number of streams that the peer will be using sstat_instrms: The number of streams that the peer will be using
inbound. outbound.
sstat_outstrms: The number of streams that the endpoint is allowed sstat_outstrms: The number of streams that the endpoint is allowed
to use outbound. to use outbound.
sstat_fragmentation_point: The size at which SCTP fragmentation will sstat_fragmentation_point: The size at which SCTP fragmentation will
occur. occur.
sstat_primary: This is information on the current primary peer
address.
To access these status values, the application calls getsockopt() To access these status values, the application calls getsockopt()
with the option name SCTP_STATUS. with the option name SCTP_STATUS.
7.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO) 7.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO)
Applications can retrieve information about a specific peer address Applications can retrieve information about a specific peer address
of an association, including its reachability state, congestion of an association, including its reachability state, congestion
window, and retransmission timer values. This information is read- window, and retransmission timer values. This information is read-
only. only.
skipping to change at page 67, line 42 skipping to change at page 67, line 31
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 chunks for a specified association that This option gets a list of chunk types (see [RFC4960] for a specified
the peer requires to be received authenticated only. 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;
guint32_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
user is requesting the list of peer authenticated chunks. For user is requesting the list of peer authenticated chunks. For
one-to-one sockets, this parameter is ignored. Note that the one-to-one sockets, this parameter is ignored. Note that the
predefined constants are not allowed with this option. predefined constants are not allowed with this option.
gauth_number_of_chunks: This parameter gives the number of elements gauth_number_of_chunks: This parameter gives the number of elements
in the array gauth_chunks. in the array gauth_chunks.
gauth_chunks: This parameter contains an array of chunks that the
peer is requesting to be authenticated. gauth_chunks: This parameter contains an array of chunk types that
the peer is requesting to be authenticated.
7.2.4. Get the List of Chunks the Local Endpoint Requires to be 7.2.4. Get the List of Chunks the Local Endpoint Requires to be
Authenticated (SCTP_LOCAL_AUTH_CHUNKS) Authenticated (SCTP_LOCAL_AUTH_CHUNKS)
This option gets a list of chunks for a specified association that This option gets a list of chunk types (see [RFC4960]) for a
the local endpoint requires to be received authenticated only. specified association that the local endpoint 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
user is requesting the list of local authenticated chunks. For user is requesting the list of local authenticated chunks. For
one-to-one sockets, this parameter is ignored. one-to-one sockets, this parameter is ignored.
gauth_number_of_chunks: This parameter gives the number of elements gauth_number_of_chunks: This parameter gives the number of elements
in the array gauth_chunks. in the array gauth_chunks.
gauth_chunks: This parameter contains an array of chunks that the gauth_chunks: This parameter contains an array of chunk types that
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
number of associations may have changed when the caller gets back the
option result.
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 {
skipping to change at page 69, line 4 skipping to change at page 68, line 51
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;
sctp_assoc_t gaids_assoc_id[]; sctp_assoc_t gaids_assoc_id[];
}; };
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. 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
by the time the caller gets back the result.
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. The enclosed address must be one of the association's primary (see [RFC5061]). The enclosed address must be one of the
locally bound addresses. association's locally bound 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_setpeerprim { struct sctp_setpeerprim {
sctp_assoc_t sspp_assoc_id; sctp_assoc_t sspp_assoc_id;
struct sockaddr_storage sspp_addr; struct sockaddr_storage sspp_addr;
}; };
sspp_addr: The address to set as primary. sspp_addr: The address to set as primary.
sspp_assoc_id: This parameter is ignored for one-to-one style sspp_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 predefined constants association for this request. Note that the predefined constants
are not allowed on this option. are not allowed on this option.
7.3.2. Add a Chunk That Must Be Authenticated (SCTP_AUTH_CHUNK) 7.3.2. Add a Chunk That Must Be Authenticated (SCTP_AUTH_CHUNK)
This set option adds a chunk type that the user is requesting to be This set option adds a chunk type that the user is requesting to be
received only in an authenticated way. Changes to the list of chunks received only in an authenticated way. Changes to the list of chunks
will only effect future associations on the socket. will only affect future associations on the socket.
The following structure is used to add a chunk: The following structure is used to add a chunk:
struct sctp_authchunk { struct sctp_authchunk {
uint8_t sauth_chunk; uint8_t sauth_chunk;
}; };
sauth_chunk: This parameter contains a chunk type that the user is sauth_chunk: This parameter contains a chunk type that the user is
requesting to be authenticated. requesting to be authenticated.
The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE, and AUTH The chunk types for INIT, INIT-ACK, SHUTDOWN-COMPLETE, and AUTH
chunks must not be used. If they are used, an error must be chunks must not be used. If they are used, an error must be
returned. The usage of this option enables SCTP-AUTH in cases where returned. The usage of this option enables SCTP AUTH in cases where
it is not required by other means (for example the use of dynamic it is not required by other means (for example the use of dynamic
address reconfiguration). address reconfiguration).
7.3.3. Set a Shared Key (SCTP_AUTH_KEY) 7.3.3. Set a Shared Key (SCTP_AUTH_KEY)
This option will set a shared secret key which is used to build an This option will set a shared secret key which is used to build an
association shared key. association shared key.
The following structure is used to access and modify these The following structure is used to access and modify these
parameters: parameters:
struct sctp_authkey { struct sctp_authkey {
sctp_assoc_t sca_assoc_id; sctp_assoc_t sca_assoc_id;
uint16_t sca_keynumber; uint16_t sca_keynumber;
uint16_t sca_keylength; uint16_t sca_keylength;
uint8_t sca_key[]; uint8_t sca_key[];
}; };
sca_assoc_id: This parameter, if non-zero, indicates what sca_assoc_id: This parameter indicates what association the shared
association the shared key is being set upon. Note that any of key is being set upon. The special SCTP_{FUTURE|CURRENT|
the predefined constants can be used. For one-to-one sockets, ALL}_ASSOC can be used. For one-to-one sockets, this parameter is
this parameter is ignored. Note, however, that this option will ignored. Note, however, that this option will set a key on the
set a key on the association if the socket is connected, otherwise association if the socket is connected, otherwise this will set a
this will set a key on the endpoint. key on the endpoint.
sca_keynumber: This parameter is the shared key identifier by which sca_keynumber: This parameter is the shared key identifier by which
the application will refer to this shared key. If a key of the the application will refer to this shared key. If a key of the
specified index already exists, then this new key will replace the specified index already exists, then this new key will replace the
old existing key. Note that shared key identifier '0' defaults to old existing key. Note that shared key identifier '0' defaults to
a null key. a null key.
sca_keylength: This parameter is the length of the array sca_key. sca_keylength: This parameter is the length of the array sca_key.
sca_key: This parameter contains an array of bytes that is to be sca_key: This parameter contains an array of bytes that is to be
used by the endpoint (or association) as the shared secret key. used by the endpoint (or association) as the shared secret key.
Note, if the length of this field is zero, a null key is set. Note, if the length of this field is zero, a null key is set.
7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY) 7.3.4. Deactivate a Shared Key (SCTP_AUTH_DEACTIVATE_KEY)
This set option indicates that the application will not send user This set option indicates that the application will not send user
messages anymore requiring the usage of the indicated key identifier. messages anymore using the indicated key identifier.
struct sctp_authkeyid { struct sctp_authkeyid {
sctp_assoc_t scact_assoc_id; sctp_assoc_t scact_assoc_id;
uint16_t scact_keynumber; uint16_t scact_keynumber;
}; };
scact_assoc_id: This parameter, if non-zero, indicates what
association the shared key identifier is being deactivated for. scact_assoc_id: This parameter indicates which association the
Note that the predefined constants may be used with this option. shared key identifier is being deleted from. The special
For one-to-one sockets, this parameter is ignored. Note, however, SCTP_{FUTURE|CURRENT|ALL}_ASSOC can be used. For one-to-one
that this option will deactivate the key from the association if sockets, this parameter is ignored. Note, however, that this
the socket is connected, otherwise this will deactivate the key option will deactivate the key from the association if the socket
from the endpoint. is connected, otherwise this will deactivate the key from the
endpoint.
scact_keynumber: This parameter is the shared key identifier which scact_keynumber: This parameter is the shared key identifier which
the application is requesting to be deactivated. The key the application is requesting to be deactivated. The key
identifier must correspond to an existing shared key. Note if identifier must correspond to an existing shared key. Note if
this parameter is zero, use of the null key identifier '0' is this parameter is zero, use of the null key identifier '0' is
deactivated on the endpoint and/or association. deactivated on the endpoint and/or association.
The currently active key cannot be deactivated. The currently active key cannot be deactivated.
7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY) 7.3.5. Delete a Shared Key (SCTP_AUTH_DELETE_KEY)
This set option will delete a shared secret key in the SCTP This set option will delete a shared secret key which has been
implementation. deactivated of an SCTP association.
struct sctp_authkeyid { struct sctp_authkeyid {
sctp_assoc_t scact_assoc_id; sctp_assoc_t scact_assoc_id;
uint16_t scact_keynumber; uint16_t scact_keynumber;
}; };
scact_assoc_id: This parameter, if non-zero, indicates which scact_assoc_id: This parameter indicates which association the
association the shared key identifier is being deleted from. Note shared key identifier is being deleted from. The special
that if this element contains zero, then the shared key is deleted SCTP_{FUTURE|CURRENT|ALL}_ASSOC can be used. For one-to-one
from the endpoint and all associations will no longer use the sockets, this parameter is ignored. Note, however, that this
specified shared key identifier (unless otherwise set on the option will delete the key from the association if the socket is
association using SCTP_AUTH_KEY). For one-to-one sockets, this connected, otherwise this will delete the key from the endpoint.
parameter is ignored. Note, however, that this option will delete
the key from the association if the socket is connected, otherwise
this will delete the key from the endpoint.
scact_keynumber: This parameter is the shared key identifier which scact_keynumber: This parameter is the shared key identifier which
the application is requesting to be deleted. The key identifier the application is requesting to be deleted. The key identifier
must correspond to an existing shared key and must not be in use must correspond to an existing shared key and must not be in use
for any packet being sent by the SCTP implementation. This means for any packet being sent by the SCTP implementation. This means
in particular, that it must be deactivated first. Note if this in particular, that it must be deactivated first. Note if this
parameter is zero, use of the null key identifier '0' is deleted parameter is zero, use of the null key identifier '0' is deleted
from the endpoint and/or association. from the endpoint and/or association.
Only deactivated keys which are no longer used by the kernel can be Only deactivated keys which are no longer used by the association can
deleted. be deleted.
7.4. Ancillary Data and Notification Interest Options 7.4. Ancillary Data and Notification Interest Options
Applications can receive per-message ancillary information and Applications can receive per-message ancillary information and
notifications of certain SCTP events with recvmsg(). notifications of certain SCTP events with recvmsg().
The following optional information is available to the application: The following optional information is available to the application:
SCTP_SNDRCV (sctp_data_io_event): Per-message information (i.e. SCTP_SNDRCV (sctp_data_io_event): Per-message information (i.e.
stream number, TSN, SSN, etc. described in Section 5.2.2) stream number, TSN, SSN, etc. described in Section 5.2.2)
SCTP_ASSOC_CHANGE (sctp_association_event): described in SCTP_ASSOC_CHANGE (sctp_association_event): described in
skipping to change at page 72, line 31 skipping to change at page 72, line 26
SCTP_SHUTDOWN_EVENT (sctp_shutdown_event): described in SCTP_SHUTDOWN_EVENT (sctp_shutdown_event): described in
Section 5.3.6 Section 5.3.6
SCTP_PARTIAL_DELIVERY_EVENT (sctp_partial_delivery_event): described SCTP_PARTIAL_DELIVERY_EVENT (sctp_partial_delivery_event): described
in Section 5.3.8 in Section 5.3.8
SCTP_ADAPTATION_INDICATION (sctp_adaptation_layer_event): described SCTP_ADAPTATION_INDICATION (sctp_adaptation_layer_event): described
in Section 5.3.7 in Section 5.3.7
SCTP_AUTHENTICATION_EVENT (sctp_authentication_event): described in SCTP_AUTHENTICATION_EVENT (sctp_authentication_event): described in
Section 5.3.9) Section 5.3.9)
SCTP_SENDER_DRY_EVENT (sctp_sender_dry_event): described in SCTP_SENDER_DRY_EVENT (sctp_sender_dry_event): described in
Section 5.3.10 Section 5.3.10
SCTP_NOTIFICATIONS_STOPPED_EVENT (sctp_tlv): described in SCTP_NOTIFICATIONS_STOPPED_EVENT (): described in Section 5.3.11
Section 5.3.11
To receive any ancillary data or notifications, first the application To receive any ancillary data or notifications, first the application
registers its interest by calling the SCTP_EVENTS setsockopt() with registers its interest by calling the SCTP_EVENTS (deprecated, see
the following structure: below) setsockopt() with the following structure:
struct sctp_event_subscribe{ struct sctp_event_subscribe{
uint8_t sctp_data_io_event; uint8_t sctp_data_io_event;
uint8_t sctp_association_event; uint8_t sctp_association_event;
uint8_t sctp_address_event; uint8_t sctp_address_event;
uint8_t sctp_send_failure_event; uint8_t sctp_send_failure_event;
uint8_t sctp_peer_error_event; uint8_t sctp_peer_error_event;
uint8_t sctp_shutdown_event; uint8_t sctp_shutdown_event;
uint8_t sctp_partial_delivery_event; uint8_t sctp_partial_delivery_event;
uint8_t sctp_adaptation_layer_event; uint8_t sctp_adaptation_layer_event;
skipping to change at page 74, line 26 skipping to change at page 74, line 21
following structure: following structure:
struct sctp_event { struct sctp_event {
sctp_assoc_t se_assoc_id; sctp_assoc_t se_assoc_id;
uint16_t se_type; uint16_t se_type;
uint8_t se_on; uint8_t se_on;
}; };
se_assoc_id: The se_assoc_id field is ignored for one-to-one style se_assoc_id: The se_assoc_id field is ignored for one-to-one style
sockets. For one-to-many style sockets any this field can be a sockets. For one-to-many style sockets any this field can be a
particular association id or one of the defined constants. particular association id or SCTP_{FUTURE|CURRENT|ALL}_ASSOC.
se_type: The se_type field can be filled with any value that would se_type: The se_type field can be filled with any value that would
show up in the respective sn_type field (in the sctp_tlv structure show up in the respective sn_type field (in the sctp_tlv structure
of the notification). In addition SCTP_SNDRCV_EVENT, of the notification). In addition SCTP_SNDRCV_EVENT,
SCTP_RCV_EVENT, and SCTP_NXT_EVENT can be used. SCTP_RCV_EVENT, and SCTP_NXT_EVENT can be used.
se_on: The se_on field is set to 1 to turn on an event and set to 0 se_on: The se_on field is set to 1 to turn on an event and set to 0
to turn off an event. to turn off an event.
To use this option the user fills in this structure and then calls To use this option the user fills in this structure and then calls
the setsockopt to turn on or off an individual event. The following the setsockopt to turn on or off an individual event. The following
is an example use of this option: is an example use of this option:
skipping to change at page 75, line 32 skipping to change at page 75, line 27
If sd is an IPv4 socket, the addresses passed must be IPv4 addresses. If sd is an IPv4 socket, the addresses passed must be IPv4 addresses.
If the sd is an IPv6 socket, the addresses passed can either be IPv4 If the sd is an IPv6 socket, the addresses passed can either be IPv4
or IPv6 addresses. or IPv6 addresses.
A single address may be specified as INADDR_ANY or IN6ADDR_ANY, see A single address may be specified as INADDR_ANY or IN6ADDR_ANY, see
Section 3.1.2 for this usage. Section 3.1.2 for this usage.
addrs is a pointer to an array of one or more socket addresses. Each addrs is a pointer to an array of one or more socket addresses. Each
address is contained in its appropriate structure. For an IPv6 address is contained in its appropriate structure. For an IPv6
socket, an array of sockaddr_in6 would be returned. For a IPv4 socket, an array of sockaddr_in6 is used. For a IPv4 socket, an
socket, an array of sockaddr_in would be returned. The caller array of sockaddr_in would is used. The caller specifies the number
specifies the number of addresses in the array with addrcnt. Note of addresses in the array with addrcnt. Note that the wildcard
that the wildcard addresses cannot be used in combination with non addresses cannot be used in combination with non wildcard addresses
wildcard addresses on a socket with this function, doing so will on a socket with this function, doing so will result in an error.
result in an error.
On success, sctp_bindx() returns 0. On failure, sctp_bindx() returns On success, sctp_bindx() returns 0. On failure, sctp_bindx() returns
-1 and sets errno to the appropriate error code. -1 and sets errno to the appropriate error code.
For SCTP, the port given in each socket address must be the same, or For SCTP, the port given in each socket address must be the same, or
sctp_bindx() will fail, setting errno to EINVAL. sctp_bindx() will fail, setting errno to EINVAL.
The flags parameter is formed from the bitwise OR of zero or more of The flags parameter is formed from the bitwise OR of zero or more of
the following currently defined flags: the following currently defined flags:
o SCTP_BINDX_ADD_ADDR o SCTP_BINDX_ADD_ADDR
skipping to change at page 79, line 51 skipping to change at page 79, line 46
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()
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 effect 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
ssize_t sctp_recvmsg(int sd, ssize_t sctp_recvmsg(int sd,
void *msg, void *msg,
size_t len, size_t len,
struct sockaddr *from, struct sockaddr *from,
socklen_t *fromlen socklen_t *fromlen
struct sctp_sndrcvinfo *sinfo struct sctp_sndrcvinfo *sinfo
int *msg_flags); int *msg_flags);
and the arguments are and the arguments are
sd: The socket descriptor. sd: The socket descriptor.
 End of changes. 140 change blocks. 
317 lines changed or deleted 326 lines changed or added

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