geoff@bodleian.East.Sun.COM (Geoff Arnold @ Sun BOS - R.H. coast near the top) (03/12/91)
In the two following postings I will be submitting a "work in progress"
version of PCNFSD V2 for your review and consideration. Here's how I'm
doing it. In the remainder of this posting, I will include a copy
of the pcnfsd.x RPCGEN input. From this you can see what new functions,
options, etc. I have included. The next two postings must be
combined and run through uudecode, uncompress and tar to yield
full sources. The Makefile is Sun style: I haven't tried it on
other systems yet. Read the README file, and save a copy of the
tarfile in case anything goes wrong with the rpcgen phase of making
the binaries. For testing purposes you don't need a PC (except to
verify backward compatibility with V1).
Geoff
-----------------------------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh to create the files:
# pcnfsd.x
# This archive created: Mon Mar 11 17:38:38 1991 by geoff, Sun Microsystems PC-NFS Engineering
#
#
export PATH; PATH=/bin:$PATH
if test -f pcnfsd.x ; then
echo shar: will not over-write existing file pcnfsd.x
else
echo shar: extracting pcnfsd.x, 19131 characters
sed 's/^X//' > pcnfsd.x <<'SHAR_EOF'
X/* The maximum number of bytes in a user name argument */
Xconst IDENTLEN = 32;
X/* The maximum number of bytes in a password argument */
Xconst PASSWORDLEN = 64;
X/* The maximum number of bytes in a print client name argument */
Xconst CLIENTLEN = 64;
X/* The maximum number of bytes in a printer name argument */
Xconst PRINTERNAMELEN = 64;
X/* The maximum number of bytes in a print user name argument */
Xconst USERNAMELEN = 64;
X/* The maximum number of bytes in a print spool file name argument */
Xconst SPOOLNAMELEN = 64;
X/* The maximum number of bytes in a print options argument */
Xconst OPTIONSLEN = 64;
X/* The maximum number of bytes in a print spool directory path */
Xconst SPOOLDIRLEN = 255;
X/* The maximum number of secondary GIDs returned by a V2 AUTH */
Xconst EXTRAGIDLEN = 16;
X/* The maximum number of bytes in a home directory spec */
Xconst HOMEDIRLEN = 255;
X/* The maximum number of bytes in a misc. comments string */
Xconst COMMENTLEN = 255;
X/* The maximum number of bytes in a print job id */
Xconst PRINTJOBIDLEN = 255;
X/* The maximum number of printers returned by a LIST operation */
Xconst PRLISTMAX = 32;
X/* The maximum number of print jobs returned by a QUEUE operation */
Xconst PRQUEUEMAX = 128;
X/* The maximum number of entries in the facilities list */
Xconst FACILITIESMAX = 32;
X/* The maximum length of an operator message */
Xconst MESSAGELEN = 512;
X
X
X
Xtypedef string ident<IDENTLEN>;
X/*
X** The type ident is used for passing an encoded user name for
X** authentication. The server should decode the string by replacing each
X** octet with the value formed by performing an exclusive-or of the octet
X** value with the value 0x5b and and'ing the result with 0x7f.
X*/
X
Xtypedef string message<MESSAGELEN>;
X/*
X** The type message is used for passing an alert message to the
X** system operator on the server. The text may include newlines.
X*/
X
Xtypedef string password<PASSWORDLEN>;
X/*
X** The type password is used for passing an encode password for
X** authentication. The server should decode the password as described
X** above.
X*/
X
Xtypedef string client<CLIENTLEN>;
X/*
X** The type client is used for passing the hostname of a client for
X** printing. The server may use this name in constructing the spool
X** directory name.
X*/
X
Xtypedef string printername<PRINTERNAMELEN>;
X/*
X** The type printername is used for passing the name of a printer on which
X** the client wishes to print.
X*/
X
Xtypedef string username<USERNAMELEN>;
X/*
X** The type username is used for passing the user name for a print job.
X** The server may use this in any way it chooses: it may attempt to change
X** the effective identity with which it is running to username or may
X** simply arrange for the text to be printed on the banner page.
X*/
X
Xtypedef string comment<COMMENTLEN>;
X/*
X** The type comment is used to pass an uninterpreted text string which
X** may be used by displayed to a human user or used for custom
X** extensions to the PCNFSD service. If you elect to extend PCNFSD
X** service in this way, please do so in a way which will avoid
X** problems if your client attempts to interoperate with a server
X** which does not support your extension. One way to do this is to
X** use the
X*/
X
Xtypedef string spoolname<SPOOLNAMELEN>;
X/*
X** The type spoolname is used for passing the name of a print spool file
X** (a simple filename not a pathname) within the spool directory.
X*/
X
Xtypedef string printjobid<PRINTJOBIDLEN>;
X/*
X** The type printjobid is used for passing the id of a print job.
X*/
X
Xtypedef string homedir<OPTIONSLEN>;
X/*
X** The type homedir is used to return the home directory for the user.
X** If present, it should be in the form "hostname:path", where hostname
X** and path are in a suitable form for communicating with the mount server.
X*/
X
Xtypedef string options<OPTIONSLEN>;
X/*
X** The type options is used for passing implementation-specific print
X** control information. The option string is a set of printable ASCII
X** characters. The first character should be ignored by the server; it is
X** reserved for client use. The second character specifies the type of
X** data in the print file. The following types are defined (an
X** implementation may define additional values):
X**
X** p - PostScript data. The client will ensure that a valid
X** PostScript header is included.
X** d - Diablo 630 data.
X** x - Generic printable ASCII text. The client will have filtered
X** out all non-printable characters other than CR, LF, TAB,
X** BS and VT.
X** r - Raw print data. The client performs no filtering.
X** u - User-defined. Reserved for custom extensions. A vanilla
X** pcnfsd server will treat this as equivalent to "r"
X**
X** If diablo data (type 'd') is specified, a formatting specification
X** string will be appended. This has the form:
X** ppnnnbbb
X** pp
X** Pitch - 10, 12 or 15.
X** nnn
X** The ``normal'' font to be used - encoded as follows:
X** Courier crn
X** Courier-Bold crb
X** Courier-Oblique con
X** Courier-BoldObliqu cob
X** Helvetica hrn
X** Helvetica-Bold hrb
X** Helvetica-Oblique hon
X** Helvetica-BoldOblique hob
X** Times-Roman trn
X** Times-Bold trb
X** Times-Italic ton
X** Times-BoldItalic tob
X** bbb
X** The ``bold'' font to be used - encoded in the same way. For example,
X** the string ``nd10hrbcob'' specifies that the print data is in Diablo
X** 630 format, it should be printed at 10 pitch, ``normal'' text should be
X** printed in Helvetica-Bold, and ``bold'' text should be printed in
X** Courier-BoldOblique.
X*/
X
Xenum arstat {
X AUTH_RES_OK = 0,
X AUTH_RES_FAKE = 1,
X AUTH_RES_FAIL = 2
X};
X/*
X** The type arstat is returned by PCNFSD_AUTH. A value of AUTH_RES_OK
X** indicates that the server was able to verify the ident and password
X** successfully.AUTH_RES_FAIL is returned if a verification failure
X** occurred. The value AUTH_RES_FAKE may be used if the server wishes to
X** indicate that the verification failed, but that the server has
X** synthesised acceptable values for uid and gid which the client may use
X** if it wishes.
X*/
X
Xenum alrstat {
X ALERT_RES_OK = 0,
X ALERT_RES_FAIL = 1
X};
X/*
X** The type alrstat is returned by PCNFSD_ALERT. A value of ALERT_RES_OK
X** indicates that the server was able to notify the system operator
X** successfully. ALERT_RES_FAIL is returned if a failure occurred
X*/
Xenum pirstat {
X PI_RES_OK = 0,
X PI_RES_NO_SUCH_PRINTER = 1,
X PI_RES_FAIL = 2
X};
X/*
X** The type pirstat is returned by a number of print operations. PI_RES_OK
X** indicates that the operation was performed successfully. PI_RES_FAIL
X** indicates that the printer name was valid, but the operation could
X** not be performed. PI_RES_NO_SUCH_PRINTER indicates that the printer
X** name was not recognised.
X*/
X
Xenum pcrstat {
X PC_RES_OK = 0,
X PC_RES_NO_SUCH_PRINTER = 1,
X PC_RES_NO_SUCH_JOB = 2,
X PC_RES_NOT_OWNER = 3,
X PC_RES_FAIL = 4
X};
X/*
X** The type pcrstat is returned by a CANCEL, REQUEUE, HOLD, or RELEASE
X** print operation.
X** PC_RES_OK indicates that the operation was performed successfully.
X** PC_RES_NO_SUCH_PRINTER indicates that the printer name was not recognised.
X** PC_RES_NO_SUCH_JOB means that the job does not exist, or is not
X** associated with the specified printer.
X** PC_RES_NOT_OWNER means that the user does not have permission to
X** manipulate the job.
X** PC_RES_FAIL means that the job could not be manipulated for an unknown
X** reason.
X*/
X
X
Xenum psrstat {
X PS_RES_OK = 0,
X PS_RES_ALREADY = 1,
X PS_RES_NULL = 2,
X PS_RES_NO_FILE = 3,
X PS_RES_FAIL = 4
X};
X/*
X** The type psrstat is returned by PCNFSD_PR_START. A value of PS_RES_OK
X** indicates that the server has started printing the job. It is possible
X** that the reply from a PCNFSD_PR_START call may be lost, in which case
X** the client will repeat the call. If the spool file is still in
X** existence, the server will return PS_RES_ALREADY indicating that it has
X** already started printing. If the file cannot be found, PS_RES_NO_FILE
X** is returned. PS_RES_NULL indicates that the spool file was empty,
X** while PS_RES_FAIL denotes a general failure. PI_RES_FAIL is returned
X** if spool directory could not be created. The value
X** PI_RES_NO_SUCH_PRINTER indicates that the printer name was not
X** recognised.
X*/
X
Xenum mapreq {
X MAP_REQ_UID = 0,
X MAP_REQ_GID = 1,
X MAP_REQ_UNAME = 2,
X MAP_REQ_GNAME = 3
X};
X/*
X** The type mapreq identifies the type of a mapping request.
X** MAP_REQ_UID requests that the server treat the value in the
X** id field as a uid and return the corresponding username in name.
X** MAP_REQ_GID requests that the server treat the value in the
X** id field as a gid and return the corresponding groupname in name.
X** MAP_REQ_UNAME requests that the server treat the value in the
X** name field as a username and return the corresponding uid in id.
X** MAP_REQ_GNAME requests that the server treat the value in the
X** name field as a groupname and return the corresponding gid in id.
X*/
X
Xenum maprstat {
X MAP_RES_OK = 0,
X MAP_RES_UNKNOWN = 1,
X MAP_RES_DENIED = 2
X};
X/*
X** The type maprstat indicates the success or failure of
X** an individual mapping request.
X*/
X
X/*
X**********************************************************
X** Version 1 of the PCNFSD protocol.
X**********************************************************
X*/
Xstruct auth_args {
X ident id;
X password pw;
X};
Xstruct auth_results {
X arstat stat;
X unsigned int uid;
X unsigned int gid;
X};
X
Xstruct pr_init_args {
X client system;
X printername pn;
X};
Xstruct pr_init_results {
X pirstat stat;
X spoolname dir;
X};
X
Xstruct pr_start_args {
X client system;
X printername pn;
X username user;
X spoolname file;
X options opts;
X};
Xstruct pr_start_results {
X psrstat stat;
X};
X
X
X/*
X**********************************************************
X** Version 2 of the PCNFSD protocol.
X**********************************************************
X*/
X
Xstruct v2_info_args {
X comment vers;
X comment cm;
X};
X
Xstruct v2_info_results {
X comment vers;
X comment cm;
X int facilities<FACILITIESMAX>;
X};
X
Xstruct v2_pr_init_args {
X client system;
X printername pn;
X comment cm;
X};
Xstruct v2_pr_init_results {
X pirstat stat;
X spoolname dir;
X comment cm;
X};
X
Xstruct v2_pr_start_args {
X client system;
X printername pn;
X username user;
X spoolname file;
X options opts;
X int copies;
X comment cm;
X};
Xstruct v2_pr_start_results {
X psrstat stat;
X printjobid id;
X comment cm;
X};
X
X
X
Xtypedef struct pr_list_item *pr_list;
X
Xstruct pr_list_item {
X printername pn;
X printername device;
X client remhost; /* empty if local */
X comment cm;
X pr_list pr_next;
X};
X
Xstruct v2_pr_list_results {
X comment cm;
X pr_list printers;
X};
X
Xstruct v2_pr_queue_args {
X printername pn;
X client system;
X username user;
X bool just_mine;
X comment cm;
X};
X
Xtypedef struct pr_queue_item *pr_queue;
X
Xstruct pr_queue_item {
X int position;
X printjobid id;
X comment size;
X comment status;
X client system;
X username user;
X spoolname file;
X comment cm;
X pr_queue pr_next;
X};
X
Xstruct v2_pr_queue_results {
X pirstat stat;
X comment cm;
X bool just_yours;
X int qlen;
X int qshown;
X pr_queue jobs;
X};
X
X
Xstruct v2_pr_cancel_args {
X printername pn;
X client system;
X username user;
X printjobid id;
X comment cm;
X};
Xstruct v2_pr_cancel_results {
X pcrstat stat;
X comment cm;
X};
X
X
Xstruct v2_pr_status_args {
X printername pn;
X comment cm;
X};
Xstruct v2_pr_status_results {
X pirstat stat;
X bool avail;
X bool printing;
X int qlen;
X bool needs_operator;
X comment status;
X comment cm;
X};
X
Xstruct v2_pr_admin_args {
X client system;
X username user;
X printername pn;
X comment cm;
X};
Xstruct v2_pr_admin_results {
X pirstat stat;
X comment cm;
X};
X
Xstruct v2_pr_requeue_args {
X printername pn;
X client system;
X username user;
X printjobid id;
X int qpos;
X comment cm;
X};
X
Xstruct v2_pr_requeue_results {
X pcrstat stat;
X comment cm;
X};
X
Xstruct v2_pr_hold_args {
X printername pn;
X client system;
X username user;
X printjobid id;
X comment cm;
X};
Xstruct v2_pr_hold_results {
X pcrstat stat;
X comment cm;
X};
X
Xstruct v2_pr_release_args {
X printername pn;
X client system;
X username user;
X printjobid id;
X comment cm;
X};
Xstruct v2_pr_release_results {
X pcrstat stat;
X comment cm;
X};
X
X
Xtypedef struct mapreq_arg_item *mapreq_arg;
X
Xstruct mapreq_arg_item {
X mapreq req;
X int id;
X username name;
X mapreq_arg mapreq_next;
X};
X
Xtypedef struct mapreq_res_item *mapreq_res;
X
Xstruct mapreq_res_item {
X mapreq req;
X maprstat stat;
X int id;
X username name;
X mapreq_res mapreq_next;
X};
X
Xstruct v2_mapid_args {
X comment cm;
X mapreq_arg req_list;
X};
X
X
Xstruct v2_mapid_results {
X comment cm;
X mapreq_res res_list;
X};
X
Xstruct v2_auth_args {
X client system;
X ident id;
X password pw;
X comment cm;
X};
Xstruct v2_auth_results {
X arstat stat;
X unsigned int uid;
X unsigned int gid;
X unsigned int gids<EXTRAGIDLEN>;
X homedir home;
X int def_umask;
X comment cm;
X};
X
Xstruct v2_alert_args {
X client system;
X printername pn;
X username user;
X message msg;
X};
Xstruct v2_alert_results {
X alrstat stat;
X comment cm;
X};
X
X
X/*
X**********************************************************
X** Protocol description for the PCNFSD program
X**********************************************************
X*/
X/*
X** Version 1 of the PCNFSD protocol.
X**
X** -- PCNFSD_NULL() = 0
X** Null procedure - standard for all RPC programs.
X**
X** -- PCNFSD_AUTH() = 1
X** Perform user authentication - map username, password into uid, gid.
X**
X** -- PCNFSD_PR_INIT() = 2
X** Prepare for remote printing: identify exporting spool directory.
X**
X** -- PCNFSD_PR_START() = 3
X** Submit a spooled print job for printing: the print data is
X** in a file created in the spool directory.
X**
X** Version 2 of the -- PCNFSD protocol.
X**
X** -- PCNFSD2_NULL() = 0
X** Null procedure - standard for all RPC programs.
X**
X** -- PCNFSD2_INFO() = 1
X** Determine which services are supported by this implementation
X** of PCNFSD.
X**
X** -- PCNFSD2_PR_INIT() = 2
X** Prepare for remote printing: identify exporting spool directory.
X**
X** -- PCNFSD2_PR_START() = 3
X** Submit a spooled print job for printing: the print data is
X** in a file created in the spool directory.
X**
X** -- PCNFSD2_PR_LIST() = 4
X** List all printers known on the server.
X**
X** -- PCNFSD2_PR_QUEUE() = 5
X** List all or part of the queued jobs for a printer.
X**
X** -- PCNFSD2_PR_STATUS() = 6
X** Determine the status of a printer.
X**
X** -- PCNFSD2_PR_CANCEL() = 7
X** Cancel a print job.
X**
X** -- PCNFSD2_PR_ADMIN() = 8
X** Perform an implementation-dependent printer administration
X** operation.
X**
X** -- PCNFSD2_PR_REQUEUE() = 9
X** Change the queue position of a previously-submitted print job.
X**
X** -- PCNFSD2_PR_HOLD() = 10
X** Place a "hold" on a previously-submitted print job. The job
X** will remain in the queue, but will not be printed.
X**
X** -- PCNFSD2_PR_RELEASE() = 11
X** Release the "hold" on a previously-held print job.
X**
X** -- PCNFSD2_MAPID() = 12
X** Perform one or more translations between user and group
X** names and IDs.
X**
X** -- PCNFSD2_AUTH() = 13
X** Perform user authentication - map username, password into uid, gid;
X** may also return secondary gids, home directory, umask.
X**
X** -- PCNFSD2_ALERT() = 14
X** Send a message to the system operator.
X*/
Xprogram PCNFSDPROG {
X version PCNFSDVERS {
X void PCNFSD_NULL(void) = 0;
X auth_results PCNFSD_AUTH(auth_args) = 1;
X pr_init_results PCNFSD_PR_INIT(pr_init_args) = 2;
X pr_start_results PCNFSD_PR_START(pr_start_args) = 3;
X } = 1;
X/*
X** Version 2 of the PCNFSD protocol.
X*/
X version PCNFSDV2 {
X void PCNFSD2_NULL(void) = 0;
X v2_info_results PCNFSD2_INFO(v2_info_args) = 1;
X v2_pr_init_results PCNFSD2_PR_INIT(v2_pr_init_args) = 2;
X v2_pr_start_results PCNFSD2_PR_START(v2_pr_start_args) = 3;
X v2_pr_list_results PCNFSD2_PR_LIST(void) = 4;
X v2_pr_queue_results PCNFSD2_PR_QUEUE(v2_pr_queue_args) = 5;
X v2_pr_status_results PCNFSD2_PR_STATUS(v2_pr_status_args) = 6;
X v2_pr_cancel_results PCNFSD2_PR_CANCEL(v2_pr_cancel_args) = 7;
X v2_pr_admin_results PCNFSD2_PR_ADMIN(v2_pr_admin_args) = 8;
X v2_pr_requeue_results PCNFSD2_PR_REQUEUE(v2_pr_requeue_args) = 9;
X v2_pr_hold_results PCNFSD2_PR_HOLD(v2_pr_hold_args) = 10;
X v2_pr_release_results PCNFSD2_PR_RELEASE(v2_pr_release_args) = 11;
X v2_mapid_results PCNFSD2_MAPID(v2_mapid_args) = 12;
X v2_auth_results PCNFSD2_AUTH(v2_auth_args) = 13;
X v2_alert_results PCNFSD2_ALERT(v2_alert_args) = 14;
X } = 2;
X
X} = 150001;
X
X/*
X** The following forces a publically-visible msgout()
X*/
X%#if RPC_SVC
X% void msgout(msg) char *msg; {_msgout(msg);}
X%#endif
X%#if RPC_HDR
X% extern void msgout();
X%#endif
SHAR_EOF
len=`wc -c < pcnfsd.x`
if test $len != 19131 ; then
echo shar: pcnfsd.x was $len bytes long, should have been 19131
fi
fi # end of overwriting check
exit 0
# End of shell archive
-- Geoff Arnold, PC-NFS architect, Sun Microsystems. (geoff@East.Sun.COM) --
------------------------------------------------------------------------------
-- Sun Microsystems PC Distributed Systems ... --
-- ... soon to be a part of SunTech (stay tuned for details) --