]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/compat/svr4/svr4_stropts.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / compat / svr4 / svr4_stropts.h
1 /*-
2  * Copyright (c) 1998 Mark Newton
3  * Copyright (c) 1994 Christos Zoulas
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  * 
28  * $FreeBSD$
29  */
30
31 #ifndef _SVR4_STROPTS_H_
32 #define _SVR4_STROPTS_H_
33
34
35 struct svr4_strbuf {
36         int      maxlen;
37         int      len;
38         char    *buf;
39 };
40
41 #define SVR4_STR             ('S' << 8)
42 #define SVR4_I_NREAD         (SVR4_STR| 1)
43 #define SVR4_I_PUSH          (SVR4_STR| 2)
44 #define SVR4_I_POP           (SVR4_STR| 3)
45 #define SVR4_I_LOOK          (SVR4_STR| 4)
46 #define SVR4_I_FLUSH         (SVR4_STR| 5)
47 #define SVR4_I_SRDOPT        (SVR4_STR| 6)
48 #define SVR4_I_GRDOPT        (SVR4_STR| 7)
49 #define SVR4_I_STR           (SVR4_STR| 8)
50 #define SVR4_I_SETSIG        (SVR4_STR| 9)
51 #define SVR4_I_GETSIG        (SVR4_STR|10)
52 #define SVR4_I_FIND          (SVR4_STR|11)
53 #define SVR4_I_LINK          (SVR4_STR|12)
54 #define SVR4_I_UNLINK        (SVR4_STR|13)
55 #define SVR4_I_ERECVFD       (SVR4_STR|14)
56 #define SVR4_I_PEEK          (SVR4_STR|15)
57 #define SVR4_I_FDINSERT      (SVR4_STR|16)
58 #define SVR4_I_SENDFD        (SVR4_STR|17)
59 #define SVR4_I_RECVFD        (SVR4_STR|18)
60 #define SVR4_I_SWROPT        (SVR4_STR|19)
61 #define SVR4_I_GWROPT        (SVR4_STR|20)
62 #define SVR4_I_LIST          (SVR4_STR|21)
63 #define SVR4_I_PLINK         (SVR4_STR|22)
64 #define SVR4_I_PUNLINK       (SVR4_STR|23)
65 #define SVR4_I_SETEV         (SVR4_STR|24)
66 #define SVR4_I_GETEV         (SVR4_STR|25)
67 #define SVR4_I_STREV         (SVR4_STR|26)
68 #define SVR4_I_UNSTREV       (SVR4_STR|27)
69 #define SVR4_I_FLUSHBAND     (SVR4_STR|28)
70 #define SVR4_I_CKBAND        (SVR4_STR|29)
71 #define SVR4_I_GETBAND       (SVR4_STR|30)
72 #define SVR4_I_ATMARK        (SVR4_STR|31)
73 #define SVR4_I_SETCLTIME     (SVR4_STR|32)
74 #define SVR4_I_GETCLTIME     (SVR4_STR|33)
75 #define SVR4_I_CANPUT        (SVR4_STR|34)
76
77 /*
78  * The following two ioctls are OS specific and
79  * undocumented.
80  */
81 #define SVR4__I_BIND_RSVD    (SVR4_STR|242)
82 #define SVR4__I_RELE_RSVD    (SVR4_STR|243)
83
84 /*
85  * Service type definitions
86  */
87 #define SVR4_T_COTS           1   /* Connection-orieted */
88 #define SVR4_T_COTS_ORD       2   /* Local connection-oriented */
89 #define SVR4_T_CLTS           3   /* Connectionless */
90
91 /* Struct passed for SVR4_I_STR */
92 struct svr4_strioctl {
93         u_long   cmd;
94         int      timeout;
95         int      len;
96         char    *buf;
97 };
98
99 /*
100  * Bits for I_{G,S}ETSIG
101  */
102 #define SVR4_S_INPUT    0x0001          /* any message on read queue no HIPRI */
103 #define SVR4_S_HIPRI    0x0002          /* high prio message on read queue */
104 #define SVR4_S_OUTPUT   0x0004          /* write queue has free space */
105 #define SVR4_S_MSG      0x0008          /* signal message in read queue head */
106 #define SVR4_S_ERROR    0x0010          /* error message in read queue head */
107 #define SVR4_S_HANGUP   0x0020          /* hangup message in read queue head */
108 #define SVR4_S_RDNORM   0x0040          /* normal message on read queue */
109 #define SVR4_S_WRNORM   S_OUTPUT        /* write queue has free space */
110 #define SVR4_S_RDBAND   0x0080          /* out of band message on read queue */
111 #define SVR4_S_WRBAND   0x0100          /* write queue has free space for oob */
112 #define SVR4_S_BANDURG  0x0200          /* generate SIGURG instead of SIGPOLL */
113 #define SVR4_S_ALLMASK  0x03ff          /* all events mask */
114
115 /*
116  * Our internal state for the stream
117  * For now we keep almost nothing... In the future we can keep more
118  * streams state.
119  *
120  * Locking key:
121  *      r - Read only field only set during creation
122  *      G - Giant
123  */
124 struct svr4_strm {
125         int     s_family;       /* (r) socket family */
126         int     s_cmd;          /* (G) last getmsg reply or putmsg request */
127         int     s_afd;          /* (G) last accepted fd; [for fd_insert] */
128         int     s_eventmask;    /* (G) state info from I_SETSIG et al */
129 };
130
131 /*
132  * The following structures are determined empirically.
133  */
134 struct svr4_strmcmd {
135         long    cmd;            /* command ?            */
136         long    len;            /* Address len          */
137         long    offs;           /* Address offset       */
138         long    pad[61];
139 };
140
141 struct svr4_infocmd {
142         long    cmd;
143         long    tsdu;
144         long    etsdu;
145         long    cdata;
146         long    ddata;
147         long    addr;
148         long    opt;
149         long    tidu;
150         long    serv;
151         long    current;
152         long    provider;
153 };
154
155 struct svr4_strfdinsert {
156         struct svr4_strbuf      ctl;
157         struct svr4_strbuf      data;
158         long                    flags;
159         int                     fd;
160         int                     offset;
161 };
162
163 struct svr4_netaddr_in {
164         u_short family;
165         u_short port;
166         u_long  addr;
167 };
168
169 struct svr4_netaddr_un {
170         u_short family;
171         char    path[1];
172 };
173
174 #define SVR4_ADDROF(sc) (void *) (((char *) (sc)) + (sc)->offs)
175 #define SVR4_C_ADDROF(sc) (const void *) (((const char *) (sc)) + (sc)->offs)
176
177 struct svr4_strm *svr4_stream_get(struct file *fp);
178
179 #endif /* !_SVR4_STROPTS */