draft-ietf-tsvwg-sctpsocket-03.txt   draft-ietf-tsvwg-sctpsocket-04.txt 
skipping to change at page 1, line 15 skipping to change at page 1, line 15
Q. Xie Q. Xie
L Yarroll L Yarroll
Motorola Motorola
J. Wood J. Wood
DoCoMo USA Labs DoCoMo USA Labs
K. Poon K. Poon
Sun Microsystems Sun Microsystems
K. Fujita K. Fujita
NEC NEC
expires in six months January 29, 2002 expires in six months May 12, 2002
Sockets API Extensions for SCTP Sockets API Extensions for Stream Control Transmission Protocol
<draft-ietf-tsvwg-sctpsocket-03.txt> <draft-ietf-tsvwg-sctpsocket-04.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 in full conformance with
all provisions of Section 10 of [RFC2026]. Internet-Drafts are all provisions of Section 10 of [RFC2026]. Internet-Drafts are
working documents of the Internet Engineering Task Force (IETF), its working documents of the Internet Engineering Task Force (IETF), its
areas, and its working groups. Note that other groups may also areas, and its working groups. Note that other groups may also
distribute working documents as Internet-Drafts. distribute working documents as Internet-Drafts.
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
skipping to change at page 2, line 29 skipping to change at page 2, line 29
5.3.1.1 SCTP_ASSOC_CHANGE................................23 5.3.1.1 SCTP_ASSOC_CHANGE................................23
5.3.1.2 SCTP_PEER_ADDR_CHANGE............................24 5.3.1.2 SCTP_PEER_ADDR_CHANGE............................24
5.3.1.3 SCTP_REMOTE_ERROR................................25 5.3.1.3 SCTP_REMOTE_ERROR................................25
5.3.1.4 SCTP_SEND_FAILED.................................26 5.3.1.4 SCTP_SEND_FAILED.................................26
5.3.1.5 SCTP_SHUTDOWN_EVENT..............................27 5.3.1.5 SCTP_SHUTDOWN_EVENT..............................27
5.3.1.6 SCTP_ADAPTION_INDICATION.........................28 5.3.1.6 SCTP_ADAPTION_INDICATION.........................28
5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT......................29 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT......................29
5.4 Ancillary Data Considerations and Semantics...........30 5.4 Ancillary Data Considerations and Semantics...........30
5.4.1 Multiple Items and Ordering........................30 5.4.1 Multiple Items and Ordering........................30
5.4.2 Accessing and Manipulating Ancillary Data..........30 5.4.2 Accessing and Manipulating Ancillary Data..........30
5.4.3 Control Message Buffer Sizing......................30 5.4.3 Control Message Buffer Sizing......................31
6. Common Operations for Both Styles.......................31 6. Common Operations for Both Styles.......................31
6.1 send(), recv(), sendto(), recvfrom()..................31 6.1 send(), recv(), sendto(), recvfrom()..................31
6.2 setsockopt(), getsockopt()............................32 6.2 setsockopt(), getsockopt()............................32
6.3 read() and write()....................................33 6.3 read() and write()....................................33
6.4 getsockname().........................................33 6.4 getsockname().........................................33
7. Socket Options..........................................33 7. Socket Options..........................................34
7.1 Read / Write Options..................................36 7.1 Read / Write Options..................................36
7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)...36 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)...36
7.1.2 Association Retransmission Parameter 7.1.2 Association Retransmission Parameter
(SCTP_ASSOCRTXINFO)................................36 (SCTP_ASSOCRTXINFO)................................36
7.1.3 Initialization Parameters (SCTP_INITMSG)...........37 7.1.3 Initialization Parameters (SCTP_INITMSG)...........38
7.1.4 SO_LINGER..........................................37 7.1.4 SO_LINGER..........................................38
7.1.5 SO_NODELAY.........................................37 7.1.5 SO_NODELAY.........................................38
7.1.6 SO_RCVBUF..........................................37 7.1.6 SO_RCVBUF..........................................38
7.1.7 SO_SNDBUF..........................................37 7.1.7 SO_SNDBUF..........................................38
7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE)...39 7.1.8 Automatic Close of associations (SCTP_AUTOCLOSE)...39
7.1.9 SCTP_SET_PRIMARY_ADDR..............................39 7.1.9 SCTP_SET_PRIMARY_ADDR..............................39
7.1.10 SCTP_SET_PEER_PRIMARY_ADDR........................39 7.1.10 SCTP_SET_PEER_PRIMARY_ADDR........................39
7.1.11 Set Adaption Layer Bits...........................39 7.1.11 Set Adaption Layer Bits...........................40
7.1.12 Set default message time outs 7.1.12 Set default message time outs
(SCTP_SET_STREAM_TIMEOUTS)........................40 (SCTP_SET_STREAM_TIMEOUTS)........................40
7.1.13 Enable/Disable message fragmentation 7.1.13 Enable/Disable message fragmentation
(SCTP_DISABLE_FRAGMENTS)..........................40 (SCTP_DISABLE_FRAGMENTS)..........................40
7.1.14 Peer Address Parameters (SCTP_SET_PEER_ADDR_PARAMS 7.1.14 Peer Address Parameters
/SCTP_GET_PEER_ADDR_PARAMS)....40 (SCTP_SET_PEER_ADDR_PARAMS).......................40
7.1.15 Set default send parameters.......................41
7.1.16 Set notification and ancillary events
(SCTP_SET_EVENTS).................................41
7.2 Read-Only Options.....................................41 7.2 Read-Only Options.....................................41
7.2.1 Association Status (SCTP_STATUS)...................41 7.2.1 Association Status (SCTP_STATUS)...................42
7.2.2 Peer Address Information (SCTP_GET_PEER_ADDR_INFO).42 7.2.2 Peer Address Information (SCTP_GET_PEER_ADDR_INFO).43
7.3. Ancillary Data and Notification Interest Options.....43 7.3. Ancillary Data and Notification Interest Options.....43
8. New Interfaces..........................................45 8. New Interfaces..........................................45
8.1 sctp_bindx()..........................................45 8.1 sctp_bindx()..........................................45
8.2 Branched-off Association, sctp_peeloff()..............46 8.2 Branched-off Association, sctp_peeloff()..............46
8.3 sctp_getpaddrs()......................................47 8.3 sctp_getpaddrs()......................................47
8.4 sctp_freepaddrs().....................................47 8.4 sctp_freepaddrs().....................................47
8.5 sctp_getladdrs()......................................47 8.5 sctp_getladdrs()......................................48
8.6 sctp_freeladdrs().....................................48 8.6 sctp_freeladdrs().....................................48
9. Security Considerations.................................48 9. Security Considerations.................................48
10. Acknowledgements......................................48 10. Acknowledgments.......................................49
11. Authors' Addresses....................................48 11. Authors' Addresses....................................49
12. References............................................49 12. References............................................49
Appendix A: TCP-style Code Example.........................50 Appendix A: TCP-style Code Example.........................50
Appendix B: UDP-style Code Example.........................54 Appendix B: UDP-style Code Example.........................55
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] and UDP Protocol suite to many operating systems. Both TCP [RFC793] and UDP
[RFC768] have benefited from this standard representation and access [RFC768] have benefited from this standard representation and access
method across many diverse platforms. SCTP is a new protocol that method across many diverse platforms. SCTP is a new protocol that
provides many of the characteristics of TCP but also incorporates provides many of the characteristics of TCP but also incorporates
semantics more akin to UDP. This document defines a method to map semantics more akin to UDP. This document defines a method to map
the existing sockets API for use with SCTP, providing both a base the existing sockets API for use with SCTP, providing both a base
skipping to change at page 3, line 41 skipping to change at page 3, line 42
There are three basic design objectives: There are three basic design objectives:
1) Maintain consistency with existing sockets APIs: 1) Maintain consistency with existing sockets APIs:
We define a sockets mapping for SCTP that is consistent with other We define a sockets mapping for SCTP that is consistent with other
sockets API protocol mappings (for instance, UDP, TCP, IPv4, and sockets API protocol mappings (for instance, UDP, TCP, IPv4, and
IPv6). IPv6).
2) Support a UDP-style interface 2) Support a UDP-style interface
This set of semantics is similar to that defined for conntionless This set of semantics is similar to that defined for connection less
protocols, such as UDP. It is more efficient than a TCP-like protocols, such as UDP. It is more efficient than a TCP-like
connection-oriented interface in terms of exploring the new features connection-oriented interface in terms of exploring the new features
of SCTP. of SCTP.
Note that SCTP is connection-oriented in nature, and it does not Note that SCTP is connection-oriented in nature, and it does not
support broadcast or multicast communications, as UDP does. support broadcast or multicast communications, as UDP does.
3) Support a TCP-style interface 3) Support a TCP-style interface
This interface supports the same basic semantics as sockets for This interface supports the same basic semantics as sockets for
connection-oriented protocols, such as TCP. connection-oriented protocols, such as TCP.
The purpose of defining this interface is to allow existing The purpose of defining this interface is to allow existing
applications built on connnection-oriented protocols be ported to applications built on connection-oriented protocols be ported to
use SCTP with very little effort, and developers familiar with those use SCTP with very little effort, and developers familiar with those
semantics can easily adapt to SCTP. semantics can easily adapt to SCTP.
Extensions will be added to this mapping to provide mechanisms to Extensions will be added to this mapping to provide mechanisms to
exploit new features of SCTP. exploit new features of SCTP.
Goals 2 and 3 are not compatible, so in this document we define two Goals 2 and 3 are not compatible, so in this document we define two
modes of mapping, namely the UDP-style mapping and the TCP-style modes of mapping, namely the UDP-style mapping and the TCP-style
mapping. These two modes share some common data structures and mapping. These two modes share some common data structures and
operations, but will require the use of two different programming operations, but will require the use of two different programming
models. models.
A mechanism is defined to convert a UDP-style SCTP socket into a A mechanism is defined to convert a UDP-style SCTP socket into a
TCP-style socket. TCP-style socket.
Some of the SCTP mechanisms cannot be adequately mapped to existing Some of the SCTP mechanisms cannot be adequately mapped to existing
socket interface. In some cases, it is more desirable to have new socket interface. In some cases, it is more desirable to have new
interface instead of using exisitng socket calls. This document interface instead of using existing socket calls. This document
also describes those new interface. also describes those new interface.
2. Conventions 2. Conventions
2.1 Data Types 2.1 Data Types
Whenever possible, data types from Draft 6.6 (March 1997) of POSIX Whenever possible, data types from Draft 6.6 (March 1997) of POSIX
1003.1g are used: uintN_t means an unsigned integer of exactly N 1003.1g are used: uintN_t means an unsigned integer of exactly N
bits (e.g., uint16_t). We also assume the argument data types from bits (e.g., uint16_t). We also assume the argument data types from
1003.1g when possible (e.g., the final argument to setsockopt() is a 1003.1g when possible (e.g., the final argument to setsockopt() is a
skipping to change at page 6, line 37 skipping to change at page 6, line 38
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() or sctp_bindx() is not called prior to a sendmsg() call If a bind() or sctp_bindx() is not called prior to a sendmsg() call
that initiates a new association, the system picks an ephemeral port that initiates a new association, the system picks an ephemeral port
and will choose an address set equivalent to binding with a wildcard and will choose an address set equivalent to binding with a wildcard
address. One of those addresses will be the primary address for the address. One of those addresses will be the primary address for the
association. This automatically enables the multihoming capability association. This automatically enables the multi-homing capability
of SCTP. of SCTP.
3.1.3 listen() - UDP Style Syntax 3.1.3 listen() - UDP Style Syntax
By default, new associations are not accepted for UDP style sockets. By default, new associations are not accepted for UDP style sockets.
An application uses listen() to mark a socket as being able to An application uses listen() to mark a socket as being able to
accept new associations. The syntax is, accept new associations. The syntax is,
int listen(int socket, int backlog); int listen(int socket, int backlog);
skipping to change at page 9, line 32 skipping to change at page 9, line 32
through any explicit association setup procedures (i.e., no through any explicit association setup procedures (i.e., no
connect() calls required). connect() calls required).
Whenever sendmsg() or sendto() is called and the SCTP stack at the Whenever sendmsg() or sendto() is called and the SCTP stack at the
sender finds that there is no association existing between the sender finds that there is no association existing between the
sender and the intended receiver (identified by the address passed sender and the intended receiver (identified by the address passed
either in the msg_name field of msghdr structure in the sendmsg() either in the msg_name field of msghdr structure in the sendmsg()
call or the dest_addr field in the sendto() call), the SCTP stack call or the dest_addr field in the sendto() call), the SCTP stack
will automatically setup an association to the intended receiver. will automatically setup an association to the intended receiver.
Upon the successful association setup a COMMUNICATION_UP Upon the successful association setup a SCTP_COMM_UP
notification will be dispatched to the socket at both the sender and notification will be dispatched to the socket at both the sender and
receiver side. This notification can be read by the recvmsg() system receiver side. This notification can be read by the recvmsg() system
call (see Section 3.1.3). call (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
[SCTP]. [SCTP].
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 consults the sctp_initmsg structure, which is passed along within
skipping to change at page 10, line 17 skipping to change at page 10, line 17
Whenever the user which want to avoid blocking must call select() Whenever the user which want to avoid blocking must call select()
before calling sendmsg()/sendto() and recvmsg()/recvfrom(), and before calling sendmsg()/sendto() and recvmsg()/recvfrom(), and
check the socket status is writable or readable. If the socket check the socket status is writable or readable. If the socket
status isn't writeable or readable, the user should not call status isn't writeable or readable, the user should not call
sendmsg()/sendto() and recvmsg()/recvfrom(). sendmsg()/sendto() and recvmsg()/recvfrom().
Once all bind() calls are complete on a UDP-style socket, the Once all bind() calls are complete on a UDP-style socket, the
application must set the non-blocking option by a fcntl() (such as application must set the non-blocking option by a fcntl() (such as
O_NONBLOCK). After which the sendmsg() function returns O_NONBLOCK). After which the sendmsg() function returns
immediately, and the success or failure of the data message (and immediately, and the success or failure of the data message (and
possible SCTP_INITMSG parameters) will be signalled by the possible SCTP_INITMSG parameters) will be signaled by the
SCTP_ASSOC_CHANGE event with COMMUNICATION_UP or SCTP_ASSOC_CHANGE event with SCTP_COMM_UP or
CANT_START_ASSOC. If user data could not be sent (due to a CANT_START_ASSOC. If user data could not be sent (due to a
CANT_START_ASSOC), the sender will also receive a SCTP_SEND_FAILED CANT_START_ASSOC), the sender will also receive a SCTP_SEND_FAILED
event. Those event(s) can be received by the user calling of event. Those event(s) can be received by the user calling of
recvmsg(). A server (having called listen()) is also notified of an recvmsg(). A server (having called listen()) is also notified of an
association up event by the reception of a SCTP_ASSOC_CHANGE with association up event by the reception of a SCTP_ASSOC_CHANGE with
COMMUNICATION_UP via the calling of recvmsg() and possibly the SCTP_COMM_UP via the calling of recvmsg() and possibly the
reception of the first data message. reception of the first data message.
In order to shutdown the association gracefully, the user must call In order to shutdown the association gracefully, the user must call
sendmsg() with no data and with the MSG_EOF flag set. The function sendmsg() with no data and with the MSG_EOF flag set. The function
returns immediately, and completion of the graceful shutdown is returns immediately, and completion of the graceful shutdown is
indicated by an SCTP_ASSOC_CHANGE notification of type indicated by an SCTP_ASSOC_CHANGE notification of type
SHUTDOWN_COMPLETE (see section 5.3.1.1). SHUTDOWN_COMPLETE (see section 5.3.1.1).
4. TCP-style Interface 4. TCP-style Interface
skipping to change at page 12, line 31 skipping to change at page 12, line 32
addresses to the endpoint. After the first call to bind(), all addresses to the endpoint. After the first call to bind(), all
subsequent calls will return an error. subsequent calls will return an error.
If addr is specified as a wildcard (INADDR_ANY for an IPv4 address, If 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() or sctp_bindx() is not called prior to the connect() If a bind() or sctp_bindx() is not called prior to the connect()
call, the system picks an ephemeral port and will choose an address call, the system picks an ephemeral port and will choose an address
set equivalant to binding with a wildcard address. One of those set equivalent to binding with a wildcard address. One of those
addresses will be the primary address for the association. This addresses will be the primary address for the association. This
automatically enables the multihoming capability of SCTP. automatically enables the multi-homing capability of SCTP.
The completion of this bind() process does not ready the SCTP The completion of this bind() process does not ready the SCTP
endpoint to accept inbound SCTP association requests. Until a endpoint to accept inbound SCTP association requests. Until a
listen() system call, described below, is performed on the socket, listen() system call, described below, is performed on the socket,
the SCTP endpoint will promptly reject an inbound SCTP INIT request the SCTP endpoint will promptly reject an inbound SCTP INIT request
with an SCTP ABORT. with an SCTP ABORT.
4.1.3 listen() - TCP Style Syntax 4.1.3 listen() - TCP Style Syntax
Applications use listen() to ready the SCTP endpoint for accepting Applications use listen() to ready the SCTP endpoint for accepting
skipping to change at page 13, line 46 skipping to change at page 13, line 47
By default, the new association created has only one outbound By default, the new association created has only one outbound
stream. The SCTP_INITMSG option described in Section 7.1.3 should be stream. The SCTP_INITMSG option described in Section 7.1.3 should be
used before connecting to change the number of outbound streams. used before connecting to change the number of outbound streams.
If a bind() or sctp_bindx() is not called prior to the connect() If a bind() or sctp_bindx() is not called prior to the connect()
call, the system picks an ephemeral port and will choose an address call, the system picks an ephemeral port and will choose an address
set equivalent to binding with INADDR_ANY and IN6ADDR_ANY for IPv4 set equivalent to binding with INADDR_ANY and IN6ADDR_ANY for IPv4
and IPv6 socket respectively. One of those addresses will be the and IPv6 socket respectively. One of those addresses will be the
primary address for the association. This automatically enables the primary address for the association. This automatically enables the
multihoming capability of SCTP. multi-homing capability of SCTP.
Note that SCTP allows data exchange, similar to T/TCP [RFC1644], Note that SCTP allows data exchange, similar to T/TCP [RFC1644],
during the association set up phase. If an application wants to do during the association set up phase. If an application wants to do
this, it cannot use connect() call. Instead, it should use sendto() this, it cannot use connect() call. Instead, it should use sendto()
or sendmsg() to initiate an association. If it uses sendto() and it or sendmsg() to initiate an association. If it uses sendto() and it
wants to change initialization behavior, it needs to use the wants to change initialization behavior, it needs to use the
SCTP_INITMSG socket option before calling sendto(). Or it can use SCTP_INITMSG socket option before calling sendto(). Or it can use
SCTP_INIT type sendmsg() to initiate an association without doing SCTP_INIT type sendmsg() to initiate an association without doing
the setsockopt(). the setsockopt().
skipping to change at page 14, line 19 skipping to change at page 14, line 21
Applications use close() to gracefully close down an association. Applications use close() to gracefully close down an association.
The syntax is: The syntax is:
int close(int sd); int close(int sd);
sd - the socket descriptor of the association to be closed. sd - the socket descriptor of the association to be closed.
After an application calls close() on a socket descriptor, no After an application calls close() on a socket descriptor, no
further socket operations will suceed on that descriptor. further socket operations will succeed on that descriptor.
4.1.7 shutdown() - TCP Style Syntax 4.1.7 shutdown() - TCP Style Syntax
SCTP differs from TCP in that it does not have half closed SCTP differs from TCP in that it does not have half closed
semantics. Hence the shutdown() call for SCTP is an approximation semantics. Hence the shutdown() call for SCTP is an approximation
of the TCP shutdown() call, and solves some different problems. of the TCP shutdown() call, and solves some different problems.
Full TCP-compatibility is not provided, so developers porting TCP Full TCP-compatibility is not provided, so developers porting TCP
applications to SCTP may need to recode sections that use applications to SCTP may need to recode sections that use
shutdown(). (Note that it is possible to achieve the same results shutdown(). (Note that it is possible to achieve the same results
as half close in SCTP using SCTP streams.) as half close in SCTP using SCTP streams.)
skipping to change at page 15, line 40 skipping to change at page 15, line 41
2) An application must use close() to gracefully shutdown an 2) An application must use close() to gracefully shutdown an
association, or use SO_LINGER option with close() to abort an association, or use SO_LINGER option with close() to abort an
association. It must not use the MSG_ABORT or MSG_EOF flag in association. It must not use the MSG_ABORT or MSG_EOF flag in
sendmsg(). The system returns an error if an application tries to sendmsg(). The system returns an error if an application tries to
do so. do so.
4.1.9 getpeername() 4.1.9 getpeername()
Applications use getpeername() to retrieve the primary socket Applications use getpeername() to retrieve the primary socket
address of the peer. This call is for TCP compatibility, and is not address of the peer. This call is for TCP compatibility, and is not
multihomed.It does not work with UDP-style sockets. See section 8.3 multi-homed.It does not work with UDP-style sockets. See section 8.3
for a multihomed/UDP-sockets version of the call. for a multi-homed/UDP-sockets version of the call.
The syntax is: The syntax is:
int getpeername(int socket, struct sockaddr *address, int getpeername(int socket, struct sockaddr *address,
socklen_t *len); socklen_t *len);
sd - the socket descriptor to be queried. sd - the socket descriptor to be queried.
address - On return, the peer primary address is stored in address - On return, the peer primary address is stored in
this buffer. If the socket is an IPv4 socket, the this buffer. If the socket is an IPv4 socket, the
skipping to change at page 17, line 21 skipping to change at page 17, line 21
recvmsg() will return with MSG_EOR set in msg_flags. recvmsg() will return with MSG_EOR set in msg_flags.
5.2 SCTP msg_control Structures 5.2 SCTP msg_control Structures
A key element of all SCTP-specific socket extensions is the use of A key element of all SCTP-specific socket extensions is the use of
ancillary data to specify and access SCTP-specific data via the ancillary data to specify and access SCTP-specific data via the
struct msghdr's msg_control member used in sendmsg() and recvmsg(). struct msghdr's msg_control member used in sendmsg() and recvmsg().
Fine-grained control over initialization and sending parameters are Fine-grained control over initialization and sending parameters are
handled with ancillary data. handled with ancillary data.
Each ancillary data item is preceeded 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
(UDP-style only) sets protocol parameters for new associations. (UDP-style only) sets protocol parameters for new associations.
Section 5.2.1 provides more details. Header information can set or Section 5.2.1 provides more details. Header information can set or
report parameters on individual messages in a stream. See section report parameters on individual messages in a stream. See section
5.2.2 for how to use SNDRCV ancillary data. 5.2.2 for how to use SNDRCV ancillary data.
skipping to change at page 17, line 52 skipping to change at page 17, line 52
Other protocols may also provide ancillary data to the socket layer Other protocols may also provide ancillary data to the socket layer
consumer. These ancillary data items from other protocols may consumer. These ancillary data items from other protocols may
intermingle with SCTP data. For example, the IPv6 socket API intermingle with SCTP data. For example, the IPv6 socket API
definitions ([RFC2292] and [RFC2553]) define a number of ancillary definitions ([RFC2292] and [RFC2553]) define a number of ancillary
data items. If a socket API consumer enables delivery of both SCTP data items. If a socket API consumer enables delivery of both SCTP
and IPv6 ancillary data, they both may appear in the same and IPv6 ancillary data, they both may appear in the same
msg_control buffer in any order. An application may thus need to msg_control buffer in any order. An application may thus need to
handle other types of ancillary data besides that passed by SCTP. handle other types of ancillary data besides that passed by SCTP.
The sockets application must provide a buffer large enough to The sockets application must provide a buffer large enough to
accomodate all ancillary data provided via recvmsg(). If the buffer accommodate all ancillary data provided via recvmsg(). If the buffer
is not large enough, the ancillary data will be truncated and the is not large enough, the ancillary data will be truncated and the
msghdr's msg_flags will include MSG_CTRUNC. msghdr's msg_flags will include MSG_CTRUNC.
5.2.1 SCTP Initiation Structure (SCTP_INIT) 5.2.1 SCTP Initiation Structure (SCTP_INIT)
This cmsghdr structure provides information for initializing new This cmsghdr structure provides information for initializing new
SCTP associations with sendmsg(). The SCTP_INITMSG socket option SCTP associations with sendmsg(). The SCTP_INITMSG socket option
uses this same data structure. This structure is not used for uses this same data structure. This structure is not used for
recvmsg(). recvmsg().
cmsg_level cmsg_type cmsg_data[] cmsg_level cmsg_type cmsg_data[]
------------ ------------ ---------------------- ------------ ------------ ----------------------
IPPROTO_SCTP SCTP_INIT struct sctp_initmsg IPPROTO_SCTP SCTP_INIT struct sctp_initmsg
Here is the definition of the sctp_initmsg structure: Here is the definition of the sctp_initmsg structure:
skipping to change at page 18, line 25 skipping to change at page 18, line 26
uint16_t sinit_num_ostreams; uint16_t sinit_num_ostreams;
uint16_t sinit_max_instreams; uint16_t sinit_max_instreams;
uint16_t sinit_max_attempts; uint16_t sinit_max_attempts;
uint16_t sinit_max_init_timeo; uint16_t sinit_max_init_timeo;
}; };
sinit_num_ostreams: 16 bits (unsigned integer) sinit_num_ostreams: 16 bits (unsigned integer)
This is an integer number representing the number of streams that This is an integer number representing the number of streams that
the application wishes to be able to send to. This number is the application wishes to be able to send to. This number is
confirmed in the COMMUNICATION_UP notification and must be verified confirmed in the SCTP_COMM_UP notification and must be verified
since it is a negotiated number with the remote endpoint. The since it is a negotiated number with the remote endpoint. The
default value of 0 indicates to use the endpoint default value. default value of 0 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 Operating System limit overrides the value requested by the
skipping to change at page 19, line 15 skipping to change at page 19, line 15
5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
This cmsghdr structure specifies SCTP options for sendmsg() and This cmsghdr structure specifies SCTP options for sendmsg() and
describes SCTP header information about a received message through describes SCTP header information about a received message through
recvmsg(). recvmsg().
cmsg_level cmsg_type cmsg_data[] cmsg_level cmsg_type cmsg_data[]
------------ ------------ ---------------------- ------------ ------------ ----------------------
IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo
Here is the defintion of sctp_sndrcvinfo: Here is the definition of sctp_sndrcvinfo:
struct sctp_sndrcvinfo { struct sctp_sndrcvinfo {
uint16_t sinfo_stream; uint16_t sinfo_stream;
uint16_t sinfo_ssn; uint16_t sinfo_ssn;
uint16_t sinfo_flags; uint16_t sinfo_flags;
uint32_t sinfo_ppid; uint32_t sinfo_ppid;
uint32_t sinfo_context; uint32_t sinfo_context;
uint32_t sinfo_timetolive; uint32_t sinfo_timetolive;
uint32_t sinfo_tsn; uint32_t sinfo_tsn;
sctp_assoc_t sinfo_assoc_id; sctp_assoc_t sinfo_assoc_id;
skipping to change at page 19, line 58 skipping to change at page 20, line 4
the same information that was passed by the upper layer in the peer the same information that was passed by the upper layer in the peer
application. Please note that byte order issues are NOT accounted application. Please note that byte order issues are NOT accounted
for and this information is passed opaquely by the SCTP stack from for and this information is passed opaquely by the SCTP stack from
one end to the other. one end to the other.
sinfo_context: 32 bits (unsigned integer) sinfo_context: 32 bits (unsigned integer)
This value is an opaque 32 bit context datum that is used in the This value is an opaque 32 bit context datum that is used in the
sendmsg() function. This value is passed back to the upper layer if sendmsg() function. This value is passed back to the upper layer if
a error occurs on the send of a message and is retrieved with each a error occurs on the send of a message and is retrieved with each
undelivered message (Note: if a endpoint has done multple sends, all undelivered message (Note: if a endpoint has done multiple sends, all
of which fail, multiple different sinfo_context values will be of which fail, multiple different sinfo_context values will be
returned. One with each user data message). returned. One with each user data message).
sinfo_flags: 16 bits (unsigned integer) sinfo_flags: 16 bits (unsigned integer)
This field may contain any of the following flags and is composed of This field may contain any of the following flags and is composed of
a bitwise OR of these values. a bitwise OR of these values.
recvmsg() flags: recvmsg() flags:
skipping to change at page 20, line 41 skipping to change at page 20, line 42
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 (UDP-style only). the association (UDP-style only).
sinfo_timetolive: 32 bit (unsigned integer) sinfo_timetolive: 32 bit (unsigned integer)
For the sending side, this field contains the message time For the sending side, this field contains the message time
to live in milliseconds. The sending side wil expire the to live in milliseconds. The sending side will expire the
message within the specified time period if the message as message within the specified time period if the message as
not been sent to the peer within this time period. not been sent to the peer 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 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 For the receiving side, this field holds a TSN that was
assigned to one of the SCTP Data Chunks. assigned to one of the SCTP Data Chunks.
sinfo_assoc_id: sizeof (sctp_assoc_t) sinfo_assoc_id: sizeof (sctp_assoc_t)
The association handle field, sinfo_assoc_id, holds the identifier The association handle field, sinfo_assoc_id, holds the identifier
for the association announced in the COMMUNICATION_UP notification. for the association announced in the SCTP_COMM_UP notification.
All notifications for a given association have the same identifier. All notifications for a given association have the same identifier.
Ignored for TCP-style sockets. Ignored for TCP-style sockets.
A sctp_sndrcvinfo item always corresponds to the data in msg_iov. A sctp_sndrcvinfo item always corresponds to the data in msg_iov.
5.3 SCTP Events and Notifications 5.3 SCTP Events and Notifications
An SCTP application may need to understand and process events and An SCTP application may need to understand and process events and
errors that happen on the SCTP stack. These events include network errors that happen on the SCTP stack. These events include network
status changes, association startups, remote operational errors and status changes, association startups, remote operational errors and
skipping to change at page 22, line 47 skipping to change at page 22, line 51
uses the sctp_sndrecvinfo per uses the sctp_sndrecvinfo per
section 5.3.1.4. section 5.3.1.4.
SCTP_SHUTDOWN_EVENT The peer has sent a SHUTDOWN. No further SCTP_SHUTDOWN_EVENT The peer has sent a SHUTDOWN. No further
data should be sent on this socket. data should be sent on this socket.
SCTP_ADAPTION_INDICATION This notification holds the SCTP_ADAPTION_INDICATION This notification holds the
peers indicated adaption layer. peers indicated adaption layer.
Please see 5.3.1.6. Please see 5.3.1.6.
SCTP_PARTIAL_DELIVERY_EVENT This notitifcation is used to SCTP_PARTIAL_DELIVERY_EVENT This notification is used to
tell a receiver that the partial tell a receiver that the partial
delivery has been aborted. This delivery has been aborted. This
may indicate the association is may indicate the association is
about to be aborted. Please see about to be aborted. Please see
5.3.1.7. 5.3.1.7.
All standard values for sn_type flags are greater than 2^15. All standard values for sn_type flags are greater than 2^15.
Values from 2^15 and down are reserved. Values from 2^15 and down are reserved.
sn_flags: 16 bits (unsigned integer) sn_flags: 16 bits (unsigned integer)
skipping to change at page 23, line 18 skipping to change at page 23, line 21
sn_length: 32 bits (unsigned integer) sn_length: 32 bits (unsigned integer)
This is the length of the whole sctp_notification structure This is the length of the whole sctp_notification structure
including the sn_type, sn_flags, and sn_length fields. including the sn_type, sn_flags, and sn_length fields.
5.3.1.1 SCTP_ASSOC_CHANGE 5.3.1.1 SCTP_ASSOC_CHANGE
Communication notifications inform the ULP that an SCTP association Communication notifications inform the ULP that an SCTP association
has either begun or ended. The identifier for a new association is has either begun or ended. The identifier for a new association is
provided by this notificaion. The notification information has the provided by this notification. The notification information has the
following format: following format:
struct sctp_assoc_change { struct sctp_assoc_change {
uint16_t sac_type; uint16_t sac_type;
uint16_t sac_flags; uint16_t sac_flags;
uint32_t sac_length; uint32_t sac_length;
uint16_t sac_state; uint16_t sac_state;
uint16_t sac_error; uint16_t sac_error;
uint16_t sac_outbound_streams; uint16_t sac_outbound_streams;
uint16_t sac_inbound_streams; uint16_t sac_inbound_streams;
skipping to change at page 23, line 45 skipping to change at page 23, line 48
sac_flags: 16 bits (unsigned integer) sac_flags: 16 bits (unsigned integer)
Currently unused. Currently unused.
sac_length: 32 bits (unsigned integer) sac_length: 32 bits (unsigned integer)
This field is the total length of the notification data, including This field is the total length of the notification data, including
the notification header. the notification header.
sac_state: 32 bits (signed integer) sac_state: 16 bits (signed integer)
This field holds one of a number of values that communicate the This field holds one of a number of values that communicate the
event that happened to the association. They include: event that happened to the association. They include:
Event Name Description Event Name Description
---------------- --------------- ---------------- ---------------
COMMUNICATION_UP A new association is now ready SCTP_COMM_UP A new association is now ready
and data may be exchanged with this and data may be exchanged with this
peer. peer.
COMMUNICATION_LOST The association has failed. The association SCTP_COMM_LOST The association has failed. The association
is now in the closed state. If SEND FAILED is now in the closed state. If SEND FAILED
notifications are turned on, a COMMUNICATION_LOST notifications are turned on, a SCTP_COMM_LOST
is followed by a series of SCTP_SEND_FAILED is followed by a series of SCTP_SEND_FAILED
events, one for each outstanding message. events, one for each outstanding message.
RESTART SCTP has detected that the peer has restarted. SCTP_RESTART SCTP has detected that the peer has restarted.
SHUTDOWN_COMPLETE The association has gracefully closed. SCTP_SHUTDOWN_COMP The association has gracefully closed.
CANT_START_ASSOC The association failed to setup. If non blocking SCTP_CANT_STR_ASSOC The association failed to setup. If non blocking
mode is set and data was sent (in the udp mode), mode is set and data was sent (in the udp mode),
a CANT_START_ASSOC is followed by a series of a SCTP_CANT_STR_ASSOC is followed by a series of
SCTP_SEND_FAILED events, one for each outstanding SCTP_SEND_FAILED events, one for each outstanding
message. message.
sac_error: 32 bits (signed integer) sac_error: 16 bits (signed integer)
If the state was reached due to a error condition (e.g. If the state was reached due to a error condition (e.g.
COMMUNICATION_LOST) any relevant error information is available in SCTP_COMM_LOST) any relevant error information is available in
this field. This corresponds to the protocol error codes defined in this field. This corresponds to the protocol error codes defined in
[SCTP]. [SCTP].
sac_outbound_streams: 16 bits (unsigned integer) sac_outbound_streams: 16 bits (unsigned integer)
sac_inbound_streams: 16 bits (unsigned integer) sac_inbound_streams: 16 bits (unsigned integer)
The maximum number of streams allowed in each direction are The maximum number of streams allowed in each direction are
available in sac_outbound_streams and sac_inbound streams. available in sac_outbound_streams and sac_inbound streams.
sac_assoc_id: sizeof (sctp_assoc_t) sac_assoc_id: sizeof (sctp_assoc_t)
skipping to change at page 25, line 23 skipping to change at page 25, line 28
The affected address field, holds the remote peer's address that is The affected address field, holds the remote peer's address that is
encountering the change of state. encountering the change of state.
spc_state: 32 bits (signed integer) spc_state: 32 bits (signed integer)
This field holds one of a number of values that communicate the This field holds one of a number of values that communicate the
event that happened to the address. They include: event that happened to the address. They include:
Event Name Description Event Name Description
---------------- --------------- ---------------- ---------------
ADDRESS_AVAILABLE This address is now reachable. SCTP_ADDR_AVAILABLE This address is now reachable.
ADDRESS_UNREACHABLE The address specified can no SCTP_ADDR_UNREACHABL The address specified can no
longer be reached. Any data sent longer be reached. Any data sent
to this address is rerouted to an to this address is rerouted to an
alternate until this address becomes alternate until this address becomes
reachable. reachable.
ADDRESS_REMOVED The address is no longer part of SCTP_ADDR_REMOVED The address is no longer part of
the association. the association.
ADDRESS_ADDED The address is now part of the SCTP_ADDR_ADDED The address is now part of the
association. association.
ADDRESS_MADE_PRIM This address has now been made SCTP_ADDR_MADE_PRIM This address has now been made
to be the primary destination address. to be the primary destination address.
spc_error: 32 bits (signed integer) spc_error: 32 bits (signed integer)
If the state was reached due to any error condition (e.g. If the state was reached due to any error condition (e.g.
ADDRESS_UNREACHABLE) any relevant error information is available in SCTP_ADDR_UNREACHABL) any relevant error information is available in
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 TCP style socket, this field is ignored. identifier. For TCP 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. A remote peer may send an Operational Error message to its peer.
This message indicates a variety of error conditions on an This message indicates a variety of error conditions on an
association. The entire error TLV as it appears on the wire is association. The entire error TLV as it appears on the wire is
included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP included in a SCTP_REMOTE_ERROR event. Please refer to the SCTP
specification [SCTP] and any extensions for a list of possible specification [SCTP] and any extensions for a list of possible
error formats. SCTP error TLVs have the format: error formats. SCTP error TLVs 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;
skipping to change at page 29, line 22 skipping to change at page 29, line 26
network byte order. network byte order.
sai_assoc_id: sizeof (sctp_assoc_t) sai_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 TCP style socket, this field is ignored. identifier. For TCP style socket, this field is ignored.
5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
When a reciever is engaged in a partial delivery of a When a receiver is engaged in a partial delivery of a
message this notification will be used to inidicate message this notification will be used to indicate
various events. various events.
struct sctp_rcv_pdapi_event { struct sctp_rcv_pdapi_event {
uint16_t pdapi_type; uint16_t pdapi_type;
uint16_t pdapi_flags; uint16_t pdapi_flags;
uint32_t pdapi_length; uint32_t pdapi_length;
uint32_t pdapi_indication; uint32_t pdapi_indication;
sctp_assoc_t pdapi_assoc_id; sctp_assoc_t pdapi_assoc_id;
}; };
skipping to change at page 30, line 20 skipping to change at page 30, line 22
Programming with ancillary socket data contains some subtleties and Programming with ancillary socket data contains some subtleties and
pitfalls, which are discussed below. pitfalls, which are discussed below.
5.4.1 Multiple Items and Ordering 5.4.1 Multiple Items and Ordering
Multiple ancillary data items may be included in any call to Multiple ancillary data items may be included in any call to
sendmsg() or recvmsg(); these may include multiple SCTP or non-SCTP sendmsg() or recvmsg(); these may include multiple SCTP or non-SCTP
items, or both. items, or both.
The ordering of ancillary data items (either by SCTP or another The ordering of ancillary data items (either by SCTP or another
protocol) is not significant and is implementation-dependant, so protocol) is not significant and is implementation-dependent, so
applications must not depend on any ordering. applications must not depend on any ordering.
SCTP_SNDRCV items must always correspond to the data in the msghdr's SCTP_SNDRCV items must always correspond to the data in the msghdr's
msg_iov member. There can be only a single SCTP_SNDRCV info for msg_iov member. There can be only a single SCTP_SNDRCV info for
each sendmsg() or recvmsg() call. each sendmsg() or recvmsg() call.
5.4.2 Accessing and Manipulating Ancillary Data 5.4.2 Accessing and Manipulating Ancillary Data
Applications can infer the presence of data or ancillary data by Applications can infer the presence of data or ancillary data by
examining the msg_iovlen and msg_controllen msghdr members, examining the msg_iovlen and msg_controllen msghdr members,
skipping to change at page 33, line 31 skipping to change at page 33, line 34
except that the flags parameter cannot be used. except that the flags parameter cannot be used.
Note, these calls, when used in the UDP-style model, may only be Note, these calls, when used in the UDP-style model, may only be
used with branched off socket descriptors (see Section 8.2). used with branched off socket descriptors (see Section 8.2).
6.4 getsockname() 6.4 getsockname()
Applications use getsockname() to retrieve the locally-bound socket Applications use getsockname() to retrieve the locally-bound socket
address of the specified socket. This is especially useful if the address of the specified socket. This is especially useful if the
caller let SCTP chose a local port. This call is for where the caller let SCTP chose a local port. This call is for where the
endpoint is not multihomed. It does not work well with multi-homed endpoint is not multi-homed. It does not work well with multi-homed
sockets. See section 8.5 for a multihomed version of the call. sockets. See section 8.5 for a multi-homed version of the call.
The syntax is: The syntax is:
int getsockname(int socket, struct sockaddr *address, int getsockname(int socket, struct sockaddr *address,
socklen_t *len); socklen_t *len);
sd - the socket descriptor to be queried. sd - the socket descriptor to be queried.
address - On return, one locally bound address (chosen by address - On return, one locally bound address (chosen by
the SCTP stack) is stored in this buffer. If the the SCTP stack) is stored in this buffer. If the
skipping to change at page 34, line 4 skipping to change at page 34, line 9
address. address.
If the actual length of the address is greater than the length of If the actual length of the address is greater than the length of
the supplied sockaddr structure, the stored address will be the supplied sockaddr structure, the stored address will be
truncated. truncated.
If the socket has not been bound to a local name, the value stored If the socket has not been bound to a local name, the value stored
in the object pointed to by address is unspecified. in the object pointed to by address is unspecified.
7. Socket Options 7. Socket Options
The following sub-section describes various SCTP level socket The following sub-section describes various SCTP level socket
options that are common to both models. SCTP associations can be options that are common to both models. SCTP associations can be
multihomed. Therefore, certain option parameters include a multi-homed. Therefore, certain option parameters include a
sockaddr_storage structure to select which peer address the option sockaddr_storage structure to select which peer address the option
should be applied to. should be applied to.
For the UDP-style sockets, an sctp_assoc_t structure (association For the UDP-style sockets, an sctp_assoc_t structure (association
ID) is used to identify the the association instance that the ID) is used to identify the the association instance that the
operation affects. So it must be set when using this model. operation affects. So it must be set when using this model.
For the TCP-style sockets and branched off UDP-style sockets (see For the TCP-style sockets and branched off UDP-style sockets (see
section 8.2) this association ID parameter is ignored. In the cases section 8.2) this association ID parameter is ignored. In the cases
noted below where the parameter is ignored, an application can pass noted below where the parameter is ignored, an application can pass
skipping to change at page 34, line 56 skipping to change at page 35, line 7
opt specifies which SCTP socket option to get. It can opt specifies which SCTP socket option to get. It can
any socket option currently supported that requests information any socket option currently supported that requests information
(either read/write options or read only) such as: (either read/write options or read only) such as:
SCTP_RTOINFO SCTP_RTOINFO
SCTP_ASSOCINFO SCTP_ASSOCINFO
SCTP_SET_PRIMARY_ADDR SCTP_SET_PRIMARY_ADDR
SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR
SCTP_SET_STREAM_TIMEOUTS SCTP_SET_STREAM_TIMEOUTS
SCTP_SET_PEER_ADDR_PARAMS SCTP_SET_PEER_ADDR_PARAMS
SCTP_GET_PEER_ADDR_PARAMS
SCTP_STATUS SCTP_STATUS
SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
arg is an option-specific structure buffer provided by the caller. arg is an option-specific structure buffer provided by the caller.
See 8.5 subsections for more information on these options and See 8.5 subsections for more information on these options and
option-specific structures. 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.
skipping to change at page 35, line 26 skipping to change at page 35, line 29
created to support the sctp_opt_info() interface such as: created to support the sctp_opt_info() interface such as:
#define sctp_opt_info(fd,asoc,opt,arg,sz) \ #define sctp_opt_info(fd,asoc,opt,arg,sz) \
do { \ do { \
if((opt == SCTP_RTOINFO) || \ if((opt == SCTP_RTOINFO) || \
(opt == SCTP_ASSOCINFO) || \ (opt == SCTP_ASSOCINFO) || \
(opt == SCTP_SET_PRIMARY_ADDR) || \ (opt == SCTP_SET_PRIMARY_ADDR) || \
(opt == SCTP_SET_PEER_PRIMARY_ADDR) || \ (opt == SCTP_SET_PEER_PRIMARY_ADDR) || \
(opt == SCTP_SET_STREAM_TIMEOUTS) || \ (opt == SCTP_SET_STREAM_TIMEOUTS) || \
(opt == SCTP_SET_PEER_ADDR_PARAMS) || \ (opt == SCTP_SET_PEER_ADDR_PARAMS) || \
(opt == SCTP_GET_PEER_ADDR_PARAMS) || \
(opt == SCTP_STATUS) || \ (opt == SCTP_STATUS) || \
(opt == SCTP_GET_PEER_ADDR_INFO)){ \ (opt == SCTP_GET_PEER_ADDR_INFO)){ \
*(sctp_assoc_t *)arg = asoc; \ *(sctp_assoc_t *)arg = asoc; \
return(getsockopt(fd,IPPROTO_SCTP,opt,arg,sz)); \ return(getsockopt(fd,IPPROTO_SCTP,opt,arg,sz)); \
}else{ \ }else{ \
return(ENOTSUP); \ return(ENOTSUP); \
} \ } \
}while(0); }while(0);
All options that support specific settings on an association All options that support specific settings on an association
skipping to change at page 36, line 28 skipping to change at page 36, line 30
parameters: parameters:
struct sctp_rtoinfo { struct sctp_rtoinfo {
sctp_assoc_t srto_assoc_id; sctp_assoc_t srto_assoc_id;
uint32_t srto_initial; uint32_t srto_initial;
uint32_t srto_max; uint32_t srto_max;
uint32_t srto_min; uint32_t srto_min;
}; };
srto_initial - This contains the initial RTO value. srto_initial - This contains the initial RTO value.
srto_max and srto_min - These contain the maximum and minumum bounds srto_max and srto_min - These contain the maximum and minimum bounds
for all RTOs. for all RTOs.
srto_assoc_id - (UDP style socket) This is filled in the application, srto_assoc_id - (UDP style socket) This is filled in the application,
and identifies the association for this query. If and identifies the association for this query. If
this parameter is missing (on a UDP style socket), this parameter is missing (on a UDP style socket),
then the change effects the entire endpoint. then the change effects the entire endpoint.
All parameters are time values, in milliseconds. A value of 0, when All parameters are time values, in milliseconds. A value of 0, when
modifying the parameters, indicates that the current value should modifying the parameters, indicates that the current value should
not be changed. not be changed.
skipping to change at page 37, line 21 skipping to change at page 37, line 23
sasoc_number_peer_destinations - This is the number of destination sasoc_number_peer_destinations - This is the number of destination
address that the peer considers address that the peer considers
valid. valid.
sasoc_peer_rwnd - This holds the current value of the peers sasoc_peer_rwnd - This holds the current value of the peers
rwnd (reported in the last SACK) minus any rwnd (reported in the last SACK) minus any
outstanding data (i.e. data inflight). outstanding data (i.e. data inflight).
sasoc_local_rwnd - This holds the last reported rwnd that was sasoc_local_rwnd - This holds the last reported rwnd that was
sent to the peer. sent to the peer.
sasoc_cookie_life - This is the associations cookie life value sasoc_cookie_life - This is the associations cookie life value
used when issueing cookies. used when issuing cookies.
sasoc_assoc_id - (UDP style socket) This is filled in the application, sasoc_assoc_id - (UDP style socket) This is filled in the application,
and identifies the association for this query. and identifies the association for this query.
This information may be examined for either the This information may be examined for either the
endpoint or a specific association. To examine a endpoints endpoint or a specific association. To examine a endpoints
default parameters the association id (sasoc_assoc_id) should default parameters the association id (sasoc_assoc_id) should
must be set to the value '0'. The values of the sasoc_peer_rwnd must be set to the value '0'. The values of the sasoc_peer_rwnd
is meaningless when examining endpoint information. is meaningless when examining endpoint information.
skipping to change at page 37, line 44 skipping to change at page 37, line 46
rwnd and destination counts (sasoc_number_peer_destinations, rwnd and destination counts (sasoc_number_peer_destinations,
sasoc_peer_rwnd,sasoc_local_rwnd) are NOT settable and any sasoc_peer_rwnd,sasoc_local_rwnd) are NOT settable and any
value placed in these is ignored. value placed in these is ignored.
To access or modify these parameters, the application should call To access or modify these parameters, the application should call
getsockopt or setsockopt() respectively with the option name getsockopt or setsockopt() respectively with the option name
SCTP_ASSOCRTXINFO. SCTP_ASSOCRTXINFO.
The maximum number of retransmissions before an address is The maximum number of retransmissions before an address is
considered unreachable is also tunable, but is address-specific, so considered unreachable is also tunable, but is address-specific, so
it is covered in a seperate option. If an application attempts to it is covered in a separate option. If an application attempts to
set the value of the association maximum retransmission parameter to set the value of the association maximum retransmission parameter to
more than the sum of all maximum retransmission parameters, more than the sum of all maximum retransmission parameters,
setsockopt() shall return an error. The reason for this, from setsockopt() shall return an error. The reason for this, from
[SCTP] section 8.2: [SCTP] section 8.2:
Note: When configuring the SCTP endpoint, the user should avoid Note: When configuring the SCTP endpoint, the user should avoid
having the value of 'Association.Max.Retrans' larger than the having the value of 'Association.Max.Retrans' larger than the
summation of the 'Path.Max.Retrans' of all the destination addresses summation of the 'Path.Max.Retrans' of all the destination addresses
for the remote endpoint. Otherwise, all the destination addresses for the remote endpoint. Otherwise, all the destination addresses
may become inactive while the endpoint still considers the peer may become inactive while the endpoint still considers the peer
endpoint reachable. endpoint reachable.
7.1.3 Initialization Parameters (SCTP_INITMSG) 7.1.3 Initialization Parameters (SCTP_INITMSG)
Applications can specify protocol parameters for the default Applications can specify protocol parameters for the default
association intialization. The structure used to access and modify association initialization. The structure used to access and modify
these parameters is defined in section 5.2.1. The option name these parameters is defined in section 5.2.1. The option name
argument to setsockopt() and getsockopt() is SCTP_INITMSG. argument to setsockopt() and getsockopt() is SCTP_INITMSG.
Setting initialization parameters is effective only on an Setting initialization parameters is effective only on an
unconnected socket (for UDP-style sockets only future associations unconnected socket (for UDP-style sockets only future associations
are effected by the change). With TCP-style sockets, this option is are effected by the change). With TCP-style sockets, this option is
inherited by sockets derived from a listener socket. inherited by sockets derived from a listener socket.
7.1.4 SO_LINGER 7.1.4 SO_LINGER
skipping to change at page 38, line 49 skipping to change at page 38, line 50
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
Sets receive buffer size. For SCTP TCP-style sockets, this controls Sets receive buffer size. For SCTP TCP-style sockets, this controls
the receiver window size. For UDP-style sockets, this controls the the receiver window size. For UDP-style sockets, this controls the
receiver window size for all associations bound to the socket receiver window size for all associations bound to the socket
descriptor used in the setsockopt() or getsockopt() call. The option descriptor used in the setsockopt() or getsockopt() call. The option
applies to each association's window size seperately. Expects an applies to each association's window size separately. Expects an
integer. integer.
7.1.7 SO_SNDBUF 7.1.7 SO_SNDBUF
Sets send buffer size. For SCTP TCP-style sockets, this controls the Sets send buffer size. For SCTP TCP-style sockets, this controls the
amount of data SCTP may have waiting in internal buffers to be amount of data SCTP may have waiting in internal buffers to be
sent. This option therefore bounds the maximum size of data that can sent. This option therefore bounds the maximum size of data that can
be sent in a single send call. For UDP-style sockets, the effect is be sent in a single send call. For UDP-style sockets, the effect is
the same, except that it applies to all associations bound to the the same, except that it applies to all associations bound to the
socket descriptor used in the setsockopt() or getsockopt() call. The socket descriptor used in the setsockopt() or getsockopt() call. The
option applies to each association's window size seperately. Expects option applies to each association's window size separately. Expects
an integer. an 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 UDP-style socket only. When This socket option is applicable to the UDP-style socket only. When
set it will cause associations that are idle for more than the set it will cause associations that are idle for more than the
specified number of seconds to automatically close. An association specified number of seconds to automatically close. An association
being idle is defined an association that has NOT sent or received being idle is defined an association that has NOT sent or received
user data. The special value of '0' indicates that no automatic user data. The special value of '0' indicates that no automatic
close of any associations should be performed. The option expects close of any associations should be performed. The option expects
skipping to change at page 40, line 4 skipping to change at page 40, line 6
sctp_assoc_t sspp_assoc_id; sctp_assoc_t sspp_assoc_id;
struct sockaddr_storage sspp_addr; struct sockaddr_storage sspp_addr;
}; };
sspp_addr The address to set as primary sspp_addr The address to set as primary
sspp_assoc_id (UDP style socket) This is filled in by the sspp_assoc_id (UDP style socket) This is filled in by the
application, and identifies the association application, and identifies the association
for this request. for this request.
7.1.11 Set Adaption Layer Indicator (SCTP_SET_ADAPTION_LAYER) 7.1.11 Set Adaption Layer Indicator (SCTP_SET_ADAPTION_LAYER)
Requests that the local endpoint set the specified Adaption Layer Requests that the local endpoint set the specified Adaption Layer
Indication parameter for all future Indication parameter for all future
INIT and INIT-ACK exchanges. INIT and INIT-ACK exchanges.
struct sctp_setadaption { struct sctp_setadaption {
u_int32_t ssb_adaption_ind; u_int32_t ssb_adaption_ind;
} };
ssb_adaption_ind The adaption layer indicator that will be included ssb_adaption_ind The adaption layer indicator that will be included
in any outgoing Adaption Layer Indication in any outgoing Adaption Layer Indication
parameter. parameter.
7.1.12 Set default message time outs (SCTP_SET_STREAM_TIMEOUTS) 7.1.12 Set default message time outs (SCTP_SET_STREAM_TIMEOUTS)
This option requests that the requested stream apply a This option requests that the requested stream apply a
default time-out for messages in queue. default time-out for messages in queue. The default value
is used when the application does not specify a timeout
in the sendrcvinfo structure (sinfo_timetolive element
see section 5.2.2).
struct sctp_setstrm_timeout { struct sctp_setstrm_timeout {
sctp_assoc_t ssto_assoc_id; sctp_assoc_t ssto_assoc_id;
u_int32_t ssto_timeout; u_int32_t ssto_timeout;
u_int16_t ssto_streamid_start; u_int16_t ssto_streamid_start;
u_int16_t ssto_streamid_end; u_int16_t ssto_streamid_end;
}; };
ssto_assoc_id (UDP style socket) This is filled in by the ssto_assoc_id (UDP style socket) This is filled in by the
application, and identifies the association application, and identifies the association
for this request. for this request.
ssto_timeout The maximum time in milliseconds that messages ssto_timeout The maximum time in milliseconds that messages
should be held inqueue before failure. should be held inqueue before failure.
ssto_streamid_start The beginning stream identifer to apply this ssto_streamid_start The beginning stream identifier to apply this
default against. default against.
ssto_streamid_end The ending stream identifer to apply this ssto_streamid_end The ending stream identifier to apply this
default against. default against.
Note that a timeout value of 0 indicates that no inqueue timeout Note that a timeout value of 0 indicates that no inqueue timeout
should be applied against the stream. should be applied against the stream.
7.1.13 Enable/Disable message fragmentation (SCTP_DISABLE_FRAGMENTS) 7.1.13 Enable/Disable message fragmentation (SCTP_DISABLE_FRAGMENTS)
This option is a on/off flag. If enabled no SCTP message This option is a on/off flag. If enabled no SCTP message
fragmentation will be performed. Instead if a message fragmentation will be performed. Instead if a message
being sent exceeds the current PMTU size, the message will being sent exceeds the current PMTU size, the message will
NOT be sent and instead a error will be indicated to the user. NOT be sent and instead a error will be indicated to the user.
7.1.14 Peer Address Parameters (SCTP_SET_PEER_ADDR_PARAMS/ 7.1.14 Peer Address Parameters (SCTP_SET_PEER_ADDR_PARAMS)
SCTP_GET_PEER_ADDR_PARAMS)
Applications can enable or disable heartbeats for any peer address Applications can enable or disable heartbeats for any peer address
of an association, modify an address's heartbeat interval, force a of an association, modify an address's heartbeat interval, force a
heartbeat to be sent immediately, and adjust the address's maximum heartbeat to be sent immediately, and adjust the address's maximum
number of retransmissions sent before an address is considered number of retransmissions sent before an address is considered
unreachable. The following structure is used to access and modify an unreachable. The following structure is used to access and modify an
address's parameters: address's parameters:
struct sctp_paddrparams { struct sctp_paddrparams {
sctp_assoc_t spp_assoc_id; sctp_assoc_t spp_assoc_id;
skipping to change at page 41, line 27 skipping to change at page 41, line 32
parameter, specifies that the heartbeat on this parameter, specifies that the heartbeat on this
address should be disabled. A value of UINT32_MAX address should be disabled. A value of UINT32_MAX
(4294967295), when modifying the parameter, (4294967295), when modifying the parameter,
specifies that a heartbeat should be sent specifies that a heartbeat should be sent
immediately to the peer address, and the current immediately to the peer address, and the current
interval should remain unchanged. interval should remain unchanged.
spp_pathmaxrxt - This contains the maximum number of spp_pathmaxrxt - This contains the maximum number of
retransmissions before this address shall be retransmissions before this address shall be
considered unreachable. considered unreachable.
To modify these parameters, the application should call To read or modify these parameters, the application should call
sctp_opt_info() with the SCTP_SET_PEER_ADDR_PARAMS option. To get sctp_opt_info() with the SCTP_SET_PEER_ADDR_PARAMS option.
these parameters, the application should use
SCTP_GET_PEER_ADDR_PARAMS. 7.1.15 Set default send parameters (SET_DEFAULT_SEND_PARAM)
Applications that wish to use the sendto() system call may wish
to specify a default set of parameters that would normally be
supplied through the inclusion of ancillary data. This socket
option allows such an application to set the default
sctp_sndrcvinfo structure. The application that wishes
to use this socket option simply passes in to this
call the sctp_sndrcvinfo structure defined in section 5.2.2
The input parameters accepted by this call include
sinfo_stream, sinfo_flags, sinfo_ppid, sinfo_context,
sinfo_timetolive. The user must provide the sinfo_assoc_id
field in to this call if the caller is using the UDP model.
7.1.16 Set notification and ancillary events (SCTP_SET_EVENTS)
This socket option is used to specify various notifications
and ancillary data the user wishes to receive. Please see
section 7.3 for a full description of this option and its
usage.
7.2 Read-Only Options 7.2 Read-Only Options
7.2.1 Association Status (SCTP_STATUS) 7.2.1 Association Status (SCTP_STATUS)
Applications can retrieve current status information about an Applications can retrieve current status information about an
association, including association state, peer receiver window size, association, including association state, peer receiver window size,
number of unacked data chunks, and number of data chunks pending number of unacked data chunks, and number of data chunks pending
receipt. This information is read-only. The following structure is receipt. This information is read-only. The following structure is
used to access this information: used to access this information:
skipping to change at page 44, line 53 skipping to change at page 45, line 24
the flag to 0 will disable partial delivery event notifications. the flag to 0 will disable partial delivery event notifications.
For more information on event notifications please see section For more information on event notifications please see section
5.3. 5.3.
sctp_adaption_layer_event - Setting this flag to 1 will enable sctp_adaption_layer_event - Setting this flag to 1 will enable
the reception of adaption layer notifications. Setting the reception of adaption layer notifications. Setting
the flag to 0 will disable adaption layer event notifications. the flag to 0 will disable adaption layer event notifications.
For more information on event notifications please see section For more information on event notifications please see section
5.3. 5.3.
An example where an application would like to recieve data An example where an application would like to receive data
io events and association events but no others would be io events and association events but no others would be
as follows: 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;
event.sctp_association_event = 1; event.sctp_association_event = 1;
skipping to change at page 45, line 28 skipping to change at page 45, line 53
association bound to the file descriptor. association bound to the file descriptor.
By default a TCP-style socket has all options off. By default a TCP-style socket has all options off.
By default a UDP-style socket has sctp_data_io_event and By default a UDP-style socket has sctp_data_io_event and
sctp_association_event on and all other options off. sctp_association_event on and all other options off.
8. New Interfaces 8. New Interfaces
Depending on the system, the following interface can be implemented Depending on the system, the following interface can be implemented
as a system call or library funtion. as a system call or library function.
8.1 sctp_bindx() 8.1 sctp_bindx()
The syntax of sctp_bindx() is, The syntax of sctp_bindx() is,
int sctp_bindx(int sd, struct sockaddr_storage *addrs, int addrcnt, int sctp_bindx(int sd, struct sockaddr_storage *addrs, int addrcnt,
int flags); int flags);
If sd is an IPv4 socket, the addresses passed must be IPv4 If sd is an IPv4 socket, the addresses passed must be IPv4
addresses. If the sd is an IPv6 socket, the addresses passed can addresses. If the sd is an IPv6 socket, the addresses passed can
either be IPv4 or IPv6 addresses. either be IPv4 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.
skipping to change at page 48, line 30 skipping to change at page 48, line 55
addrs is the array of peer addresses returned by sctp_getladdrs(). addrs is the array of peer addresses returned by sctp_getladdrs().
9. Security Considerations 9. 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() the SCTP implementation SHOULD restrict the ability to call bind()
or sctp_bindx() on these port numbers to privileged users. or sctp_bindx() on these port numbers to privileged users.
Similarly unprivelged users should not be able to set protocol Similarly unprevledged users should not be able to set protocol
parameters which could result in the congestion control algorithm parameters which could result in the congestion control algorithm
being more agressive than permitted on the public Internet. These being more aggressive than permitted on the public Internet. These
paramaters are: parameters are:
struct sctp_rtoinfo struct sctp_rtoinfo
If an unprivileged user inherits a UDP-style socket with open If an unprivileged user inherits a UDP-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 associations. This could be relevant for the r* family of
protocols. protocols.
10. Acknowledgements 10. Acknowledgments
The authors wish to thank Kavitha Baratakke, Mike Bartlett, The authors wish to thank Kavitha Baratakke, Mike Bartlett,
Jon Berger, Scott Kimble, Renee Revis, and many others on Jon Berger, Scott Kimble, Renee Revis, and many others on
the TSVWG mailing list for contributing valuable comments. the TSVWG mailing list for contributing valuable comments.
11. Authors' Addresses 11. Authors' Addresses
Randall R. Stewart Tel: +1-815-477-2127 Randall R. Stewart Tel: +1-815-477-2127
Cisco Systems, Inc. EMail: rrs@cisco.com Cisco Systems, Inc. EMail: rrs@cisco.com
Crystal Lake, IL 60012 Crystal Lake, IL 60012
skipping to change at page 49, line 27 skipping to change at page 49, line 51
181 Metro Drive, Suite 300 181 Metro Drive, Suite 300
San Jose, CA 95110 San Jose, CA 95110
USA USA
Kacheong Poon Kacheong Poon
Sun Microsystems, Inc. Email: kacheong.poon@sun.com Sun Microsystems, Inc. Email: kacheong.poon@sun.com
901 San Antonio Road 901 San Antonio Road
Palo Alto, CA 94303 Palo Alto, CA 94303
USA USA
Ken Fujita Tel: +81-471-82-1131 Ken Fujita Tel: +1-408-863-6045
NEC Corporation Email: fken@cd.jp.nec.com NEC Corporation Email: fken@cd.jp.nec.com
1131, Hinode, Abiko Cupertino, CA
Chiba, 270-1198
Japan
12. References 12. References
[RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793,
September 1981. September 1981.
[RFC768] Postel, J. (ed.), "User Datagram Protocol", STD 6, RFC 768, [RFC768] Postel, J. (ed.), "User Datagram Protocol", STD 6, RFC 768,
August 1980. August 1980.
[RFC1644] Braden, R., "T/TCP -- TCP Extensions for Transactions [RFC1644] Braden, R., "T/TCP -- TCP Extensions for Transactions
skipping to change at page 50, line 47 skipping to change at page 51, line 18
sac = &snp->sn_assoc_change; sac = &snp->sn_assoc_change;
printf("^^^ assoc_change: state=%hu, error=%hu, instr=%hu " printf("^^^ assoc_change: state=%hu, error=%hu, instr=%hu "
"outstr=%hu\n", sac->sac_state, sac->sac_error, "outstr=%hu\n", sac->sac_state, sac->sac_error,
sac->sac_inbound_streams, sac->sac_outbound_streams); sac->sac_inbound_streams, sac->sac_outbound_streams);
break; break;
case SCTP_SEND_FAILED: case SCTP_SEND_FAILED:
ssf = &snp->sn_send_failed; ssf = &snp->sn_send_failed;
printf("^^^ sendfailed: len=%hu err=%d\n", ssf->ssf_length, printf("^^^ sendfailed: len=%hu err=%d\n", ssf->ssf_length,
ssf->ssf_error); ssf->ssf_error);
break; break;
case SCTP_PEER_ADDR_CHANGE: case SCTP_PEER_ADDR_CHANGE:
spc = &snp->sn_intf_change; spc = &snp->sn_paddr_change; /* mt changed */
if (spc->spc_addr.ss_family == AF_INET) { if (spc->spc_aaddr.ss_family == AF_INET) {
sin = (struct sockaddr_in *)&spc->spc_addr; sin = (struct sockaddr_in *)&spc->spc_aaddr;
ap = inet_ntop(AF_INET, &sin->sin_addr, addrbuf, ap = inet_ntop(AF_INET, &sin->sin_addr,
INET6_ADDRSTRLEN); addrbuf, INET6_ADDRSTRLEN);
} else { } else {
sin6 = (struct sockaddr_in6 *)&spc->spc_addr; sin6 = (struct sockaddr_in6 *)&spc->spc_aaddr;
ap = inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, ap = inet_ntop(AF_INET6, &sin6->sin6_addr,
INET6_ADDRSTRLEN); addrbuf, INET6_ADDRSTRLEN);
} }
printf("^^^ intf_change: %s state=%d, error=%d\n", ap, printf("^^^ intf_change: %s state=%d, error=%d\n", ap,
spc->spc_state, spc->spc_error); spc->spc_state, spc->spc_error);
break; break;
case SCTP_REMOTE_ERROR: case SCTP_REMOTE_ERROR:
sre = &snp->sn_remote_error; sre = &snp->sn_remote_error;
printf("^^^ remote_error: err=%hu len=%hu\n", printf("^^^ remote_error: err=%hu len=%hu\n",
ntohs(sre->sre_error), ntohs(sre->sre_len)); ntohs(sre->sre_error), ntohs(sre->sre_len));
break; break;
case SCTP_SHUTDOWN_EVENT: case SCTP_SHUTDOWN_EVENT:
skipping to change at page 53, line 23 skipping to change at page 53, line 47
} }
} }
if (nr < 0) { if (nr < 0) {
perror("recvmsg"); perror("recvmsg");
} }
if(socketModeUDP == 0) if(socketModeUDP == 0)
close(fd); close(fd);
} }
main() int main()
{ {
int lfd, cfd; int lfd, cfd;
int onoff = 1; int onoff = 1;
struct sockaddr_in sin[1]; struct sockaddr_in sin[1];
if ((lfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) == -1) { if ((lfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) == -1) {
perror("socket"); perror("socket");
exit(1); exit(1);
} }
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
sin->sin_port = htons(7); sin->sin_port = htons(7);
sin->sin_addr.s_addr = INADDR_ANY; sin->sin_addr.s_addr = INADDR_ANY;
if (bind(lfd, (struct sockaddr *)sin, sizeof (*sin)) == -1) { if (bind(lfd, (struct sockaddr *)sin, sizeof (*sin)) == -1) {
perror("bind"); perror("bind");
exit(1); exit(1);
} }
if (listen(lfd, 1) == -1) { if (listen(lfd, 1) == -1) {
perror("listen"); perror("listen");
skipping to change at page 54, line 54 skipping to change at page 55, line 24
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 Note most functions defined in Appendix A are reused in
this example. this example.
main() int main()
{ {
int fd; int fd;
int onoff = 1; int onoff = 1;
int idleTime = 2; int idleTime = 2;
struct sockaddr_in sin[1]; struct sockaddr_in sin[1];
if ((fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) == -1) { if ((fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) == -1) {
perror("socket"); perror("socket");
exit(1); exit(1);
} }
 End of changes. 

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