xref: /illumos-gate/usr/src/uts/common/inet/sctp_itf.h (revision bd670b35)
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
50f1702c5SYu Xiangning  * Common Development and Distribution License (the "License").
60f1702c5SYu Xiangning  * 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 /*
22da9d9933SAnders Persson  * Copyright 2009 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_ITF_H
277c478bd9Sstevel@tonic-gate #define	_INET_SCTP_ITF_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef __cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
331d8c4025Svi #include <netinet/sctp.h>
341d8c4025Svi 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Kernel SCTP programming interface.  Note that this interface
377c478bd9Sstevel@tonic-gate  * is private to Sun and can be changed without notice.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifdef _KERNEL
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * The version number of the SCTP kernel interface.  Use it with
447c478bd9Sstevel@tonic-gate  * sctp_itf_ver() to verify if the kernel supports the correct
457c478bd9Sstevel@tonic-gate  * version of the interface.
467c478bd9Sstevel@tonic-gate  *
477c478bd9Sstevel@tonic-gate  * NOTE: do not assume backward compatibility of the interface.
487c478bd9Sstevel@tonic-gate  * If the return value of sctp_itf_ver() is different from what
497c478bd9Sstevel@tonic-gate  * is expected, do not call any of the routines.
507c478bd9Sstevel@tonic-gate  */
51da9d9933SAnders Persson #define	SCTP_ITF_VER	2
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * This struct holds various flow control limits the caller of
557c478bd9Sstevel@tonic-gate  * sctp_create() should observe when interacting with SCTP.
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate typedef struct sctp_sockbuf_limits_s {
587c478bd9Sstevel@tonic-gate 	int sbl_rxbuf;
597c478bd9Sstevel@tonic-gate 	int sbl_rxlowat;
607c478bd9Sstevel@tonic-gate 	int sbl_txbuf;
617c478bd9Sstevel@tonic-gate 	int sbl_txlowat;
627c478bd9Sstevel@tonic-gate } sctp_sockbuf_limits_t;
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * Parameter to SCTP_UC_SWAP setsockopt
667c478bd9Sstevel@tonic-gate  */
670f1702c5SYu Xiangning struct sock_upcalls_s;
687c478bd9Sstevel@tonic-gate struct sctp_uc_swap {
690f1702c5SYu Xiangning 	void			*sus_handle;
700f1702c5SYu Xiangning 	struct sock_upcalls_s	*sus_upcalls;
717c478bd9Sstevel@tonic-gate };
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate struct sctp_s;
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate /*
767c478bd9Sstevel@tonic-gate  * The list of routines the SCTP kernel module provides.
777c478bd9Sstevel@tonic-gate  */
787c478bd9Sstevel@tonic-gate extern mblk_t *sctp_alloc_hdr(const char *name, int namelen,
797c478bd9Sstevel@tonic-gate     const char *control, int controllen, int flags);
807c478bd9Sstevel@tonic-gate extern int sctp_bind(struct sctp_s *conn, struct sockaddr *addr,
817c478bd9Sstevel@tonic-gate     socklen_t addrlen);
827c478bd9Sstevel@tonic-gate extern int sctp_bindx(struct sctp_s *conn, const void *addrs, int addrcnt,
837c478bd9Sstevel@tonic-gate     int flags);
847c478bd9Sstevel@tonic-gate extern void sctp_close(struct sctp_s *conn);
857c478bd9Sstevel@tonic-gate extern int sctp_connect(struct sctp_s *conn, const struct sockaddr *dst,
86*bd670b35SErik Nordmark     socklen_t addrlen, cred_t *cr, pid_t pid);
877c478bd9Sstevel@tonic-gate extern struct sctp_s *sctp_create(void *newhandle, struct sctp_s *parent,
88*bd670b35SErik Nordmark     int family, int type, int flags, struct sock_upcalls_s *su,
897c478bd9Sstevel@tonic-gate     sctp_sockbuf_limits_t *sbl, cred_t *cr);
907c478bd9Sstevel@tonic-gate extern int sctp_disconnect(struct sctp_s *conn);
917c478bd9Sstevel@tonic-gate extern int sctp_get_opt(struct sctp_s *conn, int level, int opt, void *opts,
927c478bd9Sstevel@tonic-gate     socklen_t *optlen);
937c478bd9Sstevel@tonic-gate extern int sctp_getpeername(struct sctp_s *conn, struct sockaddr *addr,
947c478bd9Sstevel@tonic-gate     socklen_t *addrlen);
957c478bd9Sstevel@tonic-gate extern int sctp_getsockname(struct sctp_s *conn, struct sockaddr *addr,
967c478bd9Sstevel@tonic-gate     socklen_t *addrlen);
977c478bd9Sstevel@tonic-gate extern int sctp_itf_ver(int);
987c478bd9Sstevel@tonic-gate extern int sctp_listen(struct sctp_s *conn);
997c478bd9Sstevel@tonic-gate extern void sctp_recvd(struct sctp_s *conn, int len);
1007c478bd9Sstevel@tonic-gate extern int sctp_sendmsg(struct sctp_s *conn, mblk_t *mp, int flags);
1017c478bd9Sstevel@tonic-gate extern int sctp_set_opt(struct sctp_s *conn, int level, int opt,
1027c478bd9Sstevel@tonic-gate     const void *opts, socklen_t optlen);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /* Flags for sctp_create(), sctp_alloc_hdr() */
1057c478bd9Sstevel@tonic-gate #define	SCTP_CAN_BLOCK			0x01
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /* Flags for upcall su_recv() */
1087c478bd9Sstevel@tonic-gate #define	SCTP_NOTIFICATION		0x01	/* message is a notification */
1097c478bd9Sstevel@tonic-gate #define	SCTP_PARTIAL_DATA		0x02	/* not a full message */
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate /* Use by sockfs to do sctp_peeloff(). */
1127c478bd9Sstevel@tonic-gate #define	SCTP_UC_SWAP			255
1137c478bd9Sstevel@tonic-gate 
1141d8c4025Svi /*
1151d8c4025Svi  * The following are private interfaces between Solaris SCTP and SunCluster.
1161d8c4025Svi  * Hence, these interfaces are only for use by SunCluster and are *not* part
1171d8c4025Svi  * of the general SCTP kernel interface.
1181d8c4025Svi  */
1191d8c4025Svi 
1201d8c4025Svi typedef uintptr_t cl_sctp_handle_t;
1211d8c4025Svi 
1221d8c4025Svi typedef struct cl_sctp_info_s {
1231d8c4025Svi 	ushort_t		cl_sctpi_version;
1241d8c4025Svi 	ushort_t		cl_sctpi_family;
1251d8c4025Svi 	ushort_t		cl_sctpi_ipversion;
1261d8c4025Svi 	int32_t			cl_sctpi_state;
1271d8c4025Svi 	in_port_t		cl_sctpi_lport;
1281d8c4025Svi 	in_port_t		cl_sctpi_fport;
1291d8c4025Svi 	uint_t			cl_sctpi_nladdr;
1301d8c4025Svi 	uchar_t			*cl_sctpi_laddrp;
1311d8c4025Svi 	uint_t			cl_sctpi_nfaddr;
1321d8c4025Svi 	uchar_t			*cl_sctpi_faddrp;
1331d8c4025Svi 	cl_sctp_handle_t	cl_sctpi_handle;
1341d8c4025Svi } cl_sctp_info_t;
1351d8c4025Svi 
1361d8c4025Svi #define	CL_SCTPI_V1	1	/* cl_sctpi_version number */
1371d8c4025Svi 
1381d8c4025Svi /* Used to indicate if the local or peer address list has changed */
1391d8c4025Svi #define	SCTP_CL_LADDR	1
1401d8c4025Svi #define	SCTP_CL_PADDR	2
1411d8c4025Svi 
1421d8c4025Svi extern int cl_sctp_cookie_paddr(sctp_chunk_hdr_t *, in6_addr_t *);
1431d8c4025Svi extern int cl_sctp_walk_list(int (*callback)(cl_sctp_info_t *, void *), void *,
1441d8c4025Svi     boolean_t);
1451d8c4025Svi 
1461d8c4025Svi /* End of private SunCluster interfaces */
1471d8c4025Svi 
1487c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1517c478bd9Sstevel@tonic-gate }
1527c478bd9Sstevel@tonic-gate #endif
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate #endif /* _INET_SCTP_ITF_H */
155