xref: /illumos-gate/usr/src/uts/common/inet/sctp_ip.h (revision e35d2278)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22f4b3ec61Sdh  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _INET_SCTP_IP_H
277c478bd9Sstevel@tonic-gate #define	_INET_SCTP_IP_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef __cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
35f4b3ec61Sdh #include <inet/sctp/sctp_stack.h>
36f4b3ec61Sdh 
377c478bd9Sstevel@tonic-gate #define	SCTP_COMMON_HDR_LENGTH	12	/* SCTP common header length */
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /* SCTP routines for IP to call. */
407c478bd9Sstevel@tonic-gate extern void ip_fanout_sctp(mblk_t *, ill_t *, ipha_t *, uint32_t,
41*e35d2278Svi     uint_t, boolean_t, boolean_t, zoneid_t);
42f4b3ec61Sdh extern void sctp_ddi_g_init(void);
43f4b3ec61Sdh extern void sctp_ddi_g_destroy(void);
44*e35d2278Svi extern conn_t *sctp_find_conn(in6_addr_t *, in6_addr_t *, uint32_t,
45f4b3ec61Sdh     zoneid_t, sctp_stack_t *);
46*e35d2278Svi extern conn_t *sctp_fanout(in6_addr_t *, in6_addr_t *, uint32_t,
47f4b3ec61Sdh     zoneid_t, mblk_t *, sctp_stack_t *);
4845916cd2Sjpk 
497c478bd9Sstevel@tonic-gate extern void sctp_input(conn_t *, ipha_t *, mblk_t *, mblk_t *, ill_t *,
507c478bd9Sstevel@tonic-gate     boolean_t, boolean_t);
517c478bd9Sstevel@tonic-gate extern void sctp_wput(queue_t *, mblk_t *);
52*e35d2278Svi extern void sctp_ootb_input(mblk_t *, ill_t *, zoneid_t, boolean_t);
53f4b3ec61Sdh extern void sctp_hash_init(sctp_stack_t *);
54f4b3ec61Sdh extern void sctp_hash_destroy(sctp_stack_t *);
557c478bd9Sstevel@tonic-gate extern uint32_t sctp_cksum(mblk_t *, int);
56f4b3ec61Sdh extern mblk_t *sctp_snmp_get_mib2(queue_t *, mblk_t *, sctp_stack_t *);
577c478bd9Sstevel@tonic-gate extern void sctp_free(conn_t *);
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate #define	SCTP_STASH_IPINFO(mp, ire)			\
607c478bd9Sstevel@tonic-gate {							\
617c478bd9Sstevel@tonic-gate 	unsigned char *stp;				\
627c478bd9Sstevel@tonic-gate 	stp = DB_BASE((mp));				\
637c478bd9Sstevel@tonic-gate 	ASSERT(stp + sizeof (ire_t *) < (mp)->b_rptr);	\
647c478bd9Sstevel@tonic-gate 	*(ire_t **)stp  = (ire);			\
657c478bd9Sstevel@tonic-gate }
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate #define	SCTP_EXTRACT_IPINFO(mp, ire)			\
687c478bd9Sstevel@tonic-gate {							\
697c478bd9Sstevel@tonic-gate 	unsigned char *stp;				\
707c478bd9Sstevel@tonic-gate 	stp = (mp)->b_datap->db_base;			\
717c478bd9Sstevel@tonic-gate 	(ire) = *(ire_t **)stp;				\
727c478bd9Sstevel@tonic-gate }
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /*
757c478bd9Sstevel@tonic-gate  * SCTP maintains a list of ILLs/IPIFs, these functions are provided by
767c478bd9Sstevel@tonic-gate  * SCTP to keep its interface list up to date.
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate extern void sctp_update_ill(ill_t *, int);
797c478bd9Sstevel@tonic-gate extern void sctp_update_ipif(ipif_t *, int);
807c478bd9Sstevel@tonic-gate extern void sctp_move_ipif(ipif_t *, ill_t *, ill_t *);
81*e35d2278Svi extern void sctp_update_ipif_addr(ipif_t *, in6_addr_t);
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate #define	SCTP_ILL_INSERT		1
847c478bd9Sstevel@tonic-gate #define	SCTP_ILL_REMOVE		2
857c478bd9Sstevel@tonic-gate #define	SCTP_IPIF_INSERT	3
867c478bd9Sstevel@tonic-gate #define	SCTP_IPIF_REMOVE	4
877c478bd9Sstevel@tonic-gate #define	SCTP_IPIF_UP		5
887c478bd9Sstevel@tonic-gate #define	SCTP_IPIF_DOWN		6
897c478bd9Sstevel@tonic-gate #define	SCTP_IPIF_UPDATE	7
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /* IP routines for SCTP to call. */
927c478bd9Sstevel@tonic-gate extern void ip_fanout_sctp_raw(mblk_t *, ill_t *, ipha_t *, boolean_t,
93*e35d2278Svi     uint32_t, boolean_t, uint_t, boolean_t, zoneid_t);
947c478bd9Sstevel@tonic-gate extern void sctp_ire_cache_flush(ipif_t *);
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Private (and possibly temporary) ioctls.  It is a large number
987c478bd9Sstevel@tonic-gate  * to avoid conflict with other ioctls, which are normally smaller
997c478bd9Sstevel@tonic-gate  * than 2^16.
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate #define	SCTP_IOC_DEFAULT_Q	(('S' << 16) | 1024)
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1047c478bd9Sstevel@tonic-gate }
1057c478bd9Sstevel@tonic-gate #endif
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate #endif /* _INET_SCTP_IP_H */
108