xref: /illumos-gate/usr/src/uts/common/sys/ib/clients/rdsv3/info.h (revision b1d7ec75953cd517f5b7c3d9cb427ff8ec5d7d07)
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _RDSV3_INFO_H
26 #define	_RDSV3_INFO_H
27 
28 struct rdsv3_info_iterator {
29 	char *addr;
30 	unsigned long offset;
31 };
32 
33 struct rdsv3_info_lengths {
34 	unsigned int	nr;
35 	unsigned int	each;
36 };
37 
38 struct rdsv3_sock;
39 
40 /*
41  * These functions must fill in the fields of @lens to reflect the size
42  * of the available info source.  If the snapshot fits in @len then it
43  * should be copied using @iter.  The caller will deduce if it was copied
44  * or not by comparing the lengths.
45  */
46 typedef void (*rdsv3_info_func)(struct rsock *sock, unsigned int len,
47     struct rdsv3_info_iterator *iter,
48     struct rdsv3_info_lengths *lens);
49 
50 #define	rdsv3_info_copy(iter, data, bytes)			\
51 	bcopy(data, iter->addr + iter->offset, bytes);		\
52 	iter->offset += bytes
53 
54 void rdsv3_info_register_func(int optname, rdsv3_info_func func);
55 void rdsv3_info_deregister_func(int optname, rdsv3_info_func func);
56 int rdsv3_info_getsockopt(struct rsock *sock, int optname, char *optval,
57     socklen_t *optlen);
58 
59 #endif /* _RDSV3_INFO_H */
60