]> git.decadent.org.uk Git - nfs-utils.git/blob - support/nsm/sm_inter.x
libexport.a: Refactor client_init()
[nfs-utils.git] / support / nsm / sm_inter.x
1 /*
2  * Copyright (C) 1986 Sun Microsystems, Inc.
3  * Modified by Jeffrey A. Uphoff, 1995, 1997-1999.
4  * Modified by Olaf Kirch, 1996.
5  * Modified by H.J. Lu, 1998.
6  *
7  * NSM for Linux.
8  */
9
10 /*
11  * Copyright (c) 2009, Sun Microsystems, Inc.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are met:
16  * - Redistributions of source code must retain the above copyright notice,
17  *   this list of conditions and the following disclaimer.
18  * - Redistributions in binary form must reproduce the above copyright notice,
19  *   this list of conditions and the following disclaimer in the documentation
20  *   and/or other materials provided with the distribution.
21  * - Neither the name of Sun Microsystems, Inc. nor the names of its
22  *   contributors may be used to endorse or promote products derived
23  *   from this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  */
37
38 /*
39  * Status monitor protocol specification
40  */
41
42 #ifdef RPC_CLNT
43 %#include <string.h>
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
66                 void                                     SM_NOTIFY(struct stat_chge) = 6;
67
68         } = 1;
69 } = 100024;
70
71 const   SM_MAXSTRLEN = 1024;
72 const   SM_PRIV_SIZE = 16;
73
74 struct sm_name {
75         string mon_name<SM_MAXSTRLEN>;
76 };
77
78 struct my_id {
79         string   my_name<SM_MAXSTRLEN>;         /* name of the site iniates the monitoring request*/
80         int     my_prog;                        /* rpc program # of the requesting process */
81         int     my_vers;                        /* rpc version # of the requesting process */
82         int     my_proc;                        /* rpc procedure # of the requesting process */
83 };
84
85 struct mon_id {
86         string  mon_name<SM_MAXSTRLEN>;         /* name of the site to be monitored */
87         struct my_id my_id;
88 };
89
90
91 struct mon {
92         struct mon_id mon_id;
93         opaque priv[SM_PRIV_SIZE];              /* private information to store at monitor for requesting process */
94 };
95
96 struct stat_chge {
97         string  mon_name<SM_MAXSTRLEN>;         /* name of the site that had the state change */
98         int     state;
99 };
100
101 /*
102  * state # of status monitor monitonically increases each time
103  * status of the site changes:
104  * an even number (>= 0) indicates the site is down and
105  * an odd number (> 0) indicates the site is up;
106  */
107 struct sm_stat {
108         int state;              /* state # of status monitor */
109 };
110
111 enum res {
112         stat_succ = 0,          /* status monitor agrees to monitor */
113         stat_fail = 1           /* status monitor cannot monitor */
114 };
115
116 struct sm_stat_res {
117         res res_stat;
118         int state;
119 };
120
121 /* 
122  * structure of the status message sent back by the status monitor
123  * when monitor site status changes
124  */
125 struct status {
126         string mon_name<SM_MAXSTRLEN>;
127         int state;
128         opaque priv[SM_PRIV_SIZE]; /* stored private information */
129 };
130
131 %#define SM_INTER_X