xref: /freebsd/include/rpcsvc/sm_inter.x (revision fed1ca4b719c56c930f2259d80663cd34be812bb)
1 /* @(#)sm_inter.x	2.2 88/08/01 4.0 RPCSRC */
2 /* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */
3 
4 /*-
5  * Copyright (c) 2010, Oracle America, Inc.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above
14  *       copyright notice, this list of conditions and the following
15  *       disclaimer in the documentation and/or other materials
16  *       provided with the distribution.
17  *     * Neither the name of the "Oracle America, Inc." nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
26  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * Status monitor protocol specification
37  * Copyright (C) 1986 Sun Microsystems, Inc.
38  *
39  */
40 
41 #ifndef RPC_HDR
42 %#include <sys/cdefs.h>
43 %__FBSDID("$FreeBSD$");
44 #endif
45 
46 program SM_PROG {
47 	version SM_VERS  {
48 		/* res_stat = stat_succ if status monitor agrees to monitor */
49 		/* res_stat = stat_fail if status monitor cannot monitor */
50 		/* if res_stat == stat_succ, state = state number of site sm_name */
51 		struct sm_stat_res			 SM_STAT(struct sm_name) = 1;
52 
53 		/* res_stat = stat_succ if status monitor agrees to monitor */
54 		/* res_stat = stat_fail if status monitor cannot monitor */
55 		/* stat consists of state number of local site */
56 		struct sm_stat_res			 SM_MON(struct mon) = 2;
57 
58 		/* stat consists of state number of local site */
59 		struct sm_stat				 SM_UNMON(struct mon_id) = 3;
60 
61 		/* stat consists of state number of local site */
62 		struct sm_stat				 SM_UNMON_ALL(struct my_id) = 4;
63 
64 		void					 SM_SIMU_CRASH(void) = 5;
65 		void					 SM_NOTIFY(struct stat_chge) = 6;
66 
67 	} = 1;
68 } = 100024;
69 
70 const	SM_MAXSTRLEN = 1024;
71 
72 struct sm_name {
73 	string mon_name<SM_MAXSTRLEN>;
74 };
75 
76 struct my_id {
77 	string	 my_name<SM_MAXSTRLEN>;		/* name of the site iniates the monitoring request*/
78 	int	my_prog;			/* rpc program # of the requesting process */
79 	int	my_vers;			/* rpc version # of the requesting process */
80 	int	my_proc;			/* rpc procedure # of the requesting process */
81 };
82 
83 struct mon_id {
84 	string	mon_name<SM_MAXSTRLEN>;		/* name of the site to be monitored */
85 	struct my_id my_id;
86 };
87 
88 
89 struct mon{
90 	struct mon_id mon_id;
91 	opaque priv[16]; 		/* private information to store at monitor for requesting process */
92 };
93 
94 struct stat_chge {
95 	string  mon_name<SM_MAXSTRLEN>;         /* name of the site that had the state change */
96 	int state;
97 };
98 
99 /*
100  * state # of status monitor monitonically increases each time
101  * status of the site changes:
102  * an even number (>= 0) indicates the site is down and
103  * an odd number (> 0) indicates the site is up;
104  */
105 struct sm_stat {
106 	int state;		/* state # of status monitor */
107 };
108 
109 enum sm_res {
110 	stat_succ = 0,		/* status monitor agrees to monitor */
111 	stat_fail = 1		/* status monitor cannot monitor */
112 };
113 
114 struct sm_stat_res {
115 	sm_res res_stat;
116 	int state;
117 };
118 
119 /*
120  * structure of the status message sent back by the status monitor
121  * when monitor site status changes
122  */
123 struct sm_status {
124 	string mon_name<SM_MAXSTRLEN>;
125 	int state;
126 	opaque priv[16];		/* stored private information */
127 };
128