/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <sys/sysmacros.h>
#include <sys/socketvar.h>
#include <inet/sctp_itf.h>
#include "socksctp.h"
extern kmem_cache_t *sosctp_assoccache;
/*
* for description of the algorithm.
*/
{
continue;
ralloc = 0;
}
}
return (id);
}
return (-1);
}
/*
* Allocate or free ID, depending on whether incr is 1 or -1
*/
void
{
}
}
/*
* Increase size of the ss_assocs array to accommodate at least maxid.
* We keep the size of the form 2^n - 1 for benefit of sosctp_aid_get().
*/
int
{
continue;
}
return (-1);
}
return (0);
}
}
return (0);
}
/*
* Convert a id into a pointer to sctp_sockassoc structure.
* Increments refcnt.
*/
int
{
return (EINVAL);
}
return (EINVAL);
}
/*
* Disconnected connection, shouldn't be found anymore
*/
return (ESHUTDOWN);
}
return (0);
}
/*
* Can be called from upcall, or through system call.
*/
struct sctp_soassoc *
{
ssa->ssa_snd_qfull = 0;
ssa->ssa_rcv_queued = 0;
}
return (ssa);
}
void
{
}
--ss->ss_assoccnt;
}
/*
* Pack the ancillary stuff taking care of alignment issues.
* sctp_input_add_ancillary() packs the information as:
* struct cmsghdr -> ancillary data + struct cmsghdr -> ancillary data + ...
* In the next version of SCTP, sctp_input_add_ancillary() should
* pack the information taking alignment into account, then we would
* not need this routine.
*/
void
{
int optlen = 0;
char *cend;
/* Figure out the length incl. alignment et. al. */
for (;;) {
break;
}
} else {
break;
}
}
/* Now allocate and copy */
if (isaligned) {
return;
}
for (;;) {
break;
}
} else {
break;
}
}
}
/*
* Find cmsghdr of specified type
*/
struct cmsghdr *
{
char *cend;
for (;;) {
break;
}
return (cmsg);
}
} else {
break;
}
}
return (NULL);
}
/*
* Wait until the association is connected or there is an error.
* fmode should contain any nonblocking flags.
*/
static int
{
int error = 0;
return (EINPROGRESS);
return (EINTR);
/*
* Return EINTR and let the application use
* nonblocking techniques for detecting when
* the connection has been established.
*/
return (EINTR);
}
}
return (error);
}
/*
* Another thread could have consumed so_error
* e.g. by calling read. - take from sowaitconnected()
*/
return (error);
}
return (0);
}
/*
* Called from connect(), sendmsg() when we need to create a new association.
*/
int
{
int error;
/*
* System needs to pick local endpoint
*/
if (error) {
return (error);
}
}
/*
* Create a new association, and call connect on that.
*/
for (;;) {
if (id != -1) {
break;
}
/*
* Array not large enough; increase size.
*/
}
++ss->ss_assoccnt;
return (ENOMEM);
}
/*
* Can specify special init params
*/
if (error != 0)
goto ret_err;
}
goto ret_err;
/*
* Allow other threads to access the socket
*/
switch (error) {
case 0:
case EINPROGRESS:
case EALREADY:
case EINTR:
/* Non-fatal errors */
break;
default:
/*
* Fatal errors. It means that sctp_assoc_disconnected()
* must have been called. So we only need to do a
* SSA_REFRELE() here to release our hold done above.
*/
break;
}
return (error);
/*
* There should not be any upcall done by SCTP. So normally the
* ssa_refcnt should be 2. And we can call sosctp_assoc_free()
* directly. But since the ssa is inserted to the ss_soassocs
* array above, some thread can actually put a hold on it. In
* this special case, we "manually" decrease the ssa_refcnt by 2.
*/
else
return (error);
}
/*
* Inherit socket properties
*/
void
{
}
/*
* Branching association to it's own socket. Inherit properties from
* the parent, and move data for the association to the new socket.
*/
void
struct sctp_soassoc *ssa)
{
/* The peeled off socket is connection oriented */
/* Consolidate all data on a single rcv list */
}
if (nso->so_rcv_queued > 0) {
#ifdef DEBUG
{
/*
* Verify that b_prev points to the last
* mblk in the b_cont chain (as mandated
* by so_dequeue_msg().)
*/
}
#endif /* DEBUG */
} else {
}
} else {
}
}
}
}
void
{
}
void
{
}
void
{
}
void
{
if (error != 0)
}