xref: /onnv-gate/usr/src/uts/common/avs/ncall/ncall.h (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM /*
22*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
24*7836SJohn.Forte@Sun.COM  */
25*7836SJohn.Forte@Sun.COM 
26*7836SJohn.Forte@Sun.COM #ifndef	_NCALL_H
27*7836SJohn.Forte@Sun.COM #define	_NCALL_H
28*7836SJohn.Forte@Sun.COM 
29*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
30*7836SJohn.Forte@Sun.COM extern "C" {
31*7836SJohn.Forte@Sun.COM #endif
32*7836SJohn.Forte@Sun.COM 
33*7836SJohn.Forte@Sun.COM #ifndef DS_DDICT
34*7836SJohn.Forte@Sun.COM #include <sys/time.h>
35*7836SJohn.Forte@Sun.COM #endif
36*7836SJohn.Forte@Sun.COM 
37*7836SJohn.Forte@Sun.COM #ifdef _KERNEL
38*7836SJohn.Forte@Sun.COM 
39*7836SJohn.Forte@Sun.COM /*
40*7836SJohn.Forte@Sun.COM  * ncall_t is opaque RPC pointer
41*7836SJohn.Forte@Sun.COM  */
42*7836SJohn.Forte@Sun.COM typedef	struct ncall_s {
43*7836SJohn.Forte@Sun.COM 	int	opaque;
44*7836SJohn.Forte@Sun.COM } ncall_t;
45*7836SJohn.Forte@Sun.COM 
46*7836SJohn.Forte@Sun.COM #define	NCALL_DATA_SZ	8192	/* ncall_put/get_data max size */
47*7836SJohn.Forte@Sun.COM #define	NCALL_BROADCAST_ID	(-2) /* magic broadcast nodeid */
48*7836SJohn.Forte@Sun.COM /*
49*7836SJohn.Forte@Sun.COM  * ncall send flags
50*7836SJohn.Forte@Sun.COM  */
51*7836SJohn.Forte@Sun.COM #define	NCALL_PEND	1	/* disconnect immediately */
52*7836SJohn.Forte@Sun.COM #define	NCALL_UNUSED	2	/* unused */
53*7836SJohn.Forte@Sun.COM #define	NCALL_ASYNC	4	/* asynchronous	send (ncall_free implied) */
54*7836SJohn.Forte@Sun.COM #define	NCALL_RDATA	8	/* allocate a buffer to receive data in */
55*7836SJohn.Forte@Sun.COM 
56*7836SJohn.Forte@Sun.COM extern void ncall_register_svc(int, void (*)(ncall_t *, int *));
57*7836SJohn.Forte@Sun.COM extern void ncall_unregister_svc(int);
58*7836SJohn.Forte@Sun.COM 
59*7836SJohn.Forte@Sun.COM extern int  ncall_nodeid(char *);
60*7836SJohn.Forte@Sun.COM extern char *ncall_nodename(int);
61*7836SJohn.Forte@Sun.COM extern int  ncall_mirror(int);
62*7836SJohn.Forte@Sun.COM extern int  ncall_self(void);
63*7836SJohn.Forte@Sun.COM 
64*7836SJohn.Forte@Sun.COM extern int  ncall_alloc(int, int, int, ncall_t **);
65*7836SJohn.Forte@Sun.COM extern int  ncall_timedsend(ncall_t *, int, int, struct timeval *, ...);
66*7836SJohn.Forte@Sun.COM extern int  ncall_timedsendnotify(ncall_t *, int, int, struct timeval *,
67*7836SJohn.Forte@Sun.COM     void (*)(ncall_t *, void *), void *, ...);
68*7836SJohn.Forte@Sun.COM extern int  ncall_broadcast(ncall_t *, int, int, struct timeval *, ...);
69*7836SJohn.Forte@Sun.COM extern int  ncall_send(ncall_t *, int, int, ...);
70*7836SJohn.Forte@Sun.COM extern int  ncall_read_reply(ncall_t *, int, ...);
71*7836SJohn.Forte@Sun.COM extern void ncall_reset(ncall_t *);
72*7836SJohn.Forte@Sun.COM extern void ncall_free(ncall_t *);
73*7836SJohn.Forte@Sun.COM 
74*7836SJohn.Forte@Sun.COM extern int  ncall_put_data(ncall_t *, void *, int);
75*7836SJohn.Forte@Sun.COM extern int  ncall_get_data(ncall_t *, void *, int);
76*7836SJohn.Forte@Sun.COM 
77*7836SJohn.Forte@Sun.COM extern int  ncall_sender(ncall_t *);
78*7836SJohn.Forte@Sun.COM extern void ncall_reply(ncall_t *, ...);
79*7836SJohn.Forte@Sun.COM extern void ncall_pend(ncall_t	*);
80*7836SJohn.Forte@Sun.COM extern void ncall_done(ncall_t	*);
81*7836SJohn.Forte@Sun.COM extern int ncall_ping(char *, int *);
82*7836SJohn.Forte@Sun.COM extern int ncall_maxnodes(void);
83*7836SJohn.Forte@Sun.COM extern int ncall_nextnode(void **);
84*7836SJohn.Forte@Sun.COM extern int ncall_errcode(ncall_t *, int *);
85*7836SJohn.Forte@Sun.COM 
86*7836SJohn.Forte@Sun.COM #endif /* _KERNEL */
87*7836SJohn.Forte@Sun.COM 
88*7836SJohn.Forte@Sun.COM #define	NCALLNMLN	257
89*7836SJohn.Forte@Sun.COM 
90*7836SJohn.Forte@Sun.COM /*
91*7836SJohn.Forte@Sun.COM  * Basic node info
92*7836SJohn.Forte@Sun.COM  */
93*7836SJohn.Forte@Sun.COM typedef struct ncall_node_s {
94*7836SJohn.Forte@Sun.COM 	char nc_nodename[NCALLNMLN];	/* Nodename */
95*7836SJohn.Forte@Sun.COM 	int nc_nodeid;			/* Nodeid */
96*7836SJohn.Forte@Sun.COM } ncall_node_t;
97*7836SJohn.Forte@Sun.COM 
98*7836SJohn.Forte@Sun.COM 
99*7836SJohn.Forte@Sun.COM #define	_NCIOC_(x)	(('N'<<16)|('C'<<8)|(x))
100*7836SJohn.Forte@Sun.COM 
101*7836SJohn.Forte@Sun.COM #define	NC_IOC_GETNODE	_NCIOC_(0)	/* return this node */
102*7836SJohn.Forte@Sun.COM #define	NC_IOC_START	_NCIOC_(1)	/* ncall core and stubs start */
103*7836SJohn.Forte@Sun.COM #define	NC_IOC_STOP	_NCIOC_(2)	/* ncall stop */
104*7836SJohn.Forte@Sun.COM #define	NC_IOC_GETNETNODES	_NCIOC_(3)	/* ncalladm -i */
105*7836SJohn.Forte@Sun.COM #define	NC_IOC_PING	_NCIOC_(4)	/* ncalladm -p */
106*7836SJohn.Forte@Sun.COM /*
107*7836SJohn.Forte@Sun.COM  * _NCIOC_(5) to _NCIOC_(20) are reserved for the implementation module
108*7836SJohn.Forte@Sun.COM  */
109*7836SJohn.Forte@Sun.COM 
110*7836SJohn.Forte@Sun.COM #define	NCALL_NSC	100	/* 100 - 109 */
111*7836SJohn.Forte@Sun.COM #define	NCALL_UNUSED1	110	/* 110 - 119 */
112*7836SJohn.Forte@Sun.COM #define	NCALL_UNUSED2	120	/* 120 - 129 */
113*7836SJohn.Forte@Sun.COM #define	NCALL_SDBC	130	/* 130 - 149 */
114*7836SJohn.Forte@Sun.COM #define	NCALL_STE	150	/* 150 - 159 */
115*7836SJohn.Forte@Sun.COM #define	NCALL_HM	160	/* 160 - 169 */
116*7836SJohn.Forte@Sun.COM 
117*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
118*7836SJohn.Forte@Sun.COM }
119*7836SJohn.Forte@Sun.COM #endif
120*7836SJohn.Forte@Sun.COM 
121*7836SJohn.Forte@Sun.COM #endif	/* _NCALL_H */
122