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