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 (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 /* 27 * Copyright 2026 Edgecast Cloud LLC. 28 */ 29 30 #ifndef _INET_SCTP_ITF_H 31 #define _INET_SCTP_ITF_H 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #include <netinet/sctp.h> 38 39 /* 40 * Kernel SCTP programming interface. Note that this interface 41 * is private to Sun and can be changed without notice. 42 */ 43 44 #ifdef _KERNEL 45 46 /* 47 * The version number of the SCTP kernel interface. Use it with 48 * sctp_itf_ver() to verify if the kernel supports the correct 49 * version of the interface. 50 * 51 * NOTE: do not assume backward compatibility of the interface. 52 * If the return value of sctp_itf_ver() is different from what 53 * is expected, do not call any of the routines. 54 */ 55 #define SCTP_ITF_VER 2 56 57 /* 58 * This struct holds various flow control limits the caller of 59 * sctp_create() should observe when interacting with SCTP. 60 */ 61 typedef struct sctp_sockbuf_limits_s { 62 int sbl_rxbuf; 63 int sbl_rxlowat; 64 int sbl_txbuf; 65 int sbl_txlowat; 66 } sctp_sockbuf_limits_t; 67 68 /* 69 * Parameter to SCTP_UC_SWAP setsockopt 70 */ 71 struct sock_upcalls_s; 72 struct sctp_uc_swap { 73 void *sus_handle; 74 struct sock_upcalls_s *sus_upcalls; 75 }; 76 77 struct sctp_s; 78 79 /* 80 * The list of routines the SCTP kernel module provides. 81 */ 82 extern mblk_t *sctp_alloc_hdr(const char *name, int namelen, 83 const char *control, int controllen, int flags); 84 extern int sctp_bind(struct sctp_s *conn, struct sockaddr *addr, 85 socklen_t addrlen); 86 extern int sctp_bindx(struct sctp_s *conn, const void *addrs, int addrcnt, 87 int flags); 88 extern void sctp_close(struct sctp_s *conn); 89 extern int sctp_connect(struct sctp_s *conn, const struct sockaddr *dst, 90 socklen_t addrlen, cred_t *cr, pid_t pid); 91 extern struct sctp_s *sctp_create(void *newhandle, struct sctp_s *parent, 92 int family, int type, int flags, struct sock_upcalls_s *su, 93 sctp_sockbuf_limits_t *sbl, cred_t *cr); 94 extern int sctp_disconnect(struct sctp_s *conn); 95 extern int sctp_get_opt(struct sctp_s *conn, int level, int opt, void *opts, 96 socklen_t *optlen); 97 extern int sctp_getpeername(struct sctp_s *conn, struct sockaddr *addr, 98 socklen_t *addrlen); 99 extern int sctp_getsockname(struct sctp_s *conn, struct sockaddr *addr, 100 socklen_t *addrlen); 101 extern int sctp_itf_ver(int); 102 extern int sctp_listen(struct sctp_s *conn); 103 extern void sctp_recvd(struct sctp_s *conn, int len); 104 extern int sctp_sendmsg(struct sctp_s *conn, mblk_t *mp, int flags); 105 extern int sctp_set_opt(struct sctp_s *conn, int level, int opt, 106 const void *opts, socklen_t optlen); 107 extern int sctp_set_opt_common(struct sctp_s *conn, int level, int opt, 108 const void *opts, socklen_t optlen, boolean_t); 109 110 /* Flags for sctp_create(), sctp_alloc_hdr() */ 111 #define SCTP_CAN_BLOCK 0x01 112 113 /* Flags for upcall su_recv() */ 114 #define SCTP_NOTIFICATION 0x01 /* message is a notification */ 115 #define SCTP_PARTIAL_DATA 0x02 /* not a full message */ 116 117 /* Use by sockfs to do sctp_peeloff(). */ 118 #define SCTP_UC_SWAP 255 119 120 /* 121 * The following are private interfaces between Solaris SCTP and SunCluster. 122 * Hence, these interfaces are only for use by SunCluster and are *not* part 123 * of the general SCTP kernel interface. 124 */ 125 126 typedef uintptr_t cl_sctp_handle_t; 127 128 typedef struct cl_sctp_info_s { 129 ushort_t cl_sctpi_version; 130 ushort_t cl_sctpi_family; 131 ushort_t cl_sctpi_ipversion; 132 int32_t cl_sctpi_state; 133 in_port_t cl_sctpi_lport; 134 in_port_t cl_sctpi_fport; 135 uint_t cl_sctpi_nladdr; 136 uchar_t *cl_sctpi_laddrp; 137 uint_t cl_sctpi_nfaddr; 138 uchar_t *cl_sctpi_faddrp; 139 cl_sctp_handle_t cl_sctpi_handle; 140 } cl_sctp_info_t; 141 142 #define CL_SCTPI_V1 1 /* cl_sctpi_version number */ 143 144 /* Used to indicate if the local or peer address list has changed */ 145 #define SCTP_CL_LADDR 1 146 #define SCTP_CL_PADDR 2 147 148 extern int cl_sctp_cookie_paddr(sctp_chunk_hdr_t *, in6_addr_t *); 149 extern int cl_sctp_walk_list(int (*callback)(cl_sctp_info_t *, void *), void *, 150 boolean_t); 151 152 /* End of private SunCluster interfaces */ 153 154 #endif /* _KERNEL */ 155 156 #ifdef __cplusplus 157 } 158 #endif 159 160 #endif /* _INET_SCTP_ITF_H */ 161