1 /* $NetBSD: pcnfsd.x,v 1.5 2008/09/30 06:25:22 dholland Exp $ */
3 /* The maximum number of bytes in a user name argument */
5 /* The maximum number of bytes in a password argument */
6 const PASSWORDLEN = 64;
7 /* The maximum number of bytes in a print client name argument */
9 /* The maximum number of bytes in a printer name argument */
10 const PRINTERNAMELEN = 64;
11 /* The maximum number of bytes in a print user name argument */
12 const USERNAMELEN = 64;
13 /* The maximum number of bytes in a print spool file name argument */
14 const SPOOLNAMELEN = 64;
15 /* The maximum number of bytes in a print options argument */
16 const OPTIONSLEN = 64;
17 /* The maximum number of bytes in a print spool directory path */
18 const SPOOLDIRLEN = 255;
19 /* The maximum number of secondary GIDs returned by a V2 AUTH */
20 const EXTRAGIDLEN = 16;
21 /* The maximum number of bytes in a home directory spec */
22 const HOMEDIRLEN = 255;
23 /* The maximum number of bytes in a misc. comments string */
24 const COMMENTLEN = 255;
25 /* The maximum number of bytes in a print job id */
26 const PRINTJOBIDLEN = 255;
27 /* The maximum number of printers returned by a LIST operation */
29 /* The maximum number of print jobs returned by a QUEUE operation */
30 const PRQUEUEMAX = 128;
31 /* The maximum number of entries in the facilities list */
32 const FACILITIESMAX = 32;
33 /* The maximum length of an operator message */
34 const MESSAGELEN = 512;
38 typedef string ident<IDENTLEN>;
40 ** The type ident is used for passing an encoded user name for
41 ** authentication. The server should decode the string by replacing each
42 ** octet with the value formed by performing an exclusive-or of the octet
43 ** value with the value 0x5b and and'ing the result with 0x7f.
46 typedef string message<MESSAGELEN>;
48 ** The type message is used for passing an alert message to the
49 ** system operator on the server. The text may include newlines.
52 typedef string password<PASSWORDLEN>;
54 ** The type password is used for passing an encode password for
55 ** authentication. The server should decode the password as described
59 typedef string client<CLIENTLEN>;
61 ** The type client is used for passing the hostname of a client for
62 ** printing. The server may use this name in constructing the spool
66 typedef string printername<PRINTERNAMELEN>;
68 ** The type printername is used for passing the name of a printer on which
69 ** the client wishes to print.
72 typedef string username<USERNAMELEN>;
74 ** The type username is used for passing the user name for a print job.
75 ** The server may use this in any way it chooses: it may attempt to change
76 ** the effective identity with which it is running to username or may
77 ** simply arrange for the text to be printed on the banner page.
80 typedef string comment<COMMENTLEN>;
82 ** The type comment is used to pass an uninterpreted text string which
83 ** may be used by displayed to a human user or used for custom
84 ** extensions to the PCNFSD service. If you elect to extend PCNFSD
85 ** service in this way, please do so in a way which will avoid
86 ** problems if your client attempts to interoperate with a server
87 ** which does not support your extension. One way to do this is to
91 typedef string spoolname<SPOOLNAMELEN>;
93 ** The type spoolname is used for passing the name of a print spool file
94 ** (a simple filename not a pathname) within the spool directory.
97 typedef string printjobid<PRINTJOBIDLEN>;
99 ** The type printjobid is used for passing the id of a print job.
102 typedef string homedir<OPTIONSLEN>;
104 ** The type homedir is used to return the home directory for the user.
105 ** If present, it should be in the form "hostname:path", where hostname
106 ** and path are in a suitable form for communicating with the mount server.
109 typedef string options<OPTIONSLEN>;
111 ** The type options is used for passing implementation-specific print
112 ** control information. The option string is a set of printable ASCII
113 ** characters. The first character should be ignored by the server; it is
114 ** reserved for client use. The second character specifies the type of
115 ** data in the print file. The following types are defined (an
116 ** implementation may define additional values):
118 ** p - PostScript data. The client will ensure that a valid
119 ** PostScript header is included.
120 ** d - Diablo 630 data.
121 ** x - Generic printable ASCII text. The client will have filtered
122 ** out all non-printable characters other than CR, LF, TAB,
124 ** r - Raw print data. The client performs no filtering.
125 ** u - User-defined. Reserved for custom extensions. A vanilla
126 ** pcnfsd server will treat this as equivalent to "r"
128 ** If diablo data (type 'd') is specified, a formatting specification
129 ** string will be appended. This has the form:
132 ** Pitch - 10, 12 or 15.
134 ** The ``normal'' font to be used - encoded as follows:
137 ** Courier-Oblique con
138 ** Courier-BoldObliqu cob
140 ** Helvetica-Bold hrb
141 ** Helvetica-Oblique hon
142 ** Helvetica-BoldOblique hob
146 ** Times-BoldItalic tob
148 ** The ``bold'' font to be used - encoded in the same way. For example,
149 ** the string ``nd10hrbcob'' specifies that the print data is in Diablo
150 ** 630 format, it should be printed at 10 pitch, ``normal'' text should be
151 ** printed in Helvetica-Bold, and ``bold'' text should be printed in
152 ** Courier-BoldOblique.
161 ** The type arstat is returned by PCNFSD_AUTH. A value of AUTH_RES_OK
162 ** indicates that the server was able to verify the ident and password
163 ** successfully.AUTH_RES_FAIL is returned if a verification failure
164 ** occurred. The value AUTH_RES_FAKE may be used if the server wishes to
165 ** indicate that the verification failed, but that the server has
166 ** synthesised acceptable values for uid and gid which the client may use
175 ** The type alrstat is returned by PCNFSD_ALERT. A value of ALERT_RES_OK
176 ** indicates that the server was able to notify the system operator
177 ** successfully. ALERT_RES_FAIL is returned if a failure occurred
181 PI_RES_NO_SUCH_PRINTER = 1,
185 ** The type pirstat is returned by a number of print operations. PI_RES_OK
186 ** indicates that the operation was performed successfully. PI_RES_FAIL
187 ** indicates that the printer name was valid, but the operation could
188 ** not be performed. PI_RES_NO_SUCH_PRINTER indicates that the printer
189 ** name was not recognised.
194 PC_RES_NO_SUCH_PRINTER = 1,
195 PC_RES_NO_SUCH_JOB = 2,
196 PC_RES_NOT_OWNER = 3,
200 ** The type pcrstat is returned by a CANCEL, REQUEUE, HOLD, or RELEASE
202 ** PC_RES_OK indicates that the operation was performed successfully.
203 ** PC_RES_NO_SUCH_PRINTER indicates that the printer name was not recognised.
204 ** PC_RES_NO_SUCH_JOB means that the job does not exist, or is not
205 ** associated with the specified printer.
206 ** PC_RES_NOT_OWNER means that the user does not have permission to
207 ** manipulate the job.
208 ** PC_RES_FAIL means that the job could not be manipulated for an unknown
221 ** The type psrstat is returned by PCNFSD_PR_START. A value of PS_RES_OK
222 ** indicates that the server has started printing the job. It is possible
223 ** that the reply from a PCNFSD_PR_START call may be lost, in which case
224 ** the client will repeat the call. If the spool file is still in
225 ** existence, the server will return PS_RES_ALREADY indicating that it has
226 ** already started printing. If the file cannot be found, PS_RES_NO_FILE
227 ** is returned. PS_RES_NULL indicates that the spool file was empty,
228 ** while PS_RES_FAIL denotes a general failure. PI_RES_FAIL is returned
229 ** if spool directory could not be created. The value
230 ** PI_RES_NO_SUCH_PRINTER indicates that the printer name was not
241 ** The type mapreq identifies the type of a mapping request.
242 ** MAP_REQ_UID requests that the server treat the value in the
243 ** id field as a uid and return the corresponding username in name.
244 ** MAP_REQ_GID requests that the server treat the value in the
245 ** id field as a gid and return the corresponding groupname in name.
246 ** MAP_REQ_UNAME requests that the server treat the value in the
247 ** name field as a username and return the corresponding uid in id.
248 ** MAP_REQ_GNAME requests that the server treat the value in the
249 ** name field as a groupname and return the corresponding gid in id.
258 ** The type maprstat indicates the success or failure of
259 ** an individual mapping request.
263 **********************************************************
264 ** Version 1 of the PCNFSD protocol.
265 **********************************************************
271 struct auth_results {
277 struct pr_init_args {
281 struct pr_init_results {
286 struct pr_start_args {
293 struct pr_start_results {
299 **********************************************************
300 ** Version 2 of the PCNFSD protocol.
301 **********************************************************
304 struct v2_info_args {
309 struct v2_info_results {
312 int facilities<FACILITIESMAX>;
315 struct v2_pr_init_args {
320 struct v2_pr_init_results {
326 struct v2_pr_start_args {
335 struct v2_pr_start_results {
343 typedef struct pr_list_item *pr_list;
345 struct pr_list_item {
348 client remhost; /* empty if local */
353 struct v2_pr_list_results {
358 struct v2_pr_queue_args {
366 typedef struct pr_queue_item *pr_queue;
368 struct pr_queue_item {
380 struct v2_pr_queue_results {
390 struct v2_pr_cancel_args {
397 struct v2_pr_cancel_results {
403 struct v2_pr_status_args {
407 struct v2_pr_status_results {
417 struct v2_pr_admin_args {
423 struct v2_pr_admin_results {
428 struct v2_pr_requeue_args {
437 struct v2_pr_requeue_results {
442 struct v2_pr_hold_args {
449 struct v2_pr_hold_results {
454 struct v2_pr_release_args {
461 struct v2_pr_release_results {
467 typedef struct mapreq_arg_item *mapreq_arg;
469 struct mapreq_arg_item {
473 mapreq_arg mapreq_next;
476 typedef struct mapreq_res_item *mapreq_res;
478 struct mapreq_res_item {
483 mapreq_res mapreq_next;
486 struct v2_mapid_args {
492 struct v2_mapid_results {
497 struct v2_auth_args {
503 struct v2_auth_results {
507 unsigned int gids<EXTRAGIDLEN>;
513 struct v2_alert_args {
519 struct v2_alert_results {
526 **********************************************************
527 ** Protocol description for the PCNFSD program
528 **********************************************************
531 ** Version 1 of the PCNFSD protocol.
533 ** -- PCNFSD_NULL() = 0
534 ** Null procedure - standard for all RPC programs.
536 ** -- PCNFSD_AUTH() = 1
537 ** Perform user authentication - map username, password into uid, gid.
539 ** -- PCNFSD_PR_INIT() = 2
540 ** Prepare for remote printing: identify exporting spool directory.
542 ** -- PCNFSD_PR_START() = 3
543 ** Submit a spooled print job for printing: the print data is
544 ** in a file created in the spool directory.
546 ** Version 2 of the -- PCNFSD protocol.
548 ** -- PCNFSD2_NULL() = 0
549 ** Null procedure - standard for all RPC programs.
551 ** -- PCNFSD2_INFO() = 1
552 ** Determine which services are supported by this implementation
555 ** -- PCNFSD2_PR_INIT() = 2
556 ** Prepare for remote printing: identify exporting spool directory.
558 ** -- PCNFSD2_PR_START() = 3
559 ** Submit a spooled print job for printing: the print data is
560 ** in a file created in the spool directory.
562 ** -- PCNFSD2_PR_LIST() = 4
563 ** List all printers known on the server.
565 ** -- PCNFSD2_PR_QUEUE() = 5
566 ** List all or part of the queued jobs for a printer.
568 ** -- PCNFSD2_PR_STATUS() = 6
569 ** Determine the status of a printer.
571 ** -- PCNFSD2_PR_CANCEL() = 7
572 ** Cancel a print job.
574 ** -- PCNFSD2_PR_ADMIN() = 8
575 ** Perform an implementation-dependent printer administration
578 ** -- PCNFSD2_PR_REQUEUE() = 9
579 ** Change the queue position of a previously-submitted print job.
581 ** -- PCNFSD2_PR_HOLD() = 10
582 ** Place a "hold" on a previously-submitted print job. The job
583 ** will remain in the queue, but will not be printed.
585 ** -- PCNFSD2_PR_RELEASE() = 11
586 ** Release the "hold" on a previously-held print job.
588 ** -- PCNFSD2_MAPID() = 12
589 ** Perform one or more translations between user and group
592 ** -- PCNFSD2_AUTH() = 13
593 ** Perform user authentication - map username, password into uid, gid;
594 ** may also return secondary gids, home directory, umask.
596 ** -- PCNFSD2_ALERT() = 14
597 ** Send a message to the system operator.
601 void PCNFSD_NULL(void) = 0;
602 auth_results PCNFSD_AUTH(auth_args) = 1;
603 pr_init_results PCNFSD_PR_INIT(pr_init_args) = 2;
604 pr_start_results PCNFSD_PR_START(pr_start_args) = 3;
607 ** Version 2 of the PCNFSD protocol.
610 void PCNFSD2_NULL(void) = 0;
611 v2_info_results PCNFSD2_INFO(v2_info_args) = 1;
612 v2_pr_init_results PCNFSD2_PR_INIT(v2_pr_init_args) = 2;
613 v2_pr_start_results PCNFSD2_PR_START(v2_pr_start_args) = 3;
614 v2_pr_list_results PCNFSD2_PR_LIST(void) = 4;
615 v2_pr_queue_results PCNFSD2_PR_QUEUE(v2_pr_queue_args) = 5;
616 v2_pr_status_results PCNFSD2_PR_STATUS(v2_pr_status_args) = 6;
617 v2_pr_cancel_results PCNFSD2_PR_CANCEL(v2_pr_cancel_args) = 7;
618 v2_pr_admin_results PCNFSD2_PR_ADMIN(v2_pr_admin_args) = 8;
619 v2_pr_requeue_results PCNFSD2_PR_REQUEUE(v2_pr_requeue_args) = 9;
620 v2_pr_hold_results PCNFSD2_PR_HOLD(v2_pr_hold_args) = 10;
621 v2_pr_release_results PCNFSD2_PR_RELEASE(v2_pr_release_args) = 11;
622 v2_mapid_results PCNFSD2_MAPID(v2_mapid_args) = 12;
623 v2_auth_results PCNFSD2_AUTH(v2_auth_args) = 13;
624 v2_alert_results PCNFSD2_ALERT(v2_alert_args) = 14;
630 ** The following forces a publically-visible msg_out()
633 % static void _msgout __P((const char *));
634 % void msg_out(msg) const char *msg; {_msgout(msg);}
637 % extern void msg_out __P((const char *));
641 ** This allows initialization prior to running the service. (see PR 12758)