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