| 1 | /* |
| 2 | Copyright (c) 2014, Ronnie Sahlberg |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | |
| 8 | 1. Redistributions of source code must retain the above copyright notice, this |
| 9 | list of conditions and the following disclaimer. |
| 10 | 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | this list of conditions and the following disclaimer in the documentation |
| 12 | and/or other materials provided with the distribution. |
| 13 | |
| 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | |
| 25 | The views and conclusions contained in the software and documentation are those |
| 26 | of the authors and should not be interpreted as representing official policies, |
| 27 | either expressed or implied, of the FreeBSD Project. |
| 28 | */ |
| 29 | |
| 30 | /* |
| 31 | * This defines the maximum length of the string |
| 32 | * identifying the caller. |
| 33 | */ |
| 34 | const NSM_MAXSTRLEN = 1024; |
| 35 | |
| 36 | enum nsmstat1 { |
| 37 | NSM_STAT_SUCC = 0, /* NSM agrees to monitor. */ |
| 38 | NSM_STAT_FAIL = 1 /* NSM cannot monitor. */ |
| 39 | }; |
| 40 | |
| 41 | struct nsm_my_id { |
| 42 | string my_name<NSM_MAXSTRLEN>; /* hostname */ |
| 43 | int my_prog; /* RPC program number */ |
| 44 | int my_vers; /* program version number */ |
| 45 | int my_proc; /* procedure number */ |
| 46 | }; |
| 47 | |
| 48 | struct nsm_mon_id { |
| 49 | string mon_name<NSM_MAXSTRLEN>; /* name of the host to be monitored */ |
| 50 | struct nsm_my_id my_id; |
| 51 | }; |
| 52 | |
| 53 | struct NSM1_STATres { |
| 54 | nsmstat1 res; |
| 55 | int state; |
| 56 | }; |
| 57 | |
| 58 | struct NSM1_STATargs { |
| 59 | string mon_name<NSM_MAXSTRLEN>; |
| 60 | }; |
| 61 | |
| 62 | struct NSM1_MONres { |
| 63 | nsmstat1 res; |
| 64 | int state; |
| 65 | }; |
| 66 | |
| 67 | struct NSM1_MONargs { |
| 68 | struct nsm_mon_id mon_id; |
| 69 | opaque priv[16]; /* private information */ |
| 70 | }; |
| 71 | |
| 72 | struct NSM1_UNMONres { |
| 73 | int state; /* state number of NSM */ |
| 74 | }; |
| 75 | |
| 76 | struct NSM1_UNMONargs { |
| 77 | struct nsm_mon_id mon_id; |
| 78 | }; |
| 79 | |
| 80 | struct NSM1_UNMONALLres { |
| 81 | int state; /* state number of NSM */ |
| 82 | }; |
| 83 | |
| 84 | struct NSM1_UNMONALLargs { |
| 85 | struct nsm_my_id my_id; |
| 86 | }; |
| 87 | |
| 88 | struct NSM1_NOTIFYargs { |
| 89 | string mon_name<NSM_MAXSTRLEN>; |
| 90 | int state; |
| 91 | }; |
| 92 | |
| 93 | /* |
| 94 | * Protocol description for the NSM program. |
| 95 | */ |
| 96 | program NSM_PROGRAM { |
| 97 | version NSM_V1 { |
| 98 | void NSM1_NULL(void) = 0; |
| 99 | struct NSM1_STATres NSM1_STAT(struct NSM1_STATargs) = 1; |
| 100 | struct NSM1_MONres NSM1_MON(struct NSM1_MONargs) = 2; |
| 101 | struct NSM1_UNMONres NSM1_UNMON(struct NSM1_UNMONargs) = 3; |
| 102 | struct NSM1_UNMONALLres NSM1_UNMON_ALL(struct NSM1_UNMONALLargs) = 4; |
| 103 | void NSM1_SIMU_CRASH(void) = 5; |
| 104 | void NSM1_NOTIFY(struct NSM1_NOTIFYargs) = 6; |
| 105 | } = 1; |
| 106 | } = 100024; |
| 107 | |
| 108 | |