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