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