Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


sm_inter.x
001: /*
002:  * Status monitor protocol specification
003:  * Copyright (c) 2010, Oracle America, Inc.
004:  *
005:  * Redistribution and use in source and binary forms, with or without
006:  * modification, are permitted provided that the following conditions are
007:  * met:
008:  *
009:  *     * Redistributions of source code must retain the above copyright
010:  *       notice, this list of conditions and the following disclaimer.
011:  *     * Redistributions in binary form must reproduce the above
012:  *       copyright notice, this list of conditions and the following
013:  *       disclaimer in the documentation and/or other materials
014:  *       provided with the distribution.
015:  *     * Neither the name of the "Oracle America, Inc." nor the names of its
016:  *       contributors may be used to endorse or promote products derived
017:  *       from this software without specific prior written permission.
018:  *
019:  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
020:  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
021:  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
022:  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
023:  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
024:  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
025:  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
026:  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
027:  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028:  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
030:  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:  */
032: 
033: 
034: program SM_PROG {
035:         version SM_VERS  {
036:                 /* res_stat = stat_succ if status monitor agrees to monitor */
037:                 /* res_stat = stat_fail if status monitor cannot monitor */
038:                 /* if res_stat == stat_succ, state = state number of site sm_name */
039:                 struct sm_stat_res                       SM_STAT(struct sm_name) = 1;
040: 
041:                 /* res_stat = stat_succ if status monitor agrees to monitor */
042:                 /* res_stat = stat_fail if status monitor cannot monitor */
043:                 /* stat consists of state number of local site */
044:                 struct sm_stat_res                       SM_MON(struct mon) = 2;
045: 
046:                 /* stat consists of state number of local site */
047:                 struct sm_stat                           SM_UNMON(struct mon_id) = 3;
048: 
049:                 /* stat consists of state number of local site */
050:                 struct sm_stat                           SM_UNMON_ALL(struct my_id) = 4;
051: 
052:                 void                                     SM_SIMU_CRASH(void) = 5;
053: 
054:         } = 1;
055: } = 100024;
056: 
057: const   SM_MAXSTRLEN = 1024;
058: 
059: struct sm_name {
060:         string mon_name<SM_MAXSTRLEN>;
061: };
062: 
063: struct my_id {
064:         string   my_name<SM_MAXSTRLEN>;         /* name of the site initiating the monitoring request*/
065:         int     my_prog;                        /* rpc program # of the requesting process */
066:         int     my_vers;                        /* rpc version # of the requesting process */
067:         int     my_proc;                        /* rpc procedure # of the requesting process */
068: };
069: 
070: struct mon_id {
071:         string  mon_name<SM_MAXSTRLEN>;         /* name of the site to be monitored */
072:         struct my_id my_id;
073: };
074: 
075: 
076: struct mon{
077:         struct mon_id mon_id;
078:         opaque priv[16];                /* private information to store at monitor for requesting process */
079: };
080: 
081: 
082: /*
083:  * state # of status monitor monotonically increases each time
084:  * status of the site changes:
085:  * an even number (>= 0) indicates the site is down and
086:  * an odd number (> 0) indicates the site is up;
087:  */
088: struct sm_stat {
089:         int state;              /* state # of status monitor */
090: };
091: 
092: enum res {
093:         stat_succ = 0,          /* status monitor agrees to monitor */
094:         stat_fail = 1           /* status monitor cannot monitor */
095: };
096: 
097: struct sm_stat_res {
098:         res res_stat;
099:         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: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/