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