An event refers to a change in the network status, association
startups, remote operational errors, or undeliverable messages. An
SCTP application must understand and process these events, and resolve
errors that occur on an SCTP stack.
If an SCTP application wants the SCTP stack to deliver notifications
for a particular event, the SCTP application can set the appropriate
socket option for notifications in the setsockopt()() call. You can configure an SCTP application to send notifications
using the setsockoptg()() call. When an SCTP application
sends a recvmsg()() call to another application
at the peer endpoint, the SCTP application normally reads the data
message from the peer endpoint. For information on recvmsg()(), see “The sendmsg() and recvmsg() Socket APIs”.
If the SCTP application reads a non-data message, the application
sets the message notification flag in the recvmsg()() API. When the notification arrives, recvmsg()() returns the notification in the application-supplied data buffer
in the msg_iov parameter, and sets the MSG_NOTIFICATION flag
in the msg_flags parameter. A recvmsg()() call returns only one notification at a time. While the SCTP application
is reading data, recvmsg()() returns a part of
a notification if the msg_iov buffer is not
sufficient. If a single read is not sufficient, MSG_EOR is not set in the msg_flags parameter. The
SCTP application must finish reading the notification before the subsequent
data arrives.
Following is the SCTP notification structure:
union sctp_notification {
struct {
uint16_t sn_type; /* Notification type. */
uint16_t sn_flags;
uint32_t sn_length;
} sn_header;
struct sctp_assoc_change sn_assoc_change;
struct sctp_paddr_change sn_paddr_change;
struct sctp_remote_error sn_remote_error;
struct sctp_send_failed sn_send_failed;
struct sctp_shutdown_event sn_shutdown_event;
struct sctp_adaption_event sn_adaption_event;
struct sctp_pdapi_event sn_pdapi_event;
}; |
For more information on the SCTP notification structure, see draft-ietf-tsvwg-sctpsocket-10.txt