1*1ae08745Sheppo 2*1ae08745Sheppo /* 3*1ae08745Sheppo * CDDL HEADER START 4*1ae08745Sheppo * 5*1ae08745Sheppo * The contents of this file are subject to the terms of the 6*1ae08745Sheppo * Common Development and Distribution License (the "License"). 7*1ae08745Sheppo * You may not use this file except in compliance with the License. 8*1ae08745Sheppo * 9*1ae08745Sheppo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*1ae08745Sheppo * or http://www.opensolaris.org/os/licensing. 11*1ae08745Sheppo * See the License for the specific language governing permissions 12*1ae08745Sheppo * and limitations under the License. 13*1ae08745Sheppo * 14*1ae08745Sheppo * When distributing Covered Code, include this CDDL HEADER in each 15*1ae08745Sheppo * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*1ae08745Sheppo * If applicable, add the following below this CDDL HEADER, with the 17*1ae08745Sheppo * fields enclosed by brackets "[]" replaced with your own identifying 18*1ae08745Sheppo * information: Portions Copyright [yyyy] [name of copyright owner] 19*1ae08745Sheppo * 20*1ae08745Sheppo * CDDL HEADER END 21*1ae08745Sheppo */ 22*1ae08745Sheppo 23*1ae08745Sheppo /* 24*1ae08745Sheppo * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 25*1ae08745Sheppo * Use is subject to license terms. 26*1ae08745Sheppo */ 27*1ae08745Sheppo 28*1ae08745Sheppo #ifndef _VCC_H 29*1ae08745Sheppo #define _VCC_H 30*1ae08745Sheppo 31*1ae08745Sheppo #pragma ident "%Z%%M% %I% %E% SMI" 32*1ae08745Sheppo 33*1ae08745Sheppo #ifdef __cplusplus 34*1ae08745Sheppo extern "C" { 35*1ae08745Sheppo #endif 36*1ae08745Sheppo 37*1ae08745Sheppo #include <sys/stream.h> 38*1ae08745Sheppo #include <sys/ddi.h> 39*1ae08745Sheppo #include <sys/sunddi.h> 40*1ae08745Sheppo #include <sys/ioctl.h> 41*1ae08745Sheppo 42*1ae08745Sheppo /* 43*1ae08745Sheppo * vcc and vntsd exchange information using ioctl commands. When vntsd starts, 44*1ae08745Sheppo * it uses VCC_NUM_CONSOLE to get number of existing ports and 45*1ae08745Sheppo * VCC_CONS_TBL to obtain the table of existing consoles. In this table, 46*1ae08745Sheppo * vcc returns information about each of the console ports using vcc_console_t 47*1ae08745Sheppo * structure. Vntsd then sleeps on polling vcc control port. 48*1ae08745Sheppo * 49*1ae08745Sheppo * When there is a change in configuration, such as addtion or deletion 50*1ae08745Sheppo * of a console port, vcc wakes up vntsd via the poll events. Subsequently, 51*1ae08745Sheppo * vntsd uses VCC_INQUIRY ioctl to determine the reason for wakeup. In 52*1ae08745Sheppo * response to the inquiry, vcc provides a vcc_response_t structure 53*1ae08745Sheppo * containing reason and port number. 54*1ae08745Sheppo * 55*1ae08745Sheppo * If a port is being added or updated (group change), vntsd uses 56*1ae08745Sheppo * VCC_CONS_INFO ioctl with port number to obtain configuration of 57*1ae08745Sheppo * the port. 58*1ae08745Sheppo * 59*1ae08745Sheppo * If the port is being deleted, vntsd uses VCC_DEL_CONS_OK ioctl to notify 60*1ae08745Sheppo * vcc after its clean up is done. Vcc subsequently tears down 61*1ae08745Sheppo * its internal configuration and remove the associated TTY minor node. 62*1ae08745Sheppo * 63*1ae08745Sheppo * Only one open is allowd for each vcc port. If vntsd opens a port that is 64*1ae08745Sheppo * already open, vntsd will use VNTSD_FORCE_CLOSE to take port from other 65*1ae08745Sheppo * application 66*1ae08745Sheppo */ 67*1ae08745Sheppo 68*1ae08745Sheppo /* VCC CNTRL IOCTL */ 69*1ae08745Sheppo 70*1ae08745Sheppo #define VCC_IOCTL_CMD ('c' << 8) 71*1ae08745Sheppo 72*1ae08745Sheppo 73*1ae08745Sheppo #define VCC_NUM_CONSOLE VCC_IOCTL_CMD | 0x1 /* num of consoles */ 74*1ae08745Sheppo #define VCC_CONS_TBL VCC_IOCTL_CMD | 0x2 /* config table */ 75*1ae08745Sheppo #define VCC_INQUIRY VCC_IOCTL_CMD | 0x3 /* inquiry by vntsd */ 76*1ae08745Sheppo #define VCC_CONS_INFO VCC_IOCTL_CMD | 0x4 /* config */ 77*1ae08745Sheppo #define VCC_CONS_STATUS VCC_IOCTL_CMD | 0x5 /* console status */ 78*1ae08745Sheppo #define VCC_FORCE_CLOSE VCC_IOCTL_CMD | 0x6 /* force to close */ 79*1ae08745Sheppo 80*1ae08745Sheppo /* reasons to wake up vntsd */ 81*1ae08745Sheppo typedef enum { 82*1ae08745Sheppo VCC_CONS_ADDED, /* a port was added */ 83*1ae08745Sheppo VCC_CONS_DELETED, /* a port was removed */ 84*1ae08745Sheppo /* XXX not implemented yet */ 85*1ae08745Sheppo VCC_CONS_UPDATED /* a port configuration was changed */ 86*1ae08745Sheppo } vcc_reason_t; 87*1ae08745Sheppo 88*1ae08745Sheppo /* 89*1ae08745Sheppo * structure that vcc returns to vntsd in response to VCC_CONS_TBL and 90*1ae08745Sheppo * VCC_CONS_INFO ioctl call. 91*1ae08745Sheppo */ 92*1ae08745Sheppo typedef struct vcc_console { 93*1ae08745Sheppo int cons_no; /* console port number */ 94*1ae08745Sheppo uint64_t tcp_port; /* tcp port for the group */ 95*1ae08745Sheppo char domain_name[MAXPATHLEN]; /* domain name */ 96*1ae08745Sheppo char group_name[MAXPATHLEN]; /* group name */ 97*1ae08745Sheppo char dev_name[MAXPATHLEN]; 98*1ae08745Sheppo } vcc_console_t; 99*1ae08745Sheppo 100*1ae08745Sheppo /* structure that vcc sends to vntsd in response to wake up inquiry */ 101*1ae08745Sheppo typedef struct vcc_response { 102*1ae08745Sheppo int cons_no; /* console port number */ 103*1ae08745Sheppo vcc_reason_t reason; /* wake up reason */ 104*1ae08745Sheppo } vcc_response_t; 105*1ae08745Sheppo 106*1ae08745Sheppo #ifdef __cplusplus 107*1ae08745Sheppo } 108*1ae08745Sheppo #endif 109*1ae08745Sheppo 110*1ae08745Sheppo #endif /* _VCC_H */ 111