1139743Simp/*- 243412Snewton * Copyright (c) 1998 Mark Newton 343412Snewton * Copyright (c) 1994 Christos Zoulas 443412Snewton * All rights reserved. 543412Snewton * 643412Snewton * Redistribution and use in source and binary forms, with or without 743412Snewton * modification, are permitted provided that the following conditions 843412Snewton * are met: 943412Snewton * 1. Redistributions of source code must retain the above copyright 1043412Snewton * notice, this list of conditions and the following disclaimer. 1143412Snewton * 2. Redistributions in binary form must reproduce the above copyright 1243412Snewton * notice, this list of conditions and the following disclaimer in the 1343412Snewton * documentation and/or other materials provided with the distribution. 1443412Snewton * 3. The name of the author may not be used to endorse or promote products 1543412Snewton * derived from this software without specific prior written permission 1643412Snewton * 1743412Snewton * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1843412Snewton * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1943412Snewton * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2043412Snewton * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2143412Snewton * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2243412Snewton * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2343412Snewton * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2443412Snewton * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2543412Snewton * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2643412Snewton * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2749267Snewton * 2850477Speter * $FreeBSD$ 2943412Snewton */ 3043412Snewton 3143412Snewton#ifndef _SVR4_STROPTS_H_ 3243412Snewton#define _SVR4_STROPTS_H_ 3343412Snewton 3443412Snewton 3543412Snewtonstruct svr4_strbuf { 3643412Snewton int maxlen; 3743412Snewton int len; 3843412Snewton char *buf; 3943412Snewton}; 4043412Snewton 4143412Snewton#define SVR4_STR ('S' << 8) 4243412Snewton#define SVR4_I_NREAD (SVR4_STR| 1) 4343412Snewton#define SVR4_I_PUSH (SVR4_STR| 2) 4443412Snewton#define SVR4_I_POP (SVR4_STR| 3) 4543412Snewton#define SVR4_I_LOOK (SVR4_STR| 4) 4643412Snewton#define SVR4_I_FLUSH (SVR4_STR| 5) 4743412Snewton#define SVR4_I_SRDOPT (SVR4_STR| 6) 4843412Snewton#define SVR4_I_GRDOPT (SVR4_STR| 7) 4943412Snewton#define SVR4_I_STR (SVR4_STR| 8) 5043412Snewton#define SVR4_I_SETSIG (SVR4_STR| 9) 5143412Snewton#define SVR4_I_GETSIG (SVR4_STR|10) 5243412Snewton#define SVR4_I_FIND (SVR4_STR|11) 5343412Snewton#define SVR4_I_LINK (SVR4_STR|12) 5443412Snewton#define SVR4_I_UNLINK (SVR4_STR|13) 5543412Snewton#define SVR4_I_ERECVFD (SVR4_STR|14) 5643412Snewton#define SVR4_I_PEEK (SVR4_STR|15) 5743412Snewton#define SVR4_I_FDINSERT (SVR4_STR|16) 5843412Snewton#define SVR4_I_SENDFD (SVR4_STR|17) 5943412Snewton#define SVR4_I_RECVFD (SVR4_STR|18) 6043412Snewton#define SVR4_I_SWROPT (SVR4_STR|19) 6143412Snewton#define SVR4_I_GWROPT (SVR4_STR|20) 6243412Snewton#define SVR4_I_LIST (SVR4_STR|21) 6343412Snewton#define SVR4_I_PLINK (SVR4_STR|22) 6443412Snewton#define SVR4_I_PUNLINK (SVR4_STR|23) 6543412Snewton#define SVR4_I_SETEV (SVR4_STR|24) 6643412Snewton#define SVR4_I_GETEV (SVR4_STR|25) 6743412Snewton#define SVR4_I_STREV (SVR4_STR|26) 6843412Snewton#define SVR4_I_UNSTREV (SVR4_STR|27) 6943412Snewton#define SVR4_I_FLUSHBAND (SVR4_STR|28) 7043412Snewton#define SVR4_I_CKBAND (SVR4_STR|29) 7143412Snewton#define SVR4_I_GETBAND (SVR4_STR|30) 7243412Snewton#define SVR4_I_ATMARK (SVR4_STR|31) 7343412Snewton#define SVR4_I_SETCLTIME (SVR4_STR|32) 7443412Snewton#define SVR4_I_GETCLTIME (SVR4_STR|33) 7543412Snewton#define SVR4_I_CANPUT (SVR4_STR|34) 7643412Snewton 7743412Snewton/* 7843412Snewton * The following two ioctls are OS specific and 7943412Snewton * undocumented. 8043412Snewton */ 8143412Snewton#define SVR4__I_BIND_RSVD (SVR4_STR|242) 8243412Snewton#define SVR4__I_RELE_RSVD (SVR4_STR|243) 8343412Snewton 8443412Snewton/* 8543412Snewton * Service type definitions 8643412Snewton */ 8743412Snewton#define SVR4_T_COTS 1 /* Connection-orieted */ 8843412Snewton#define SVR4_T_COTS_ORD 2 /* Local connection-oriented */ 8943412Snewton#define SVR4_T_CLTS 3 /* Connectionless */ 9043412Snewton 9143412Snewton/* Struct passed for SVR4_I_STR */ 9243412Snewtonstruct svr4_strioctl { 9343412Snewton u_long cmd; 9443412Snewton int timeout; 9543412Snewton int len; 9643412Snewton char *buf; 9743412Snewton}; 9843412Snewton 9943412Snewton/* 10043412Snewton * Bits for I_{G,S}ETSIG 10143412Snewton */ 10243412Snewton#define SVR4_S_INPUT 0x0001 /* any message on read queue no HIPRI */ 10343412Snewton#define SVR4_S_HIPRI 0x0002 /* high prio message on read queue */ 10443412Snewton#define SVR4_S_OUTPUT 0x0004 /* write queue has free space */ 10543412Snewton#define SVR4_S_MSG 0x0008 /* signal message in read queue head */ 10643412Snewton#define SVR4_S_ERROR 0x0010 /* error message in read queue head */ 10743412Snewton#define SVR4_S_HANGUP 0x0020 /* hangup message in read queue head */ 10843412Snewton#define SVR4_S_RDNORM 0x0040 /* normal message on read queue */ 10943412Snewton#define SVR4_S_WRNORM S_OUTPUT /* write queue has free space */ 11043412Snewton#define SVR4_S_RDBAND 0x0080 /* out of band message on read queue */ 11143412Snewton#define SVR4_S_WRBAND 0x0100 /* write queue has free space for oob */ 11243412Snewton#define SVR4_S_BANDURG 0x0200 /* generate SIGURG instead of SIGPOLL */ 11343412Snewton#define SVR4_S_ALLMASK 0x03ff /* all events mask */ 11443412Snewton 11543412Snewton/* 11643412Snewton * Our internal state for the stream 11743412Snewton * For now we keep almost nothing... In the future we can keep more 11843412Snewton * streams state. 119160794Sjhb * 120160794Sjhb * Locking key: 121160794Sjhb * r - Read only field only set during creation 122160794Sjhb * G - Giant 12343412Snewton */ 12443412Snewtonstruct svr4_strm { 125160794Sjhb int s_family; /* (r) socket family */ 126160794Sjhb int s_cmd; /* (G) last getmsg reply or putmsg request */ 127160794Sjhb int s_afd; /* (G) last accepted fd; [for fd_insert] */ 128160794Sjhb int s_eventmask; /* (G) state info from I_SETSIG et al */ 12943412Snewton}; 13043412Snewton 13143412Snewton/* 13243412Snewton * The following structures are determined empirically. 13343412Snewton */ 13443412Snewtonstruct svr4_strmcmd { 13543412Snewton long cmd; /* command ? */ 13643412Snewton long len; /* Address len */ 13743412Snewton long offs; /* Address offset */ 13843412Snewton long pad[61]; 13943412Snewton}; 14043412Snewton 14143412Snewtonstruct svr4_infocmd { 14243412Snewton long cmd; 14343412Snewton long tsdu; 14443412Snewton long etsdu; 14543412Snewton long cdata; 14643412Snewton long ddata; 14743412Snewton long addr; 14843412Snewton long opt; 14943412Snewton long tidu; 15043412Snewton long serv; 15143412Snewton long current; 15243412Snewton long provider; 15343412Snewton}; 15443412Snewton 15543412Snewtonstruct svr4_strfdinsert { 15643412Snewton struct svr4_strbuf ctl; 15743412Snewton struct svr4_strbuf data; 15843412Snewton long flags; 15943412Snewton int fd; 16043412Snewton int offset; 16143412Snewton}; 16243412Snewton 16343412Snewtonstruct svr4_netaddr_in { 16443412Snewton u_short family; 16543412Snewton u_short port; 16643412Snewton u_long addr; 16743412Snewton}; 16843412Snewton 16943412Snewtonstruct svr4_netaddr_un { 17043412Snewton u_short family; 17143412Snewton char path[1]; 17243412Snewton}; 17343412Snewton 17443412Snewton#define SVR4_ADDROF(sc) (void *) (((char *) (sc)) + (sc)->offs) 17543412Snewton#define SVR4_C_ADDROF(sc) (const void *) (((const char *) (sc)) + (sc)->offs) 17643412Snewton 17792761Salfredstruct svr4_strm *svr4_stream_get(struct file *fp); 17843412Snewton 17943412Snewton#endif /* !_SVR4_STROPTS */ 180