move include generation and rpc source files intp lib/librpcsvc

This commit is contained in:
cgd 1993-10-08 05:26:25 +00:00
parent 6a93cfbcbc
commit 8a4e4890b1
21 changed files with 2596 additions and 29 deletions

View File

@ -1,31 +1,5 @@
# from: @(#)Makefile 5.10 (Berkeley) 6/24/90
# $Id: Makefile,v 1.6 1993/08/01 05:40:01 mycroft Exp $
# $Id: Makefile,v 1.7 1993/10/08 05:26:25 cgd Exp $
.PATH: ${.CURDIR}/../../include/rpcsvc /usr/src/include/rpcsvc
SUBDIR= include lib
LIB= rpcsvc
RPCSRCS= klm_prot.x mount.x nfs_prot.x nlm_prot.x rex.x rnusers.x \
rquota.x rstat.x rwall.x sm_inter.x spray.x yppasswd.x
RPCCOM = rpcgen
INCDIRS= -I/usr/include/rpcsvc
CFLAGS+= ${INCDIRS}
SRCS= ${RPCSRCS:R:S/$/_xdr.c/g}
CLEANFILES+= ${SRCS} ${RPCSRCS}
NOMAN= noman
.include <bsd.lib.mk>
.SUFFIXES: .x _xdr.c
.x_xdr.c:
@echo generating $@...
@PWD=`pwd` ; cd ${.CURDIR} ; if cmp -s ${.IMPSRC} ${*F}.x > /dev/null; then :; else cp -f ${.IMPSRC} $$PWD/${*F}.x ; fi
@${RPCCOM} -c ${*F}.x -o ${.TARGET}
OBJS+= ${RPCSRCS:R:S/$/_xdr.o/g}
.include <bsd.subdir.mk>

View File

@ -0,0 +1,13 @@
# $Id: Makefile.dep,v 1.1 1993/10/08 05:26:27 cgd Exp $
RPCCOM= rpcgen
.SUFFIXES: .x .c .h
.x.c:
@echo generating $@...
@PWD=`pwd` ; cd ${RPCDIR} ; ${RPCCOM} -c $*.x -o $$PWD/$@
.x.h:
@echo generating $@...
@PWD=`pwd` ; cd ${RPCDIR} ; ${RPCCOM} -h $*.x -o $$PWD/$@

View File

@ -0,0 +1,9 @@
# $Id: Makefile.src,v 1.1 1993/10/08 05:26:28 cgd Exp $
RPCSRCS= bootparam_prot.x klm_prot.x mount.x nfs_prot.x nlm_prot.x \
rex.x rnusers.x rquota.x rstat.x rwall.x sm_inter.x spray.x \
yp.x yppasswd.x
RPCHDRS= yp_prot.h ypclnt.h
bootparam_prot.o: bootparam_prot.h
yp.o: yp.h

View File

@ -0,0 +1,32 @@
# $Id: Makefile,v 1.1 1993/10/08 05:26:31 cgd Exp $
RPCDIR= ${.CURDIR}/../src
.PATH: ${RPCDIR}
.include "${.CURDIR}/../Makefile.src"
HDRS= ${RPCSRCS:R:S/$/.h/g}
CLEANFILES+= ${HDRS}
all: ${HDRS}
NOMAN= noman
install:
install -d -o bin -g bin -m 755 ${DESTDIR}/usr/include/rpcsvc
@for i in $(HDRS); do \
echo install ${COPY} -o bin -g bin -m 444 $$i \
${DESTDIR}/usr/include/rpcsvc ; \
install ${COPY} -o bin -g bin -m 444 $$i \
${DESTDIR}/usr/include/rpcsvc ; \
done
@for i in $(RPCSRCS) $(RPCHDRS); do \
echo install -c -o bin -g bin -m 444 ${RPCDIR}/$$i \
${DESTDIR}/usr/include/rpcsvc ; \
install -c -o bin -g bin -m 444 ${RPCDIR}/$$i \
${DESTDIR}/usr/include/rpcsvc ; \
done
# new suffixes have to go afterwards, because bsd.lib.mk clears them
.include <bsd.prog.mk>
.include "${.CURDIR}/../Makefile.dep"

View File

@ -0,0 +1,19 @@
# $Id: Makefile,v 1.1 1993/10/08 05:26:38 cgd Exp $
RPCDIR= ${.CURDIR}/../src
.PATH: ${RPCDIR}
.include "${.CURDIR}/../Makefile.src"
LIB= rpcsvc
CFLAGS+= -I/usr/include/rpcsvc
SRCS= ${RPCSRCS:R:S/$/.c/g}
CLEANFILES+= ${SRCS}
NOMAN= noman
NOPIC=
# new suffixes have to go afterwards, because bsd.lib.mk clears them
.include <bsd.lib.mk>
.include "${.CURDIR}/../Makefile.dep"

View File

@ -0,0 +1,101 @@
/*
* 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
*/
/*
* RPC for bootparms service.
* There are two procedures:
* WHOAMI takes a net address and returns a client name and also a
* likely net address for routing
* GETFILE takes a client name and file identifier and returns the
* server name, server net address and pathname for the file.
* file identifiers typically include root, swap, pub and dump
*/
#ifdef RPC_HDR
%#include <rpc/types.h>
%#include <sys/time.h>
%#include <sys/errno.h>
%#include <nfs/nfsv2.h>
%#include <nfs/nfs.h>
#else
%#ifndef lint
%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: bootparam_prot.x,v 1.1 1993/10/08 05:26:47 cgd Exp $";
%#endif /* not lint */
#endif
const MAX_MACHINE_NAME = 255;
const MAX_PATH_LEN = 1024;
const MAX_FILEID = 32;
const IP_ADDR_TYPE = 1;
typedef string bp_machine_name_t<MAX_MACHINE_NAME>;
typedef string bp_path_t<MAX_PATH_LEN>;
typedef string bp_fileid_t<MAX_FILEID>;
struct ip_addr_t {
char net;
char host;
char lh;
char impno;
};
union bp_address switch (int address_type) {
case IP_ADDR_TYPE:
ip_addr_t ip_addr;
};
struct bp_whoami_arg {
bp_address client_address;
};
struct bp_whoami_res {
bp_machine_name_t client_name;
bp_machine_name_t domain_name;
bp_address router_address;
};
struct bp_getfile_arg {
bp_machine_name_t client_name;
bp_fileid_t file_id;
};
struct bp_getfile_res {
bp_machine_name_t server_name;
bp_address server_address;
bp_path_t server_path;
};
program BOOTPARAMPROG {
version BOOTPARAMVERS {
bp_whoami_res BOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;
bp_getfile_res BOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;
} = 1;
} = 100026;

View File

@ -0,0 +1,138 @@
/*
* 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
*/
/*
* Kernel/lock manager protocol definition
* Copyright (C) 1986 Sun Microsystems, Inc.
*
* protocol used between the UNIX kernel (the "client") and the
* local lock manager. The local lock manager is a deamon running
* above the kernel.
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: klm_prot.x,v 1.1 1993/10/08 05:26:51 cgd Exp $";
%#endif /* not lint */
#endif
const LM_MAXSTRLEN = 1024;
/*
* lock manager status returns
*/
enum klm_stats {
klm_granted = 0, /* lock is granted */
klm_denied = 1, /* lock is denied */
klm_denied_nolocks = 2, /* no lock entry available */
klm_working = 3 /* lock is being processed */
};
/*
* lock manager lock identifier
*/
struct klm_lock {
string server_name<LM_MAXSTRLEN>;
netobj fh; /* a counted file handle */
int pid; /* holder of the lock */
unsigned l_offset; /* beginning offset of the lock */
unsigned l_len; /* byte length of the lock;
* zero means through end of file */
};
/*
* lock holder identifier
*/
struct klm_holder {
bool exclusive; /* FALSE if shared lock */
int svid; /* holder of the lock (pid) */
unsigned l_offset; /* beginning offset of the lock */
unsigned l_len; /* byte length of the lock;
* zero means through end of file */
};
/*
* reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL
*/
struct klm_stat {
klm_stats stat;
};
/*
* reply to a KLM_TEST call
*/
union klm_testrply switch (klm_stats stat) {
case klm_denied:
struct klm_holder holder;
default: /* All other cases return no arguments */
void;
};
/*
* arguments to KLM_LOCK
*/
struct klm_lockargs {
bool block;
bool exclusive;
struct klm_lock alock;
};
/*
* arguments to KLM_TEST
*/
struct klm_testargs {
bool exclusive;
struct klm_lock alock;
};
/*
* arguments to KLM_UNLOCK
*/
struct klm_unlockargs {
struct klm_lock alock;
};
program KLM_PROG {
version KLM_VERS {
klm_testrply KLM_TEST (struct klm_testargs) = 1;
klm_stat KLM_LOCK (struct klm_lockargs) = 2;
klm_stat KLM_CANCEL (struct klm_lockargs) = 3;
/* klm_granted=> the cancel request fails due to lock is already granted */
/* klm_denied=> the cancel request successfully aborts
lock request */
klm_stat KLM_UNLOCK (struct klm_unlockargs) = 4;
} = 1;
} = 100020;

165
lib/librpcsvc/src/mount.x Normal file
View File

@ -0,0 +1,165 @@
/*
* 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 for the mount program
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: mount.x,v 1.1 1993/10/08 05:26:52 cgd Exp $";
%#endif /* not lint */
#endif
const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */
const MNTNAMLEN = 255; /* maximum bytes in a name argument */
const FHSIZE = 32; /* size in bytes of a file handle */
/*
* The fhandle is the file handle that the server passes to the client.
* All file operations are done using the file handles to refer to a file
* or a directory. The file handle can contain whatever information the
* server needs to distinguish an individual file.
*/
typedef opaque fhandle[FHSIZE];
/*
* If a status of zero is returned, the call completed successfully, and
* a file handle for the directory follows. A non-zero status indicates
* some sort of error. The status corresponds with UNIX error numbers.
*/
union fhstatus switch (unsigned fhs_status) {
case 0:
fhandle fhs_fhandle;
default:
void;
};
/*
* The type dirpath is the pathname of a directory
*/
typedef string dirpath<MNTPATHLEN>;
/*
* The type name is used for arbitrary names (hostnames, groupnames)
*/
typedef string name<MNTNAMLEN>;
/*
* A list of who has what mounted
*/
typedef struct mountbody *mountlist;
struct mountbody {
name ml_hostname;
dirpath ml_directory;
mountlist ml_next;
};
/*
* A list of netgroups
*/
typedef struct groupnode *groups;
struct groupnode {
name gr_name;
groups gr_next;
};
/*
* A list of what is exported and to whom
*/
typedef struct exportnode *exports;
struct exportnode {
dirpath ex_dir;
groups ex_groups;
exports ex_next;
};
program MOUNTPROG {
/*
* Version one of the mount protocol communicates with version two
* of the NFS protocol. The only connecting point is the fhandle
* structure, which is the same for both protocols.
*/
version MOUNTVERS {
/*
* Does no work. It is made available in all RPC services
* to allow server reponse testing and timing
*/
void
MOUNTPROC_NULL(void) = 0;
/*
* If fhs_status is 0, then fhs_fhandle contains the
* file handle for the directory. This file handle may
* be used in the NFS protocol. This procedure also adds
* a new entry to the mount list for this client mounting
* the directory.
* Unix authentication required.
*/
fhstatus
MOUNTPROC_MNT(dirpath) = 1;
/*
* Returns the list of remotely mounted filesystems. The
* mountlist contains one entry for each hostname and
* directory pair.
*/
mountlist
MOUNTPROC_DUMP(void) = 2;
/*
* Removes the mount list entry for the directory
* Unix authentication required.
*/
void
MOUNTPROC_UMNT(dirpath) = 3;
/*
* Removes all of the mount list entries for this client
* Unix authentication required.
*/
void
MOUNTPROC_UMNTALL(void) = 4;
/*
* Returns a list of all the exported filesystems, and which
* machines are allowed to import it.
*/
exports
MOUNTPROC_EXPORT(void) = 5;
/*
* Identical to MOUNTPROC_EXPORT above
*/
exports
MOUNTPROC_EXPORTALL(void) = 6;
} = 1;
} = 100005;

View File

@ -0,0 +1,357 @@
/*
* 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
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: nfs_prot.x,v 1.1 1993/10/08 05:26:53 cgd Exp $";
%#endif /* not lint */
#endif
const NFS_PORT = 2049;
const NFS_MAXDATA = 8192;
const NFS_MAXPATHLEN = 1024;
const NFS_MAXNAMLEN = 255;
const NFS_FHSIZE = 32;
const NFS_COOKIESIZE = 4;
const NFS_FIFO_DEV = -1; /* size kludge for named pipes */
/*
* File types
*/
const NFSMODE_FMT = 0170000; /* type of file */
const NFSMODE_DIR = 0040000; /* directory */
const NFSMODE_CHR = 0020000; /* character special */
const NFSMODE_BLK = 0060000; /* block special */
const NFSMODE_REG = 0100000; /* regular */
const NFSMODE_LNK = 0120000; /* symbolic link */
const NFSMODE_SOCK = 0140000; /* socket */
const NFSMODE_FIFO = 0010000; /* fifo */
/*
* Error status
*/
enum nfsstat {
NFS_OK= 0, /* no error */
NFSERR_PERM=1, /* Not owner */
NFSERR_NOENT=2, /* No such file or directory */
NFSERR_IO=5, /* I/O error */
NFSERR_NXIO=6, /* No such device or address */
NFSERR_ACCES=13, /* Permission denied */
NFSERR_EXIST=17, /* File exists */
NFSERR_NODEV=19, /* No such device */
NFSERR_NOTDIR=20, /* Not a directory*/
NFSERR_ISDIR=21, /* Is a directory */
NFSERR_FBIG=27, /* File too large */
NFSERR_NOSPC=28, /* No space left on device */
NFSERR_ROFS=30, /* Read-only file system */
NFSERR_NAMETOOLONG=63, /* File name too long */
NFSERR_NOTEMPTY=66, /* Directory not empty */
NFSERR_DQUOT=69, /* Disc quota exceeded */
NFSERR_STALE=70, /* Stale NFS file handle */
NFSERR_WFLUSH=99 /* write cache flushed */
};
/*
* File types
*/
enum ftype {
NFNON = 0, /* non-file */
NFREG = 1, /* regular file */
NFDIR = 2, /* directory */
NFBLK = 3, /* block special */
NFCHR = 4, /* character special */
NFLNK = 5, /* symbolic link */
NFSOCK = 6, /* unix domain sockets */
NFBAD = 7, /* unused */
NFFIFO = 8 /* named pipe */
};
/*
* File access handle
*/
struct nfs_fh {
opaque data[NFS_FHSIZE];
};
/*
* Timeval
*/
struct nfstime {
unsigned seconds;
unsigned useconds;
};
/*
* File attributes
*/
struct fattr {
ftype type; /* file type */
unsigned mode; /* protection mode bits */
unsigned nlink; /* # hard links */
unsigned uid; /* owner user id */
unsigned gid; /* owner group id */
unsigned size; /* file size in bytes */
unsigned blocksize; /* prefered block size */
unsigned rdev; /* special device # */
unsigned blocks; /* Kb of disk used by file */
unsigned fsid; /* device # */
unsigned fileid; /* inode # */
nfstime atime; /* time of last access */
nfstime mtime; /* time of last modification */
nfstime ctime; /* time of last change */
};
/*
* File attributes which can be set
*/
struct sattr {
unsigned mode; /* protection mode bits */
unsigned uid; /* owner user id */
unsigned gid; /* owner group id */
unsigned size; /* file size in bytes */
nfstime atime; /* time of last access */
nfstime mtime; /* time of last modification */
};
typedef string filename<NFS_MAXNAMLEN>;
typedef string nfspath<NFS_MAXPATHLEN>;
/*
* Reply status with file attributes
*/
union attrstat switch (nfsstat status) {
case NFS_OK:
fattr attributes;
default:
void;
};
struct sattrargs {
nfs_fh file;
sattr attributes;
};
/*
* Arguments for directory operations
*/
struct diropargs {
nfs_fh dir; /* directory file handle */
filename name; /* name (up to NFS_MAXNAMLEN bytes) */
};
struct diropokres {
nfs_fh file;
fattr attributes;
};
/*
* Results from directory operation
*/
union diropres switch (nfsstat status) {
case NFS_OK:
diropokres diropres;
default:
void;
};
union readlinkres switch (nfsstat status) {
case NFS_OK:
nfspath data;
default:
void;
};
/*
* Arguments to remote read
*/
struct readargs {
nfs_fh file; /* handle for file */
unsigned offset; /* byte offset in file */
unsigned count; /* immediate read count */
unsigned totalcount; /* total read count (from this offset)*/
};
/*
* Status OK portion of remote read reply
*/
struct readokres {
fattr attributes; /* attributes, need for pagin*/
opaque data<NFS_MAXDATA>;
};
union readres switch (nfsstat status) {
case NFS_OK:
readokres reply;
default:
void;
};
/*
* Arguments to remote write
*/
struct writeargs {
nfs_fh file; /* handle for file */
unsigned beginoffset; /* beginning byte offset in file */
unsigned offset; /* current byte offset in file */
unsigned totalcount; /* total write count (to this offset)*/
opaque data<NFS_MAXDATA>;
};
struct createargs {
diropargs where;
sattr attributes;
};
struct renameargs {
diropargs from;
diropargs to;
};
struct linkargs {
nfs_fh from;
diropargs to;
};
struct symlinkargs {
diropargs from;
nfspath to;
sattr attributes;
};
typedef opaque nfscookie[NFS_COOKIESIZE];
/*
* Arguments to readdir
*/
struct readdirargs {
nfs_fh dir; /* directory handle */
nfscookie cookie;
unsigned count; /* number of directory bytes to read */
};
struct entry {
unsigned fileid;
filename name;
nfscookie cookie;
entry *nextentry;
};
struct dirlist {
entry *entries;
bool eof;
};
union readdirres switch (nfsstat status) {
case NFS_OK:
dirlist reply;
default:
void;
};
struct statfsokres {
unsigned tsize; /* preferred transfer size in bytes */
unsigned bsize; /* fundamental file system block size */
unsigned blocks; /* total blocks in file system */
unsigned bfree; /* free blocks in fs */
unsigned bavail; /* free blocks avail to non-superuser */
};
union statfsres switch (nfsstat status) {
case NFS_OK:
statfsokres reply;
default:
void;
};
/*
* Remote file service routines
*/
program NFS_PROGRAM {
version NFS_VERSION {
void
NFSPROC_NULL(void) = 0;
attrstat
NFSPROC_GETATTR(nfs_fh) = 1;
attrstat
NFSPROC_SETATTR(sattrargs) = 2;
void
NFSPROC_ROOT(void) = 3;
diropres
NFSPROC_LOOKUP(diropargs) = 4;
readlinkres
NFSPROC_READLINK(nfs_fh) = 5;
readres
NFSPROC_READ(readargs) = 6;
void
NFSPROC_WRITECACHE(void) = 7;
attrstat
NFSPROC_WRITE(writeargs) = 8;
diropres
NFSPROC_CREATE(createargs) = 9;
nfsstat
NFSPROC_REMOVE(diropargs) = 10;
nfsstat
NFSPROC_RENAME(renameargs) = 11;
nfsstat
NFSPROC_LINK(linkargs) = 12;
nfsstat
NFSPROC_SYMLINK(symlinkargs) = 13;
diropres
NFSPROC_MKDIR(createargs) = 14;
nfsstat
NFSPROC_RMDIR(diropargs) = 15;
readdirres
NFSPROC_READDIR(readdirargs) = 16;
statfsres
NFSPROC_STATFS(nfs_fh) = 17;
} = 2;
} = 100003;

View File

@ -0,0 +1,182 @@
/*
* Network lock manager protocol definition
* Copyright (C) 1986 Sun Microsystems, Inc.
*
* protocol used between local lock manager and remote lock manager
*/
#ifdef RPC_HDR
%#define LM_MAXSTRLEN 1024
%#define MAXNAMELEN LM_MAXSTRLEN+1
#else
%#ifndef lint
%/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: nlm_prot.x,v 1.1 1993/10/08 05:26:54 cgd Exp $";
%#endif /* not lint */
#endif
/*
* status of a call to the lock manager
*/
enum nlm_stats {
nlm_granted = 0,
nlm_denied = 1,
nlm_denied_nolocks = 2,
nlm_blocked = 3,
nlm_denied_grace_period = 4
};
struct nlm_holder {
bool exclusive;
int svid;
netobj oh;
unsigned l_offset;
unsigned l_len;
};
union nlm_testrply switch (nlm_stats stat) {
case nlm_denied:
struct nlm_holder holder;
default:
void;
};
struct nlm_stat {
nlm_stats stat;
};
struct nlm_res {
netobj cookie;
nlm_stat stat;
};
struct nlm_testres {
netobj cookie;
nlm_testrply stat;
};
struct nlm_lock {
string caller_name<LM_MAXSTRLEN>;
netobj fh; /* identify a file */
netobj oh; /* identify owner of a lock */
int svid; /* generated from pid for svid */
unsigned l_offset;
unsigned l_len;
};
struct nlm_lockargs {
netobj cookie;
bool block;
bool exclusive;
struct nlm_lock alock;
bool reclaim; /* used for recovering locks */
int state; /* specify local status monitor state */
};
struct nlm_cancargs {
netobj cookie;
bool block;
bool exclusive;
struct nlm_lock alock;
};
struct nlm_testargs {
netobj cookie;
bool exclusive;
struct nlm_lock alock;
};
struct nlm_unlockargs {
netobj cookie;
struct nlm_lock alock;
};
#ifdef RPC_HDR
%/*
% * The following enums are actually bit encoded for efficient
% * boolean algebra.... DON'T change them.....
% */
#endif
enum fsh_mode {
fsm_DN = 0, /* deny none */
fsm_DR = 1, /* deny read */
fsm_DW = 2, /* deny write */
fsm_DRW = 3 /* deny read/write */
};
enum fsh_access {
fsa_NONE = 0, /* for completeness */
fsa_R = 1, /* read only */
fsa_W = 2, /* write only */
fsa_RW = 3 /* read/write */
};
struct nlm_share {
string caller_name<LM_MAXSTRLEN>;
netobj fh;
netobj oh;
fsh_mode mode;
fsh_access access;
};
struct nlm_shareargs {
netobj cookie;
nlm_share share;
bool reclaim;
};
struct nlm_shareres {
netobj cookie;
nlm_stats stat;
int sequence;
};
struct nlm_notify {
string name<MAXNAMELEN>;
long state;
};
/*
* Over-the-wire protocol used between the network lock managers
*/
program NLM_PROG {
version NLM_VERS {
nlm_testres NLM_TEST(struct nlm_testargs) = 1;
nlm_res NLM_LOCK(struct nlm_lockargs) = 2;
nlm_res NLM_CANCEL(struct nlm_cancargs) = 3;
nlm_res NLM_UNLOCK(struct nlm_unlockargs) = 4;
/*
* remote lock manager call-back to grant lock
*/
nlm_res NLM_GRANTED(struct nlm_testargs)= 5;
/*
* message passing style of requesting lock
*/
void NLM_TEST_MSG(struct nlm_testargs) = 6;
void NLM_LOCK_MSG(struct nlm_lockargs) = 7;
void NLM_CANCEL_MSG(struct nlm_cancargs) =8;
void NLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;
void NLM_GRANTED_MSG(struct nlm_testargs) = 10;
void NLM_TEST_RES(nlm_testres) = 11;
void NLM_LOCK_RES(nlm_res) = 12;
void NLM_CANCEL_RES(nlm_res) = 13;
void NLM_UNLOCK_RES(nlm_res) = 14;
void NLM_GRANTED_RES(nlm_res) = 15;
} = 1;
version NLM_VERSX {
nlm_shareres NLM_SHARE(nlm_shareargs) = 20;
nlm_shareres NLM_UNSHARE(nlm_shareargs) = 21;
nlm_res NLM_NM_LOCK(nlm_lockargs) = 22;
void NLM_FREE_ALL(nlm_notify) = 23;
} = 3;
} = 100021;

234
lib/librpcsvc/src/rex.x Normal file
View File

@ -0,0 +1,234 @@
/*
* 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
*/
/*
* Remote execution (rex) protocol specification
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)rex.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: rex.x,v 1.1 1993/10/08 05:26:56 cgd Exp $";
%#endif /* not lint */
#endif
const STRINGSIZE = 1024;
typedef string rexstring<1024>;
/*
* values to pass to REXPROC_SIGNAL
*/
const SIGINT = 2; /* interrupt */
/*
* Values for rst_flags, below
*/
const REX_INTERACTIVE = 1; /* interactive mode */
struct rex_start {
rexstring rst_cmd<>; /* list of command and args */
rexstring rst_host; /* working directory host name */
rexstring rst_fsname; /* working directory file system name */
rexstring rst_dirwithin;/* working directory within file system */
rexstring rst_env<>; /* list of environment */
unsigned int rst_port0; /* port for stdin */
unsigned int rst_port1; /* port for stdout */
unsigned int rst_port2; /* port for stderr */
unsigned int rst_flags; /* options - see const above */
};
struct rex_result {
int rlt_stat; /* integer status code */
rexstring rlt_message; /* string message for human consumption */
};
struct sgttyb {
unsigned four; /* always equals 4 */
opaque chars[4];
/* chars[0] == input speed */
/* chars[1] == output speed */
/* chars[2] == kill character */
/* chars[3] == erase character */
unsigned flags;
};
/* values for speeds above (baud rates) */
const B0 = 0;
const B50 = 1;
const B75 = 2;
const B110 = 3;
const B134 = 4;
const B150 = 5;
const B200 = 6;
const B300 = 7;
const B600 = 8;
const B1200 = 9;
const B1800 = 10;
const B2400 = 11;
const B4800 = 12;
const B9600 = 13;
const B19200 = 14;
const B38400 = 15;
/* values for flags above */
const TANDEM = 0x00000001; /* send stopc on out q full */
const CBREAK = 0x00000002; /* half-cooked mode */
const LCASE = 0x00000004; /* simulate lower case */
const ECHO = 0x00000008; /* echo input */
const CRMOD = 0x00000010; /* map \r to \r\n on output */
const RAW = 0x00000020; /* no i/o processing */
const ODDP = 0x00000040; /* get/send odd parity */
const EVENP = 0x00000080; /* get/send even parity */
const ANYP = 0x000000c0; /* get any parity/send none */
const NLDELAY = 0x00000300; /* \n delay */
const NL0 = 0x00000000;
const NL1 = 0x00000100; /* tty 37 */
const NL2 = 0x00000200; /* vt05 */
const NL3 = 0x00000300;
const TBDELAY = 0x00000c00; /* horizontal tab delay */
const TAB0 = 0x00000000;
const TAB1 = 0x00000400; /* tty 37 */
const TAB2 = 0x00000800;
const XTABS = 0x00000c00; /* expand tabs on output */
const CRDELAY = 0x00003000; /* \r delay */
const CR0 = 0x00000000;
const CR1 = 0x00001000; /* tn 300 */
const CR2 = 0x00002000; /* tty 37 */
const CR3 = 0x00003000; /* concept 100 */
const VTDELAY = 0x00004000; /* vertical tab delay */
const FF0 = 0x00000000;
const FF1 = 0x00004000; /* tty 37 */
const BSDELAY = 0x00008000; /* \b delay */
const BS0 = 0x00000000;
const BS1 = 0x00008000;
const CRTBS = 0x00010000; /* do backspacing for crt */
const PRTERA = 0x00020000; /* \ ... / erase */
const CRTERA = 0x00040000; /* " \b " to wipe out char */
const TILDE = 0x00080000; /* hazeltine tilde kludge */
const MDMBUF = 0x00100000; /* start/stop output on carrier intr */
const LITOUT = 0x00200000; /* literal output */
const TOSTOP = 0x00400000; /* SIGTTOU on background output */
const FLUSHO = 0x00800000; /* flush output to terminal */
const NOHANG = 0x01000000; /* no SIGHUP on carrier drop */
const L001000 = 0x02000000;
const CRTKIL = 0x04000000; /* kill line with " \b " */
const PASS8 = 0x08000000;
const CTLECH = 0x10000000; /* echo control chars as ^X */
const PENDIN = 0x20000000; /* tp->t_rawq needs reread */
const DECCTQ = 0x40000000; /* only ^Q starts after ^S */
const NOFLSH = 0x80000000; /* no output flush on signal */
struct tchars {
unsigned six; /* always equals 6 */
opaque chars[6];
/* chars[0] == interrupt char */
/* chars[1] == quit char */
/* chars[2] == start output char */
/* chars[3] == stop output char */
/* chars[4] == end-of-file char */
/* chars[5] == input delimeter (like nl) */
};
struct ltchars {
unsigned six; /* always equals 6 */
opaque chars[6];
/* chars[0] == stop process signal */
/* chars[1] == delayed stop process signal */
/* chars[2] == reprint line */
/* chars[3] == flush output */
/* chars[4] == word erase */
/* chars[5] == literal next character */
unsigned mode;
};
struct rex_ttysize {
int ts_lines;
int ts_cols;
};
struct rex_ttymode {
sgttyb basic; /* standard unix tty flags */
tchars more; /* interrupt, kill characters, etc. */
ltchars yetmore; /* special Berkeley characters */
unsigned andmore; /* and Berkeley modes */
};
/* values for andmore above */
const LCRTBS = 0x0001; /* do backspacing for crt */
const LPRTERA = 0x0002; /* \ ... / erase */
const LCRTERA = 0x0004; /* " \b " to wipe out char */
const LTILDE = 0x0008; /* hazeltine tilde kludge */
const LMDMBUF = 0x0010; /* start/stop output on carrier intr */
const LLITOUT = 0x0020; /* literal output */
const LTOSTOP = 0x0040; /* SIGTTOU on background output */
const LFLUSHO = 0x0080; /* flush output to terminal */
const LNOHANG = 0x0100; /* no SIGHUP on carrier drop */
const LL001000 = 0x0200;
const LCRTKIL = 0x0400; /* kill line with " \b " */
const LPASS8 = 0x0800;
const LCTLECH = 0x1000; /* echo control chars as ^X */
const LPENDIN = 0x2000; /* needs reread */
const LDECCTQ = 0x4000; /* only ^Q starts after ^S */
const LNOFLSH = 0x8000; /* no output flush on signal */
program REXPROG {
version REXVERS {
/*
* Start remote execution
*/
rex_result
REXPROC_START(rex_start) = 1;
/*
* Wait for remote execution to terminate
*/
rex_result
REXPROC_WAIT(void) = 2;
/*
* Send tty modes
*/
void
REXPROC_MODES(rex_ttymode) = 3;
/*
* Send window size change
*/
void
REXPROC_WINCH(rex_ttysize) = 4;
/*
* Send other signal
*/
void
REXPROC_SIGNAL(int) = 5;
} = 1;
} = 100017;

View File

@ -0,0 +1,91 @@
/*
* 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
*/
/*
* Find out about remote users
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)rnusers.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: rnusers.x,v 1.1 1993/10/08 05:26:57 cgd Exp $";
%#endif /* not lint */
#endif
const MAXUSERS = 100;
const MAXUTLEN = 256;
struct utmp {
string ut_line<MAXUTLEN>;
string ut_name<MAXUTLEN>;
string ut_host<MAXUTLEN>;
int ut_time;
};
struct utmpidle {
utmp ui_utmp;
unsigned int ui_idle;
};
typedef utmp utmparr<MAXUSERS>;
typedef utmpidle utmpidlearr<MAXUSERS>;
program RUSERSPROG {
/*
* Old version does not include idle information
*/
version RUSERSVERS_ORIG {
int
RUSERSPROC_NUM(void) = 1;
utmparr
RUSERSPROC_NAMES(void) = 2;
utmparr
RUSERSPROC_ALLNAMES(void) = 3;
} = 1;
/*
* Includes idle information
*/
version RUSERSVERS_IDLE {
int
RUSERSPROC_NUM(void) = 1;
utmpidlearr
RUSERSPROC_NAMES(void) = 2;
utmpidlearr
RUSERSPROC_ALLNAMES(void) = 3;
} = 2;
} = 100002;

View File

@ -0,0 +1,66 @@
/*
* Remote quota protocol
* Requires unix authentication
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: rquota.x,v 1.1 1993/10/08 05:26:58 cgd Exp $";
%#endif /* not lint */
#endif
const RQ_PATHLEN = 1024;
struct getquota_args {
string gqa_pathp<RQ_PATHLEN>; /* path to filesystem of interest */
int gqa_uid; /* inquire about quota for uid */
};
/*
* remote quota structure
*/
struct rquota {
int rq_bsize; /* block size for block counts */
bool rq_active; /* indicates whether quota is active */
unsigned int rq_bhardlimit; /* absolute limit on disk blks alloc */
unsigned int rq_bsoftlimit; /* preferred limit on disk blks */
unsigned int rq_curblocks; /* current block count */
unsigned int rq_fhardlimit; /* absolute limit on allocated files */
unsigned int rq_fsoftlimit; /* preferred file limit */
unsigned int rq_curfiles; /* current # allocated files */
unsigned int rq_btimeleft; /* time left for excessive disk use */
unsigned int rq_ftimeleft; /* time left for excessive files */
};
enum gqr_status {
Q_OK = 1, /* quota returned */
Q_NOQUOTA = 2, /* noquota for uid */
Q_EPERM = 3 /* no permission to access quota */
};
union getquota_rslt switch (gqr_status status) {
case Q_OK:
rquota gqr_rquota; /* valid if status == Q_OK */
case Q_NOQUOTA:
void;
case Q_EPERM:
void;
};
program RQUOTAPROG {
version RQUOTAVERS {
/*
* Get all quotas
*/
getquota_rslt
RQUOTAPROC_GETQUOTA(getquota_args) = 1;
/*
* Get active quotas only
*/
getquota_rslt
RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
} = 1;
} = 100011;

150
lib/librpcsvc/src/rstat.x Normal file
View File

@ -0,0 +1,150 @@
/*
* 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
*/
#ifdef RPC_HDR
%#ifndef FSCALE
%/*
% * Scale factor for scaled integers used to count load averages.
% */
%#define FSHIFT 8 /* bits to right of fixed binary point */
%#define FSCALE (1<<FSHIFT)
%
%#endif /* ndef FSCALE */
#else
%#ifndef lint
%/*static char sccsid[] = "from: @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)rstat.x 2.2 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: rstat.x,v 1.1 1993/10/08 05:26:59 cgd Exp $";
%#endif /* not lint */
#endif /* def RPC_HDR */
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]; /* scaled by FSCALE */
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];/* scaled by FSCALE */
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;

46
lib/librpcsvc/src/rwall.x Normal file
View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 1993 Christopher G. Demetriou
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* rpc protocol definition for (remote) wall protocol
*
* this has to be compatible with sun's definition
*/
#ifndef RPC_HDR
%#ifndef lint
%static char rcsid[] = "$Id: rwall.x,v 1.1 1993/10/08 05:26:59 cgd Exp $";
%#endif /* not lint */
#endif
program WALLPROG {
version WALLVERS {
void WALLPROC_WALL(string) = 2;
} = 1;
} = 100008;

View File

@ -0,0 +1,120 @@
/*
* 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
*/
/*
* Status monitor protocol specification
* Copyright (C) 1986 Sun Microsystems, Inc.
*
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)sm_inter.x 2.2 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: sm_inter.x,v 1.1 1993/10/08 05:27:00 cgd Exp $";
%#endif /* not lint */
#endif
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 */
};

89
lib/librpcsvc/src/spray.x Normal file
View File

@ -0,0 +1,89 @@
/*
* 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
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)spray.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: spray.x,v 1.1 1993/10/08 05:27:01 cgd Exp $";
%#endif /* not lint */
#endif
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;

296
lib/librpcsvc/src/yp.x Normal file
View File

@ -0,0 +1,296 @@
/*
* 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
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)yp.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: yp.x,v 1.1 1993/10/08 05:27:02 cgd Exp $";
%#endif /* not lint */
#endif
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;

330
lib/librpcsvc/src/yp_prot.h Normal file
View File

@ -0,0 +1,330 @@
/*
* Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: yp_prot.h,v 1.1 1993/10/08 05:27:03 cgd Exp $
*/
#ifndef _YP_PROT_H_
#define _YP_PROT_H_
/*
* YPSERV PROTOCOL:
*
* ypserv supports the following procedures:
*
* YPPROC_NULL takes (void), returns (void).
* called to check if server is alive.
* YPPROC_DOMAIN takes (char *), returns (bool_t).
* true if ypserv serves the named domain.
* YPPROC_DOMAIN_NOACK takes (char *), returns (bool_t).
* true if ypserv serves the named domain.
* used for broadcasts, does not ack if ypserv
* doesn't handle named domain.
* YPPROC_MATCH takes (struct ypreq_key), returns (struct ypresp_val)
* does a lookup.
* YPPROC_FIRST takes (struct ypreq_nokey) returns (ypresp_key_val).
* gets the first key/datum from the map.
* YPPROC_NEXT takes (struct ypreq_key) returns (ypresp_key_val).
* gets the next key/datum from the map.
* YPPROC_XFR takes (struct ypreq_xfr), returns (void).
* tells ypserv to check if there is a new version of
* the map.
* YPPROC_CLEAR takes (void), returns (void).
* tells ypserv to flush it's file cache, so that
* newly transferred files will get read.
* YPPROC_ALL takes (struct ypreq_nokey), returns (bool_t and
* struct ypresp_key_val).
* returns an array of data, with the bool_t being
* false on the last datum. read the source, it's
* convoluted.
* YPPROC_MASTER takes (struct ypreq_nokey), returns (ypresp_master).
* YPPROC_ORDER takes (struct ypreq_nokey), returns (ypresp_order).
* YPPROC_MAPLIST takes (char *), returns (struct ypmaplist *).
*/
#ifndef BOOL_DEFINED
typedef u_int bool;
#define BOOL_DEFINED
#endif
bool_t xdr_datum();
bool_t xdr_ypdomain_wrap_string();
bool_t xdr_ypmap_wrap_string();
bool_t xdr_ypreq_key();
bool_t xdr_ypreq_nokey();
bool_t xdr_ypreq_xfr();
bool_t xdr_ypresp_val();
bool_t xdr_ypresp_key_val();
bool_t xdr_ypbind_resp();
bool_t xdr_ypbind_setdom();
bool_t xdr_yp_inaddr();
bool_t xdr_ypmap_parms();
bool_t xdr_ypowner_wrap_string();
bool_t xdr_yppushresp_xfr();
bool_t xdr_ypresp_order();
bool_t xdr_ypresp_master();
bool_t xdr_ypall();
bool_t xdr_ypresp_maplist();
/* Program and version symbols, magic numbers */
#define YPPROG ((u_long)100004)
#define YPVERS ((u_long)2)
#define YPVERS_ORIG ((u_long)1)
#define YPMAXRECORD ((u_long)1024)
#define YPMAXDOMAIN ((u_long)64)
#define YPMAXMAP ((u_long)64)
#define YPMAXPEER ((u_long)256)
/*
* I don't know if anything of sun's depends on this, or if they
* simply defined it so that their own code wouldn't try to send
* packets over the ethernet MTU. This YP code doesn't use it.
*/
#define YPMSGSZ 1600
#ifndef DATUM
typedef struct {
char *dptr;
int dsize;
} datum;
#define DATUM
#endif
struct ypmap_parms {
char *domain;
char *map;
u_long ordernum;
char *owner;
};
struct ypreq_key {
char *domain;
char *map;
datum keydat;
};
struct ypreq_nokey {
char *domain;
char *map;
};
struct ypreq_xfr {
struct ypmap_parms map_parms;
u_long transid;
u_long proto;
u_short port;
};
#define ypxfr_domain map_parms.domain
#define ypxfr_map map_parms.map
#define ypxfr_ordernum map_parms.ordernum
#define ypxfr_owner map_parms.owner
struct ypresp_val {
u_long status;
datum valdat;
};
struct ypresp_key_val {
u_long status;
datum keydat;
datum valdat;
};
struct ypresp_master {
u_long status;
char *master;
};
struct ypresp_order {
u_long status;
u_long ordernum;
};
struct ypmaplist {
char ypml_name[YPMAXMAP + 1];
struct ypmaplist *ypml_next;
};
struct ypresp_maplist {
u_long status;
struct ypmaplist *list;
};
/* ypserv procedure numbers */
#define YPPROC_NULL ((u_long)0)
#define YPPROC_DOMAIN ((u_long)1)
#define YPPROC_DOMAIN_NONACK ((u_long)2)
#define YPPROC_MATCH ((u_long)3)
#define YPPROC_FIRST ((u_long)4)
#define YPPROC_NEXT ((u_long)5)
#define YPPROC_XFR ((u_long)6)
#define YPPROC_CLEAR ((u_long)7)
#define YPPROC_ALL ((u_long)8)
#define YPPROC_MASTER ((u_long)9)
#define YPPROC_ORDER ((u_long)10)
#define YPPROC_MAPLIST ((u_long)11)
/* ypserv procedure return status values */
#define YP_TRUE ((long)1) /* general purpose success code */
#define YP_NOMORE ((long)2) /* no more entries in map */
#define YP_FALSE ((long)0) /* general purpose failure code */
#define YP_NOMAP ((long)-1) /* no such map in domain */
#define YP_NODOM ((long)-2) /* domain not supported */
#define YP_NOKEY ((long)-3) /* no such key in map */
#define YP_BADOP ((long)-4) /* invalid operation */
#define YP_BADDB ((long)-5) /* server data base is bad */
#define YP_YPERR ((long)-6) /* YP server error */
#define YP_BADARGS ((long)-7) /* request arguments bad */
#define YP_VERS ((long)-8) /* YP server version mismatch */
/*
* Sun's header file says:
* "Domain binding data structure, used by ypclnt package and ypserv modules.
* Users of the ypclnt package (or of this protocol) don't HAVE to know about
* it, but it must be available to users because _yp_dobind is a public
* interface."
*
* This is totally bogus! Nowhere else does Sun state that _yp_dobind() is
* a public interface, and I don't know any reason anyone would want to call
* it. But, just in case anyone does actually expect it to be available..
* we provide this.. exactly as Sun wants it.
*/
struct dom_binding {
struct dom_binding *dom_pnext;
char dom_domain[YPMAXDOMAIN + 1];
struct sockaddr_in dom_server_addr;
u_short dom_server_port;
int dom_socket;
CLIENT *dom_client;
u_short dom_local_port;
long dom_vers;
};
/*
* YPBIND PROTOCOL:
*
* ypbind supports the following procedures:
*
* YPBINDPROC_NULL takes (void), returns (void).
* to check if ypbind is running.
* YPBINDPROC_DOMAIN takes (char *), returns (struct ypbind_resp).
* requests that ypbind start to serve the
* named domain (if it doesn't already)
* YPBINDPROC_SETDOM takes (struct ypbind_setdom), returns (void).
* used by ypset.
*/
#define YPBINDPROG ((u_long)100007)
#define YPBINDVERS ((u_long)2)
#define YPBINDVERS_ORIG ((u_long)1)
/* ypbind procedure numbers */
#define YPBINDPROC_NULL ((u_long)0)
#define YPBINDPROC_DOMAIN ((u_long)1)
#define YPBINDPROC_SETDOM ((u_long)2)
/* error code in ypbind_resp.ypbind_status */
enum ypbind_resptype {
YPBIND_SUCC_VAL = 1,
YPBIND_FAIL_VAL = 2
};
/* network order, of course */
struct ypbind_binding {
struct in_addr ypbind_binding_addr;
u_short ypbind_binding_port;
};
struct ypbind_resp {
enum ypbind_resptype ypbind_status;
union {
u_long ypbind_error;
struct ypbind_binding ypbind_bindinfo;
} ypbind_respbody;
};
/* error code in ypbind_resp.ypbind_respbody.ypbind_error */
#define YPBIND_ERR_ERR 1 /* internal error */
#define YPBIND_ERR_NOSERV 2 /* no bound server for passed domain */
#define YPBIND_ERR_RESC 3 /* system resource allocation failure */
/*
* Request data structure for ypbind "Set domain" procedure.
*/
struct ypbind_setdom {
char ypsetdom_domain[YPMAXDOMAIN + 1];
struct ypbind_binding ypsetdom_binding;
u_short ypsetdom_vers;
};
#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr
#define ypsetdom_port ypsetdom_binding.ypbind_binding_port
/*
* YPPUSH PROTOCOL:
*
* Sun says:
* "Protocol between clients (ypxfr, only) and yppush
* yppush speaks a protocol in the transient range, which
* is supplied to ypxfr as a command-line parameter when it
* is activated by ypserv."
*
* This protocol is not implimented, naturally, because this YP
* implimentation only does the client side.
*/
#define YPPUSHVERS ((u_long)1)
#define YPPUSHVERS_ORIG ((u_long)1)
/* yppush procedure numbers */
#define YPPUSHPROC_NULL ((u_long)0)
#define YPPUSHPROC_XFRRESP ((u_long)1)
struct yppushresp_xfr {
u_long transid;
u_long status;
};
/* yppush status value in yppushresp_xfr.status */
#define YPPUSH_SUCC ((long)1) /* Success */
#define YPPUSH_AGE ((long)2) /* Master's version not newer */
#define YPPUSH_NOMAP ((long)-1) /* Can't find server for map */
#define YPPUSH_NODOM ((long)-2) /* Domain not supported */
#define YPPUSH_RSRC ((long)-3) /* Local resouce alloc failure */
#define YPPUSH_RPC ((long)-4) /* RPC failure talking to server */
#define YPPUSH_MADDR ((long)-5) /* Can't get master address */
#define YPPUSH_YPERR ((long)-6) /* YP server/map db error */
#define YPPUSH_BADARGS ((long)-7) /* Request arguments bad */
#define YPPUSH_DBM ((long)-8) /* Local dbm operation failed */
#define YPPUSH_FILE ((long)-9) /* Local file I/O operation failed */
#define YPPUSH_SKEW ((long)-10) /* Map version skew during transfer */
#define YPPUSH_CLEAR ((long)-11) /* Can't send "Clear" req to local ypserv */
#define YPPUSH_FORCE ((long)-12) /* No local order number in map - use -f */
#define YPPUSH_XFRERR ((long)-13) /* ypxfr error */
#define YPPUSH_REFUSED ((long)-14) /* Transfer request refused by ypserv */
#endif /* _YP_PROT_H_ */

View File

@ -0,0 +1,86 @@
/*
* Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ypclnt.h,v 1.1 1993/10/08 05:27:04 cgd Exp $
*/
#ifndef _YPCLNT_H_
#define _YPCLNT_H_
#define YPERR_BADARGS 1 /* args to function are bad */
#define YPERR_RPC 2 /* RPC failure */
#define YPERR_DOMAIN 3 /* can't bind to a server for domain */
#define YPERR_MAP 4 /* no such map in server's domain */
#define YPERR_KEY 5 /* no such key in map */
#define YPERR_YPERR 6 /* some internal YP server or client error */
#define YPERR_RESRC 7 /* local resource allocation failure */
#define YPERR_NOMORE 8 /* no more records in map database */
#define YPERR_PMAP 9 /* can't communicate with portmapper */
#define YPERR_YPBIND 10 /* can't communicate with ypbind */
#define YPERR_YPSERV 11 /* can't communicate with ypserv */
#define YPERR_NODOM 12 /* local domain name not set */
#define YPERR_BADDB 13 /* YP data base is bad */
#define YPERR_VERS 14 /* YP version mismatch */
#define YPERR_ACCESS 15 /* access violation */
#define YPERR_BUSY 16 /* database is busy */
/*
* Types of update operations
*/
#define YPOP_CHANGE 1 /* change, do not add */
#define YPOP_INSERT 2 /* add, do not change */
#define YPOP_DELETE 3 /* delete this entry */
#define YPOP_STORE 4 /* add, or change */
struct ypall_callback {
int (*foreach)(); /* return non-0 to stop getting called */
char *data; /* opaque pointer for use of callback fn */
};
int yp_bind __P((char *dom));
int _yp_dobind __P((char *dom, struct dom_binding **ypdb));
void yp_unbind __P((char *dom));
int yp_get_default_domain __P((char **domp));
int yp_match __P((char *indomain, char *inmap,
const char *inkey, int inkeylen, char **outval,
int *outvallen));
int yp_first __P((char *indomain, char *inmap,
char **outkey, int *outkeylen, char **outval,
int *outvallen));
int yp_next __P((char *indomain, char *inmap,
char *inkey, int inkeylen, char **outkey,
int *outkeylen, char **outval, int *outvallen));
int yp_master __P((char *indomain, char *inmap, char **outname));
int yp_order __P((char *indomain, char *inmap, int *outorder));
int yp_all __P((char *indomain, char *inmap,
struct ypall_callback *incallback));
char * yperr_string __P((int incode));
int ypprot_err __P((unsigned int incode));
#endif /* _YPCLNT_H_ */

View File

@ -0,0 +1,69 @@
/*
* 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
*/
#ifndef RPC_HDR
%#ifndef lint
%/*static char sccsid[] = "from: @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro";*/
%/*static char sccsid[] = "from: @(#)yppasswd.x 2.1 88/08/01 4.0 RPCSRC";*/
%static char rcsid[] = "$Id: yppasswd.x,v 1.1 1993/10/08 05:27:05 cgd Exp $";
%#endif /* not lint */
#endif
program YPPASSWDPROG {
version YPPASSWDVERS {
/*
* Update my passwd entry
*/
int
YPPASSWDPROC_UPDATE(yppasswd) = 1;
} = 1;
} = 100009;
struct x_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 */
x_passwd newpw; /* new passwd entry */
};