draft-ietf-tsvwg-sctpsocket-08.txt   draft-ietf-tsvwg-sctpsocket-09.txt 
Network Working Group R. Stewart Network Working Group R. Stewart
Internet-Draft Cisco Systems, Inc. Internet-Draft Cisco Systems, Inc.
Expires: September 30, 2004 Q. Xie Expires: March 28, 2005 Q. Xie
Motorola, Inc. Motorola, Inc.
L. Yarroll L. Yarroll
USACE ERDC-CERL. TimeSys Corp
J. Wood J. Wood
DoCoMo USA Labs DoCoMo USA Labs
K. Poon K. Poon
Sun Microsystems, Inc. Sun Microsystems, Inc.
K. Fujita
NEC USA, Inc.
M. Tuexen M. Tuexen
Univ. of Applied Sciences Muenster Univ. of Applied Sciences Muenster
April 1, 2004 September 27, 2004
Sockets API Extensions for Stream Control Transmission Protocol Sockets API Extensions for Stream Control Transmission Protocol
(SCTP) (SCTP)
draft-ietf-tsvwg-sctpsocket-08.txt draft-ietf-tsvwg-sctpsocket-09.txt
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with This document is an Internet-Draft and is subject to all provisions
all provisions of Section 10 of RFC2026. of section 3 of RFC 3667. By submitting this Internet-Draft, each
author represents that any applicable patent or other IPR claims of
which he or she is aware have been or will be disclosed, and any of
which he or she become aware will be disclosed, in accordance with
RFC 3668.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that other Task Force (IETF), its areas, and its working groups. Note that
groups may also distribute working documents as Internet-Drafts. other groups may also distribute working documents as
Internet-Drafts.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
The list of current Internet-Drafts can be accessed at http:// The list of current Internet-Drafts can be accessed at
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 September 30, 2004. This Internet-Draft will expire on March 28, 2005.
Copyright Notice Copyright Notice
Copyright (C) The Internet Society (2004).
Copyright (C) The Internet Society (2004). All Rights Reserved.
Abstract Abstract
This document describes a mapping of the Stream Control Transmission This document describes a mapping of the Stream Control Transmission
Protocol SCTP RFC2960 [8] into a sockets API. The benefits of this Protocol SCTP RFC2960 [8] into a sockets API. The benefits of this
mapping include compatibility for TCP applications, access to new mapping include compatibility for TCP applications, access to new
SCTP features and a consolidated error and event notification scheme. SCTP features and a consolidated error and event notification scheme.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 5
2. Conventions . . . . . . . . . . . . . . . . . . . . . . . 6 2. Conventions . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1 Data Types . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1 Data Types . . . . . . . . . . . . . . . . . . . . . . . . 7
3. one-to-many style Interface . . . . . . . . . . . . . . . 7 3. one-to-many style Interface . . . . . . . . . . . . . . . . 8
3.1 Basic Operation . . . . . . . . . . . . . . . . . . . . . 7 3.1 Basic Operation . . . . . . . . . . . . . . . . . . . . . 8
3.1.1 socket() - one-to-many style socket . . . . . . . . . . . 8 3.1.1 socket() - one-to-many style socket . . . . . . . . . 9
3.1.2 bind() - one-to-many style socket . . . . . . . . . . . . 9 3.1.2 bind() - one-to-many style socket . . . . . . . . . . 9
3.1.3 listen() - One-to-many style socket . . . . . . . . . . . 10 3.1.3 listen() - One-to-many style socket . . . . . . . . . 10
3.1.4 sendmsg() and recvmsg() - one-to-many style socket . . . . 10 3.1.4 sendmsg() and recvmsg() - one-to-many style socket . . 11
3.1.5 close() - one-to-many style socket . . . . . . . . . . . . 12 3.1.5 close() - one-to-many style socket . . . . . . . . . . 12
3.1.6 connect() - one-to-many style socket . . . . . . . . . . . 12 3.1.6 connect() - one-to-many style socket . . . . . . . . . 13
3.2 Implicit Association Setup . . . . . . . . . . . . . . . . 13 3.2 Implicit Association Setup . . . . . . . . . . . . . . . . 13
3.3 Non-blocking mode . . . . . . . . . . . . . . . . . . . . 13 3.3 Non-blocking mode . . . . . . . . . . . . . . . . . . . . 14
3.4 Special considerations . . . . . . . . . . . . . . . . . . 14 3.4 Special considerations . . . . . . . . . . . . . . . . . . 15
4. one-to-one style Interface . . . . . . . . . . . . . . . . 17 4. one-to-one style Interface . . . . . . . . . . . . . . . . . 17
4.1 Basic Operation . . . . . . . . . . . . . . . . . . . . . 17 4.1 Basic Operation . . . . . . . . . . . . . . . . . . . . . 17
4.1.1 socket() - one-to-one style socket . . . . . . . . . . . . 18 4.1.1 socket() - one-to-one style socket . . . . . . . . . . 18
4.1.2 bind() - one-to-one style socket . . . . . . . . . . . . . 18 4.1.2 bind() - one-to-one style socket . . . . . . . . . . . 18
4.1.3 listen() - one-to-one style socket . . . . . . . . . . . . 19 4.1.3 listen() - one-to-one style socket . . . . . . . . . . 19
4.1.4 accept() - one-to-one style socket . . . . . . . . . . . . 20 4.1.4 accept() - one-to-one style socket . . . . . . . . . . 20
4.1.5 connect() - one-to-one style socket . . . . . . . . . . . 20 4.1.5 connect() - one-to-one style socket . . . . . . . . . 20
4.1.6 close() - one-to-one style socket . . . . . . . . . . . . 21 4.1.6 close() - one-to-one style socket . . . . . . . . . . 21
4.1.7 shutdown() - one-to-one style socket . . . . . . . . . . . 21 4.1.7 shutdown() - one-to-one style socket . . . . . . . . . 21
4.1.8 sendmsg() and recvmsg() - one-to-one style socket . . . . 22 4.1.8 sendmsg() and recvmsg() - one-to-one style socket . . 22
4.1.9 getpeername() . . . . . . . . . . . . . . . . . . . . . . 23 4.1.9 getpeername() . . . . . . . . . . . . . . . . . . . . 23
5. Data Structures . . . . . . . . . . . . . . . . . . . . . 24 5. Data Structures . . . . . . . . . . . . . . . . . . . . . . 24
5.1 The msghdr and cmsghdr Structures . . . . . . . . . . . . 24 5.1 The msghdr and cmsghdr Structures . . . . . . . . . . . . 24
5.2 SCTP msg_control Structures . . . . . . . . . . . . . . . 25 5.2 SCTP msg_control Structures . . . . . . . . . . . . . . . 25
5.2.1 SCTP Initiation Structure (SCTP_INIT) . . . . . . . . . . 26 5.2.1 SCTP Initiation Structure (SCTP_INIT) . . . . . . . . 26
5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) . . . . . 27 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) . . . 27
5.3 SCTP Events and Notifications . . . . . . . . . . . . . . 30 5.3 SCTP Events and Notifications . . . . . . . . . . . . . . 30
5.3.1 SCTP Notification Structure . . . . . . . . . . . . . . . 30 5.3.1 SCTP Notification Structure . . . . . . . . . . . . . 30
5.4 Ancillary Data Considerations and Semantics . . . . . . . 40 5.4 Ancillary Data Considerations and Semantics . . . . . . . 40
5.4.1 Multiple Items and Ordering . . . . . . . . . . . . . . . 40 5.4.1 Multiple Items and Ordering . . . . . . . . . . . . . 40
5.4.2 Accessing and Manipulating Ancillary Data . . . . . . . . 40 5.4.2 Accessing and Manipulating Ancillary Data . . . . . . 40
5.4.3 Control Message Buffer Sizing . . . . . . . . . . . . . . 41 5.4.3 Control Message Buffer Sizing . . . . . . . . . . . . 41
6. Common Operations for Both Styles . . . . . . . . . . . . 43 6. Common Operations for Both Styles . . . . . . . . . . . . . 43
6.1 send(), recv(), sendto(), recvfrom() . . . . . . . . . . . 43 6.1 send(), recv(), sendto(), recvfrom() . . . . . . . . . . . 43
6.2 setsockopt(), getsockopt() . . . . . . . . . . . . . . . . 44 6.2 setsockopt(), getsockopt() . . . . . . . . . . . . . . . . 44
6.3 read() and write() . . . . . . . . . . . . . . . . . . . . 44 6.3 read() and write() . . . . . . . . . . . . . . . . . . . . 44
6.4 getsockname() . . . . . . . . . . . . . . . . . . . . . . 44 6.4 getsockname() . . . . . . . . . . . . . . . . . . . . . . 44
7. Socket Options . . . . . . . . . . . . . . . . . . . . . . 46 7. Socket Options . . . . . . . . . . . . . . . . . . . . . . . 46
7.1 Read / Write Options . . . . . . . . . . . . . . . . . . . 47 7.1 Read / Write Options . . . . . . . . . . . . . . . . . . . 47
7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) . . . . . 47 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) . . . 47
7.1.2 Association Parameters (SCTP_ASSOCINFO) . . . . . . . . . 48 7.1.2 Association Parameters (SCTP_ASSOCINFO) . . . . . . . 48
7.1.3 Initialization Parameters (SCTP_INITMSG) . . . . . . . . . 50 7.1.3 Initialization Parameters (SCTP_INITMSG) . . . . . . . 50
7.1.4 SO_LINGER . . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.4 SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 50
7.1.5 SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . . . 50 7.1.5 SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . . 50
7.1.6 SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . . . 51 7.1.6 SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 51
7.1.7 SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . . . 51 7.1.7 SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 51
7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE) . . . . . 51 7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE) . . . 51
7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) . . 51 7.1.9 Set Peer Primary Address
7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . . . 52 (SCTP_SET_PEER_PRIMARY_ADDR) . . . . . . . . . . . . . 51
7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) . . . . 52 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . 52
7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER) . 52
7.1.12 Enable/Disable message fragmentation 7.1.12 Enable/Disable message fragmentation
(SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . . . . 53 (SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . 53
7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . . . 53 7.1.13 Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . 53
7.1.14 Set default send parameters (SCTP_DEFAULT_SEND_PARAM) . . 53 7.1.14 Set default send parameters
7.1.15 Set notification and ancillary events (SCTP_EVENTS) . . . 54 (SCTP_DEFAULT_SEND_PARAM) . . . . . . . . . . . . . 53
7.1.15 Set notification and ancillary events
(SCTP_EVENTS) . . . . . . . . . . . . . . . . . . . 54
7.1.16 Set/clear IPv4 mapped addresses 7.1.16 Set/clear IPv4 mapped addresses
(SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . . . . 54 (SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . 54
7.1.17 Set the maximum fragmentation size (SCTP_MAXSEG) . . . . . 54 7.1.17 Set the maximum fragmentation size (SCTP_MAXSEG) . . 54
7.2 Read-Only Options . . . . . . . . . . . . . . . . . . . . 54 7.2 Read-Only Options . . . . . . . . . . . . . . . . . . . . 54
7.2.1 Association Status (SCTP_STATUS) . . . . . . . . . . . . . 54 7.2.1 Association Status (SCTP_STATUS) . . . . . . . . . . . 54
7.2.2 Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . . . . 56 7.2.2 Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . . 56
7.3 Ancillary Data and Notification Interest Options . . . . . 57 7.3 Ancillary Data and Notification Interest Options . . . . . 57
8. New Interfaces . . . . . . . . . . . . . . . . . . . . . . 60 8. New Interfaces . . . . . . . . . . . . . . . . . . . . . . . 60
8.1 sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 60 8.1 sctp_bindx() . . . . . . . . . . . . . . . . . . . . . . . 60
8.2 Branched-off Association . . . . . . . . . . . . . . . . . 61 8.2 Branched-off Association . . . . . . . . . . . . . . . . . 61
8.3 sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 61 8.3 sctp_getpaddrs() . . . . . . . . . . . . . . . . . . . . . 61
8.4 sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 62 8.4 sctp_freepaddrs() . . . . . . . . . . . . . . . . . . . . 62
8.5 sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 62 8.5 sctp_getladdrs() . . . . . . . . . . . . . . . . . . . . . 62
8.6 sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 63 8.6 sctp_freeladdrs() . . . . . . . . . . . . . . . . . . . . 63
8.7 sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 63 8.7 sctp_sendmsg() . . . . . . . . . . . . . . . . . . . . . . 63
8.8 sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 64 8.8 sctp_recvmsg() . . . . . . . . . . . . . . . . . . . . . . 64
8.9 sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 65 8.9 sctp_connectx() . . . . . . . . . . . . . . . . . . . . . 65
8.10 sctp_send() . . . . . . . . . . . . . . . . . . . . . . . 66 8.10 sctp_send() . . . . . . . . . . . . . . . . . . . . . . 66
9. Preprocessor Constants . . . . . . . . . . . . . . . . . . 67 8.11 sctp_sendx() . . . . . . . . . . . . . . . . . . . . . . 66
10. Security Considerations . . . . . . . . . . . . . . . . . 68 9. Preprocessor Constants . . . . . . . . . . . . . . . . . . . 68
11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . 69 10. Security Considerations . . . . . . . . . . . . . . . . . . 69
References . . . . . . . . . . . . . . . . . . . . . . . . 70 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . 70
Authors' Addresses . . . . . . . . . . . . . . . . . . . . 70 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 70
A. one-to-one style Code Example . . . . . . . . . . . . . . 73 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . 71
B. one-to-many style Code Example . . . . . . . . . . . . . . 79 A. one-to-one style Code Example . . . . . . . . . . . . . . . 73
Intellectual Property and Copyright Statements . . . . . . 81 B. one-to-many style Code Example . . . . . . . . . . . . . . . 79
Intellectual Property and Copyright Statements . . . . . . . 81
1. Introduction 1. Introduction
The sockets API has provided a standard mapping of the Internet The sockets API has provided a standard mapping of the Internet
Protocol suite to many operating systems. Both TCP RFC793 [1] and UDP Protocol suite to many operating systems. Both TCP RFC793 [1] and
RFC768 [2] have benefited from this standard representation and UDP RFC768 [2] have benefited from this standard representation and
access method across many diverse platforms. SCTP is a new protocol access method across many diverse platforms. SCTP is a new protocol
that provides many of the characteristics of TCP but also that provides many of the characteristics of TCP but also
incorporates semantics more akin to UDP. This document defines a incorporates semantics more akin to UDP. This document defines a
method to map the existing sockets API for use with SCTP, providing method to map the existing sockets API for use with SCTP, providing
both a base for access to new features and compatibility so that most both a base for access to new features and compatibility so that most
existing TCP applications can be migrated to SCTP with few (if any) existing TCP applications can be migrated to SCTP with few (if any)
changes. changes.
There are three basic design objectives: There are three basic design objectives:
skipping to change at page 8, line 21 skipping to change at page 9, line 13
option (section 7.1.8) is set. In this case, after the association option (section 7.1.8) is set. In this case, after the association
is terminated automatically, the association ID assigned to it can be is terminated automatically, the association ID assigned to it can be
reused. All applications using this option should be aware of this reused. All applications using this option should be aware of this
to avoid the possible problem of sending data to an incorrect peer to avoid the possible problem of sending data to an incorrect peer
end point. end point.
If the server or client wishes to branch an existing association off If the server or client wishes to branch an existing association off
to a separate socket, it is required to call sctp_peeloff() and in to a separate socket, it is required to call sctp_peeloff() and in
the parameter specifies the association identification. The the parameter specifies the association identification. The
sctp_peeloff() call will return a new socket which can then be used sctp_peeloff() call will return a new socket which can then be used
with recv() and send() functions for message passing. See Section 8.2 with recv() and send() functions for message passing. See Section
for more on branched-off associations. 8.2 for more on branched-off associations.
Once an association is branched off to a separate socket, it becomes Once an association is branched off to a separate socket, it becomes
completely separated from the original socket. All subsequent completely separated from the original socket. All subsequent
control and data operations to that association must be done through control and data operations to that association must be done through
the new socket. For example, the close operation on the original the new socket. For example, the close operation on the original
socket will not terminate any associations that have been branched socket will not terminate any associations that have been branched
off to a different socket. off to a different socket.
We will discuss the one-to-many style socket calls in more details in We will discuss the one-to-many style socket calls in more details in
the following subsections. the following subsections.
skipping to change at page 9, line 51 skipping to change at page 10, line 41
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 addr is specified as a wildcard (INADDR_ANY for an IPv4 address,
or as IN6ADDR_ANY_INIT or in6addr_any for an IPv6 address), the or as IN6ADDR_ANY_INIT or in6addr_any for an IPv6 address), the
operating system will associate the endpoint with an optimal address operating system will associate the endpoint with an optimal address
set of the available interfaces. set of the available interfaces.
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. This those addresses will be the primary address for the association.
automatically enables the multi-homing capability of SCTP. This automatically enables the multi-homing capability of SCTP.
3.1.3 listen() - One-to-many style socket 3.1.3 listen() - One-to-many style socket
By default, new associations are not accepted for one-to-many style By default, new associations are not accepted for one-to-many style
sockets. An application uses listen() to mark a socket as being able sockets. An application uses listen() to mark a socket as being able
to accept new associations. The syntax is, to accept new associations. The syntax is,
int listen(int sd, int backlog); int listen(int sd, int backlog);
sd - the socket descriptor of the endpoint. sd - the socket descriptor of the endpoint.
backlog - if backlog is non-zero, enable listening else backlog - if backlog is non-zero, enable listening else
disable listening. disable listening.
Note that one-to-many style socket consumers do not need to call Note that one-to-many style socket consumers do not need to call
accept to retrieve new associations. Calling accept() on a accept to retrieve new associations. Calling accept() on a
one-to-many style socket should return EOPNOTSUPP. Rather, new one-to-many style socket should return EOPNOTSUPP. Rather, new
associations are accepted automatically, and notifications of the new associations are accepted automatically, and notifications of the new
associations are delivered via recvmsg() with the SCTP_ASSOC_CHANGE associations are delivered via recvmsg() with the SCTP_ASSOC_CHANGE
event (if these notifications are enabled). Clients will typically event (if these notifications are enabled). Clients will typically
not call listen(), so that they can be assured that the only not call listen(), so that they can be assured that the only
skipping to change at page 10, line 46 skipping to change at page 11, line 37
3.1.4 sendmsg() and recvmsg() - one-to-many style socket 3.1.4 sendmsg() and recvmsg() - one-to-many style socket
An application uses sendmsg() and recvmsg() call to transmit data to An application uses sendmsg() and recvmsg() call to transmit data to
and receive data from its peer. and receive data from its peer.
ssize_t sendmsg(int sd, const struct msghdr *message, int flags); ssize_t sendmsg(int sd, const struct msghdr *message, int flags);
ssize_t recvmsg(int sd, struct msghdr *message, int flags); ssize_t recvmsg(int sd, struct msghdr *message, int flags);
sd: the socket descriptor of the endpoint. sd: the socket descriptor of the endpoint.
message: pointer to the msghdr structure which contains a single user message: pointer to the msghdr structure which contains a single user
message and possibly some ancillary data. See Section 5 for 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 Section
flags: No new flags are defined for SCTP at this level. See Section 5 5 for SCTP-specific flags used in the msghdr structure.
for SCTP-specific flags used in the msghdr structure.
As we will see in Section 5, along with the user data, the ancillary As we will see in Section 5, along with the user data, the ancillary
data field is used to carry the sctp_sndrcvinfo and/or the data field is used to carry the sctp_sndrcvinfo and/or the
sctp_initmsg structures to perform various SCTP functions including sctp_initmsg structures to perform various SCTP functions including
specifying options for sending each user message. Those options, specifying options for sending each user message. Those options,
depending on whether sending or receiving, include stream number, depending on whether sending or receiving, include stream number,
stream sequence number, various flags, context and payload protocol stream sequence number, various flags, context and payload protocol
Id, etc. Id, etc.
When sending user data with sendmsg(), the msg_name field in msghdr When sending user data with sendmsg(), the msg_name field in msghdr
skipping to change at page 12, line 18 skipping to change at page 13, line 4
3.1.5 close() - one-to-many style socket 3.1.5 close() - one-to-many style socket
Applications use close() to perform graceful shutdown (as described Applications use close() to perform graceful shutdown (as described
in Section 10.1 of RFC2960 [8]) on ALL the associations currently in Section 10.1 of RFC2960 [8]) on ALL the associations currently
represented by a one-to-many style socket. represented by a one-to-many style socket.
The syntax is: The syntax is:
ret = close(int sd); ret = close(int sd);
sd - the socket descriptor of the associations to be closed. sd - the socket descriptor of the associations to be closed.
To gracefully shutdown a specific association represented by the To gracefully shutdown a specific association represented by the
one-to-many style socket, an application should use the sendmsg() one-to-many style socket, an application should use the sendmsg()
call, and including the MSG_EOF flag. A user may optionally terminate call, and including the MSG_EOF flag. A user may optionally
an association non-gracefully by sending with the MSG_ABORT flag and terminate an association non-gracefully by sending with the MSG_ABORT
possibly passing a user specified abort code in the data field. Both flag and possibly passing a user specified abort code in the data
flags MSG_EOF and MSG_ABORT are passwd with ancillary data (see field. Both flags MSG_EOF and MSG_ABORT are passwd with ancillary
Section 5.2.2) in the sendmsg call. data (see Section 5.2.2) in the sendmsg call.
If sd in the close() call is a branched-off socket representing only If sd in the close() call is a branched-off socket representing only
one association, the shutdown is performed on that association only. one association, the shutdown is performed on that association only.
3.1.6 connect() - one-to-many style socket 3.1.6 connect() - one-to-many style socket
An application may use the connect() call in the one-to-many style to An application may use the connect() call in the one-to-many style to
initiate an association without sending data. initiate an association without sending data.
The syntax is: The syntax is:
skipping to change at page 13, line 22 skipping to change at page 13, line 51
Whenever sendmsg() or sendto() is called and the SCTP stack at the Whenever sendmsg() or sendto() is called and the SCTP stack at the
sender finds that there is no association existing between the sender sender finds that there is no association existing between the sender
and the intended receiver (identified by the address passed either in and the intended receiver (identified by the address passed either in
the msg_name field of msghdr structure in the sendmsg() call or the the msg_name field of msghdr structure in the sendmsg() call or the
dest_addr field in the sendto() call), the SCTP stack will dest_addr field in the sendto() call), the SCTP stack will
automatically setup an association to the intended receiver. automatically setup an association to the intended receiver.
Upon the successful association setup a SCTP_COMM_UP notification Upon the successful association setup a 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 (see side. This notification can be read by the recvmsg() system call
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
RFC2960 [8]. RFC2960 [8].
When the SCTP stack sets up a new association implicitly, it first When the SCTP stack sets up a new association implicitly, it first
consults the sctp_initmsg structure, which is passed along within the consults the sctp_initmsg structure, which is passed along within the
ancillary data in the sendmsg() call (see Section 5.2.1 for details ancillary data in the sendmsg() call (see Section 5.2.1 for details
of the data structures), for any special options to be used on the of the data structures), for any special options to be used on the
new association. new association.
skipping to change at page 14, line 43 skipping to change at page 15, line 25
ready for reading or writing should either use the one-to-one style ready for reading or writing should either use the one-to-one style
or use the sctp_peelloff() (see Section 8.2) function to seperate the or use the sctp_peelloff() (see Section 8.2) function to seperate the
association of interest from the one-to-many socket. association of interest from the one-to-many socket.
3.4 Special considerations 3.4 Special considerations
The fact that a one-to-many style socket can provide access to many The fact that a one-to-many style socket can provide access to many
SCTP associations through a single socket descriptor has important SCTP associations through a single socket descriptor has important
implications for both application programmers and system programmers implications for both application programmers and system programmers
implementing this API. A key issue is how buffer space inside the implementing this API. A key issue is how buffer space inside the
sockets layer is managed. Because this implementation detail directly sockets layer is managed. Because this implementation detail
affects how application programmers must write their code to ensure directly affects how application programmers must write their code to
correct operation and portability, this section provides some ensure correct operation and portability, this section provides some
guidance to both implementors and application programmers. guidance to both implementors 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
skipping to change at page 15, line 30 skipping to change at page 16, line 12
single stalled association can prevent the further sending of data on single stalled association can prevent the further sending of data on
all associations active on a particular one-to-many style socket. all associations active on a particular one-to-many style socket.
For a blocking socket, it should be clear that a single stalled For a blocking socket, it should be clear that a single stalled
association can block the entire socket. For this reason, association can block the entire socket. For this reason,
application programmers may want to use non-blocking one-to-many application programmers may want to use non-blocking one-to-many
style sockets. The application should at least be able to send style sockets. The application should at least be able to send
messages to the non-stalled associations. messages to the non-stalled associations.
But a non-blocking socket is not sufficient if the API implementor But a non-blocking socket is not sufficient if the API implementor
has chosen a single shared buffer allocation for the socket. A single has chosen a single shared buffer allocation for the socket. A
stalled association would eventually cause the shared allocation to single stalled association would eventually cause the shared
fill, and it would become impossible to send even to non-stalled allocation to fill, and it would become impossible to send even to
associations. non-stalled associations.
The API implementor can solve this problem by providing each The API implementor can solve this problem by providing each
association with its own allocation of outbound buffer space. Each association with its own allocation of outbound buffer space. Each
association should conceptually have as much buffer space as it would association should conceptually have as much buffer space as it would
have if it had its own socket. As a bonus, this simplifies the have if it had its own socket. As a bonus, this simplifies the
implementation of sctp_peeloff(). implementation of sctp_peeloff().
To ensure that a given stalled association will not prevent other To ensure that a given stalled association will not prevent other
non-stalled associations from being writable, application programmers non-stalled associations from being writable, application programmers
should either: should either:
skipping to change at page 22, line 27 skipping to change at page 22, line 27
Disables further send operations, and initiates Disables further send operations, and initiates
the SCTP shutdown sequence. the SCTP shutdown sequence.
SHUT_RDWR SHUT_RDWR
Disables further send and receive operations Disables further send and receive operations
and initiates the SCTP shutdown sequence. and 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 the same for SCTP as TCP. The purpose of SCTP SHUT_WR is to close
SCTP association while still leaving the socket descriptor open, so the SCTP association while still leaving the socket descriptor open,
that the caller can receive back any data SCTP was unable to deliver so that the caller can receive back any data SCTP was unable to
(see Section 5.3.1.4 for more information). deliver (see Section 5.3.1.4 for more information).
To perform the ABORT operation described in RFC2960 [8] section 10.1, To perform the ABORT operation described in RFC2960 [8] 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() - one-to-one style socket 4.1.8 sendmsg() and recvmsg() - one-to-one style socket
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 style peer. The semantics is similar to those used in the one-to-many
(section Section 3.1.3), with the following differences: style (section Section 3.1.3), with the following differences:
1) When sending, the msg_name field in the msghdr is not used to 1) When sending, the msg_name field in the msghdr is not used to
specify the intended receiver, rather it is used to indicate a specify the intended receiver, rather it is used to indicate a
preferred peer address if the sender wishes to discourage the stack preferred peer address if the sender wishes to discourage the stack
from sending the message to the primary address of the receiver. If from sending the message to the primary address of the receiver. If
the transport address given is not part of the current association, the transport address given is not part of the current association,
the data will not be sent and a SCTP_SEND_FAILED event will be the data will not be sent and a SCTP_SEND_FAILED event will be
delivered to the application if send failure events are enabled. delivered to the application if send failure events are enabled.
2) An application must use close() to gracefully shutdown an 2) An application must use close() to gracefully shutdown an
skipping to change at page 25, line 28 skipping to change at page 25, line 28
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 in the cmsg_data[] member. contained in in the cmsg_data[] member.
There are two kinds of ancillary data used by SCTP: initialization There are two kinds of ancillary data used by SCTP: initialization
data, and, header information (SNDRCV). Initialization data data, and, header information (SNDRCV). Initialization data
(one-to-many style only) sets protocol parameters for new (one-to-many style only) sets protocol parameters for new
associations. Section 5.2.1 provides more details. Header information associations. Section 5.2.1 provides more details. Header
can set or report parameters on individual messages in a stream. See information can set or report parameters on individual messages in a
Section 5.2.2 for how to use SNDRCV ancillary data. stream. See Section 5.2.2 for how to use SNDRCV ancillary data.
By default on a one-to-one style socket, SCTP will pass no ancillary By default on a one-to-one style socket, SCTP will pass no ancillary
data; on a one-to-many style socket, SCTP will only pass SCTP_SNDRCV data; on a one-to-many style socket, SCTP will only pass SCTP_SNDRCV
and SCTP_ASSOC_CHANGE information. Specific ancillary data items can and SCTP_ASSOC_CHANGE information. Specific ancillary data items can
be enabled with socket options defined for SCTP; see Section 7.3. be enabled with socket options defined for SCTP; see Section 7.3.
Note that all ancillary types are fixed length; see Section 5.4 for Note that all ancillary types are fixed length; see Section 5.4 for
further discussion on this. These data structures use struct further discussion on this. These data structures use struct
sockaddr_storage (defined in RFC2553 [7]) as a portable, fixed length sockaddr_storage (defined in RFC2553 [7]) as a portable, fixed length
address format. address format.
skipping to change at page 26, line 40 skipping to change at page 26, line 40
in the SCTP_COMM_UP notification and must be verified since it is a in the SCTP_COMM_UP notification and must be verified since it is a
negotiated number with the remote endpoint. The default value of 0 negotiated number with the remote endpoint. The default value of 0
indicates to use the endpoint default value. indicates to use the endpoint default value.
sinit_max_instreams: 16 bits (unsigned integer) sinit_max_instreams: 16 bits (unsigned integer)
This value represents the maximum number of inbound streams the This value represents the maximum number of inbound streams the
application is prepared to support. This value is bounded by the application is prepared to support. This value is bounded by the
actual implementation. In other words the user MAY be able to actual implementation. In other words the user MAY be able to
support more streams than the Operating System. In such a case, the support more streams than the Operating System. In such a case, the
Operating System limit overrides the value requested by the user. The Operating System limit overrides the value requested by the user.
default value of 0 indicates to use the endpoint's default value. The default value of 0 indicates to use the endpoint's default value.
sinit_max_attempts: 16 bits (unsigned integer) sinit_max_attempts: 16 bits (unsigned integer)
This integer specifies how many attempts the SCTP endpoint should This integer specifies how many attempts the SCTP endpoint should
make at resending the INIT. This value overrides the system SCTP make at resending the INIT. This value overrides the system SCTP
'Max.Init.Retransmits' value. The default value of 0 indicates to 'Max.Init.Retransmits' value. The default value of 0 indicates to
use the endpoint's default value. This is normally set to the use the endpoint's default value. This is normally set to the
system's default 'Max.Init.Retransmit' value. system's default 'Max.Init.Retransmit' value.
sinit_max_init_timeo: 16 bits (unsigned integer) sinit_max_init_timeo: 16 bits (unsigned integer)
skipping to change at page 27, line 40 skipping to change at page 27, line 40
uint32_t sinfo_context; uint32_t sinfo_context;
uint32_t sinfo_timetolive; uint32_t sinfo_timetolive;
uint32_t sinfo_tsn; uint32_t sinfo_tsn;
uint32_t sinfo_cumtsn; uint32_t sinfo_cumtsn;
sctp_assoc_t sinfo_assoc_id; sctp_assoc_t sinfo_assoc_id;
}; };
sinfo_stream: 16 bits (unsigned integer) sinfo_stream: 16 bits (unsigned integer)
For recvmsg() the SCTP stack places the message's stream number in For recvmsg() the SCTP stack places the message's stream number in
this value. For sendmsg() this value holds the stream number that the this value. For sendmsg() this value holds the stream number that
application wishes to send this message to. If a sender specifies an the application wishes to send this message to. If a sender
invalid stream number an error indication is returned and the call specifies an invalid stream number an error indication is returned
fails. and the call fails.
sinfo_ssn: 16 bits (unsigned integer) sinfo_ssn: 16 bits (unsigned integer)
For recvmsg() this value contains the stream sequence number that the For recvmsg() this value contains the stream sequence number that the
remote endpoint placed in the DATA chunk. For fragmented messages remote endpoint placed in the DATA chunk. For fragmented messages
this is the same number for all deliveries of the message (if more this is the same number for all deliveries of the message (if more
than one recvmsg() is needed to read the message). The sendmsg() than one recvmsg() is needed to read the message). The sendmsg()
call will ignore this parameter. call will ignore this parameter.
sinfo_ppid: 32 bits (unsigned integer) sinfo_ppid: 32 bits (unsigned integer)
skipping to change at page 29, line 34 skipping to change at page 29, line 34
error cause 'User Initiated Abort' with cause code 12. error cause 'User Initiated Abort' with cause code 12.
The cause specific information of this error cause is The cause specific information of this error cause is
provided in msg_iov. provided in msg_iov.
MSG_EOF - Setting this flag invokes the SCTP graceful shutdown MSG_EOF - Setting this flag invokes the SCTP graceful shutdown
procedures on the specified association. Graceful procedures on the specified association. Graceful
shutdown assures that all data enqueued by both shutdown assures that all data enqueued by both
endpoints is successfully transmitted before closing endpoints is successfully transmitted before closing
the association (one-to-many style only). the association (one-to-many style only).
MSG_SENDALL - This flag, if set, will cause a one-to-many model
socket to send the message to all associations
that are currently established on this socket. For
the one-to-one socket, this flag has no effect.
sinfo_timetolive: 32 bit (unsigned integer) sinfo_timetolive: 32 bit (unsigned integer)
For the sending side, this field contains the message time to live in For the sending side, this field contains the message time to live in
milliseconds. The sending side will expire the message within the milliseconds. The sending side will expire the message within the
specified time period if the message as not been sent to the peer specified time period if the message as not been sent to the peer
within this time period. This value will override any default value within this time period. This value will override any default value
set using any socket option. Also note that the value of 0 is special set using any socket option. Also note that the value of 0 is
in that it indicates no timeout should occur on this message. special in that it indicates no timeout should occur on this message.
sinfo_tsn: 32 bit (unsigned integer) sinfo_tsn: 32 bit (unsigned integer)
For the receiving side, this field holds a TSN that was assigned to For the receiving side, this field holds a TSN that was assigned to
one of the SCTP Data Chunks. one of the SCTP Data Chunks.
sinfo_cumtsn: 32 bit (unsigned integer) sinfo_cumtsn: 32 bit (unsigned integer)
This field will hold the current cumulative TSN as known by the This field will hold the current cumulative TSN as known by the
underlying SCTP layer. Note this field is ignored when sending and underlying SCTP layer. Note this field is ignored when sending and
skipping to change at page 35, line 38 skipping to change at page 35, line 38
this field. this field.
spc_assoc_id: sizeof (sctp_assoc_t) spc_assoc_id: sizeof (sctp_assoc_t)
The association id field, holds the identifier for the association. The association id field, holds the identifier for the association.
All notifications for a given association have the same association All notifications for a given association have the same association
identifier. For one-to-one style socket, this field is ignored. identifier. For one-to-one style socket, this field is ignored.
5.3.1.3 SCTP_REMOTE_ERROR 5.3.1.3 SCTP_REMOTE_ERROR
A remote peer may send an Operational Error message to its peer. This A remote peer may send an Operational Error message to its peer.
message indicates a variety of error conditions on an association. This message indicates a variety of error conditions on an
The entire ERROR chunk as it appears on the wire is included in a association. The entire ERROR chunk as it appears on the wire is
SCTP_REMOTE_ERROR event. Please refer to the SCTP specification included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
RFC2960 [8] and any extensions for a list of possible error formats. specification RFC2960 [8] and any extensions for a list of possible
SCTP error notifications have the format: error formats. SCTP error notifications have the 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[0]; uint8_t sre_data[0];
}; };
skipping to change at page 40, line 47 skipping to change at page 40, line 47
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
RFC2292 [6] and your SCTP implementation's documentation for more RFC2292 [6] and your SCTP implementation's documentation for more
information. Following is an example, from RFC2292 [6], demonstrating information. Following is an example, from RFC2292 [6],
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() */
for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL; for (cmsgptr = CMSG_FIRSTHDR(&msg); cmsgptr != NULL;
cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) { cmsgptr = CMSG_NXTHDR(&msg, cmsgptr)) {
skipping to change at page 41, line 27 skipping to change at page 41, line 27
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 events will often be
fundamental to the correct and sane operation of the sockets fundamental to the correct and sane operation of the sockets
application. This is particularly true of the one-to-many semantics, application. This is particularly true of the one-to-many semantics,
but also of the one-ton-one semantics. For example, if an application but also of the one-ton-one semantics. For example, if an
needs to send and receive data on different SCTP streams, SCTP_SNDRCV application needs to send and receive data on different SCTP streams,
events are indispensable. SCTP_SNDRCV events are 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
constraint imposed on this specification that makes this possible is constraint imposed on this specification that makes this possible is
that all ancillary data definitions are of a fixed length. One way to that all ancillary data definitions are of a fixed length. One way
calculate the maximum required buffer size might be to take the sum to calculate the maximum required buffer size might be to take the
the sizes of all enabled ancillary data item structures, as sum the sizes of all enabled ancillary data item structures, as
calculated by CMSG_SPACE. For example, if we enabled SCTP_SNDRCV_INFO calculated by CMSG_SPACE. For example, if we enabled
and IPV6_RECVPKTINFO RFC2292 [6], we would calculate and allocate the SCTP_SNDRCV_INFO and IPV6_RECVPKTINFO RFC2292 [6], we would calculate
buffer size as follows: and allocate the buffer size as follows:
size_t total; size_t total;
void *buf; void *buf;
total = CMSG_SPACE(sizeof (struct sctp_sndrcvinfo)) + total = CMSG_SPACE(sizeof (struct sctp_sndrcvinfo)) +
CMSG_SPACE(sizeof (struct in6_pktinfo)); CMSG_SPACE(sizeof (struct in6_pktinfo));
buf = malloc(total); buf = malloc(total);
We could then use this buffer for msg_control on each call to We could then use this buffer for msg_control on each call to
skipping to change at page 47, line 14 skipping to change at page 47, line 14
See Section 8.5) subsections for more information on these options See Section 8.5) subsections for more information on these options
and option-specific structures. and option-specific structures.
sctp_opt_info() returns 0 on success, or on failure returns -1 and sctp_opt_info() returns 0 on success, or on failure returns -1 and
sets errno to the appropriate error code. sets errno to the appropriate error code.
All options that support specific settings on an association by All options that support specific settings on an association by
filling in either an association id variable or a sockaddr_storage filling in either an association id variable or a sockaddr_storage
SHOULD also support setting of the same value for the entire endpoint SHOULD also support setting of the same value for the entire endpoint
(i.e. future associations). To accomplish this the following logic is (i.e. future associations). To accomplish this the following logic
used when setting one of these options: is used when setting one of these options:
a) If an address is specified via a sockaddr_storage that is included a) If an address is specified via a sockaddr_storage that is included
in the structure the address is used to lookup the association and in the structure the address is used to lookup the association and
the settings are applied to the specific address (if appropriate) the settings are applied to the specific address (if appropriate)
or to the entire association. or to the entire association.
b) If an association identification is filled in but not a b) 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 entire 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.
c) If neither the sockaddr_storage or association identification is c) If neither the sockaddr_storage or association identification is
set i.e. the sockaddr_storage is set to all 0's (INADDR_ANY) and set i.e. the sockaddr_storage is set to all 0's (INADDR_ANY) and
the association identification is 0, the settings are a default the association identification is 0, the settings are a default
and to be applied to the endpoint (all future associations). and to be applied to the endpoint (all future associations).
7.1 Read / Write Options 7.1 Read / Write Options
7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
The protocol parameters used to initialize and bound retransmission The protocol parameters used to initialize and bound retransmission
skipping to change at page 50, line 44 skipping to change at page 50, line 44
}; };
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 continues in the system. return but the graceful shutdown phase continues in the system.
Note, this is a socket level option NOT an SCTP level option. So when Note, this is a socket level option NOT an SCTP level option. So
setting SO_LINGER you must specify a level of SOL_SOCKET in the when setting SO_LINGER you must specify a level of SOL_SOCKET in the
setsockopt() call. 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. integer boolean flag.
7.1.6 SO_RCVBUF 7.1.6 SO_RCVBUF
skipping to change at page 51, line 33 skipping to change at page 51, line 33
that can be sent in a single send call. For one-to-many style that can be sent in a single send call. For one-to-many style
sockets, the effect is the same, except that it applies to one or all sockets, the effect is the same, except that it applies to one or all
associations (see Section 3.4) bound to the socket descriptor associations (see Section 3.4) bound to the socket descriptor
used in the setsockopt() or getsockopt() call. The option applies to used in the setsockopt() or getsockopt() call. The option applies to
each association's window size separately. The call expects an each association's window size separately. The call expects an
integer. integer.
7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE) 7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE)
This socket option is applicable to the one-to-many style socket This socket option is applicable to the one-to-many style socket
only. When set it will cause associations that are idle for more than only. When set it will cause associations that are idle for more
the specified number of seconds to automatically close. An than the specified number of seconds to automatically close. An
association being idle is defined as an association that has NOT sent association being idle is defined as an association that has NOT sent
or received user data. The special value of '0' indicates that no or received user data. The special value of '0' indicates that no
automatic close of any associations should be performed, this is the automatic close of any associations should be performed, this is the
default value. The option expects an integer defining the number of default value. The option expects an integer defining the number of
seconds of idle time before an association is closed. seconds of idle time before an association is closed.
An application using this option should enable receiving the An application using this option should enable receiving the
association change notification. This is the only mechanism an association change notification. This is the only mechanism an
application is informed about the closing of an association. After application is informed about the closing of an association. After
an association is closed, the association ID assigned to it can be an association is closed, the association ID assigned to it can be
skipping to change at page 52, line 24 skipping to change at page 52, line 24
application, and identifies the association application, and identifies the association
for this request. for this request.
This functionality is optional. Implementations that do not support This functionality is optional. Implementations that do not support
this functionality should return EOPNOTSUPP. this functionality should return EOPNOTSUPP.
7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
Requests that the local SCTP stack use the enclosed peer address as Requests that the local SCTP stack use the enclosed peer address as
the association primary. The enclosed address must be one of the the association primary. The enclosed address must be one of the
association peer's addresses. The following structure is used to make association peer's addresses. The following structure is used to
a set peer primary request: 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 (one-to-many style socket) This is filled in by the ssp_assoc_id (one-to-many style socket) This is filled in by the
application, and identifies the association application, and identifies the association
for this request. for this request.
skipping to change at page 54, line 6 skipping to change at page 54, line 6
be made to this parameter. be made to this parameter.
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.14 Set default send parameters (SCTP_DEFAULT_SEND_PARAM) 7.1.14 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. The such an application to set the default sctp_sndrcvinfo structure.
application that wishes to use this socket option simply passes in to The application that wishes to use this socket option simply passes
this call the sctp_sndrcvinfo structure defined in Section 5.2.2) The in to this call the sctp_sndrcvinfo structure defined in Section
input parameters accepted by this call include sinfo_stream, 5.2.2) The input parameters accepted by this call include
sinfo_flags, sinfo_ppid, sinfo_context, sinfo_timetolive. The user sinfo_stream, sinfo_flags, sinfo_ppid, sinfo_context,
must set the sinfo_assoc_id field to identify the association to sinfo_timetolive. The user must set the sinfo_assoc_id field to
affect if the caller is using the one-to-many style. identify the association to affect if the caller is using the
one-to-many style.
7.1.15 Set notification and ancillary events (SCTP_EVENTS) 7.1.15 Set notification and ancillary events (SCTP_EVENTS)
This socket option is used to specify various notifications and This socket option is used to specify various notifications and
ancillary data the user wishes to receive. Please see Section 7.3) ancillary data the user wishes to receive. Please see Section 7.3)
for a full description of this option and its usage. for a full description of this option and its usage.
7.1.16 Set/clear IPv4 mapped addresses (SCTP_I_WANT_MAPPED_V4_ADDR) 7.1.16 Set/clear IPv4 mapped addresses (SCTP_I_WANT_MAPPED_V4_ADDR)
This socket option is a boolean flag which turns on or off mapped V4 This socket option is a boolean flag which turns on or off mapped V4
addresses. If this option is turned on and the socket is type addresses. If this option is turned on and the socket is type
PF_INET6, then IPv4 addresses will be mapped to V6 representation. If PF_INET6, then IPv4 addresses will be mapped to V6 representation.
this option is turned off, then no mapping will be done of V4 If this option is turned off, then no mapping will be done of V4
addresses and a user will receive both PF_INET6 and PF_INET type addresses and a user will receive both PF_INET6 and PF_INET type
addresses on the socket. addresses on the socket.
By default this option is turned on and expects an integer to be By default this option is turned on and expects an integer to be
passed where non-zero turns on the option and zero turns off the passed where non-zero turns on the option and zero turns off the
option. option.
7.1.17 Set the maximum fragmentation size (SCTP_MAXSEG) 7.1.17 Set the maximum fragmentation size (SCTP_MAXSEG)
This socket option specifies the maximum size to put in any outgoing This socket option specifies the maximum size to put in any outgoing
skipping to change at page 58, line 11 skipping to change at page 58, line 4
sctp_data_io_event - Setting this flag to 1 will cause the reception sctp_data_io_event - Setting this flag to 1 will cause the reception
of SCTP_SNDRCV information on a per message basis. The application of SCTP_SNDRCV information on a per message basis. The application
will need to use the recvmsg() interface so that it can receive the will need to use the recvmsg() interface so that it can receive the
event information contained in the msg_control field. Please see event information contained in the msg_control field. Please see
Section 5.2 for further details. Setting the flag to 0 will disable Section 5.2 for further details. Setting the flag to 0 will disable
reception of the message control information. reception of the message control information.
sctp_association_event - Setting this flag to 1 will enable the sctp_association_event - Setting this flag to 1 will enable the
reception of association event notifications. Setting the flag to 0 reception of association event notifications. Setting the flag to 0
will disable association event notifications. For more information on will disable association event notifications. For more information
event notifications please see Section 5.3. on event notifications please see Section 5.3.
sctp_address_event - Setting this flag to 1 will enable the reception sctp_address_event - Setting this flag to 1 will enable the reception
of address event notifications. Setting the flag to 0 will disable of address event notifications. Setting the flag to 0 will disable
address event notifications. For more information on event address event notifications. For more information on event
notifications please see Section 5.3. notifications please see Section 5.3.
sctp_send_failure_event - Setting this flag to 1 will enable the sctp_send_failure_event - Setting this flag to 1 will enable the
reception of send failure event notifications. Setting the flag to 0 reception of send failure event notifications. Setting the flag to 0
will disable send failure event notifications. For more information will disable send failure event notifications. For more information
on event notifications please see Section 5.3. on event notifications please see Section 5.3.
sctp_peer_error_event - Setting this flag to 1 will enable the sctp_peer_error_event - Setting this flag to 1 will enable the
reception of peer error event notifications. Setting the flag to 0 reception of peer error event notifications. Setting the flag to 0
will disable peer error event notifications. For more information on will disable peer error event notifications. For more information on
event notifications please see Section 5.3. event notifications please see Section 5.3.
sctp_shutdown_event - Setting this flag to 1 will enable the sctp_shutdown_event - Setting this flag to 1 will enable the
reception of shutdown event notifications. Setting the flag to 0 will reception of shutdown event notifications. Setting the flag to 0
disable shutdown event notifications. For more information on event will disable shutdown event notifications. For more information on
notifications please see Section 5.3. event notifications please see Section 5.3.
sctp_partial_delivery_event - Setting this flag to 1 will enable the sctp_partial_delivery_event - Setting this flag to 1 will enable the
reception of partial delivery notifications. Setting the flag to 0 reception of partial delivery notifications. Setting the flag to 0
will disable partial delivery event notifications. For more will disable partial delivery event notifications. For more
information on event notifications please see Section 5.3. information on event notifications please see Section 5.3.
sctp_adaption_layer_event - Setting this flag to 1 will enable the sctp_adaption_layer_event - Setting this flag to 1 will enable the
reception of adaption layer notifications. Setting the flag to 0 will reception of adaption layer notifications. Setting the flag to 0
disable adaption layer event notifications. For more information on will disable adaption layer event notifications. For more
event notifications please see Section 5.3. information on event notifications please see Section 5.3.
An example where an application would like to receive data io events An example where an application would like to receive data io events
and association events but no others would be as follows: and association events but no others would be as follows:
{ {
struct sctp_event_subscribe event; struct sctp_event_subscribe event;
memset(&event,0,sizeof(event)); memset(&event,0,sizeof(event));
event.sctp_data_io_event = 1; event.sctp_data_io_event = 1;
skipping to change at page 60, line 28 skipping to change at page 60, line 28
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 would be returned. For a IPv4
socket, an array of sockaddr_in would be returned. The caller socket, an array of sockaddr_in would be returned. The caller
specifies the number of addresses in the array with addrcnt. specifies the number of addresses in the array with addrcnt. Note
that the wildcard addresses cannot be used with this function, doing
so will 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:
SCTP_BINDX_ADD_ADDR SCTP_BINDX_ADD_ADDR
SCTP_BINDX_REM_ADDR SCTP_BINDX_REM_ADDR
SCTP_BINDX_ADD_ADDR directs SCTP to add the given addresses to the SCTP_BINDX_ADD_ADDR directs SCTP to add the given addresses to the
association, and SCTP_BINDX_REM_ADDR directs SCTP to remove the given association, and SCTP_BINDX_REM_ADDR directs SCTP to remove the given
addresses from the association. The two flags are mutually exclusive; addresses from the association. The two flags are mutually
if both are given, sctp_bindx() will fail with EINVAL. A caller may exclusive; if both are given, sctp_bindx() will fail with EINVAL. A
not remove all addresses from an association; sctp_bindx() will caller may not remove all addresses from an association; sctp_bindx()
reject such an attempt with EINVAL. will reject such an attempt with EINVAL.
An application can use sctp_bindx(SCTP_BINDX_ADD_ADDR) to associate An application can use sctp_bindx(SCTP_BINDX_ADD_ADDR) to associate
additional addresses with an endpoint after calling bind(). Or use additional addresses with an endpoint after calling bind(). Or use
sctp_bindx(SCTP_BINDX_REM_ADDR) to remove some addresses a listening sctp_bindx(SCTP_BINDX_REM_ADDR) to remove some addresses a listening
socket is associated with so that no new association accepted will be socket is associated with so that no new association accepted will be
associated with those addresses. If the endpoint supports dynamic associated with those addresses. If the endpoint supports dynamic
address a SCTP_BINDX_REM_ADDR or SCTP_BINDX_ADD_ADDR may cause a address a SCTP_BINDX_REM_ADDR or SCTP_BINDX_ADD_ADDR may cause a
endpoint to send the appropriate message to the peer to change the endpoint to send the appropriate message to the peer to change the
peers address lists. peers address lists.
skipping to change at page 62, line 9 skipping to change at page 62, line 9
8.3 sctp_getpaddrs() 8.3 sctp_getpaddrs()
sctp_getpaddrs() returns all peer addresses in an association. The sctp_getpaddrs() returns all peer addresses in an association. The
syntax is, syntax is,
int sctp_getpaddrs(int sd, sctp_assoc_t id, int sctp_getpaddrs(int sd, sctp_assoc_t id,
struct sockaddr **addrs); struct sockaddr **addrs);
On return, addrs will point to an array dynamically allocated On return, addrs will point to an array dynamically allocated
sockaddr structures of the appropriate type for the socket type. The sockaddr structures of the appropriate type for the socket type. The
caller should use sctp_freepaddrs() to free the memory. Note that the caller should use sctp_freepaddrs() to free the memory. Note that
in/out parameter addrs must not be NULL. the in/out parameter addrs must not be NULL.
If sd is an IPv4 socket, the addresses returned will be all IPv4 If sd is an IPv4 socket, the addresses returned will be all IPv4
addresses. If sd is an IPv6 socket, the addresses returned can be a addresses. If sd is an IPv6 socket, the addresses returned can be a
mix of IPv4 or IPv6 addresses. mix of IPv4 or IPv6 addresses.
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.
On success, sctp_getpaddrs() returns the number of peer addresses in On success, sctp_getpaddrs() returns the number of peer addresses in
the association. If there is no association on this socket, the association. If there is no association on this socket,
skipping to change at page 62, line 44 skipping to change at page 62, line 44
8.5 sctp_getladdrs() 8.5 sctp_getladdrs()
sctp_getladdrs() returns all locally bound address(es) on a socket. sctp_getladdrs() returns all locally bound address(es) on a socket.
The syntax is, The syntax is,
int sctp_getladdrs(int sd, sctp_assoc_t id, int sctp_getladdrs(int sd, sctp_assoc_t id,
struct sockaddr **ss); struct sockaddr **ss);
On return, addrs will point to a dynamically allocated array of On return, addrs will point to a dynamically allocated array of
sockaddr structures of the appropriate type for the socket type. The sockaddr structures of the appropriate type for the socket type. The
caller should use sctp_freeladdrs() to free the memory. Note that the caller should use sctp_freeladdrs() to free the memory. Note that
in/out parameter addrs must not be NULL. the in/out parameter addrs must not be NULL.
If sd is an IPv4 socket, the addresses returned will be all IPv4 If sd is an IPv4 socket, the addresses returned will be all IPv4
addresses. If sd is an IPv6 socket, the addresses returned can be a addresses. If sd is an IPv6 socket, the addresses returned can be a
mix of IPv4 or IPv6 addresses. mix of IPv4 or IPv6 addresses.
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.
If the id field is set to the value '0' then the locally bound If the id field is set to the value '0' then the locally bound
addresses are returned without regard to any particular association. addresses are returned without regard to any particular association.
skipping to change at page 67, line 5 skipping to change at page 66, line 35
sinfo - A pointer to a sctp_sndrcvinfo struture used sinfo - A pointer to a sctp_sndrcvinfo struture used
as described in 5.2.2 for a sendmsg call. as described in 5.2.2 for a sendmsg call.
flags - is used in the same format as the sendmsg call flags - is used in the same format as the sendmsg call
flags (e.g. MSG_DONTROUTE). flags (e.g. MSG_DONTROUTE).
This function call may also be used to terminate an association using This function call may also be used to terminate an association using
an association identification by setting the sinfo.sinfo_flags to an association identification by setting the sinfo.sinfo_flags to
MSG_EOF and the sinfo.sinf_associd to the association that needs to MSG_EOF and the sinfo.sinf_associd to the association that needs to
be terminated. In such a case the len of the message would be zero. be terminated. In such a case the len of the message would be zero.
8.11 sctp_sendx()
An implementation may provide another alternative function or system
call to assist an application with the sending of data without the
use of the CMSG header structures that also gives a list of
addresses. The list of addresses is provided for implicit
association setup. In such a case the list of addresses serves the
same purpose as the addresses given in sctp_connectx (see Section
8.9).
sctp_sendx(). Its syntax is,
int sctp_sendx(int sd,
const void *msg,
size_t len,
struct sockaddr *addrs,
int addrcnt,
const struct sctp_sndrcvinfo *sinfo,
int flags);
sd - is the socket descriptor
msg - The message to be sent
len - The length of the message
addrs - is an array of addresses.
addrcnt - is the number of addresses in the array.
sinfo - A pointer to a sctp_sndrcvinfo struture used
as described in 5.2.2 for a sendmsg call.
flags - is used in the same format as the sendmsg call
flags (e.g. MSG_DONTROUTE).
This function call may also be used to terminate an association using
an association identification by setting the sinfo.sinfo_flags to
MSG_EOF and the sinfo.sinf_associd to the association that needs to
be terminated. In such a case the len of the message would be zero.
9. Preprocessor Constants 9. Preprocessor Constants
For application portability it is desireable to define pre-processor For application portability it is desireable to define pre-processor
constants for determination if sctp is present and supports various constants for determination if sctp is present and supports various
features. The following pre-processor constants should be defined in features. The following pre-processor constants should be defined in
a include file, sctp.h. a include file, sctp.h.
HAVE_SCTP - If this constant is defined to 1, then an implementation HAVE_SCTP - If this constant is defined to 1, then an implementation
of SCTP is available. of SCTP is available.
HAVE_KERNEL_SCTP - If this constant is defined to 1, then a kernel HAVE_KERNEL_SCTP - If this constant is defined to 1, then a kernel
SCTP implementation is available through the sockets interface. SCTP implementation is available through the sockets interface.
HAVE_SCTP_PRSCTP - If this constant is defined to 1, then the SCTP HAVE_SCTP_PRSCTP - If this constant is defined to 1, then the SCTP
implementation supports the partial reliablility extension to implementation supports the partial reliablility extension to
SCTP. SCTP.
HAVE_SCTP_ADDIP - If this constant is defined to 1, then the SCTP HAVE_SCTP_ADDIP - If this constant is defined to 1, then the SCTP
implementation supports the dynamic address extension to SCTP. implementation supports the dynamic address extension to SCTP.
HAVE_SCTP_CANSET_PRIMARY - If this constant is defined to 1, then the HAVE_SCTP_CANSET_PRIMARY - If this constant is defined to 1, then the
SCTP implementation supports the ability to request setting of the SCTP implementation supports the ability to request setting of the
remote primary address. remote primary address.
HAVE_SCTP_SAT_NETWORK_CAPABILITY - If this constant is defined to 1, HAVE_SCTP_SAT_NETWORK_CAPABILITY - If this constant is defined to 1,
then the SCTP implementation supports the satellite network then the SCTP implementation supports the satellite network
extension to SCTP. extension to SCTP.
HAVE_SCTP_MULTIBUF - If this constant is defined to 1, then the SCTP HAVE_SCTP_MULTIBUF - If this constant is defined to 1, then the SCTP
implementation dedicates separate buffer space to each association implementation dedicates separate buffer space to each association
on a one-to-many socket. If this constant is defined to 0, then on a one-to-many socket. If this constant is defined to 0, then
the implementation provides a single block of shared buffer space the implementation provides a single block of shared buffer space
for a one-to-many socket. for a one-to-many socket.
HAVE_SCTP_NOCONNECT - If this constant is defined to 1, then the SCTP HAVE_SCTP_NOCONNECT - If this constant is defined to 1, then the SCTP
implementation supports initiating an association on a one-to-one implementation supports initiating an association on a one-to-one
style socket without the use of connect(), as outlined in Section style socket without the use of connect(), as outlined in Section
4.1.5. 4.1.5.
10. Security Considerations 10. Security Considerations
Many TCP and UDP implementations reserve port numbers below 1024 for Many TCP and UDP implementations reserve port numbers below 1024 for
privileged users. If the target platform supports privileged users, privileged users. If the target platform supports privileged users,
the SCTP implementation SHOULD restrict the ability to call bind() or the SCTP implementation SHOULD restrict the ability to call bind() or
skipping to change at page 69, line 7 skipping to change at page 70, line 7
struct sctp_rtoinfo struct sctp_rtoinfo
If an unprivileged user inherits a one-to-many style socket with open If an unprivileged user inherits a one-to-many style socket with open
associations on a privileged port, it MAY be permitted to accept new associations on a privileged port, it MAY be permitted to accept new
associations, but it SHOULD NOT be permitted to open new associations, but it SHOULD NOT be permitted to open new
associations. This could be relevant for the r* family of protocols. associations. This could be relevant for the r* family of protocols.
11. Acknowledgments 11. Acknowledgments
The authors wish to thank Kavitha Baratakke, Mike Bartlett, Jon Special acknowledgment is givne to Ken Fujita who helped extensively
in the early formation of this document.
The authors also wish to thank Kavitha Baratakke, Mike Bartlett, Jon
Berger, Scott Kimble, Renee Revis, and many others on the TSVWG Berger, Scott Kimble, Renee Revis, and many others on the TSVWG
mailing list for contributing valuable comments. mailing list for contributing valuable comments.
A special thanks to Phillip Conrad, for his suggested text, quick and A special thanks to Phillip Conrad, for his suggested text, quick and
constructive insights, and most of all his persistent fighting to constructive insights, and most of all his persistent fighting to
keep the interface to SCTP usable for the application programmer. keep the interface to SCTP usable for the application programmer.
References 12 References
[1] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, [1] Postel, J., "Transmission Control Protocol", STD 7, RFC 793,
September 1981. September 1981.
[2] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August [2] Postel, J., "User Datagram Protocol", STD 6, RFC 768, August
1980. 1980.
[3] Braden, B., "T/TCP -- TCP Extensions for Transactions Functional [3] Braden, B., "T/TCP -- TCP Extensions for Transactions Functional
Specification", RFC 1644, July 1994. Specification", RFC 1644, July 1994.
skipping to change at page 70, line 36 skipping to change at page 71, line 9
Socket Interface Extensions for IPv6", RFC 2553, March 1999. Socket Interface Extensions for IPv6", RFC 2553, March 1999.
[8] Stewart, R., Xie, Q., Morneault, K., Sharp, C., Schwarzbauer, [8] Stewart, R., Xie, Q., Morneault, K., Sharp, C., Schwarzbauer,
H., Taylor, T., Rytina, I., Kalla, M., Zhang, L. and V. Paxson, H., Taylor, T., Rytina, I., Kalla, M., Zhang, L. and V. Paxson,
"Stream Control Transmission Protocol", RFC 2960, October 2000. "Stream Control Transmission Protocol", RFC 2960, October 2000.
Authors' Addresses Authors' Addresses
Randall R. Stewart Randall R. Stewart
Cisco Systems, Inc. Cisco Systems, Inc.
8725 West Higgins Road 4875 Forest Drive
Suite 300 Suite 200
Chicago, IL 60631 Columbia, SC 29206
USA USA
Phone: Phone:
EMail: rrs@cisco.com EMail: rrs@cisco.com
Qiaobing Xie Qiaobing Xie
Motorola, Inc. Motorola, Inc.
1501 W. Shure Drive, #2309 1501 W. Shure Drive, #2309
Arlington Heights, IL 60004 Arlington Heights, IL 60004
USA USA
Phone: Phone:
EMail: qxie1@email.mot.com EMail: qxie1@email.mot.com
La Monte H.P. Yarroll La Monte H.P. Yarroll
skipping to change at page 71, line 14 skipping to change at page 71, line 27
Qiaobing Xie Qiaobing Xie
Motorola, Inc. Motorola, Inc.
1501 W. Shure Drive, #2309 1501 W. Shure Drive, #2309
Arlington Heights, IL 60004 Arlington Heights, IL 60004
USA USA
Phone: Phone:
EMail: qxie1@email.mot.com EMail: qxie1@email.mot.com
La Monte H.P. Yarroll La Monte H.P. Yarroll
USACE ERDC-CERL. TimeSys Corp
2902 Newmark Drive 925 Liberty Ave.
Champaign, IL 6182-1076 Pittsburgh, PA 15222
USA USA
Phone: Phone:
EMail: piggy@acm.org EMail: piggy@acm.org
Jonathan Wood Jonathan Wood
DoCoMo USA Labs DoCoMo USA Labs
181 Metro Drive, Suite 300 181 Metro Drive, Suite 300
San Jose, CA 95110 San Jose, CA 95110
USA USA
skipping to change at page 71, line 30 skipping to change at page 72, line 4
EMail: piggy@acm.org EMail: piggy@acm.org
Jonathan Wood Jonathan Wood
DoCoMo USA Labs DoCoMo USA Labs
181 Metro Drive, Suite 300 181 Metro Drive, Suite 300
San Jose, CA 95110 San Jose, CA 95110
USA USA
Phone: Phone:
EMail: jonwood@speakeasy.net EMail: jonwood@speakeasy.net
Kacheong Poon Kacheong Poon
Sun Microsystems, Inc. Sun Microsystems, Inc.
4150 Network Circle 4150 Network Circle
Santa Clara, CA 95054 Santa Clara, CA 95054
USA USA
Phone: Phone:
EMail: kacheong.poon@sun.com EMail: kacheong.poon@sun.com
Ken Fujita
NEC USA, Inc.
10080 Wolfe Road, Suite SW3-350
Cupertino, CA 95014
USA
Phone:
EMail: fken@ccrl.sj.nec.com
Michael Tuexen Michael Tuexen
Univ. of Applied Sciences Muenster Univ. of Applied Sciences Muenster
Stegerwaldstr. 39 Stegerwaldstr. 39
48565 Steinfurt 48565 Steinfurt
Germany Germany
EMail: tuexen@fh-muenster.de EMail: tuexen@fh-muenster.de
Appendix A. one-to-one style Code Example Appendix A. one-to-one style Code Example
skipping to change at page 79, line 8 skipping to change at page 79, line 8
exit(1); exit(1);
} }
/* Echo back any and all data */ /* Echo back any and all data */
echo(cfd,0); echo(cfd,0);
} }
} }
Appendix B. one-to-many style Code Example Appendix B. one-to-many style Code Example
The following code is a simple implementation of an echo server over The following code is a simple implementation of an echo server over
SCTP. The example shows how to use some features of one-to-many style SCTP. The example shows how to use some features of one-to-many
IPv4 SCTP sockets, including: style IPv4 SCTP sockets, including:
o Opening and binding of a socket; o Opening and binding of a socket;
o Enabling ancillary data o Enabling ancillary data
o Enabling notifications o Enabling notifications
o Using ancillary data with sendmsg() and recvmsg() o Using ancillary data with sendmsg() and recvmsg()
o Using MSG_EOR to determine if an entire message has been read o Using MSG_EOR to determine if an entire message has been read
o Handling notifications o Handling notifications
Note most functions defined in Appendix A are reused in this example. Note most functions defined in Appendix A are reused in this example.
int main() int main()
{ {
int fd; int fd;
int idleTime = 2; int idleTime = 2;
struct sockaddr_in sin[1]; struct sockaddr_in sin[1];
struct sctp_event_subscribe event; struct sctp_event_subscribe event;
skipping to change at page 81, line 8 skipping to change at page 81, line 8
/* Wait for new associations */ /* Wait for new associations */
while(1){ while(1){
/* Echo back any and all data */ /* Echo back any and all data */
echo(fd,1); echo(fd,1);
} }
} }
Intellectual Property Statement Intellectual Property Statement
The IETF takes no position regarding the validity or scope of any The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to Intellectual Property Rights or other rights that might be claimed to
pertain to the implementation or use of the technology described in pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights this document or the extent to which any license under such rights
might or might not be available; neither does it represent that it might or might not be available; nor does it represent that it has
has made any effort to identify any such rights. Information on the made any independent effort to identify any such rights. Information
IETF's procedures with respect to rights in standards-track and on the procedures with respect to rights in RFC documents can be
standards-related documentation can be found in BCP-11. Copies of found in BCP 78 and BCP 79.
claims of rights made available for publication and any assurances of
licenses to be made available, or the result of an attempt made to Copies of IPR disclosures made to the IETF Secretariat and any
obtain a general license or permission for the use of such assurances of licenses to be made available, or the result of an
proprietary rights by implementors or users of this specification can attempt made to obtain a general license or permission for the use of
be obtained from the IETF Secretariat. such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository at
http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention any The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary copyrights, patents or patent applications, or other proprietary
rights which may cover technology that may be required to practice rights that may cover technology that may be required to implement
this standard. Please address the information to the IETF Executive this standard. Please address the information to the IETF at
Director. ietf-ipr@ietf.org.
Full Copyright Statement
Copyright (C) The Internet Society (2004). All Rights Reserved. Disclaimer of Validity
This document and translations of it may be copied and furnished to This document and the information contained herein are provided on an
others, and derivative works that comment on or otherwise explain it "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
or assist in its implementation may be prepared, copied, published OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET
and distributed, in whole or in part, without restriction of any ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED,
kind, provided that the above copyright notice and this paragraph are INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
included on all such copies and derivative works. However, this INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
document itself may not be modified in any way, such as by removing WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be Copyright Statement
revoked by the Internet Society or its successors or assignees.
This document and the information contained herein is provided on an Copyright (C) The Internet Society (2004). This document is subject
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING to the rights, licenses and restrictions contained in BCP 78, and
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING except as set forth therein, the authors retain all their rights.
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Acknowledgment Acknowledgment
Funding for the RFC Editor function is currently provided by the Funding for the RFC Editor function is currently provided by the
Internet Society. Internet Society.
 End of changes. 

This html diff was produced by rfcdiff 1.23, available from http://www.levkowetz.com/ietf/tools/rfcdiff/