sctp_peeloff Subroutine

Purpose

Branches off an association into a separate socket.

Library

Standard C Library (libc.a)

Syntax

#include <sys/types.h> 
#include <sys/socket.h> 
#include <netinet/in.h> 
#include <netinet/sctp.h> 

int sctp_peeloff(sd, *assoc_id);
int sd;
sctp_assoc_t *assoc_id;

Description

An application uses the sctp_peeloff subroutine when it wants to branch-off an existing association into a separate socket/file descriptor. It returns a new socket descriptor, which in turn can be used to send and receive subsequent SCTP packets. After it has been branched off, an association becomes completely independent of the original socket. Any subsequent data or control operations to that association must be passed using the new socket descriptor. Also, a close on the original socket descriptor will not close the new socket descriptor branched out of the association.

All the associations under the same socket share the same socket buffer space of the socket that they belong to. If an association gets branched off to a new socket using sctp_peeloff, then it inherits the socket buffer space associated with the new socket descriptor. This way, the association that got peeled off keeps more buffer space.

Implementation Specifics

The sctp_peeloff subroutine is part of Base Operating System (BOS) Runtime.

Parameters

Item Description
sd Specifies the UDP style socket descriptor returned from the socket system call.
assoc_id Specifies the identifier of the association that is to be branched-off to a separate socket descriptor.

Return Values

Upon successful completion, the sctp_peeloff subroutine returns the nonnegative socket descriptor of the branched-off socket.

If the sctp_peeloff subroutine is unsuccessful, the subroutine handler returns a value of -1 to the calling program and moves an error code to the errno global variable.

Error Codes

The sctp_peeloff subroutine is unsuccessful if any of the following errors occurs:

Item Description
EINVAL Invalid argument.
EBADF Bad file descriptor.
EAFNOSUPPORT The addresses in the specified address family cannot be used with this socket.
ESOCKTNOSUPPORT The socket in the specified address family is not supported.
EMFILE The per-process descriptor table is full.
ENOBUFS Insufficient resources were available in the system to complete the call.
ECONNABORTED The client aborted the connection.