1 #pragma once
2 
3 #ifdef __cplusplus
4 extern "C" {
5 #endif
6 
7 #define __SID ('S' << 8)
8 
9 #define I_NREAD (__SID | 1)
10 #define I_PUSH (__SID | 2)
11 #define I_POP (__SID | 3)
12 #define I_LOOK (__SID | 4)
13 #define I_FLUSH (__SID | 5)
14 #define I_SRDOPT (__SID | 6)
15 #define I_GRDOPT (__SID | 7)
16 #define I_STR (__SID | 8)
17 #define I_SETSIG (__SID | 9)
18 #define I_GETSIG (__SID | 10)
19 #define I_FIND (__SID | 11)
20 #define I_LINK (__SID | 12)
21 #define I_UNLINK (__SID | 13)
22 #define I_PEEK (__SID | 15)
23 #define I_FDINSERT (__SID | 16)
24 #define I_SENDFD (__SID | 17)
25 #define I_RECVFD (__SID | 14)
26 #define I_SWROPT (__SID | 19)
27 #define I_GWROPT (__SID | 20)
28 #define I_LIST (__SID | 21)
29 #define I_PLINK (__SID | 22)
30 #define I_PUNLINK (__SID | 23)
31 #define I_FLUSHBAND (__SID | 28)
32 #define I_CKBAND (__SID | 29)
33 #define I_GETBAND (__SID | 30)
34 #define I_ATMARK (__SID | 31)
35 #define I_SETCLTIME (__SID | 32)
36 #define I_GETCLTIME (__SID | 33)
37 #define I_CANPUT (__SID | 34)
38 
39 #define FMNAMESZ 8
40 
41 #define FLUSHR 0x01
42 #define FLUSHW 0x02
43 #define FLUSHRW 0x03
44 #define FLUSHBAND 0x04
45 
46 #define S_INPUT 0x0001
47 #define S_HIPRI 0x0002
48 #define S_OUTPUT 0x0004
49 #define S_MSG 0x0008
50 #define S_ERROR 0x0010
51 #define S_HANGUP 0x0020
52 #define S_RDNORM 0x0040
53 #define S_WRNORM S_OUTPUT
54 #define S_RDBAND 0x0080
55 #define S_WRBAND 0x0100
56 #define S_BANDURG 0x0200
57 
58 #define RS_HIPRI 0x01
59 
60 #define RNORM 0x0000
61 #define RMSGD 0x0001
62 #define RMSGN 0x0002
63 #define RPROTDAT 0x0004
64 #define RPROTDIS 0x0008
65 #define RPROTNORM 0x0010
66 #define RPROTMASK 0x001C
67 
68 #define SNDZERO 0x001
69 #define SNDPIPE 0x002
70 
71 #define ANYMARK 0x01
72 #define LASTMARK 0x02
73 
74 #define MUXID_ALL (-1)
75 
76 #define MSG_HIPRI 0x01
77 #define MSG_ANY 0x02
78 #define MSG_BAND 0x04
79 
80 #define MORECTL 1
81 #define MOREDATA 2
82 
83 struct bandinfo {
84     unsigned char bi_pri;
85     int bi_flag;
86 };
87 
88 struct strbuf {
89     int maxlen;
90     int len;
91     char* buf;
92 };
93 
94 struct strpeek {
95     struct strbuf ctlbuf;
96     struct strbuf databuf;
97     unsigned flags;
98 };
99 
100 struct strfdinsert {
101     struct strbuf ctlbuf;
102     struct strbuf databuf;
103     unsigned flags;
104     int fildes;
105     int offset;
106 };
107 
108 struct strioctl {
109     int ic_cmd;
110     int ic_timout;
111     int ic_len;
112     char* ic_dp;
113 };
114 
115 struct strrecvfd {
116     int fd;
117     int uid;
118     int gid;
119     char __fill[8];
120 };
121 
122 struct str_mlist {
123     char l_name[FMNAMESZ + 1];
124 };
125 
126 struct str_list {
127     int sl_nmods;
128     struct str_mlist* sl_modlist;
129 };
130 
131 int isastream(int);
132 int ioctl(int, int, ...);
133 
134 #ifdef __cplusplus
135 }
136 #endif
137