/* * Copyright (C) 2000 Kees Cook * cook@cpoint.net, http://outflux.net/ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * http://www.gnu.org/copyleft/gpl.html * */ #ifndef STS_H #define STS_H /* shamelessly stolen from EXT2 headers... */ /* * Define STS_DEBUG to produce debug messages */ #undef STS_DEBUG /* * Debug code * printf ("sts DEBUG (%s, %d): %s:", \ * __FILE__, __LINE__, __FUNCTION__); \ */ #ifdef STS_DEBUG # define sts_debug(f, a...) { \ printf (f, ## a); \ } #else # define sts_debug(f, a...) /**/ #endif #include "fas.h" /* for typing convenience */ #define SG_LEN sizeof(struct sg_header) #define MAX_PACKET 4096 /* scsi vendor info offsets */ #define EXTRA_OFF 4 /* where the extra len is */ #define VENDOR_START 8 /* Offset in reply data to vendor name */ #define VENDOR_LEN 8 /* length of vendor string */ #define PRODUCT_LEN 16 /* length of product string */ #define REV_LEN 4 /* length of rev string */ #define EXTRA_LEN 20 /* length of the extra string */ /* cmd list info */ typedef struct cmd_list_t { unsigned char * data; int size; struct cmd_list_t * prev; struct cmd_list_t * next; } cmd_list; /* port state info */ typedef struct port_state_t { int reserved; /* is this port reserved? */ int enabled; /* is this port enabled? */ int flowed; /* has this port been flowed? */ int paramed; /* has this port been paramed? */ int modemed; /* has this port been modemed? */ int available; /* has this port been successfully inited? */ /* waitlist[FAS_CMD_MAX] .... for the kernel stalls */ unsigned char * recvbuff; /* for remembering caller's recv buffers */ int status[FAS_CMD_MAX]; /* hold status info on commands */ /* serial stuff should go here ..... */ } port_state; /* pty state info */ typedef struct tty_state_t { int ptm; /* pseudo terminal master fd */ char * pts_name; /* strdup'd copy of the pt slave name */ /* anything else here? ..... */ } tty_state; /* sts structure */ typedef struct sts_state_t { int host, chan, id; /* SCSI identifiers */ char vendor[VENDOR_LEN + 1]; /* SCSI manufacturer string */ char product[PRODUCT_LEN + 1]; /* SCSI model string */ char rev[REV_LEN + 1]; /* SCSI revision */ char sendextra[EXTRA_LEN + 1]; /* SCSI vendor extras */ char recvextra[EXTRA_LEN + 1]; /* SCSI vendor extras */ int sendfd, recvfd; /* write and read fds (LUN 0 and 1) */ int total_ports; /* how many ports in the STS */ struct port_state_t ** ports; /* array of STS port info structures */ struct tty_state_t ** ttys; /* array of PTY info structures */ cmd_list * head; /* head of cmd list */ cmd_list * tail; /* tail of cmd list */ int writable; /* can I post an STS write cmd? */ int readable; /* can I post an STS read cmd? */ int flushed; /* msg recv are clear */ int globaled; /* did we init the sts? */ int portsensed; /* did we finish sensing the number of ports?*/ int shutdown; /* shutdown requested */ } sts_state; #endif