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