xref: /titanic_50/usr/src/cmd/lp/include/msgs.h (revision 0a44ef6d9afbfe052a7e975f55ea0d2954b62a82)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
545916cd2Sjpk  * Common Development and Distribution License (the "License").
645916cd2Sjpk  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
2245916cd2Sjpk  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
30*0a44ef6dSjacobs #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate # include	<sys/types.h>
337c478bd9Sstevel@tonic-gate # include	<poll.h>
347c478bd9Sstevel@tonic-gate # include	<stdarg.h>
357c478bd9Sstevel@tonic-gate # include	<stropts.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #if	!defined(_LP_MSGS_H)
387c478bd9Sstevel@tonic-gate # define	_LP_MSGS_H
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * THE DISPATCH TABLE DEPENDS ON EACH R_... MESSAGE FOLLOWING
427c478bd9Sstevel@tonic-gate  * IMMEDIATELY AFTER ITS CORRESPONDING S_... COUNTERPART.
437c478bd9Sstevel@tonic-gate  * I.E R_... MESSAGE FOR A S_... MESSAGE IS (S_... + 1)
447c478bd9Sstevel@tonic-gate  */
457c478bd9Sstevel@tonic-gate # define	R_BAD_MESSAGE			0
46*0a44ef6dSjacobs /* # define	S_NEW_QUEUE			1	DEFUNCT */
47*0a44ef6dSjacobs /* # define	R_NEW_QUEUE			2	DEFUNCT */
487c478bd9Sstevel@tonic-gate # define	S_ALLOC_FILES			3
497c478bd9Sstevel@tonic-gate # define	R_ALLOC_FILES			4
507c478bd9Sstevel@tonic-gate # define	S_PRINT_REQUEST			5
517c478bd9Sstevel@tonic-gate # define	R_PRINT_REQUEST			6
527c478bd9Sstevel@tonic-gate # define	S_START_CHANGE_REQUEST		7
537c478bd9Sstevel@tonic-gate # define	R_START_CHANGE_REQUEST		8
547c478bd9Sstevel@tonic-gate # define	S_END_CHANGE_REQUEST		9
557c478bd9Sstevel@tonic-gate # define	R_END_CHANGE_REQUEST		10
567c478bd9Sstevel@tonic-gate # define	S_CANCEL_REQUEST		11
577c478bd9Sstevel@tonic-gate # define	R_CANCEL_REQUEST		12
58*0a44ef6dSjacobs /* # define	S_INQUIRE_REQUEST		13	DEFUNCT */
59*0a44ef6dSjacobs /* # define	R_INQUIRE_REQUEST		14	DEFUNCT */
607c478bd9Sstevel@tonic-gate # define	S_LOAD_PRINTER			15
617c478bd9Sstevel@tonic-gate # define	R_LOAD_PRINTER			16
627c478bd9Sstevel@tonic-gate # define	S_UNLOAD_PRINTER		17
637c478bd9Sstevel@tonic-gate # define	R_UNLOAD_PRINTER		18
647c478bd9Sstevel@tonic-gate # define	S_INQUIRE_PRINTER_STATUS	19
657c478bd9Sstevel@tonic-gate # define	R_INQUIRE_PRINTER_STATUS	20
667c478bd9Sstevel@tonic-gate # define	S_LOAD_CLASS			21
677c478bd9Sstevel@tonic-gate # define	R_LOAD_CLASS			22
687c478bd9Sstevel@tonic-gate # define	S_UNLOAD_CLASS			23
697c478bd9Sstevel@tonic-gate # define	R_UNLOAD_CLASS			24
707c478bd9Sstevel@tonic-gate # define	S_INQUIRE_CLASS			25
717c478bd9Sstevel@tonic-gate # define	R_INQUIRE_CLASS			26
727c478bd9Sstevel@tonic-gate # define	S_MOUNT				27
737c478bd9Sstevel@tonic-gate # define	R_MOUNT				28
747c478bd9Sstevel@tonic-gate # define	S_UNMOUNT			29
757c478bd9Sstevel@tonic-gate # define	R_UNMOUNT			30
767c478bd9Sstevel@tonic-gate # define	S_MOVE_REQUEST			31
777c478bd9Sstevel@tonic-gate # define	R_MOVE_REQUEST			32
787c478bd9Sstevel@tonic-gate # define	S_MOVE_DEST			33
797c478bd9Sstevel@tonic-gate # define	R_MOVE_DEST			34
807c478bd9Sstevel@tonic-gate # define	S_ACCEPT_DEST			35
817c478bd9Sstevel@tonic-gate # define	R_ACCEPT_DEST			36
827c478bd9Sstevel@tonic-gate # define	S_REJECT_DEST			37
837c478bd9Sstevel@tonic-gate # define	R_REJECT_DEST			38
847c478bd9Sstevel@tonic-gate # define	S_ENABLE_DEST			39
857c478bd9Sstevel@tonic-gate # define	R_ENABLE_DEST			40
867c478bd9Sstevel@tonic-gate # define	S_DISABLE_DEST			41
877c478bd9Sstevel@tonic-gate # define	R_DISABLE_DEST			42
887c478bd9Sstevel@tonic-gate # define	S_LOAD_FILTER_TABLE		43
897c478bd9Sstevel@tonic-gate # define	R_LOAD_FILTER_TABLE		44
907c478bd9Sstevel@tonic-gate # define	S_UNLOAD_FILTER_TABLE		45
917c478bd9Sstevel@tonic-gate # define	R_UNLOAD_FILTER_TABLE		46
927c478bd9Sstevel@tonic-gate # define	S_LOAD_PRINTWHEEL		47
937c478bd9Sstevel@tonic-gate # define	R_LOAD_PRINTWHEEL		48
947c478bd9Sstevel@tonic-gate # define	S_UNLOAD_PRINTWHEEL		49
957c478bd9Sstevel@tonic-gate # define	R_UNLOAD_PRINTWHEEL		50
967c478bd9Sstevel@tonic-gate # define	S_LOAD_USER_FILE		51
977c478bd9Sstevel@tonic-gate # define	R_LOAD_USER_FILE		52
987c478bd9Sstevel@tonic-gate # define	S_UNLOAD_USER_FILE		53
997c478bd9Sstevel@tonic-gate # define	R_UNLOAD_USER_FILE		54
1007c478bd9Sstevel@tonic-gate # define	S_LOAD_FORM			55
1017c478bd9Sstevel@tonic-gate # define	R_LOAD_FORM			56
1027c478bd9Sstevel@tonic-gate # define	S_UNLOAD_FORM			57
1037c478bd9Sstevel@tonic-gate # define	R_UNLOAD_FORM			58
104*0a44ef6dSjacobs /* # define	S_GETSTATUS			59	DEFUNCT */
105*0a44ef6dSjacobs /* # define	R_GETSTATUS			60	DEFUNCT */
1067c478bd9Sstevel@tonic-gate # define	S_QUIET_ALERT			61
1077c478bd9Sstevel@tonic-gate # define	R_QUIET_ALERT			62
1087c478bd9Sstevel@tonic-gate # define	S_SEND_FAULT			63
1097c478bd9Sstevel@tonic-gate # define	R_SEND_FAULT			64
1107c478bd9Sstevel@tonic-gate # define	S_SHUTDOWN			65
1117c478bd9Sstevel@tonic-gate # define	R_SHUTDOWN			66
1127c478bd9Sstevel@tonic-gate # define	S_GOODBYE			67
1137c478bd9Sstevel@tonic-gate # define	S_CHILD_DONE			68
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate /*
1167c478bd9Sstevel@tonic-gate **	These are for use by the scheduler only
1177c478bd9Sstevel@tonic-gate */
1187c478bd9Sstevel@tonic-gate # define	I_GET_TYPE			69
1197c478bd9Sstevel@tonic-gate # define	I_QUEUE_CHK			70
120*0a44ef6dSjacobs /* # define	R_CONNECT			71	DEFUNCT */
1217c478bd9Sstevel@tonic-gate 
122*0a44ef6dSjacobs /* # define	S_GET_STATUS			72	DEFUNCT */
123*0a44ef6dSjacobs /* # define	R_GET_STATUS			73	DEFUNCT */
1247c478bd9Sstevel@tonic-gate # define	S_INQUIRE_REQUEST_RANK		74
1257c478bd9Sstevel@tonic-gate # define	R_INQUIRE_REQUEST_RANK		75
1267c478bd9Sstevel@tonic-gate # define	S_CANCEL			76
1277c478bd9Sstevel@tonic-gate # define	R_CANCEL			77
128*0a44ef6dSjacobs /* # define	S_NEW_CHILD			78	DEFUNCT */
129*0a44ef6dSjacobs /* # define	R_NEW_CHILD			79	DEFUNCT */
130*0a44ef6dSjacobs /* # define	S_SEND_JOB			80	DEFUNCT */
131*0a44ef6dSjacobs /* # define	R_SEND_JOB			81	DEFUNCT */
132*0a44ef6dSjacobs /* # define	S_JOB_COMPLETED			82	DEFUNCT */
133*0a44ef6dSjacobs /* # define	R_JOB_COMPLETED			83	DEFUNCT */
134*0a44ef6dSjacobs /* # define	S_INQUIRE_REMOTE_PRINTER	84	DEFUNCT */
135*0a44ef6dSjacobs /* # define	R_INQUIRE_REMOTE_PRINTER	20	DEFUNCT */
136*0a44ef6dSjacobs /* # define	S_CHILD_SYNC			85	DEFUNCT */
137*0a44ef6dSjacobs /* # define	S_LOAD_SYSTEM			86	DEFUNCT */
138*0a44ef6dSjacobs /* # define	R_LOAD_SYSTEM			87	DEFUNCT */
139*0a44ef6dSjacobs /* # define	S_UNLOAD_SYSTEM			88	DEFUNCT */
140*0a44ef6dSjacobs /* # define	R_UNLOAD_SYSTEM			89	DEFUNCT */
1417c478bd9Sstevel@tonic-gate /* new messages */
1427c478bd9Sstevel@tonic-gate # define	S_CLEAR_FAULT			90
1437c478bd9Sstevel@tonic-gate # define	R_CLEAR_FAULT			91
1447c478bd9Sstevel@tonic-gate # define	S_MOUNT_TRAY			92
1457c478bd9Sstevel@tonic-gate # define	R_MOUNT_TRAY			93
1467c478bd9Sstevel@tonic-gate # define	S_UNMOUNT_TRAY			94
1477c478bd9Sstevel@tonic-gate # define	R_UNMOUNT_TRAY			95
1487c478bd9Sstevel@tonic-gate # define	S_MAX_TRAYS			96
1497c478bd9Sstevel@tonic-gate # define	R_MAX_TRAYS			97
1507c478bd9Sstevel@tonic-gate # define	S_PAPER_CHANGED			98
1517c478bd9Sstevel@tonic-gate # define	R_PAPER_CHANGED			99
1527c478bd9Sstevel@tonic-gate # define	S_PAPER_ALLOWED			100
1537c478bd9Sstevel@tonic-gate # define	R_PAPER_ALLOWED			101
15445916cd2Sjpk # define	S_PASS_PEER_CONNECTION		102
15545916cd2Sjpk # define	R_PASS_PEER_CONNECTION		103
1567c478bd9Sstevel@tonic-gate /*
1577c478bd9Sstevel@tonic-gate **	Last available message
1587c478bd9Sstevel@tonic-gate */
15945916cd2Sjpk # define	LAST_MESSAGE			104
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate /*
1627c478bd9Sstevel@tonic-gate **      These are the possible status codes returned by the scheduler
1637c478bd9Sstevel@tonic-gate */
1647c478bd9Sstevel@tonic-gate # define	MOK		 0
1657c478bd9Sstevel@tonic-gate # define	MOKMORE		 1
1667c478bd9Sstevel@tonic-gate # define	MOKREMOTE	 2
1677c478bd9Sstevel@tonic-gate # define	MMORERR		 3
1687c478bd9Sstevel@tonic-gate # define	MNODEST		 4
1697c478bd9Sstevel@tonic-gate # define	MERRDEST	 5
1707c478bd9Sstevel@tonic-gate # define	MDENYDEST	 6
1717c478bd9Sstevel@tonic-gate # define	MNOMEDIA	 7
1727c478bd9Sstevel@tonic-gate # define	MDENYMEDIA	 8
1737c478bd9Sstevel@tonic-gate # define	MNOFILTER	 9
1747c478bd9Sstevel@tonic-gate # define	MNOINFO		10
1757c478bd9Sstevel@tonic-gate # define	MNOMEM		11
1767c478bd9Sstevel@tonic-gate # define	MNOMOUNT	12
1777c478bd9Sstevel@tonic-gate # define	MNOOPEN		13
1787c478bd9Sstevel@tonic-gate # define	MNOPERM		14
1797c478bd9Sstevel@tonic-gate # define	MNOSTART	15
1807c478bd9Sstevel@tonic-gate # define	MUNKNOWN	16
1817c478bd9Sstevel@tonic-gate # define	M2LATE		17
1827c478bd9Sstevel@tonic-gate # define	MNOSPACE	18
1837c478bd9Sstevel@tonic-gate # define	MBUSY		19
1847c478bd9Sstevel@tonic-gate # define	MTRANSMITERR	20
1857c478bd9Sstevel@tonic-gate # define	MNOMORE		21
1867c478bd9Sstevel@tonic-gate # define	MGONEREMOTE	22
1877c478bd9Sstevel@tonic-gate # define	MNOTRAY		23
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate /*
1907c478bd9Sstevel@tonic-gate ** Offsets and lengths of the various elements of the message header.
1917c478bd9Sstevel@tonic-gate **
1927c478bd9Sstevel@tonic-gate **	Macro		Data Type	Size	Comment
1937c478bd9Sstevel@tonic-gate **
1947c478bd9Sstevel@tonic-gate **	HEAD_RESYNC	2 bytes		(2)	*
1957c478bd9Sstevel@tonic-gate **	HEAD_AUTHCODE	short + long	(6)	*
1967c478bd9Sstevel@tonic-gate **
1977c478bd9Sstevel@tonic-gate **	HEAD_SIZE	4 bytes		(4)	\
1987c478bd9Sstevel@tonic-gate **	HEAD_TYPE	4 bytes		(4)	 > message propper
1997c478bd9Sstevel@tonic-gate **	HEAD_DATA	n bytes		(n)	/
2007c478bd9Sstevel@tonic-gate **
2017c478bd9Sstevel@tonic-gate **	TAIL_CHKSUM	4 bytes		(4)	*
2027c478bd9Sstevel@tonic-gate **	TAIL_ENDSYNC	2 bytes		(2)	*
2037c478bd9Sstevel@tonic-gate **
2047c478bd9Sstevel@tonic-gate **	Items marked with an asterisk are only used with the 3.2
2057c478bd9Sstevel@tonic-gate **	Spooler protocol.
2067c478bd9Sstevel@tonic-gate */
2077c478bd9Sstevel@tonic-gate 
2087c478bd9Sstevel@tonic-gate /*
2097c478bd9Sstevel@tonic-gate **	3.2 Protocol Header Information:
2107c478bd9Sstevel@tonic-gate **		2-byte message introduction
2117c478bd9Sstevel@tonic-gate **		6-byte client authorization data
2127c478bd9Sstevel@tonic-gate */
2137c478bd9Sstevel@tonic-gate #define	HEAD_RESYNC		(0)
2147c478bd9Sstevel@tonic-gate #define HEAD_RESYNC_LEN		2
2157c478bd9Sstevel@tonic-gate #define HEAD_AUTHCODE		(HEAD_RESYNC + HEAD_RESYNC_LEN)
2167c478bd9Sstevel@tonic-gate #define HEAD_AUTHCODE_LEN		(sizeof(short) + sizeof(long))
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate /*
2197c478bd9Sstevel@tonic-gate **	3.2 Protocol Message Information:
2207c478bd9Sstevel@tonic-gate **		4-byte message size
2217c478bd9Sstevel@tonic-gate **		4-byte message type
2227c478bd9Sstevel@tonic-gate **		n-byte message data
2237c478bd9Sstevel@tonic-gate */
2247c478bd9Sstevel@tonic-gate #define HEAD_SIZE		(HEAD_AUTHCODE + HEAD_AUTHCODE_LEN)
2257c478bd9Sstevel@tonic-gate #define HEAD_SIZE_LEN			4
2267c478bd9Sstevel@tonic-gate #define HEAD_TYPE		(HEAD_SIZE + HEAD_SIZE_LEN)
2277c478bd9Sstevel@tonic-gate #define HEAD_TYPE_LEN			4
2287c478bd9Sstevel@tonic-gate #define HEAD_DATA		(HEAD_TYPE + HEAD_TYPE_LEN)
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate /*
2317c478bd9Sstevel@tonic-gate **	3.2 Protocol Size of non-data header information
2327c478bd9Sstevel@tonic-gate */
2337c478bd9Sstevel@tonic-gate #define HEAD_LEN		HEAD_DATA
2347c478bd9Sstevel@tonic-gate 
2357c478bd9Sstevel@tonic-gate /*
2367c478bd9Sstevel@tonic-gate **	Equivalents for 4.0 protocol
2377c478bd9Sstevel@tonic-gate */
2387c478bd9Sstevel@tonic-gate #define MESG_SIZE		(0)
2397c478bd9Sstevel@tonic-gate #define MESG_SIZE_LEN			4
2407c478bd9Sstevel@tonic-gate #define MESG_TYPE		(MESG_SIZE + MESG_SIZE_LEN)
2417c478bd9Sstevel@tonic-gate #define MESG_TYPE_LEN			4
2427c478bd9Sstevel@tonic-gate #define MESG_DATA		(MESG_TYPE + MESG_TYPE_LEN)
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate #define MESG_LEN		MESG_DATA
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate **	3.2 Protocol Trailer Information:
2487c478bd9Sstevel@tonic-gate **		4-byte message check sum
2497c478bd9Sstevel@tonic-gate **		2-byte message closing identifier
2507c478bd9Sstevel@tonic-gate **
2517c478bd9Sstevel@tonic-gate **	"N" is the decoded value of buffer[HEAD_SIZE].  This must
2527c478bd9Sstevel@tonic-gate **	be provided because messages are variable length.
2537c478bd9Sstevel@tonic-gate */
2547c478bd9Sstevel@tonic-gate #define	TAIL_ENDSYNC_LEN		2
2557c478bd9Sstevel@tonic-gate #define	TAIL_ENDSYNC(N)		(N - TAIL_ENDSYNC_LEN)
2567c478bd9Sstevel@tonic-gate #define TAIL_CHKSUM_LEN			4
2577c478bd9Sstevel@tonic-gate #define TAIL_CHKSUM(N)		(TAIL_ENDSYNC(N) - TAIL_CHKSUM_LEN)
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /*
2607c478bd9Sstevel@tonic-gate **	3.2 Protocol Size of non-data trailer information
2617c478bd9Sstevel@tonic-gate */
2627c478bd9Sstevel@tonic-gate #define	TAIL_LEN		(TAIL_CHKSUM_LEN + TAIL_ENDSYNC_LEN)
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate /*
2657c478bd9Sstevel@tonic-gate **	3.2 Protocol Size of all non-data information
2667c478bd9Sstevel@tonic-gate **	(This is also the minimum size for 3.2 protocol messages)
2677c478bd9Sstevel@tonic-gate */
2687c478bd9Sstevel@tonic-gate #define	CONTROL_LEN		(HEAD_LEN + TAIL_LEN)
2697c478bd9Sstevel@tonic-gate 
2707c478bd9Sstevel@tonic-gate /*
2717c478bd9Sstevel@tonic-gate **	Size of excess data induced by 3.2 Protocol.
2727c478bd9Sstevel@tonic-gate **	(This is also the size differance between 3.2 & 4.0 protocols)
2737c478bd9Sstevel@tonic-gate */
2747c478bd9Sstevel@tonic-gate #define	EXCESS_3_2_LEN		(HEAD_SIZE + TAIL_LEN)
2757c478bd9Sstevel@tonic-gate /**
2767c478bd9Sstevel@tonic-gate  ** Checksum:
2777c478bd9Sstevel@tonic-gate  **/
2787c478bd9Sstevel@tonic-gate #define CALC_CHKSUM(B,SZ,RC) \
2797c478bd9Sstevel@tonic-gate if (SZ >= CONTROL_LEN) \
2807c478bd9Sstevel@tonic-gate { \
2817c478bd9Sstevel@tonic-gate     register unsigned char	*p = (unsigned char *)B, \
2827c478bd9Sstevel@tonic-gate 			    *pend = p + SZ - TAIL_LEN; \
2837c478bd9Sstevel@tonic-gate     RC = 0; \
2847c478bd9Sstevel@tonic-gate     while (p < pend) \
2857c478bd9Sstevel@tonic-gate 	RC += *p++;  /* let it overflow */ \
2867c478bd9Sstevel@tonic-gate } \
2877c478bd9Sstevel@tonic-gate else \
2887c478bd9Sstevel@tonic-gate     return ((errno = EINVAL, -1))
2897c478bd9Sstevel@tonic-gate 
2907c478bd9Sstevel@tonic-gate /*
2917c478bd9Sstevel@tonic-gate **      Largest size permitted for any given message
2927c478bd9Sstevel@tonic-gate */
2937c478bd9Sstevel@tonic-gate # define	MSGMAX		2048
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate /*
2967c478bd9Sstevel@tonic-gate **      Possible values of the type field of S_QUIET_ALERT
2977c478bd9Sstevel@tonic-gate */
2987c478bd9Sstevel@tonic-gate # define	QA_FORM		1
2997c478bd9Sstevel@tonic-gate # define	QA_PRINTER	2
3007c478bd9Sstevel@tonic-gate # define	QA_PRINTWHEEL	3
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate typedef	struct	strbuf	strbuf_t;	/*  STREAMS buffer */
3037c478bd9Sstevel@tonic-gate 
3047c478bd9Sstevel@tonic-gate typedef	struct mque
3057c478bd9Sstevel@tonic-gate {
3067c478bd9Sstevel@tonic-gate     struct mque	  *next;
3077c478bd9Sstevel@tonic-gate     struct strbuf *dat;
3087c478bd9Sstevel@tonic-gate } MQUE;
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate /*
3117c478bd9Sstevel@tonic-gate **	Definition of a message descriptor
3127c478bd9Sstevel@tonic-gate */
3137c478bd9Sstevel@tonic-gate typedef struct
3147c478bd9Sstevel@tonic-gate {
3157c478bd9Sstevel@tonic-gate     short	type;			/* type of connection */
3167c478bd9Sstevel@tonic-gate     int		readfd;			/* STREAM fd to read from */
3177c478bd9Sstevel@tonic-gate     int		writefd;		/* STREAM fd to write to */
3187c478bd9Sstevel@tonic-gate     int		wait;			/* number of systems waiting for */
3197c478bd9Sstevel@tonic-gate     char	*file;			/* pipe name if type==MD_FIFO */
3207c478bd9Sstevel@tonic-gate     short	state;			/* Current state of client */
3217c478bd9Sstevel@tonic-gate     short	admin;			/* Non zero if admin  */
3227c478bd9Sstevel@tonic-gate     short	event;			/* Event returned from poll */
3237c478bd9Sstevel@tonic-gate     MQUE *	mque;			/* backlogged message ptr */
3247c478bd9Sstevel@tonic-gate     uid_t	uid;			/* Clients UID */
3257c478bd9Sstevel@tonic-gate     gid_t	gid;			/* Clients GID */
32645916cd2Sjpk     char *	slabel;			/* Clients SLABEL */
3277c478bd9Sstevel@tonic-gate     void	(**on_discon)();	/* Clean up functions */
3287c478bd9Sstevel@tonic-gate } MESG;
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate # define	MDSIZE	(sizeof(MESG))
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate /*
3337c478bd9Sstevel@tonic-gate **	Possible values of MESG.state
3347c478bd9Sstevel@tonic-gate */
3357c478bd9Sstevel@tonic-gate # define	MDS_IDLE	0
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate # define	MDS_32PROTO	320
3387c478bd9Sstevel@tonic-gate # define	MDS_32CONNECT	321
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate /*
3417c478bd9Sstevel@tonic-gate **	Possible values of MESG.type
3427c478bd9Sstevel@tonic-gate */
3437c478bd9Sstevel@tonic-gate # define	MD_UNKNOWN	0	/* We don't know just yet */
3447c478bd9Sstevel@tonic-gate # define	MD_STREAM	1	/* 4.0 STREAMS pipe protocol */
3457c478bd9Sstevel@tonic-gate # define	MD_BOUND	2	/* 4.0 STREAMS fd protocol */
3467c478bd9Sstevel@tonic-gate # define	MD_SYS_FIFO	3	/* 3.2 named-pipe protocol */
3477c478bd9Sstevel@tonic-gate # define	MD_USR_FIFO	4	/* 3.2 named-pipe protocol */
3487c478bd9Sstevel@tonic-gate # define	MD_MASTER	5	/* MD_STREAM used by lpsched */
3497c478bd9Sstevel@tonic-gate # define	MD_CHILD	6	/* MD_STREAM to a child process */
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate /*
3527c478bd9Sstevel@tonic-gate **	Definition for a FIFO buffer (used
3537c478bd9Sstevel@tonic-gate **	in read_fifo.
3547c478bd9Sstevel@tonic-gate */
3557c478bd9Sstevel@tonic-gate typedef struct
3567c478bd9Sstevel@tonic-gate {
3577c478bd9Sstevel@tonic-gate 	int	full;
3587c478bd9Sstevel@tonic-gate 	char	save [MSGMAX],
3597c478bd9Sstevel@tonic-gate 		*psave,
3607c478bd9Sstevel@tonic-gate 		*psave_end;
3617c478bd9Sstevel@tonic-gate } fifobuffer_t;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate /*
3647c478bd9Sstevel@tonic-gate **      Definitions for the rest of the world and lint
3657c478bd9Sstevel@tonic-gate */
3667c478bd9Sstevel@tonic-gate /*
3677c478bd9Sstevel@tonic-gate **	Server functions in order of usage
3687c478bd9Sstevel@tonic-gate */
3697c478bd9Sstevel@tonic-gate MESG		* mcreate ( char * );
3707c478bd9Sstevel@tonic-gate int		mlisteninit ( MESG * );
3717c478bd9Sstevel@tonic-gate MESG		* mlisten ( void );
3727c478bd9Sstevel@tonic-gate int		mlistenadd ( MESG *, short );
3737c478bd9Sstevel@tonic-gate int		mon_discon ( MESG *, void (*)());
3747c478bd9Sstevel@tonic-gate MESG		* mlistenreset ( void );
3757c478bd9Sstevel@tonic-gate int		mdestroy ( MESG * );
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate /*
3787c478bd9Sstevel@tonic-gate **	Client functions in order of typical usage
3797c478bd9Sstevel@tonic-gate */
3807c478bd9Sstevel@tonic-gate MESG		* mconnect ( char *, int, int );
3817c478bd9Sstevel@tonic-gate int		mgetm ( MESG *, int, ... );
3827c478bd9Sstevel@tonic-gate int		mwrite ( MESG *, char * );
3837c478bd9Sstevel@tonic-gate int		mputm ( MESG *, int, ... );
3847c478bd9Sstevel@tonic-gate int		mread ( MESG *, char *, int );
3857c478bd9Sstevel@tonic-gate short		msize ( char * );
3867c478bd9Sstevel@tonic-gate short		mpeek ( MESG * );
3877c478bd9Sstevel@tonic-gate int		mdisconnect ( MESG * );
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate /*
3907c478bd9Sstevel@tonic-gate **	This may be called to deallocate internal buffers allocated
3917c478bd9Sstevel@tonic-gate **	by mgetm and mputm.  Probably not useful except right before
3927c478bd9Sstevel@tonic-gate **	a fork().
3937c478bd9Sstevel@tonic-gate */
3947c478bd9Sstevel@tonic-gate void		__mbfree ( void );
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate /*
3977c478bd9Sstevel@tonic-gate **	Client functions for pre-4.0 compatability
3987c478bd9Sstevel@tonic-gate */
3997c478bd9Sstevel@tonic-gate int		mclose ( void );
4007c478bd9Sstevel@tonic-gate int		mneeds ( void );
4017c478bd9Sstevel@tonic-gate int		mopen ( void );
4027c478bd9Sstevel@tonic-gate int		mrecv ( char *, int );
4037c478bd9Sstevel@tonic-gate int		msend ( char * );
4047c478bd9Sstevel@tonic-gate 
4057c478bd9Sstevel@tonic-gate int		Putmsg (MESG *, strbuf_t *, strbuf_t *, int);
4067c478bd9Sstevel@tonic-gate int		Getmsg (MESG *, strbuf_t *, strbuf_t *, int *);
4077c478bd9Sstevel@tonic-gate int		read3_2 (MESG * md, char *msgbuf, int size);
4087c478bd9Sstevel@tonic-gate int		write3_2 (MESG *, char *, int);
4097c478bd9Sstevel@tonic-gate int		read_fifo (int, char *, unsigned int);
4107c478bd9Sstevel@tonic-gate int		write_fifo (int, char *, unsigned int);
4117c478bd9Sstevel@tonic-gate int		ResetFifoBuffer (int);
4127c478bd9Sstevel@tonic-gate fifobuffer_t	*GetFifoBuffer (int);
4137c478bd9Sstevel@tonic-gate 
4147c478bd9Sstevel@tonic-gate /*
4157c478bd9Sstevel@tonic-gate **	General purpose message manipulating functions
4167c478bd9Sstevel@tonic-gate */
4177c478bd9Sstevel@tonic-gate char		* htos ( char *, unsigned short );
4187c478bd9Sstevel@tonic-gate char		* ltos ( char *, unsigned long );
4197c478bd9Sstevel@tonic-gate unsigned long	stol ( char * );
4207c478bd9Sstevel@tonic-gate unsigned short	stoh ( char * );
4217c478bd9Sstevel@tonic-gate int		_getmessage ( char *, short, va_list );
4227c478bd9Sstevel@tonic-gate int		_putmessage ( char *, short, va_list );
4237c478bd9Sstevel@tonic-gate int		getmessage ( char *, short, ... );
4247c478bd9Sstevel@tonic-gate int		putmessage ( char *, short, ... );
4257c478bd9Sstevel@tonic-gate 
4267c478bd9Sstevel@tonic-gate /*
4277c478bd9Sstevel@tonic-gate **	This will yield the type of a message
4287c478bd9Sstevel@tonic-gate */
4297c478bd9Sstevel@tonic-gate # define	mtype(buffer)	(getmessage(buffer, I_GET_TYPE))
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate /*
4327c478bd9Sstevel@tonic-gate **	This will yeild the size of a message
4337c478bd9Sstevel@tonic-gate */
4347c478bd9Sstevel@tonic-gate # define	msize(buffer)	(stoh(buffer))
4357c478bd9Sstevel@tonic-gate 
4367c478bd9Sstevel@tonic-gate /*
4377c478bd9Sstevel@tonic-gate **	Pass this for the request-id argument of S_CANCEL
4387c478bd9Sstevel@tonic-gate **	to obtain the effect of the 3.2 S_CANCEL_REQUEST.
4397c478bd9Sstevel@tonic-gate */
4407c478bd9Sstevel@tonic-gate # define	CURRENT_REQ	"current"
4417c478bd9Sstevel@tonic-gate 
4427c478bd9Sstevel@tonic-gate #endif	/* !defined (_LP_MSGS_H) */
443