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
38program SM_PROG {
39 version SM_VERS {
40 /* res_stat = stat_succ if status monitor agrees to monitor */
41 /* res_stat = stat_fail if status monitor cannot monitor */
42 /* if res_stat == stat_succ, state = state number of site sm_name */
43 struct sm_stat_res SM_STAT(struct sm_name) = 1;
44
45 /* res_stat = stat_succ if status monitor agrees to monitor */
46 /* res_stat = stat_fail if status monitor cannot monitor */
47 /* stat consists of state number of local site */
48 struct sm_stat_res SM_MON(struct mon) = 2;
49
50 /* stat consists of state number of local site */
51 struct sm_stat SM_UNMON(struct mon_id) = 3;
52
53 /* stat consists of state number of local site */
54 struct sm_stat SM_UNMON_ALL(struct my_id) = 4;
55
56 void SM_SIMU_CRASH(void) = 5;
57 void SM_NOTIFY(struct stat_chge) = 6;
58
59 } = 1;
60} = 100024;
61
62const SM_MAXSTRLEN = 1024;
63
64struct sm_name {
65 string mon_name<SM_MAXSTRLEN>;
66};
67
68struct my_id {
69 string my_name<SM_MAXSTRLEN>; /* name of the site iniates the monitoring request*/
70 int my_prog; /* rpc program # of the requesting process */
71 int my_vers; /* rpc version # of the requesting process */
72 int my_proc; /* rpc procedure # of the requesting process */
73};
74
75struct mon_id {
76 string mon_name<SM_MAXSTRLEN>; /* name of the site to be monitored */
77 struct my_id my_id;
78};
79
80
81struct mon{
82 struct mon_id mon_id;
83 opaque priv[16]; /* private information to store at monitor for requesting process */
84};
85
86struct stat_chge {
87 string mon_name<SM_MAXSTRLEN>; /* name of the site that had the state change */
88 int state;
89};
90
91/*
92 * state # of status monitor monitonically increases each time
93 * status of the site changes:
94 * an even number (>= 0) indicates the site is down and
95 * an odd number (> 0) indicates the site is up;
96 */
97struct sm_stat {
98 int state; /* state # of status monitor */
99};
100
101enum sm_res {
102 stat_succ = 0, /* status monitor agrees to monitor */
103 stat_fail = 1 /* status monitor cannot monitor */
104};
105
106struct sm_stat_res {
107 sm_res res_stat;
108 int state;
109};
110
111/*
112 * structure of the status message sent back by the status monitor
113 * when monitor site status changes
114 */
115struct sm_status {
116 string mon_name<SM_MAXSTRLEN>;
117 int state;
118 opaque priv[16]; /* stored private information */
119};