xref: /titanic_44/usr/src/head/sac.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1997-1998 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _SAC_H
32*7c478bd9Sstevel@tonic-gate #define	_SAC_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.4 */
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
39*7c478bd9Sstevel@tonic-gate extern "C" {
40*7c478bd9Sstevel@tonic-gate #endif
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #define	IDLEN		4	/* length in bytes of a utmp id */
43*7c478bd9Sstevel@tonic-gate #define	SC_WILDC	0xff	/* wild character for utmp ids */
44*7c478bd9Sstevel@tonic-gate #define	PMTAGSIZE	14	/* maximum length in bytes for */
45*7c478bd9Sstevel@tonic-gate 				/* a port monitor tag */
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate /*
48*7c478bd9Sstevel@tonic-gate  * values for rflag in doconfig()
49*7c478bd9Sstevel@tonic-gate  */
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate #define	NOASSIGN	0x1	/* don't allow assign operations */
52*7c478bd9Sstevel@tonic-gate #define	NORUN		0x2	/* don't allow run or runwait operations */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * message to SAC (header only).  This header is forever fixed.  The
57*7c478bd9Sstevel@tonic-gate  * size field (pm_size) defines the size of the data portion of the
58*7c478bd9Sstevel@tonic-gate  * message, which follows the header.  The form of this optional
59*7c478bd9Sstevel@tonic-gate  * data portion is defined strictly by the message type (pm_type).
60*7c478bd9Sstevel@tonic-gate  */
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate struct	pmmsg {
63*7c478bd9Sstevel@tonic-gate 	char	pm_type;		/* type of message */
64*7c478bd9Sstevel@tonic-gate 	uchar_t	pm_state;		/* current state of port monitor */
65*7c478bd9Sstevel@tonic-gate 	char	pm_maxclass;		/* max message class this PM */
66*7c478bd9Sstevel@tonic-gate 					/* understands */
67*7c478bd9Sstevel@tonic-gate 	char	pm_tag[PMTAGSIZE + 1];	/* port monitor's tag */
68*7c478bd9Sstevel@tonic-gate 	int	pm_size;		/* size of optional data portion */
69*7c478bd9Sstevel@tonic-gate };
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate /*
74*7c478bd9Sstevel@tonic-gate  * pm_type values
75*7c478bd9Sstevel@tonic-gate  */
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate #define	PM_STATUS	1		/* status response */
78*7c478bd9Sstevel@tonic-gate #define	PM_UNKNOWN	2		/* an unknown message was received */
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * pm_state values
82*7c478bd9Sstevel@tonic-gate  */
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate /*
85*7c478bd9Sstevel@tonic-gate  * Class 1 responses
86*7c478bd9Sstevel@tonic-gate  */
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate #define	PM_STARTING	1		/* port monitor in starting state */
89*7c478bd9Sstevel@tonic-gate #define	PM_ENABLED	2		/* port monitor in enabled state */
90*7c478bd9Sstevel@tonic-gate #define	PM_DISABLED	3		/* port monitor in disabled state */
91*7c478bd9Sstevel@tonic-gate #define	PM_STOPPING	4		/* port monitor in stopping state */
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate /*
94*7c478bd9Sstevel@tonic-gate  * message to port monitor
95*7c478bd9Sstevel@tonic-gate  */
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate struct	sacmsg {
98*7c478bd9Sstevel@tonic-gate 	int	sc_size;		/* size of optional data portion */
99*7c478bd9Sstevel@tonic-gate 	char	sc_type;		/* type of message */
100*7c478bd9Sstevel@tonic-gate };
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /*
105*7c478bd9Sstevel@tonic-gate  * sc_type values
106*7c478bd9Sstevel@tonic-gate  * These represent commands that the SAC sends to a port monitor.  These
107*7c478bd9Sstevel@tonic-gate  * commands are divided into "classes" for extensibility.  Each subsequent
108*7c478bd9Sstevel@tonic-gate  * "class" is a superset of the previous "classes" plus the new commands
109*7c478bd9Sstevel@tonic-gate  * defined within that "class".  The header for all commands is identical;
110*7c478bd9Sstevel@tonic-gate  * however, a command may be defined such that an optional data portion may
111*7c478bd9Sstevel@tonic-gate  * be sent in addition to the header.  The format of this optional data piece
112*7c478bd9Sstevel@tonic-gate  * is self-defining based on the command.  Important note:  the first message
113*7c478bd9Sstevel@tonic-gate  * sent by the SAC will always be a class 1 message.  The port monitor
114*7c478bd9Sstevel@tonic-gate  * response will indicate the maximum class that it is able to understand.
115*7c478bd9Sstevel@tonic-gate  * Another note is that port monitors should only respond to a message with
116*7c478bd9Sstevel@tonic-gate  * an equivalent class response (i.e. a class 1 command causes a class 1
117*7c478bd9Sstevel@tonic-gate  * response).
118*7c478bd9Sstevel@tonic-gate  */
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate /*
121*7c478bd9Sstevel@tonic-gate  * Class 1 commands (currently, there are only class 1 commands)
122*7c478bd9Sstevel@tonic-gate  */
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #define	SC_STATUS	1		/* status request */
125*7c478bd9Sstevel@tonic-gate #define	SC_ENABLE	2		/* enable request */
126*7c478bd9Sstevel@tonic-gate #define	SC_DISABLE	3		/* disable request */
127*7c478bd9Sstevel@tonic-gate #define	SC_READDB	4		/* read pmtab request */
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate /*
130*7c478bd9Sstevel@tonic-gate  * `errno' values for Saferrno, note that Saferrno is used by
131*7c478bd9Sstevel@tonic-gate  * both pmadm and sacadm and these values are shared between
132*7c478bd9Sstevel@tonic-gate  * them
133*7c478bd9Sstevel@tonic-gate  */
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate #define	E_BADARGS	1	/* bad args or ill-formed command line */
136*7c478bd9Sstevel@tonic-gate #define	E_NOPRIV	2	/* user not privileged for operation */
137*7c478bd9Sstevel@tonic-gate #define	E_SAFERR	3	/* generic SAF error */
138*7c478bd9Sstevel@tonic-gate #define	E_SYSERR	4	/* system error */
139*7c478bd9Sstevel@tonic-gate #define	E_NOEXIST	5	/* invalid specification */
140*7c478bd9Sstevel@tonic-gate #define	E_DUP		6	/* entry already exists */
141*7c478bd9Sstevel@tonic-gate #define	E_PMRUN	7	/* port monitor is running */
142*7c478bd9Sstevel@tonic-gate #define	E_PMNOTRUN	8	/* port monitor is not running */
143*7c478bd9Sstevel@tonic-gate #define	E_RECOVER	9	/* in recovery */
144*7c478bd9Sstevel@tonic-gate #define	E_SACNOTRUN	10	/* sac daemon is not running */
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate #ifdef __STDC__
147*7c478bd9Sstevel@tonic-gate extern int	doconfig(int, char *, long);
148*7c478bd9Sstevel@tonic-gate #else
149*7c478bd9Sstevel@tonic-gate extern int	doconfig();
150*7c478bd9Sstevel@tonic-gate #endif
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
153*7c478bd9Sstevel@tonic-gate }
154*7c478bd9Sstevel@tonic-gate #endif
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #endif	/* _SAC_H */
157