diff options
Diffstat (limited to 'lib/libc/net/sctp_sendmsg.3')
-rw-r--r-- | lib/libc/net/sctp_sendmsg.3 | 152 |
1 files changed, 95 insertions, 57 deletions
diff --git a/lib/libc/net/sctp_sendmsg.3 b/lib/libc/net/sctp_sendmsg.3 index 8c3f6ed..bc644b6 100644 --- a/lib/libc/net/sctp_sendmsg.3 +++ b/lib/libc/net/sctp_sendmsg.3 @@ -36,7 +36,7 @@ .Dt SCTP_SENDMSG 3 .Os .Sh NAME -.Nm sctp_sendmsg +.Nm sctp_sendmsg , .Nm sctp_sendmsgx .Nd send a message from an SCTP socket .Sh LIBRARY @@ -46,31 +46,44 @@ .In sys/socket.h .In netinet/sctp.h .Ft ssize_t -.Fn sctp_sendmsg "int s" "const void *msg" "size_t len" "const struct sockaddr *to" "socklen_t tolen" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" "uint32_t timetolive" "uint32_t context" +.Fo sctp_sendmsg +.Fa "int s" "const void *msg" "size_t len" "const struct sockaddr *to" +.Fa "socklen_t tolen" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" +.Fa "uint32_t timetolive" "uint32_t context" +.Fc .Ft ssize_t -.Fn sctp_sendmsgx "int s" "const void *msg" "size_t len" "const struct sockaddr *to" "int addrcnt" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" "uint32_t timetolive" "uint32_t context" - +.Fo sctp_sendmsgx +.Fa "int s" "const void *msg" "size_t len" "const struct sockaddr *to" +.Fa "int addrcnt" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" +.Fa "uint32_t timetolive" "uint32_t context" +.Fc .Sh DESCRIPTION The .Fn sctp_sendmsg -system calls +system call is used to transmit a message to another SCTP endpoint. The .Fn sctp_sendmsg -may be used at any time. If the socket is a one-to-many type (SOCK_SEQPACKET) +may be used at any time. +If the socket is a one-to-many type (SOCK_SEQPACKET) socket then an attempt to send to an address that no association exists to will -implicitly create a new association. Data sent in such an instance will result in -the data being sent on the third leg of the SCTP four-way handshake. Note that if +implicitly create a new association. +Data sent in such an instance will result in +the data being sent on the third leg of the SCTP four-way handshake. +Note that if the socket is a one-to-one type (SOCK_STREAM) socket then an association must be in existance (by use of the -.Fn connect 2 -system call). Calling +.Xr connect 2 +system call). +Calling .Fn sctp_sendmsg or .Fn sctp_sendmsgx -on a non-connected one-to-one socket will result in the errno being set to -.Er ENOTCONN -a -1 being returned, and the message is not transmitted. +on a non-connected one-to-one socket will result in +.Va errno +being set to +.Er ENOTCONN , +-1 being returned, and the message not being transmitted. .Pp The address of the target is given by .Fa to @@ -82,32 +95,37 @@ The length of the message is given by .Fa len . If the message is too long to pass atomically through the -underlying protocol, the errno is set to -.Er EMSGSIZE -a -1 is returned, and +underlying protocol, +.Va errno +is set to +.Er EMSGSIZE , +-1 is returned, and the message is not transmitted. .Pp No indication of failure to deliver is implicit in a -.Fn sctp_sendmsg 2 +.Xr sctp_sendmsg 2 +call. Locally detected errors are indicated by a return value of -1. .Pp -If no messages space is available at the socket to hold +If no space is available at the socket to hold the message to be transmitted, then -.Fn sctp_sendmsg 2 +.Xr sctp_sendmsg 2 normally blocks, unless the socket has been placed in non-blocking I/O mode. The -.Fn select 2 +.Xr select 2 system call may be used to determine when it is possible to send more data on one-to-one type (SOCK_STREAM) sockets. .Pp The .Fa ppid argument is an opaque 32 bit value that is passed transparently -through the stack to the peer endpoint. It will be available on +through the stack to the peer endpoint. +It will be available on reception of a message (see -.Fn sctp_recvmsg 2 -). Note that the stack passes this value without regard to byte +.Xr sctp_recvmsg 2 +). +Note that the stack passes this value without regard to byte order. .Pp The @@ -129,31 +147,37 @@ argument may include one or more of the following: The flag .Dv SCTP_EOF is used to instruct the SCTP stack to queue this message -and then start a graceful shutdown of the association. All +and then start a graceful shutdown of the association. +All remaining data in queue will be sent after which the association -will be shutdown. +will be shut down. .Pp .Dv SCTP_ABORT -is used to immediately terminate an association. An abort +is used to immediately terminate an association. +An abort is sent to the peer and the local TCB is destroyed. .Pp .Dv SCTP_UNORDERED is used to specify that the message being sent has no specific order and should be delivered to the peer application -as soon as possible. When this flag is absent messages +as soon as possible. +When this flag is absent messages are delivered in order within the stream they are sent, but without respect to order to peer streams. .Pp The flag .Dv SCTP_ADDR_OVER -is used to specify that an specific address should be used. Normally -SCTP will use only one of a multi-homed peers address as the primary -address to send to. By default, no matter what the +is used to specify that an specific address should be used. +Normally +SCTP will use only one of a multi-homed peers addresses as the primary +address to send to. +By default, no matter what the .Fa to -argument is, this primary address is used to send data. By specifying +argument is, this primary address is used to send data. +By specifying this flag, the user is asking the stack to ignore the primary address -and instead use the specified address not only has a lookup mechanism -to find the association but also has the actual address to send to. +and instead use the specified address not only as a lookup mechanism +to find the association but also as the actual address to send to. .Pp For a one-to-many type (SOCK_SEQPACKET) socket the flag .Dv SCTP_SENDALL @@ -165,18 +189,23 @@ copy of the data which is shared by all the associations for sending. The remaining flags are used for the partial reliabilty extension (RFC3758) and will only be effective if the peer endpoint supports this extension. This option specify's what local policy the local endpoint should use -in skipping data. If none of these options are set, then data is +in skipping data. +If none of these options are set, then data is never skipped over. .Pp .Dv SCTP_PR_SCTP_TTL Is used to indicate that a time based lifetime is being applied -to the data. The +to the data. +The .Fa timetolive argument is then a number of milliseconds for which the data is -attempted to be transmitted. If that many milliseconds ellapses -and the peer has not acknowledge the data, the data will be -skipped and no longer transmitted. Note that this policy does -not even assure that the data will ever be sent. In times of a congestion +attempted to be transmitted. +If that many milliseconds ellapse +and the peer has not acknowledged the data, the data will be +skipped and no longer transmitted. +Note that this policy does +not even assure that the data will ever be sent. +In times of a congestion with large amounts of data being queued, the .Fa timetolive may expire before the first transmission is ever made. @@ -186,9 +215,11 @@ The based policy transforms the .Fa timetolive field into a total number of bytes allowed on the outbound -send queue. If that number or more bytes are in queue, then +send queue. +If that number or more bytes are in queue, then other buffer based sends are looked to be removed and -skipped. Note that this policy may also result in the data +skipped. +Note that this policy may also result in the data never being sent if no buffer based sends are in queue and the maximum specified by .Fa timetolive @@ -198,22 +229,28 @@ The .Dv SCTP_PR_SCTP_RTX policy transforms the .Fa timetolive -into a number of retransmissions to allow. This policy +into a number of retransmissions to allow. +This policy always assures that at a minimum one send attempt is -made of the data. After which no more than +made of the data. +After which no more than .Fa timetolive retransmissions will be made before the data is skipped. .Pp .Fa stream_no is the SCTP stream that you wish to send the -message on. Streams in SCTP are reliable (or partially reliable) flows of ordered -messages. The +message on. +Streams in SCTP are reliable (or partially reliable) flows of ordered +messages. +The .Fa context -field is used only in the event the message cannot be sent. This is an opaque +field is used only in the event the message cannot be sent. +This is an opaque value that the stack retains and will give to the user when a failed send is given if that notification is enabled (see -.Tn sctp -). Normally a user process can use this value to index some application +.Xr sctp 4 +). +Normally a user process can use this value to index some application specific data structure when a send cannot be fulfilled. .Fn sctp_sendmsgx is identical to @@ -223,7 +260,8 @@ argument .Fa to and adds the additional argument .Fa addrcnt -which specifies how many addresses are in the array. This allows a +which specifies how many addresses are in the array. +This allows a caller to implictly setup an association passing multiple addresses as if an .Fn sctp_connectx @@ -261,14 +299,15 @@ but may be caused by transient congestion. .It Bq Er EHOSTUNREACH The remote host was unreachable. .It Bq Er ENOTCON -On a one to one style socket no association exists. +On a one-to-one style socket no association exists. .It Bq Er ECONNRESET An abort was received by the stack while the user was attempting to send data to the peer. .It Bq Er ENOENT -On a one to many style socket no address is specified +On a one-to-many style socket no address is specified so that the association cannot be located or the -SCTP_ABORT flag was specified on a non-existing association. +.Dv SCTP_ABORT +flag was specified on a non-existing association. .It Bq Er EPIPE The socket is unable to send anymore data .Dv ( SBS_CANTSENDMORE @@ -277,15 +316,15 @@ This typically means that the socket is not connected and is a one-to-one style socket. .El .Sh SEE ALSO -.Xr sctp 4 , -.Xr sendmsg 3 , .Xr connect 2 , -.Xr sctp_connectx 3 , .Xr getsockopt 2 , .Xr recv 2 , .Xr select 2 , .Xr socket 2 , -.Xr write 2 +.Xr write 2 , +.Xr sendmsg 3 , +.Xr sctp_connectx 3 , +.Xr sctp 4 .Sh BUGS Because in the one-to-many style socket the .Fn sctp_sendmsg @@ -294,4 +333,3 @@ or may have multiple associations under one endpoint, a select on write will only work for a one-to-one style socket. - |