xref: /titanic_44/usr/src/uts/common/inet/sdp_itf.h (revision 5363b1129db4ee42d2c9736898eab4670580bec7)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_INET_SDP_ITF_H
27 #define	_INET_SDP_ITF_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Kernel SDP programming interface.  Note that this interface
37  * is private to Sun and can be changed without notice.
38  */
39 
40 #ifdef _KERNEL
41 
42 /*
43  * The version number of the SDP kernel interface.  Use it with
44  * sdp_itf_ver() to verify if the kernel supports the correct
45  * version of the interface.
46  *
47  * NOTE: do not assume backward compatibility of the interface.
48  * If the return value of sdp_itf_ver() is different from what
49  * is expected, do not call any of the routines.
50  */
51 #define	SDP_ITF_VER	1
52 
53 /*
54  * This struct holds all the upcalls the SDP kernel module will
55  * invoke for different events.  When calling sdp_create() to create
56  * a SDP handle, the caller must provide this information.
57  */
58 typedef struct sdp_upcalls_s {
59 	void *	(*su_newconn)(void *parenthandle, void *connind);
60 	void	(*su_connected)(void *handle);
61 	void	(*su_disconnected)(void *handle, int error);
62 	void	(*su_connfailed)(void *handle, int error);
63 	int	(*su_recv)(void *handle, mblk_t *mp, int flags);
64 	void	(*su_xmitted)(void *handle, int writeable);
65 	void	(*su_urgdata)(void *handle);
66 	void	(*su_ordrel)(void *handle);
67 } sdp_upcalls_t;
68 
69 
70 /*
71  * This struct holds various flow control limits the caller of
72  * sdp_create() should observe when interacting with SDP.
73  */
74 typedef struct sdp_sockbuf_limits_s {
75 	int sbl_rxbuf;
76 	int sbl_rxlowat;
77 	int sbl_txbuf;
78 	int sbl_txlowat;
79 } sdp_sockbuf_limits_t;
80 
81 struct sdp_conn_struct_t;
82 
83 /*
84  * The list of routines the SDP kernel module provides.
85  */
86 extern int sdp_bind(struct sdp_conn_struct_t *conn, struct sockaddr *addr,
87     socklen_t addrlen);
88 extern void sdp_close(struct sdp_conn_struct_t *conn);
89 extern int sdp_connect(struct sdp_conn_struct_t *conn,
90     const struct sockaddr *dst, socklen_t addrlen);
91 extern struct sdp_conn_struct_t *sdp_create(void *newhandle,
92     struct sdp_conn_struct_t *parent, int family, int flags,
93     const sdp_upcalls_t *su, sdp_sockbuf_limits_t *sbl, cred_t *cr,
94     int *error);
95 extern int sdp_disconnect(struct sdp_conn_struct_t *conn, int flags);
96 extern int sdp_shutdown(struct sdp_conn_struct_t *conn, int flag);
97 extern int sdp_polldata(struct sdp_conn_struct_t *conn, int flag);
98 extern int sdp_get_opt(struct sdp_conn_struct_t *conn, int level, int opt,
99     void *opts, socklen_t *optlen);
100 extern int sdp_getpeername(struct sdp_conn_struct_t *conn,
101     struct sockaddr *addr, socklen_t *addrlen);
102 extern int sdp_getsockname(struct sdp_conn_struct_t *conn,
103     struct sockaddr *addr, socklen_t *addrlen);
104 extern int sdp_itf_ver(int);
105 extern int sdp_listen(struct sdp_conn_struct_t *conn, int backlog);
106 extern int sdp_send(struct sdp_conn_struct_t *conn, struct msghdr *msg,
107     size_t size, int flags, struct uio *uiop);
108 extern int sdp_recv(struct sdp_conn_struct_t *conn, struct msghdr *msg,
109     size_t size, int flags, struct uio *uiop);
110 extern int sdp_set_opt(struct sdp_conn_struct_t *conn, int level, int opt,
111     const void *opts, socklen_t optlen);
112 extern int sdp_ioctl(struct sdp_conn_struct_t *conn, int cmd, int32_t *value,
113     struct cred *cr);
114 
115 
116 /* Flags for sdp_create() */
117 #define	SDP_CAN_BLOCK			0x01
118 
119 #define	SDP_READ 0x01
120 #define	SDP_XMIT 0x02
121 
122 #endif /* _KERNEL */
123 
124 #define	SDP_NODELAY 0x01
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif /* _INET_SDP_ITF_H */
131