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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
24 */
25
26 #ifndef _SYS_SOCKET_PROTO_H_
27 #define _SYS_SOCKET_PROTO_H_
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 #include <sys/socket.h>
34 #include <sys/stream.h>
35 #include <sys/vnode.h>
36
37 /*
38 * Generation count
39 */
40 typedef uint64_t sock_connid_t;
41
42 #define SOCK_CONNID_INIT(id) { \
43 (id) = 0; \
185 SOCK_OPCTL_SHUT_RECV
186 } sock_opctl_action_t;
187
188 struct sock_upcalls_s {
189 sock_upper_handle_t (*su_newconn)(sock_upper_handle_t,
190 sock_lower_handle_t, sock_downcalls_t *, cred_t *, pid_t,
191 sock_upcalls_t **);
192 void (*su_connected)(sock_upper_handle_t, sock_connid_t, cred_t *,
193 pid_t);
194 int (*su_disconnected)(sock_upper_handle_t, sock_connid_t, int);
195 void (*su_opctl)(sock_upper_handle_t, sock_opctl_action_t,
196 uintptr_t);
197 ssize_t (*su_recv)(sock_upper_handle_t, mblk_t *, size_t, int,
198 int *, boolean_t *);
199 void (*su_set_proto_props)(sock_upper_handle_t,
200 struct sock_proto_props *);
201 void (*su_txq_full)(sock_upper_handle_t, boolean_t);
202 void (*su_signal_oob)(sock_upper_handle_t, ssize_t);
203 void (*su_zcopy_notify)(sock_upper_handle_t);
204 void (*su_set_error)(sock_upper_handle_t, int);
205 void (*su_closed)(sock_upper_handle_t);
206 vnode_t *(*su_get_vnode)(sock_upper_handle_t);
207 };
208
209 #define SOCK_UC_VERSION sizeof (sock_upcalls_t)
210 #define SOCK_DC_VERSION sizeof (sock_downcalls_t)
211
212 #define SOCKET_RECVHIWATER (48 * 1024)
213 #define SOCKET_RECVLOWATER 1024
214
215 #define SOCKET_NO_RCVTIMER 0
216 #define SOCKET_TIMER_INTERVAL 50
217
218 #endif /* _KERNEL */
219
220 #ifdef __cplusplus
221 }
222 #endif
223
224 #endif /* _SYS_SOCKET_PROTO_H_ */
|
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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
24 * Copyright 2020 Joyent, Inc.
25 */
26
27 #ifndef _SYS_SOCKET_PROTO_H_
28 #define _SYS_SOCKET_PROTO_H_
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #include <sys/socket.h>
35 #include <sys/stream.h>
36 #include <sys/vnode.h>
37
38 /*
39 * Generation count
40 */
41 typedef uint64_t sock_connid_t;
42
43 #define SOCK_CONNID_INIT(id) { \
44 (id) = 0; \
186 SOCK_OPCTL_SHUT_RECV
187 } sock_opctl_action_t;
188
189 struct sock_upcalls_s {
190 sock_upper_handle_t (*su_newconn)(sock_upper_handle_t,
191 sock_lower_handle_t, sock_downcalls_t *, cred_t *, pid_t,
192 sock_upcalls_t **);
193 void (*su_connected)(sock_upper_handle_t, sock_connid_t, cred_t *,
194 pid_t);
195 int (*su_disconnected)(sock_upper_handle_t, sock_connid_t, int);
196 void (*su_opctl)(sock_upper_handle_t, sock_opctl_action_t,
197 uintptr_t);
198 ssize_t (*su_recv)(sock_upper_handle_t, mblk_t *, size_t, int,
199 int *, boolean_t *);
200 void (*su_set_proto_props)(sock_upper_handle_t,
201 struct sock_proto_props *);
202 void (*su_txq_full)(sock_upper_handle_t, boolean_t);
203 void (*su_signal_oob)(sock_upper_handle_t, ssize_t);
204 void (*su_zcopy_notify)(sock_upper_handle_t);
205 void (*su_set_error)(sock_upper_handle_t, int);
206 /*
207 * NOTE: This function frees upper handle items. Caller cannot
208 * rely on them after this upcall.
209 */
210 void (*su_closed)(sock_upper_handle_t);
211 /*
212 * NOTE: This function MUST be implemented without using lower-level
213 * downcalls or accesses. This allows callers to ensure su_closed()
214 * upcalls can happen indepdently or concurrently.
215 */
216 vnode_t *(*su_get_vnode)(sock_upper_handle_t);
217 };
218
219 #define SOCK_UC_VERSION sizeof (sock_upcalls_t)
220 #define SOCK_DC_VERSION sizeof (sock_downcalls_t)
221
222 #define SOCKET_RECVHIWATER (48 * 1024)
223 #define SOCKET_RECVLOWATER 1024
224
225 #define SOCKET_NO_RCVTIMER 0
226 #define SOCKET_TIMER_INTERVAL 50
227
228 #endif /* _KERNEL */
229
230 #ifdef __cplusplus
231 }
232 #endif
233
234 #endif /* _SYS_SOCKET_PROTO_H_ */
|