draft-ietf-tsvwg-sctpsocket-27.txt   draft-ietf-tsvwg-sctpsocket-28.txt 
Network Working Group R. Stewart Network Working Group R. Stewart
Internet-Draft Huawei Internet-Draft Huawei
Intended status: Informational M. Tuexen Intended status: Informational M. Tuexen
Expires: September 2, 2011 Muenster Univ. of Appl. Sciences Expires: October 10, 2011 Muenster Univ. of Appl. Sciences
K. Poon K. Poon
Oracle Corporation Oracle Corporation
P. Lei P. Lei
Cisco Systems, Inc. Cisco Systems, Inc.
V. Yasevich V. Yasevich
HP HP
March 1, 2011 April 8, 2011
Sockets API Extensions for Stream Control Transmission Protocol (SCTP) Sockets API Extensions for Stream Control Transmission Protocol (SCTP)
draft-ietf-tsvwg-sctpsocket-27.txt draft-ietf-tsvwg-sctpsocket-28.txt
Abstract Abstract
This document describes a mapping of the Stream Control Transmission This document describes a mapping of the Stream Control Transmission
Protocol (SCTP) into a sockets API. The benefits of this mapping Protocol (SCTP) into a sockets API. The benefits of this mapping
include compatibility for TCP applications, access to new SCTP include compatibility for TCP applications, access to new SCTP
features and a consolidated error and event notification scheme. features and a consolidated error and event notification scheme.
Status of this Memo Status of this Memo
skipping to change at page 1, line 40 skipping to change at page 1, line 40
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 2, 2011. This Internet-Draft will expire on October 10, 2011.
Copyright Notice Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the Copyright (c) 2011 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 4, line 22 skipping to change at page 4, line 22
6.1.8. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 50 6.1.8. SCTP_AUTHENTICATION_EVENT . . . . . . . . . . . . . . 50
6.1.9. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 51 6.1.9. SCTP_SENDER_DRY_EVENT . . . . . . . . . . . . . . . . 51
6.1.10. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . 51 6.1.10. SCTP_NOTIFICATIONS_STOPPED_EVENT . . . . . . . . . . 51
6.1.11. SCTP_SEND_FAILED_EVENT . . . . . . . . . . . . . . . 52 6.1.11. SCTP_SEND_FAILED_EVENT . . . . . . . . . . . . . . . 52
6.2. Notification Interest Options . . . . . . . . . . . . . . 53 6.2. Notification Interest Options . . . . . . . . . . . . . . 53
6.2.1. SCTP_EVENTS option - DEPRECATED . . . . . . . . . . . 53 6.2.1. SCTP_EVENTS option - DEPRECATED . . . . . . . . . . . 53
6.2.2. SCTP_EVENT option . . . . . . . . . . . . . . . . . . 55 6.2.2. SCTP_EVENT option . . . . . . . . . . . . . . . . . . 55
7. Common Operations for Both Styles . . . . . . . . . . . . . . 56 7. Common Operations for Both Styles . . . . . . . . . . . . . . 56
7.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . 56 7.1. send(), recv(), sendto(), and recvfrom() . . . . . . . . 56
7.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 58 7.2. setsockopt() and getsockopt() . . . . . . . . . . . . . . 58
7.3. read() and write() . . . . . . . . . . . . . . . . . . . 59 7.3. read() and write() . . . . . . . . . . . . . . . . . . . 60
7.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 59 7.4. getsockname() . . . . . . . . . . . . . . . . . . . . . . 60
7.5. Implicit Association Setup . . . . . . . . . . . . . . . 60 7.5. Implicit Association Setup . . . . . . . . . . . . . . . 60
8. Socket Options . . . . . . . . . . . . . . . . . . . . . . . 61 8. Socket Options . . . . . . . . . . . . . . . . . . . . . . . 61
8.1. Read / Write Options . . . . . . . . . . . . . . . . . . 62 8.1. Read / Write Options . . . . . . . . . . . . . . . . . . 63
8.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . 63 8.1.1. Retransmission Timeout Parameters (SCTP_RTOINFO) . . 63
8.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 63 8.1.2. Association Parameters (SCTP_ASSOCINFO) . . . . . . . 64
8.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . 65 8.1.3. Initialization Parameters (SCTP_INITMSG) . . . . . . 65
8.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 65 8.1.4. SO_LINGER . . . . . . . . . . . . . . . . . . . . . . 65
8.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . 66 8.1.5. SCTP_NODELAY . . . . . . . . . . . . . . . . . . . . 66
8.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 66 8.1.6. SO_RCVBUF . . . . . . . . . . . . . . . . . . . . . . 66
8.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 66 8.1.7. SO_SNDBUF . . . . . . . . . . . . . . . . . . . . . . 66
8.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . 67 8.1.8. Automatic Close of Associations (SCTP_AUTOCLOSE) . . 67
8.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 67 8.1.9. Set Primary Address (SCTP_PRIMARY_ADDR) . . . . . . . 67
8.1.10. Set Adaptation Layer Indicator 8.1.10. Set Adaptation Layer Indicator
(SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 67 (SCTP_ADAPTATION_LAYER) . . . . . . . . . . . . . . . 68
8.1.11. Enable/Disable Message Fragmentation 8.1.11. Enable/Disable Message Fragmentation
(SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . 68 (SCTP_DISABLE_FRAGMENTS) . . . . . . . . . . . . . . 68
8.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 68 8.1.12. Peer Address Parameters (SCTP_PEER_ADDR_PARAMS) . . . 68
8.1.13. Set Default Send Parameters 8.1.13. Set Default Send Parameters
(SCTP_DEFAULT_SEND_PARAM) - DEPRECATED . . . . . . . 71 (SCTP_DEFAULT_SEND_PARAM) - DEPRECATED . . . . . . . 71
8.1.14. Set Notification and Ancillary Events 8.1.14. Set Notification and Ancillary Events
(SCTP_EVENTS) - DEPRECATED . . . . . . . . . . . . . 71 (SCTP_EVENTS) - DEPRECATED . . . . . . . . . . . . . 71
8.1.15. Set/Clear IPv4 Mapped Addresses 8.1.15. Set/Clear IPv4 Mapped Addresses
(SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . 71 (SCTP_I_WANT_MAPPED_V4_ADDR) . . . . . . . . . . . . 72
8.1.16. Get or Set the Maximum Fragmentation Size 8.1.16. Get or Set the Maximum Fragmentation Size
(SCTP_MAXSEG) . . . . . . . . . . . . . . . . . . . . 72 (SCTP_MAXSEG) . . . . . . . . . . . . . . . . . . . . 72
8.1.17. Get or Set the List of Supported HMAC Identifiers 8.1.17. Get or Set the List of Supported HMAC Identifiers
(SCTP_HMAC_IDENT) . . . . . . . . . . . . . . . . . . 72 (SCTP_HMAC_IDENT) . . . . . . . . . . . . . . . . . . 72
8.1.18. Get or Set the Active Shared Key 8.1.18. Get or Set the Active Shared Key
(SCTP_AUTH_ACTIVE_KEY) . . . . . . . . . . . . . . . 73 (SCTP_AUTH_ACTIVE_KEY) . . . . . . . . . . . . . . . 73
8.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK) . . 74 8.1.19. Get or Set Delayed SACK Timer (SCTP_DELAYED_SACK) . . 74
8.1.20. Get or Set Fragmented Interleave 8.1.20. Get or Set Fragmented Interleave
(SCTP_FRAGMENT_INTERLEAVE) . . . . . . . . . . . . . 74 (SCTP_FRAGMENT_INTERLEAVE) . . . . . . . . . . . . . 75
8.1.21. Set or Get the SCTP Partial Delivery Point 8.1.21. Set or Get the SCTP Partial Delivery Point
(SCTP_PARTIAL_DELIVERY_POINT) . . . . . . . . . . . . 76 (SCTP_PARTIAL_DELIVERY_POINT) . . . . . . . . . . . . 76
8.1.22. Set or Get the Use of Extended Receive Info 8.1.22. Set or Get the Use of Extended Receive Info
(SCTP_USE_EXT_RCVINFO) - DEPRECATED . . . . . . . . . 76 (SCTP_USE_EXT_RCVINFO) - DEPRECATED . . . . . . . . . 76
8.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF) . 76 8.1.23. Set or Get the Auto ASCONF Flag (SCTP_AUTO_ASCONF) . 77
8.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST) . . . . 77 8.1.24. Set or Get the Maximum Burst (SCTP_MAX_BURST) . . . . 77
8.1.25. Set or Get the Default Context (SCTP_CONTEXT) . . . . 77 8.1.25. Set or Get the Default Context (SCTP_CONTEXT) . . . . 77
8.1.26. Enable or Disable Explicit EOR Marking 8.1.26. Enable or Disable Explicit EOR Marking
(SCTP_EXPLICIT_EOR) . . . . . . . . . . . . . . . . . 78 (SCTP_EXPLICIT_EOR) . . . . . . . . . . . . . . . . . 78
8.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT) . . . . . 78 8.1.27. Enable SCTP Port Reusage (SCTP_REUSE_PORT) . . . . . 78
8.1.28. Set Notification Event (SCTP_EVENT) . . . . . . . . . 78 8.1.28. Set Notification Event (SCTP_EVENT) . . . . . . . . . 79
8.1.29. Enable or Disable the Delivery of SCTP_RCVINFO as 8.1.29. Enable or Disable the Delivery of SCTP_RCVINFO as
Ancillary Data (SCTP_RECVRCVINFO) . . . . . . . . . . 78 Ancillary Data (SCTP_RECVRCVINFO) . . . . . . . . . . 79
8.1.30. Enable or Disable the Delivery of SCTP_NXTINFO as 8.1.30. Enable or Disable the Delivery of SCTP_NXTINFO as
Ancillary Data (SCTP_RECVNXTINFO) . . . . . . . . . . 79 Ancillary Data (SCTP_RECVNXTINFO) . . . . . . . . . . 79
8.1.31. Set Default Send Parameters (SCTP_DEFAULT_SNDINFO) . 79 8.1.31. Set Default Send Parameters (SCTP_DEFAULT_SNDINFO) . 79
8.2. Read-Only Options . . . . . . . . . . . . . . . . . . . . 79 8.2. Read-Only Options . . . . . . . . . . . . . . . . . . . . 79
8.2.1. Association Status (SCTP_STATUS) . . . . . . . . . . 79 8.2.1. Association Status (SCTP_STATUS) . . . . . . . . . . 80
8.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . 81 8.2.2. Peer Address Information (SCTP_GET_PEER_ADDR_INFO) . 81
8.2.3. Get the List of Chunks the Peer Requires to be 8.2.3. Get the List of Chunks the Peer Requires to be
Authenticated (SCTP_PEER_AUTH_CHUNKS) . . . . . . . . 82 Authenticated (SCTP_PEER_AUTH_CHUNKS) . . . . . . . . 82
8.2.4. Get the List of Chunks the Local Endpoint Requires 8.2.4. Get the List of Chunks the Local Endpoint Requires
to be Authenticated (SCTP_LOCAL_AUTH_CHUNKS) . . . . 83 to be Authenticated (SCTP_LOCAL_AUTH_CHUNKS) . . . . 83
8.2.5. Get the Current Number of Associations 8.2.5. Get the Current Number of Associations
(SCTP_GET_ASSOC_NUMBER) . . . . . . . . . . . . . . . 83 (SCTP_GET_ASSOC_NUMBER) . . . . . . . . . . . . . . . 83
8.2.6. Get the Current Identifiers of Associations 8.2.6. Get the Current Identifiers of Associations
(SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . 84 (SCTP_GET_ASSOC_ID_LIST) . . . . . . . . . . . . . . 84
8.3. Write-Only Options . . . . . . . . . . . . . . . . . . . 84 8.3. Write-Only Options . . . . . . . . . . . . . . . . . . . 84
skipping to change at page 9, line 25 skipping to change at page 9, line 25
between different associations, the sendto() call can only be used to between different associations, the sendto() call can only be used to
setup an association implicitly. It cannot be used to send data to setup an association implicitly. It cannot be used to send data to
an established association as the association identifier cannot be an established association as the association identifier cannot be
specified. specified.
Once an association identifier is assigned to an SCTP association, Once an association identifier is assigned to an SCTP association,
that identifier will not be reused until the application explicitly that identifier will not be reused until the application explicitly
terminates the use of the association. The resources belonging to terminates the use of the association. The resources belonging to
that association will not be freed until that happens. This is that association will not be freed until that happens. This is
similar to the close() operation on a normal socket. The only similar to the close() operation on a normal socket. The only
exception is when the SCTP_AUTOCLOSE option (section 7.1.8) is set. exception is when the SCTP_AUTOCLOSE option (Section 8.1.8) is set.
In this case, after the association is terminated gracefully and In this case, after the association is terminated gracefully and
automatically, the association identifier assigned to it can be automatically, the association identifier 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
endpoint. endpoint.
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 to to a separate socket, it is required to call sctp_peeloff() and to
specify the association identifier. The sctp_peeloff() call will specify the association identifier. The sctp_peeloff() call will
return a new one-to-one style socket which can then be used with return a new one-to-one style socket which can then be used with
skipping to change at page 53, line 35 skipping to change at page 53, line 35
ssf_info.sinfo_flags field as noted above should be used to ssf_info.sinfo_flags field as noted above should be used to
determine if a complete message is present or just a piece of the determine if a complete message is present or just a piece of the
message. Note that only user data is present in this field, any message. Note that only user data is present in this field, any
chunk headers or SCTP common headers must be removed by the SCTP chunk headers or SCTP common headers must be removed by the SCTP
stack. stack.
6.2. Notification Interest Options 6.2. Notification Interest Options
6.2.1. SCTP_EVENTS option - DEPRECATED 6.2.1. SCTP_EVENTS option - DEPRECATED
Please note that this option is deprecated. Use the SCTP_EVENT
option described in Section 6.2.2 instead.
To receive SCTP event notifications, an application registers its To receive SCTP event notifications, an application registers its
interest by setting the SCTP_EVENTS socket option. The application interest by setting the SCTP_EVENTS socket option. The application
then uses recvmsg() to retrieve notifications. A notification is then uses recvmsg() to retrieve notifications. A notification is
stored in the data part (msg_iov) of the struct msghdr. The socket stored in the data part (msg_iov) of the struct msghdr. The socket
option uses the following structure: option uses the following structure:
struct sctp_event_subscribe { struct sctp_event_subscribe {
uint8_t sctp_data_io_event; uint8_t sctp_data_io_event;
uint8_t sctp_association_event; uint8_t sctp_association_event;
uint8_t sctp_address_event; uint8_t sctp_address_event;
skipping to change at page 108, line 6 skipping to change at page 108, line 6
sad->sai_adaptation_ind); sad->sai_adaptation_ind);
break; break;
default: default:
printf("^^^ Unknown event of type: %u.\n", printf("^^^ Unknown event of type: %u.\n",
snp->sn_header.sn_type); snp->sn_header.sn_type);
break; break;
}; };
} }
int int
main(void) { main(void) {
int sd, flags, timeout; int sd, flags, timeout, on;
ssize_t n; ssize_t n;
unsigned int i; unsigned int i;
union { union {
struct sockaddr sa; struct sockaddr sa;
struct sockaddr_in sin; struct sockaddr_in sin;
struct sockaddr_in6 sin6; struct sockaddr_in6 sin6;
} addr; } addr;
socklen_t fromlen, infolen; socklen_t fromlen, infolen;
struct sctp_rcvinfo info; struct sctp_rcvinfo info;
unsigned int infotype; unsigned int infotype;
skipping to change at page 108, line 47 skipping to change at page 108, line 47
if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENT, if (setsockopt(sd, IPPROTO_SCTP, SCTP_EVENT,
&event, sizeof(event)) < 0) { &event, sizeof(event)) < 0) {
perror("setsockopt"); perror("setsockopt");
exit(1); exit(1);
} }
} }
/* Configure auto-close timer. */ /* Configure auto-close timer. */
timeout = TIMEOUT; timeout = TIMEOUT;
if (setsockopt(sd, IPPROTO_SCTP, SCTP_AUTOCLOSE, if (setsockopt(sd, IPPROTO_SCTP, SCTP_AUTOCLOSE,
&timeout, 4) < 0) { &timeout, sizeof(timeout)) < 0) {
perror("setsockopt SCTP_AUTOCLOSE"); perror("setsockopt SCTP_AUTOCLOSE");
exit(1); exit(1);
} }
/* Enable delivery of SCTP_RCVINFO. */
on = 1;
if (setsockopt(sd, IPPROTO_SCTP, SCTP_RECVRCVINFO,
&on, sizeof(on)) < 0) {
perror("setsockopt SCTP_RECVRCVINFO");
exit(1);
}
/* Bind the socket to all local addresses. */ /* Bind the socket to all local addresses. */
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
#ifdef HAVE_SIN6_LEN #ifdef HAVE_SIN6_LEN
addr.sin6.sin6_len = sizeof(addr.sin6); addr.sin6.sin6_len = sizeof(addr.sin6);
#endif #endif
addr.sin6.sin6_family = AF_INET6; addr.sin6.sin6_family = AF_INET6;
addr.sin6.sin6_port = htons(PORT); addr.sin6.sin6_port = htons(PORT);
addr.sin6.sin6_addr = in6addr_any; addr.sin6.sin6_addr = in6addr_any;
if (bind(sd, &addr.sa, sizeof(addr.sin6)) < 0) { if (bind(sd, &addr.sa, sizeof(addr.sin6)) < 0) {
perror("bind"); perror("bind");
 End of changes. 19 change blocks. 
18 lines changed or deleted 29 lines changed or added

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