sctp_init.c revision 77c67f2fb257d2c7dfa00389cd9cd7dd5f99a920
/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <inet/ipclassifier.h>
#include "sctp_impl.h"
#include "sctp_addr.h"
/*
* This will compute the checksum over the SCTP packet, so this
* function should only be called after the whole packet has been
* built.
*
* rptr should point to the IP / SCTP composite header.
* len should be the length of the entire packet, including the IP
* header.
*/
void
{
short iplen;
/* Copy the common header from the template */
/* Set the total length in the IP hdr */
}
/*ARGSUSED*/
{
return (sizeof (sctp_parm_hdr_t) + sizeof (int32_t));
}
{
sph = (sctp_parm_hdr_t *)p;
switch (sctp->sctp_ipversion) {
case IPV4_VERSION:
*addrtype = 0;
break;
case IPV6_VERSION:
sizeof (*addrtype) * 2);
} else {
*addrtype = 0;
sizeof (*addrtype));
}
break;
default:
break;
}
}
/*
* Currently, we support on PRSCTP option, there is more to come.
*/
/*ARGSUSED*/
{
switch (option) {
case SCTP_PRSCTP_OPTION:
optlen = sizeof (sctp_parm_hdr_t);
break;
default:
ASSERT(0);
}
return (optlen);
}
/*ARGSUSED*/
{
switch (option) {
case SCTP_PRSCTP_OPTION:
break;
default:
ASSERT(0);
}
return (sizeof (*sph));
}
{
if (!sctp->sctp_send_adaption) {
return (0);
}
sph = (sctp_parm_hdr_t *)p;
}
mblk_t *
{
uchar_t *p;
int supp_af;
} else {
/* Assume here that a v6 endpoint supports v4 address. */
else
}
if (sctp->sctp_send_adaption) {
}
/*
* This could be a INIT retransmission in which case sh_verf may
* be non-zero, zero it out just to be sure.
*/
return (NULL);
}
/* Lay in a new INIT chunk, starting with the chunk header */
/* Adaption layer param */
p += sctp_adaption_code_param(sctp, p);
/* Add supported address types parameter */
p += sctp_supaddr_param(sctp, p);
/* Add address parameters */
/* Add Forward-TSN-Supported param */
return (mp);
}
/*
* Extracts the verification tag from an INIT chunk. If the INIT
* chunk is truncated or malformed, returns 0.
*/
{
return (init->sic_inittag);
}
{
/*
* If we have only one local address or it is a loopback or linklocal
* association, we let the peer pull the address from the IP header.
*/
sctp->sctp_linklocal) {
return (0);
}
}
{
/*
* If we have only one local address or it is a loopback or linklocal
* association, we let the peer pull the address from the IP header.
*/
sctp->sctp_linklocal) {
return (0);
}
}