rsalz@bbn.com (Rich Salz) (03/04/88)
Submitted-by: Stephen X. Nahm <sxn@Sun.COM> Posting-number: Volume 13, Issue 86 Archive-name: rpc3.9/part09 #! /bin/sh # This is a shell archive. To extract, remove the header and type "sh filename" # cd rpcsvc cat > rstat.x <<'Funky_Stuff' /* @(#)rstat.x 1.2 87/11/12 3.9 RPCSRC */ /* @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Gather statistics on remote machines */ const CPUSTATES = 4; const DK_NDRIVE = 4; /* * GMT since 0:00, January 1, 1970 */ struct rstat_timeval { unsigned int tv_sec; /* seconds */ unsigned int tv_usec; /* and microseconds */ }; struct statstime { /* RSTATVERS_TIME */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; unsigned int v_swtch; int avenrun[3]; rstat_timeval boottime; rstat_timeval curtime; int if_opackets; }; struct statsswtch { /* RSTATVERS_SWTCH */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; unsigned int v_swtch; unsigned int avenrun[3]; rstat_timeval boottime; int if_opackets; }; struct stats { /* RSTATVERS_ORIG */ int cp_time[CPUSTATES]; int dk_xfer[DK_NDRIVE]; unsigned int v_pgpgin; /* these are cumulative sum */ unsigned int v_pgpgout; unsigned int v_pswpin; unsigned int v_pswpout; unsigned int v_intr; int if_ipackets; int if_ierrors; int if_oerrors; int if_collisions; int if_opackets; }; program RSTATPROG { /* * Newest version includes current time and context switching info */ version RSTATVERS_TIME { statstime RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 3; /* * Does not have current time */ version RSTATVERS_SWTCH { statsswtch RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 2; /* * Old version has no info about current time or context switching */ version RSTATVERS_ORIG { stats RSTATPROC_STATS(void) = 1; unsigned int RSTATPROC_HAVEDISK(void) = 2; } = 1; } = 100001; Funky_Stuff len=`wc -c < rstat.x` if [ $len != 3375 ] ; then echo error: rstat.x was $len bytes long, should have been 3375 fi echo x - rstat_proc.c cat > rstat_proc.c <<'Funky_Stuff' /* @(#)rstat_proc.c 1.2 87/11/24 3.9 RPCSRC */ #ifndef lint static char sccsid[] = "@(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro"; #endif /* * Copyright (c) 1984 by Sun Microsystems, Inc. */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * rstat service: built with rstat.x and derived from rpc.rstatd.c */ #include <signal.h> #include <stdio.h> #include <rpc/rpc.h> #include <sys/socket.h> #include <nlist.h> #include <sys/dk.h> #include <sys/errno.h> #include <sys/vmmeter.h> #include <net/if.h> #include <sys/time.h> #include "rstat.h" struct nlist nl[] = { #define X_CPTIME 0 { "_cp_time" }, #define X_SUM 1 { "_sum" }, #define X_IFNET 2 { "_ifnet" }, #define X_DKXFER 3 { "_dk_xfer" }, #define X_BOOTTIME 4 { "_boottime" }, #define X_AVENRUN 5 { "_avenrun" }, #define X_HZ 6 { "_hz" }, "", }; int kmem; int firstifnet, numintfs; /* chain of ethernet interfaces */ int stats_service(); /* * Define EXIT_WHEN_IDLE if you are able to have this program invoked * automatically on demand (as from inetd). When defined, the service * will terminated after being idle for 20 seconds. */ int sincelastreq = 0; /* number of alarms since last request */ #ifdef EXIT_WHEN_IDLE #define CLOSEDOWN 20 /* how long to wait before exiting */ #endif /* def EXIT_WHEN_IDLE */ union { struct stats s1; struct statsswtch s2; struct statstime s3; } stats_all; int updatestat(); static stat_is_init = 0; extern int errno; #ifndef FSCALE #define FSCALE (1 << 8) #endif stat_init() { stat_is_init = 1; setup(); updatestat(); alarm(1); signal(SIGALRM, updatestat); sleep(1); /* allow for one wake-up */ } statstime * rstatproc_stats_3() { if (! stat_is_init) stat_init(); sincelastreq = 0; return(&stats_all.s3); } statsswtch * rstatproc_stats_2() { if (! stat_is_init) stat_init(); sincelastreq = 0; return(&stats_all.s2); } stats * rstatproc_stats_1() { if (! stat_is_init) stat_init(); sincelastreq = 0; return(&stats_all.s1); } u_int * rstatproc_havedisk_3() { static u_int have; if (! stat_is_init) stat_init(); sincelastreq = 0; have = havedisk(); return(&have); } u_int * rstatproc_havedisk_2() { return(rstatproc_havedisk_3()); } u_int * rstatproc_havedisk_1() { return(rstatproc_havedisk_3()); } updatestat() { int off, i, hz; struct vmmeter sum; struct ifnet ifnet; double avrun[3]; struct timeval tm, btm; #ifdef DEBUG fprintf(stderr, "entering updatestat\n"); #endif #ifdef EXIT_WHEN_IDLE if (sincelastreq >= CLOSEDOWN) { #ifdef DEBUG fprintf(stderr, "about to closedown\n"); #endif exit(0); } sincelastreq++; #endif /* def EXIT_WHEN_IDLE */ if (lseek(kmem, (long)nl[X_HZ].n_value, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&hz, sizeof hz) != sizeof hz) { fprintf(stderr, "rstat: can't read hz from kmem\n"); exit(1); } if (lseek(kmem, (long)nl[X_CPTIME].n_value, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)stats_all.s1.cp_time, sizeof (stats_all.s1.cp_time)) != sizeof (stats_all.s1.cp_time)) { fprintf(stderr, "rstat: can't read cp_time from kmem\n"); exit(1); } if (lseek(kmem, (long)nl[X_AVENRUN].n_value, 0) ==-1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } #ifdef vax if (read(kmem, (char *)avrun, sizeof (avrun)) != sizeof (avrun)) { fprintf(stderr, "rstat: can't read avenrun from kmem\n"); exit(1); } stats_all.s2.avenrun[0] = avrun[0] * FSCALE; stats_all.s2.avenrun[1] = avrun[1] * FSCALE; stats_all.s2.avenrun[2] = avrun[2] * FSCALE; #endif if (lseek(kmem, (long)nl[X_BOOTTIME].n_value, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&btm, sizeof (stats_all.s2.boottime)) != sizeof (stats_all.s2.boottime)) { fprintf(stderr, "rstat: can't read boottime from kmem\n"); exit(1); } stats_all.s2.boottime.tv_sec = btm.tv_sec; stats_all.s2.boottime.tv_usec = btm.tv_usec; #ifdef DEBUG fprintf(stderr, "%d %d %d %d\n", stats_all.s1.cp_time[0], stats_all.s1.cp_time[1], stats_all.s1.cp_time[2], stats_all.s1.cp_time[3]); #endif if (lseek(kmem, (long)nl[X_SUM].n_value, 0) ==-1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&sum, sizeof sum) != sizeof sum) { fprintf(stderr, "rstat: can't read sum from kmem\n"); exit(1); } stats_all.s1.v_pgpgin = sum.v_pgpgin; stats_all.s1.v_pgpgout = sum.v_pgpgout; stats_all.s1.v_pswpin = sum.v_pswpin; stats_all.s1.v_pswpout = sum.v_pswpout; stats_all.s1.v_intr = sum.v_intr; gettimeofday(&tm, (struct timezone *) 0); stats_all.s1.v_intr -= hz*(tm.tv_sec - btm.tv_sec) + hz*(tm.tv_usec - btm.tv_usec)/1000000; stats_all.s2.v_swtch = sum.v_swtch; if (lseek(kmem, (long)nl[X_DKXFER].n_value, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)stats_all.s1.dk_xfer, sizeof (stats_all.s1.dk_xfer)) != sizeof (stats_all.s1.dk_xfer)) { fprintf(stderr, "rstat: can't read dk_xfer from kmem\n"); exit(1); } stats_all.s1.if_ipackets = 0; stats_all.s1.if_opackets = 0; stats_all.s1.if_ierrors = 0; stats_all.s1.if_oerrors = 0; stats_all.s1.if_collisions = 0; for (off = firstifnet, i = 0; off && i < numintfs; i++) { if (lseek(kmem, (long)off, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&ifnet, sizeof ifnet) != sizeof ifnet) { fprintf(stderr, "rstat: can't read ifnet from kmem\n"); exit(1); } stats_all.s1.if_ipackets += ifnet.if_ipackets; stats_all.s1.if_opackets += ifnet.if_opackets; stats_all.s1.if_ierrors += ifnet.if_ierrors; stats_all.s1.if_oerrors += ifnet.if_oerrors; stats_all.s1.if_collisions += ifnet.if_collisions; off = (int) ifnet.if_next; } gettimeofday((struct timeval *)&stats_all.s3.curtime, (struct timezone *) 0); alarm(1); } static setup() { struct ifnet ifnet; int off; nlist("/vmunix", nl); if (nl[0].n_value == 0) { fprintf(stderr, "rstat: Variables missing from namelist\n"); exit (1); } if ((kmem = open("/dev/kmem", 0)) < 0) { fprintf(stderr, "rstat: can't open kmem\n"); exit(1); } off = nl[X_IFNET].n_value; if (lseek(kmem, (long)off, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&firstifnet, sizeof(int)) != sizeof (int)) { fprintf(stderr, "rstat: can't read firstifnet from kmem\n"); exit(1); } numintfs = 0; for (off = firstifnet; off;) { if (lseek(kmem, (long)off, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)&ifnet, sizeof ifnet) != sizeof ifnet) { fprintf(stderr, "rstat: can't read ifnet from kmem\n"); exit(1); } numintfs++; off = (int) ifnet.if_next; } } /* * returns true if have a disk */ static havedisk() { int i, cnt; long xfer[DK_NDRIVE]; nlist("/vmunix", nl); if (nl[X_DKXFER].n_value == 0) { fprintf(stderr, "rstat: Variables missing from namelist\n"); exit (1); } if ((kmem = open("/dev/kmem", 0)) < 0) { fprintf(stderr, "rstat: can't open kmem\n"); exit(1); } if (lseek(kmem, (long)nl[X_DKXFER].n_value, 0) == -1) { fprintf(stderr, "rstat: can't seek in kmem\n"); exit(1); } if (read(kmem, (char *)xfer, sizeof xfer)!= sizeof xfer) { fprintf(stderr, "rstat: can't read kmem\n"); exit(1); } cnt = 0; for (i=0; i < DK_NDRIVE; i++) cnt += xfer[i]; return (cnt != 0); } Funky_Stuff len=`wc -c < rstat_proc.c` if [ $len != 8813 ] ; then echo error: rstat_proc.c was $len bytes long, should have been 8813 fi echo x - sm_inter.x cat > sm_inter.x <<'Funky_Stuff' /* @(#)sm_inter.x 1.2 87/11/12 3.9 RPCSRC */ /* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */ /* * Status monitor protocol specification * Copyright (C) 1986 Sun Microsystems, Inc. * */ program SM_PROG { version SM_VERS { /* res_stat = stat_succ if status monitor agrees to monitor */ /* res_stat = stat_fail if status monitor cannot monitor */ /* if res_stat == stat_succ, state = state number of site sm_name */ struct sm_stat_res SM_STAT(struct sm_name) = 1; /* res_stat = stat_succ if status monitor agrees to monitor */ /* res_stat = stat_fail if status monitor cannot monitor */ /* stat consists of state number of local site */ struct sm_stat_res SM_MON(struct mon) = 2; /* stat consists of state number of local site */ struct sm_stat SM_UNMON(struct mon_id) = 3; /* stat consists of state number of local site */ struct sm_stat SM_UNMON_ALL(struct my_id) = 4; void SM_SIMU_CRASH(void) = 5; } = 1; } = 100024; const SM_MAXSTRLEN = 1024; struct sm_name { string mon_name<SM_MAXSTRLEN>; }; struct my_id { string my_name<SM_MAXSTRLEN>; /* name of the site iniates the monitoring request*/ int my_prog; /* rpc program # of the requesting process */ int my_vers; /* rpc version # of the requesting process */ int my_proc; /* rpc procedure # of the requesting process */ }; struct mon_id { string mon_name<SM_MAXSTRLEN>; /* name of the site to be monitored */ struct my_id my_id; }; struct mon{ struct mon_id mon_id; opaque priv[16]; /* private information to store at monitor for requesting process */ }; /* * state # of status monitor monitonically increases each time * status of the site changes: * an even number (>= 0) indicates the site is down and * an odd number (> 0) indicates the site is up; */ struct sm_stat { int state; /* state # of status monitor */ }; enum res { stat_succ = 0, /* status monitor agrees to monitor */ stat_fail = 1 /* status monitor cannot monitor */ }; struct sm_stat_res { res res_stat; int state; }; /* * structure of the status message sent back by the status monitor * when monitor site status changes */ struct status { string mon_name<SM_MAXSTRLEN>; int state; opaque priv[16]; /* stored private information */ }; Funky_Stuff len=`wc -c < sm_inter.x` if [ $len != 2276 ] ; then echo error: sm_inter.x was $len bytes long, should have been 2276 fi echo x - spray.x cat > spray.x <<'Funky_Stuff' /* @(#)spray.x 1.2 87/11/12 3.9 RPCSRC */ /* @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Spray a server with packets * Useful for testing flakiness of network interfaces */ const SPRAYMAX = 8845; /* max amount can spray */ /* * GMT since 0:00, 1 January 1970 */ struct spraytimeval { unsigned int sec; unsigned int usec; }; /* * spray statistics */ struct spraycumul { unsigned int counter; spraytimeval clock; }; /* * spray data */ typedef opaque sprayarr<SPRAYMAX>; program SPRAYPROG { version SPRAYVERS { /* * Just throw away the data and increment the counter * This call never returns, so the client should always * time it out. */ void SPRAYPROC_SPRAY(sprayarr) = 1; /* * Get the value of the counter and elapsed time since * last CLEAR. */ spraycumul SPRAYPROC_GET(void) = 2; /* * Clear the counter and reset the elapsed time */ void SPRAYPROC_CLEAR(void) = 3; } = 1; } = 100012; Funky_Stuff len=`wc -c < spray.x` if [ $len != 2238 ] ; then echo error: spray.x was $len bytes long, should have been 2238 fi echo x - yp.x cat > yp.x <<'Funky_Stuff' /* @(#)yp.x 1.2 87/11/12 3.9 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * Protocol description file for the Yellow Pages Service */ const YPMAXRECORD = 1024; const YPMAXDOMAIN = 64; const YPMAXMAP = 64; const YPMAXPEER = 64; enum ypstat { YP_TRUE = 1, YP_NOMORE = 2, YP_FALSE = 0, YP_NOMAP = -1, YP_NODOM = -2, YP_NOKEY = -3, YP_BADOP = -4, YP_BADDB = -5, YP_YPERR = -6, YP_BADARGS = -7, YP_VERS = -8 }; enum ypxfrstat { YPXFR_SUCC = 1, YPXFR_AGE = 2, YPXFR_NOMAP = -1, YPXFR_NODOM = -2, YPXFR_RSRC = -3, YPXFR_RPC = -4, YPXFR_MADDR = -5, YPXFR_YPERR = -6, YPXFR_BADARGS = -7, YPXFR_DBM = -8, YPXFR_FILE = -9, YPXFR_SKEW = -10, YPXFR_CLEAR = -11, YPXFR_FORCE = -12, YPXFR_XFRERR = -13, YPXFR_REFUSED = -14 }; typedef string domainname<YPMAXDOMAIN>; typedef string mapname<YPMAXMAP>; typedef string peername<YPMAXPEER>; typedef opaque keydat<YPMAXRECORD>; typedef opaque valdat<YPMAXRECORD>; struct ypmap_parms { domainname domain; mapname map; unsigned int ordernum; peername peer; }; struct ypreq_key { domainname domain; mapname map; keydat key; }; struct ypreq_nokey { domainname domain; mapname map; }; struct ypreq_xfr { ypmap_parms map_parms; unsigned int transid; unsigned int prog; unsigned int port; }; struct ypresp_val { ypstat stat; valdat val; }; struct ypresp_key_val { ypstat stat; keydat key; valdat val; }; struct ypresp_master { ypstat stat; peername peer; }; struct ypresp_order { ypstat stat; unsigned int ordernum; }; union ypresp_all switch (bool more) { case TRUE: ypresp_key_val val; case FALSE: void; }; struct ypresp_xfr { unsigned int transid; ypxfrstat xfrstat; }; struct ypmaplist { mapname map; ypmaplist *next; }; struct ypresp_maplist { ypstat stat; ypmaplist *maps; }; enum yppush_status { YPPUSH_SUCC = 1, /* Success */ YPPUSH_AGE = 2, /* Master's version not newer */ YPPUSH_NOMAP = -1, /* Can't find server for map */ YPPUSH_NODOM = -2, /* Domain not supported */ YPPUSH_RSRC = -3, /* Local resource alloc failure */ YPPUSH_RPC = -4, /* RPC failure talking to server */ YPPUSH_MADDR = -5, /* Can't get master address */ YPPUSH_YPERR = -6, /* YP server/map db error */ YPPUSH_BADARGS = -7, /* Request arguments bad */ YPPUSH_DBM = -8, /* Local dbm operation failed */ YPPUSH_FILE = -9, /* Local file I/O operation failed */ YPPUSH_SKEW = -10, /* Map version skew during transfer */ YPPUSH_CLEAR = -11, /* Can't send "Clear" req to local ypserv */ YPPUSH_FORCE = -12, /* No local order number in map use -f flag. */ YPPUSH_XFRERR = -13, /* ypxfr error */ YPPUSH_REFUSED = -14 /* Transfer request refused by ypserv */ }; struct yppushresp_xfr { unsigned transid; yppush_status status; }; /* * Response structure and overall result status codes. Success and failure * represent two separate response message types. */ enum ypbind_resptype { YPBIND_SUCC_VAL = 1, YPBIND_FAIL_VAL = 2 }; struct ypbind_binding { opaque ypbind_binding_addr[4]; /* In network order */ opaque ypbind_binding_port[2]; /* In network order */ }; union ypbind_resp switch (ypbind_resptype ypbind_status) { case YPBIND_FAIL_VAL: unsigned ypbind_error; case YPBIND_SUCC_VAL: ypbind_binding ypbind_bindinfo; }; /* Detailed failure reason codes for response field ypbind_error*/ const YPBIND_ERR_ERR = 1; /* Internal error */ const YPBIND_ERR_NOSERV = 2; /* No bound server for passed domain */ const YPBIND_ERR_RESC = 3; /* System resource allocation failure */ /* * Request data structure for ypbind "Set domain" procedure. */ struct ypbind_setdom { domainname ypsetdom_domain; ypbind_binding ypsetdom_binding; unsigned ypsetdom_vers; }; /* * YP access protocol */ program YPPROG { version YPVERS { void YPPROC_NULL(void) = 0; bool YPPROC_DOMAIN(domainname) = 1; bool YPPROC_DOMAIN_NONACK(domainname) = 2; ypresp_val YPPROC_MATCH(ypreq_key) = 3; ypresp_key_val YPPROC_FIRST(ypreq_key) = 4; ypresp_key_val YPPROC_NEXT(ypreq_key) = 5; ypresp_xfr YPPROC_XFR(ypreq_xfr) = 6; void YPPROC_CLEAR(void) = 7; ypresp_all YPPROC_ALL(ypreq_nokey) = 8; ypresp_master YPPROC_MASTER(ypreq_nokey) = 9; ypresp_order YPPROC_ORDER(ypreq_nokey) = 10; ypresp_maplist YPPROC_MAPLIST(domainname) = 11; } = 2; } = 100004; /* * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR */ program YPPUSH_XFRRESPPROG { version YPPUSH_XFRRESPVERS { void YPPUSHPROC_NULL(void) = 0; yppushresp_xfr YPPUSHPROC_XFRRESP(void) = 1; } = 1; } = 0x40000000; /* transient: could be anything up to 0x5fffffff */ /* * YP binding protocol */ program YPBINDPROG { version YPBINDVERS { void YPBINDPROC_NULL(void) = 0; ypbind_resp YPBINDPROC_DOMAIN(domainname) = 1; void YPBINDPROC_SETDOM(ypbind_setdom) = 2; } = 2; } = 100007; Funky_Stuff len=`wc -c < yp.x` if [ $len != 6130 ] ; then echo error: yp.x was $len bytes long, should have been 6130 fi echo x - yppasswd.x cat > yppasswd.x <<'Funky_Stuff' /* @(#)yppasswd.x 1.2 87/11/12 3.9 RPCSRC */ /* @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ /* * YP password update protocol * Requires unix authentication */ program YPPASSWDPROG { version YPPASSWDVERS { /* * Update my passwd entry */ int YPPASSWDPROC_UPDATE(yppasswd) = 1; } = 1; } = 100009; struct passwd { string pw_name<>; /* username */ string pw_passwd<>; /* encrypted password */ int pw_uid; /* user id */ int pw_gid; /* group id */ string pw_gecos<>; /* in real life name */ string pw_dir<>; /* home directory */ string pw_shell<>; /* default shell */ }; struct yppasswd { string oldpass<>; /* unencrypted old password */ passwd newpw; /* new passwd entry */ }; Funky_Stuff len=`wc -c < yppasswd.x` if [ $len != 1985 ] ; then echo error: yppasswd.x was $len bytes long, should have been 1985 fi cd .. echo done with directory rpcsvc exit -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.