xref: /titanic_41/usr/src/uts/common/inet/sctp_itf.h (revision fd9cb95cbb2f626355a60efb9d02c5f0a33c10e6)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_INET_SCTP_ITF_H
28 #define	_INET_SCTP_ITF_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Kernel SCTP programming interface.  Note that this interface
38  * is private to Sun and can be changed without notice.
39  */
40 
41 #ifdef _KERNEL
42 
43 /*
44  * The version number of the SCTP kernel interface.  Use it with
45  * sctp_itf_ver() to verify if the kernel supports the correct
46  * version of the interface.
47  *
48  * NOTE: do not assume backward compatibility of the interface.
49  * If the return value of sctp_itf_ver() is different from what
50  * is expected, do not call any of the routines.
51  */
52 #define	SCTP_ITF_VER	1
53 
54 /*
55  * This struct holds all the upcalls the SCTP kernel module will
56  * invoke for different events.  When calling sctp_create() to create
57  * a SCTP handle, the caller must provide this information.
58  */
59 typedef struct sctp_upcalls_s {
60 	void *	(*su_newconn)(void *parenthandle, void *connind);
61 	void	(*su_connected)(void *handle);
62 	int	(*su_disconnected)(void *handle, int error);
63 	void	(*su_disconnecting)(void *handle);
64 	int	(*su_recv)(void *handle, mblk_t *mp, int flags);
65 	void	(*su_xmitted)(void *handle, int txqueued);
66 	void	(*su_properties)(void *handle, int wroff, size_t maxblk);
67 } sctp_upcalls_t;
68 
69 /*
70  * This struct holds various flow control limits the caller of
71  * sctp_create() should observe when interacting with SCTP.
72  */
73 typedef struct sctp_sockbuf_limits_s {
74 	int sbl_rxbuf;
75 	int sbl_rxlowat;
76 	int sbl_txbuf;
77 	int sbl_txlowat;
78 } sctp_sockbuf_limits_t;
79 
80 /*
81  * Parameter to SCTP_UC_SWAP setsockopt
82  */
83 struct sctp_uc_swap {
84 	void		*sus_handle;
85 	sctp_upcalls_t	*sus_upcalls;
86 };
87 
88 struct sctp_s;
89 
90 /*
91  * The list of routines the SCTP kernel module provides.
92  */
93 extern mblk_t *sctp_alloc_hdr(const char *name, int namelen,
94     const char *control, int controllen, int flags);
95 extern int sctp_bind(struct sctp_s *conn, struct sockaddr *addr,
96     socklen_t addrlen);
97 extern int sctp_bindx(struct sctp_s *conn, const void *addrs, int addrcnt,
98     int flags);
99 extern void sctp_close(struct sctp_s *conn);
100 extern int sctp_connect(struct sctp_s *conn, const struct sockaddr *dst,
101     socklen_t addrlen);
102 extern struct sctp_s *sctp_create(void *newhandle, struct sctp_s *parent,
103     int family, int flags, const sctp_upcalls_t *su,
104     sctp_sockbuf_limits_t *sbl, cred_t *cr);
105 extern int sctp_disconnect(struct sctp_s *conn);
106 extern int sctp_get_opt(struct sctp_s *conn, int level, int opt, void *opts,
107     socklen_t *optlen);
108 extern int sctp_getpeername(struct sctp_s *conn, struct sockaddr *addr,
109     socklen_t *addrlen);
110 extern int sctp_getsockname(struct sctp_s *conn, struct sockaddr *addr,
111     socklen_t *addrlen);
112 extern int sctp_itf_ver(int);
113 extern int sctp_listen(struct sctp_s *conn);
114 extern void sctp_recvd(struct sctp_s *conn, int len);
115 extern int sctp_sendmsg(struct sctp_s *conn, mblk_t *mp, int flags);
116 extern int sctp_set_opt(struct sctp_s *conn, int level, int opt,
117     const void *opts, socklen_t optlen);
118 
119 /* Flags for sctp_create(), sctp_alloc_hdr() */
120 #define	SCTP_CAN_BLOCK			0x01
121 
122 /* Flags for upcall su_recv() */
123 #define	SCTP_NOTIFICATION		0x01	/* message is a notification */
124 #define	SCTP_PARTIAL_DATA		0x02	/* not a full message */
125 
126 /* Use by sockfs to do sctp_peeloff(). */
127 #define	SCTP_UC_SWAP			255
128 
129 #endif /* _KERNEL */
130 
131 #ifdef __cplusplus
132 }
133 #endif
134 
135 #endif /* _INET_SCTP_ITF_H */
136