pcnfsd.x revision 1.1 1 /* The maximum number of bytes in a user name argument */
2 const IDENTLEN = 32;
3 /* The maximum number of bytes in a password argument */
4 const PASSWORDLEN = 64;
5 /* The maximum number of bytes in a print client name argument */
6 const CLIENTLEN = 64;
7 /* The maximum number of bytes in a printer name argument */
8 const PRINTERNAMELEN = 64;
9 /* The maximum number of bytes in a print user name argument */
10 const USERNAMELEN = 64;
11 /* The maximum number of bytes in a print spool file name argument */
12 const SPOOLNAMELEN = 64;
13 /* The maximum number of bytes in a print options argument */
14 const OPTIONSLEN = 64;
15 /* The maximum number of bytes in a print spool directory path */
16 const SPOOLDIRLEN = 255;
17 /* The maximum number of secondary GIDs returned by a V2 AUTH */
18 const EXTRAGIDLEN = 16;
19 /* The maximum number of bytes in a home directory spec */
20 const HOMEDIRLEN = 255;
21 /* The maximum number of bytes in a misc. comments string */
22 const COMMENTLEN = 255;
23 /* The maximum number of bytes in a print job id */
24 const PRINTJOBIDLEN = 255;
25 /* The maximum number of printers returned by a LIST operation */
26 const PRLISTMAX = 32;
27 /* The maximum number of print jobs returned by a QUEUE operation */
28 const PRQUEUEMAX = 128;
29 /* The maximum number of entries in the facilities list */
30 const FACILITIESMAX = 32;
31 /* The maximum length of an operator message */
32 const MESSAGELEN = 512;
33
34
35
36 typedef string ident<IDENTLEN>;
37 /*
38 ** The type ident is used for passing an encoded user name for
39 ** authentication. The server should decode the string by replacing each
40 ** octet with the value formed by performing an exclusive-or of the octet
41 ** value with the value 0x5b and and'ing the result with 0x7f.
42 */
43
44 typedef string message<MESSAGELEN>;
45 /*
46 ** The type message is used for passing an alert message to the
47 ** system operator on the server. The text may include newlines.
48 */
49
50 typedef string password<PASSWORDLEN>;
51 /*
52 ** The type password is used for passing an encode password for
53 ** authentication. The server should decode the password as described
54 ** above.
55 */
56
57 typedef string client<CLIENTLEN>;
58 /*
59 ** The type client is used for passing the hostname of a client for
60 ** printing. The server may use this name in constructing the spool
61 ** directory name.
62 */
63
64 typedef string printername<PRINTERNAMELEN>;
65 /*
66 ** The type printername is used for passing the name of a printer on which
67 ** the client wishes to print.
68 */
69
70 typedef string username<USERNAMELEN>;
71 /*
72 ** The type username is used for passing the user name for a print job.
73 ** The server may use this in any way it chooses: it may attempt to change
74 ** the effective identity with which it is running to username or may
75 ** simply arrange for the text to be printed on the banner page.
76 */
77
78 typedef string comment<COMMENTLEN>;
79 /*
80 ** The type comment is used to pass an uninterpreted text string which
81 ** may be used by displayed to a human user or used for custom
82 ** extensions to the PCNFSD service. If you elect to extend PCNFSD
83 ** service in this way, please do so in a way which will avoid
84 ** problems if your client attempts to interoperate with a server
85 ** which does not support your extension. One way to do this is to
86 ** use the
87 */
88
89 typedef string spoolname<SPOOLNAMELEN>;
90 /*
91 ** The type spoolname is used for passing the name of a print spool file
92 ** (a simple filename not a pathname) within the spool directory.
93 */
94
95 typedef string printjobid<PRINTJOBIDLEN>;
96 /*
97 ** The type printjobid is used for passing the id of a print job.
98 */
99
100 typedef string homedir<OPTIONSLEN>;
101 /*
102 ** The type homedir is used to return the home directory for the user.
103 ** If present, it should be in the form "hostname:path", where hostname
104 ** and path are in a suitable form for communicating with the mount server.
105 */
106
107 typedef string options<OPTIONSLEN>;
108 /*
109 ** The type options is used for passing implementation-specific print
110 ** control information. The option string is a set of printable ASCII
111 ** characters. The first character should be ignored by the server; it is
112 ** reserved for client use. The second character specifies the type of
113 ** data in the print file. The following types are defined (an
114 ** implementation may define additional values):
115 **
116 ** p - PostScript data. The client will ensure that a valid
117 ** PostScript header is included.
118 ** d - Diablo 630 data.
119 ** x - Generic printable ASCII text. The client will have filtered
120 ** out all non-printable characters other than CR, LF, TAB,
121 ** BS and VT.
122 ** r - Raw print data. The client performs no filtering.
123 ** u - User-defined. Reserved for custom extensions. A vanilla
124 ** pcnfsd server will treat this as equivalent to "r"
125 **
126 ** If diablo data (type 'd') is specified, a formatting specification
127 ** string will be appended. This has the form:
128 ** ppnnnbbb
129 ** pp
130 ** Pitch - 10, 12 or 15.
131 ** nnn
132 ** The ``normal'' font to be used - encoded as follows:
133 ** Courier crn
134 ** Courier-Bold crb
135 ** Courier-Oblique con
136 ** Courier-BoldObliqu cob
137 ** Helvetica hrn
138 ** Helvetica-Bold hrb
139 ** Helvetica-Oblique hon
140 ** Helvetica-BoldOblique hob
141 ** Times-Roman trn
142 ** Times-Bold trb
143 ** Times-Italic ton
144 ** Times-BoldItalic tob
145 ** bbb
146 ** The ``bold'' font to be used - encoded in the same way. For example,
147 ** the string ``nd10hrbcob'' specifies that the print data is in Diablo
148 ** 630 format, it should be printed at 10 pitch, ``normal'' text should be
149 ** printed in Helvetica-Bold, and ``bold'' text should be printed in
150 ** Courier-BoldOblique.
151 */
152
153 enum arstat {
154 AUTH_RES_OK = 0,
155 AUTH_RES_FAKE = 1,
156 AUTH_RES_FAIL = 2
157 };
158 /*
159 ** The type arstat is returned by PCNFSD_AUTH. A value of AUTH_RES_OK
160 ** indicates that the server was able to verify the ident and password
161 ** successfully.AUTH_RES_FAIL is returned if a verification failure
162 ** occurred. The value AUTH_RES_FAKE may be used if the server wishes to
163 ** indicate that the verification failed, but that the server has
164 ** synthesised acceptable values for uid and gid which the client may use
165 ** if it wishes.
166 */
167
168 enum alrstat {
169 ALERT_RES_OK = 0,
170 ALERT_RES_FAIL = 1
171 };
172 /*
173 ** The type alrstat is returned by PCNFSD_ALERT. A value of ALERT_RES_OK
174 ** indicates that the server was able to notify the system operator
175 ** successfully. ALERT_RES_FAIL is returned if a failure occurred
176 */
177 enum pirstat {
178 PI_RES_OK = 0,
179 PI_RES_NO_SUCH_PRINTER = 1,
180 PI_RES_FAIL = 2
181 };
182 /*
183 ** The type pirstat is returned by a number of print operations. PI_RES_OK
184 ** indicates that the operation was performed successfully. PI_RES_FAIL
185 ** indicates that the printer name was valid, but the operation could
186 ** not be performed. PI_RES_NO_SUCH_PRINTER indicates that the printer
187 ** name was not recognised.
188 */
189
190 enum pcrstat {
191 PC_RES_OK = 0,
192 PC_RES_NO_SUCH_PRINTER = 1,
193 PC_RES_NO_SUCH_JOB = 2,
194 PC_RES_NOT_OWNER = 3,
195 PC_RES_FAIL = 4
196 };
197 /*
198 ** The type pcrstat is returned by a CANCEL, REQUEUE, HOLD, or RELEASE
199 ** print operation.
200 ** PC_RES_OK indicates that the operation was performed successfully.
201 ** PC_RES_NO_SUCH_PRINTER indicates that the printer name was not recognised.
202 ** PC_RES_NO_SUCH_JOB means that the job does not exist, or is not
203 ** associated with the specified printer.
204 ** PC_RES_NOT_OWNER means that the user does not have permission to
205 ** manipulate the job.
206 ** PC_RES_FAIL means that the job could not be manipulated for an unknown
207 ** reason.
208 */
209
210
211 enum psrstat {
212 PS_RES_OK = 0,
213 PS_RES_ALREADY = 1,
214 PS_RES_NULL = 2,
215 PS_RES_NO_FILE = 3,
216 PS_RES_FAIL = 4
217 };
218 /*
219 ** The type psrstat is returned by PCNFSD_PR_START. A value of PS_RES_OK
220 ** indicates that the server has started printing the job. It is possible
221 ** that the reply from a PCNFSD_PR_START call may be lost, in which case
222 ** the client will repeat the call. If the spool file is still in
223 ** existence, the server will return PS_RES_ALREADY indicating that it has
224 ** already started printing. If the file cannot be found, PS_RES_NO_FILE
225 ** is returned. PS_RES_NULL indicates that the spool file was empty,
226 ** while PS_RES_FAIL denotes a general failure. PI_RES_FAIL is returned
227 ** if spool directory could not be created. The value
228 ** PI_RES_NO_SUCH_PRINTER indicates that the printer name was not
229 ** recognised.
230 */
231
232 enum mapreq {
233 MAP_REQ_UID = 0,
234 MAP_REQ_GID = 1,
235 MAP_REQ_UNAME = 2,
236 MAP_REQ_GNAME = 3
237 };
238 /*
239 ** The type mapreq identifies the type of a mapping request.
240 ** MAP_REQ_UID requests that the server treat the value in the
241 ** id field as a uid and return the corresponding username in name.
242 ** MAP_REQ_GID requests that the server treat the value in the
243 ** id field as a gid and return the corresponding groupname in name.
244 ** MAP_REQ_UNAME requests that the server treat the value in the
245 ** name field as a username and return the corresponding uid in id.
246 ** MAP_REQ_GNAME requests that the server treat the value in the
247 ** name field as a groupname and return the corresponding gid in id.
248 */
249
250 enum maprstat {
251 MAP_RES_OK = 0,
252 MAP_RES_UNKNOWN = 1,
253 MAP_RES_DENIED = 2
254 };
255 /*
256 ** The type maprstat indicates the success or failure of
257 ** an individual mapping request.
258 */
259
260 /*
261 **********************************************************
262 ** Version 1 of the PCNFSD protocol.
263 **********************************************************
264 */
265 struct auth_args {
266 ident id;
267 password pw;
268 };
269 struct auth_results {
270 arstat stat;
271 unsigned int uid;
272 unsigned int gid;
273 };
274
275 struct pr_init_args {
276 client system;
277 printername pn;
278 };
279 struct pr_init_results {
280 pirstat stat;
281 spoolname dir;
282 };
283
284 struct pr_start_args {
285 client system;
286 printername pn;
287 username user;
288 spoolname file;
289 options opts;
290 };
291 struct pr_start_results {
292 psrstat stat;
293 };
294
295
296 /*
297 **********************************************************
298 ** Version 2 of the PCNFSD protocol.
299 **********************************************************
300 */
301
302 struct v2_info_args {
303 comment vers;
304 comment cm;
305 };
306
307 struct v2_info_results {
308 comment vers;
309 comment cm;
310 int facilities<FACILITIESMAX>;
311 };
312
313 struct v2_pr_init_args {
314 client system;
315 printername pn;
316 comment cm;
317 };
318 struct v2_pr_init_results {
319 pirstat stat;
320 spoolname dir;
321 comment cm;
322 };
323
324 struct v2_pr_start_args {
325 client system;
326 printername pn;
327 username user;
328 spoolname file;
329 options opts;
330 int copies;
331 comment cm;
332 };
333 struct v2_pr_start_results {
334 psrstat stat;
335 printjobid id;
336 comment cm;
337 };
338
339
340
341 typedef struct pr_list_item *pr_list;
342
343 struct pr_list_item {
344 printername pn;
345 printername device;
346 client remhost; /* empty if local */
347 comment cm;
348 pr_list pr_next;
349 };
350
351 struct v2_pr_list_results {
352 comment cm;
353 pr_list printers;
354 };
355
356 struct v2_pr_queue_args {
357 printername pn;
358 client system;
359 username user;
360 bool just_mine;
361 comment cm;
362 };
363
364 typedef struct pr_queue_item *pr_queue;
365
366 struct pr_queue_item {
367 int position;
368 printjobid id;
369 comment size;
370 comment status;
371 client system;
372 username user;
373 spoolname file;
374 comment cm;
375 pr_queue pr_next;
376 };
377
378 struct v2_pr_queue_results {
379 pirstat stat;
380 comment cm;
381 bool just_yours;
382 int qlen;
383 int qshown;
384 pr_queue jobs;
385 };
386
387
388 struct v2_pr_cancel_args {
389 printername pn;
390 client system;
391 username user;
392 printjobid id;
393 comment cm;
394 };
395 struct v2_pr_cancel_results {
396 pcrstat stat;
397 comment cm;
398 };
399
400
401 struct v2_pr_status_args {
402 printername pn;
403 comment cm;
404 };
405 struct v2_pr_status_results {
406 pirstat stat;
407 bool avail;
408 bool printing;
409 int qlen;
410 bool needs_operator;
411 comment status;
412 comment cm;
413 };
414
415 struct v2_pr_admin_args {
416 client system;
417 username user;
418 printername pn;
419 comment cm;
420 };
421 struct v2_pr_admin_results {
422 pirstat stat;
423 comment cm;
424 };
425
426 struct v2_pr_requeue_args {
427 printername pn;
428 client system;
429 username user;
430 printjobid id;
431 int qpos;
432 comment cm;
433 };
434
435 struct v2_pr_requeue_results {
436 pcrstat stat;
437 comment cm;
438 };
439
440 struct v2_pr_hold_args {
441 printername pn;
442 client system;
443 username user;
444 printjobid id;
445 comment cm;
446 };
447 struct v2_pr_hold_results {
448 pcrstat stat;
449 comment cm;
450 };
451
452 struct v2_pr_release_args {
453 printername pn;
454 client system;
455 username user;
456 printjobid id;
457 comment cm;
458 };
459 struct v2_pr_release_results {
460 pcrstat stat;
461 comment cm;
462 };
463
464
465 typedef struct mapreq_arg_item *mapreq_arg;
466
467 struct mapreq_arg_item {
468 mapreq req;
469 int id;
470 username name;
471 mapreq_arg mapreq_next;
472 };
473
474 typedef struct mapreq_res_item *mapreq_res;
475
476 struct mapreq_res_item {
477 mapreq req;
478 maprstat stat;
479 int id;
480 username name;
481 mapreq_res mapreq_next;
482 };
483
484 struct v2_mapid_args {
485 comment cm;
486 mapreq_arg req_list;
487 };
488
489
490 struct v2_mapid_results {
491 comment cm;
492 mapreq_res res_list;
493 };
494
495 struct v2_auth_args {
496 client system;
497 ident id;
498 password pw;
499 comment cm;
500 };
501 struct v2_auth_results {
502 arstat stat;
503 unsigned int uid;
504 unsigned int gid;
505 unsigned int gids<EXTRAGIDLEN>;
506 homedir home;
507 int def_umask;
508 comment cm;
509 };
510
511 struct v2_alert_args {
512 client system;
513 printername pn;
514 username user;
515 message msg;
516 };
517 struct v2_alert_results {
518 alrstat stat;
519 comment cm;
520 };
521
522
523 /*
524 **********************************************************
525 ** Protocol description for the PCNFSD program
526 **********************************************************
527 */
528 /*
529 ** Version 1 of the PCNFSD protocol.
530 **
531 ** -- PCNFSD_NULL() = 0
532 ** Null procedure - standard for all RPC programs.
533 **
534 ** -- PCNFSD_AUTH() = 1
535 ** Perform user authentication - map username, password into uid, gid.
536 **
537 ** -- PCNFSD_PR_INIT() = 2
538 ** Prepare for remote printing: identify exporting spool directory.
539 **
540 ** -- PCNFSD_PR_START() = 3
541 ** Submit a spooled print job for printing: the print data is
542 ** in a file created in the spool directory.
543 **
544 ** Version 2 of the -- PCNFSD protocol.
545 **
546 ** -- PCNFSD2_NULL() = 0
547 ** Null procedure - standard for all RPC programs.
548 **
549 ** -- PCNFSD2_INFO() = 1
550 ** Determine which services are supported by this implementation
551 ** of PCNFSD.
552 **
553 ** -- PCNFSD2_PR_INIT() = 2
554 ** Prepare for remote printing: identify exporting spool directory.
555 **
556 ** -- PCNFSD2_PR_START() = 3
557 ** Submit a spooled print job for printing: the print data is
558 ** in a file created in the spool directory.
559 **
560 ** -- PCNFSD2_PR_LIST() = 4
561 ** List all printers known on the server.
562 **
563 ** -- PCNFSD2_PR_QUEUE() = 5
564 ** List all or part of the queued jobs for a printer.
565 **
566 ** -- PCNFSD2_PR_STATUS() = 6
567 ** Determine the status of a printer.
568 **
569 ** -- PCNFSD2_PR_CANCEL() = 7
570 ** Cancel a print job.
571 **
572 ** -- PCNFSD2_PR_ADMIN() = 8
573 ** Perform an implementation-dependent printer administration
574 ** operation.
575 **
576 ** -- PCNFSD2_PR_REQUEUE() = 9
577 ** Change the queue position of a previously-submitted print job.
578 **
579 ** -- PCNFSD2_PR_HOLD() = 10
580 ** Place a "hold" on a previously-submitted print job. The job
581 ** will remain in the queue, but will not be printed.
582 **
583 ** -- PCNFSD2_PR_RELEASE() = 11
584 ** Release the "hold" on a previously-held print job.
585 **
586 ** -- PCNFSD2_MAPID() = 12
587 ** Perform one or more translations between user and group
588 ** names and IDs.
589 **
590 ** -- PCNFSD2_AUTH() = 13
591 ** Perform user authentication - map username, password into uid, gid;
592 ** may also return secondary gids, home directory, umask.
593 **
594 ** -- PCNFSD2_ALERT() = 14
595 ** Send a message to the system operator.
596 */
597 program PCNFSDPROG {
598 version PCNFSDVERS {
599 void PCNFSD_NULL(void) = 0;
600 auth_results PCNFSD_AUTH(auth_args) = 1;
601 pr_init_results PCNFSD_PR_INIT(pr_init_args) = 2;
602 pr_start_results PCNFSD_PR_START(pr_start_args) = 3;
603 } = 1;
604 /*
605 ** Version 2 of the PCNFSD protocol.
606 */
607 version PCNFSDV2 {
608 void PCNFSD2_NULL(void) = 0;
609 v2_info_results PCNFSD2_INFO(v2_info_args) = 1;
610 v2_pr_init_results PCNFSD2_PR_INIT(v2_pr_init_args) = 2;
611 v2_pr_start_results PCNFSD2_PR_START(v2_pr_start_args) = 3;
612 v2_pr_list_results PCNFSD2_PR_LIST(void) = 4;
613 v2_pr_queue_results PCNFSD2_PR_QUEUE(v2_pr_queue_args) = 5;
614 v2_pr_status_results PCNFSD2_PR_STATUS(v2_pr_status_args) = 6;
615 v2_pr_cancel_results PCNFSD2_PR_CANCEL(v2_pr_cancel_args) = 7;
616 v2_pr_admin_results PCNFSD2_PR_ADMIN(v2_pr_admin_args) = 8;
617 v2_pr_requeue_results PCNFSD2_PR_REQUEUE(v2_pr_requeue_args) = 9;
618 v2_pr_hold_results PCNFSD2_PR_HOLD(v2_pr_hold_args) = 10;
619 v2_pr_release_results PCNFSD2_PR_RELEASE(v2_pr_release_args) = 11;
620 v2_mapid_results PCNFSD2_MAPID(v2_mapid_args) = 12;
621 v2_auth_results PCNFSD2_AUTH(v2_auth_args) = 13;
622 v2_alert_results PCNFSD2_ALERT(v2_alert_args) = 14;
623 } = 2;
624
625 } = 150001;
626
627 /*
628 ** The following forces a publically-visible msg_out()
629 */
630 %#if RPC_SVC
631 % static void _msgout();
632 % void msg_out(msg) char *msg; {_msgout(msg);}
633 %#endif
634 %#if RPC_HDR
635 % extern void msg_out();
636 %#endif
637