1 /* $Id: socksys.h,v 1.2 1998/03/26 08:46:07 jj Exp $
2  * socksys.h: Definitions for STREAMS modules emulation code.
3  *
4  * Copyright (C) 1998 Patrik Rak (prak3264@ss1000.ms.mff.cuni.cz)
5  */
6 
7 #define MSG_HIPRI	0x01
8 #define MSG_ANY		0x02
9 #define MSG_BAND	0x04
10 
11 #define MORECTL		1
12 #define MOREDATA	2
13 
14 #define	TBADADDR		1
15 #define	TBADOPT			2
16 #define	TACCES			3
17 #define TBADF			4
18 #define TNOADDR			5
19 #define TOUTSTATE	        6
20 #define TBADSEQ		        7
21 #define TSYSERR			8
22 #define TLOOK		        9
23 #define TBADDATA	       10
24 #define TBUFOVFLW	       11
25 #define TFLOW		       12
26 #define	TNODATA		       13
27 #define TNODIS		       14
28 #define TNOUDERR	       15
29 #define TBADFLAG	       16
30 #define TNOREL		       17
31 #define TNOTSUPPORT	       18
32 #define TSTATECHNG	       19
33 
34 #define T_CONN_REQ      0
35 #define T_CONN_RES      1
36 #define T_DISCON_REQ    2
37 #define T_DATA_REQ      3
38 #define T_EXDATA_REQ    4
39 #define T_INFO_REQ      5
40 #define T_BIND_REQ      6
41 #define T_UNBIND_REQ    7
42 #define T_UNITDATA_REQ  8
43 #define T_OPTMGMT_REQ   9
44 #define T_ORDREL_REQ    10
45 
46 #define T_CONN_IND      11
47 #define T_CONN_CON      12
48 #define T_DISCON_IND    13
49 #define T_DATA_IND      14
50 #define T_EXDATA_IND    15
51 #define T_INFO_ACK      16
52 #define T_BIND_ACK      17
53 #define T_ERROR_ACK     18
54 #define T_OK_ACK        19
55 #define T_UNITDATA_IND  20
56 #define T_UDERROR_IND   21
57 #define T_OPTMGMT_ACK   22
58 #define T_ORDREL_IND    23
59 
60 #define T_NEGOTIATE	0x0004
61 #define T_FAILURE	0x0040
62 
63 #define TS_UNBND	0	/* unbound */
64 #define	TS_WACK_BREQ	1	/* waiting for T_BIND_REQ ack  */
65 #define TS_WACK_UREQ	2	/* waiting for T_UNBIND_REQ ack */
66 #define TS_IDLE		3	/* idle */
67 #define TS_WACK_OPTREQ	4	/* waiting for T_OPTMGMT_REQ ack */
68 #define TS_WACK_CREQ	5	/* waiting for T_CONN_REQ ack */
69 #define TS_WCON_CREQ	6	/* waiting for T_CONN_REQ confirmation */
70 #define	TS_WRES_CIND	7	/* waiting for T_CONN_IND */
71 #define TS_WACK_CRES	8	/* waiting for T_CONN_RES ack */
72 #define TS_DATA_XFER	9	/* data transfer */
73 #define TS_WIND_ORDREL	10	/* releasing read but not write */
74 #define TS_WREQ_ORDREL	11      /* wait to release write but not read */
75 #define TS_WACK_DREQ6	12	/* waiting for T_DISCON_REQ ack */
76 #define TS_WACK_DREQ7	13	/* waiting for T_DISCON_REQ ack */
77 #define TS_WACK_DREQ9	14	/* waiting for T_DISCON_REQ ack */
78 #define TS_WACK_DREQ10	15	/* waiting for T_DISCON_REQ ack */
79 #define TS_WACK_DREQ11	16	/* waiting for T_DISCON_REQ ack */
80 #define TS_NOSTATES	17
81 
82 struct T_conn_req {
83 	s32 PRIM_type;
84 	s32 DEST_length;
85 	s32 DEST_offset;
86 	s32 OPT_length;
87 	s32 OPT_offset;
88 };
89 
90 struct T_bind_req {
91 	s32 PRIM_type;
92 	s32 ADDR_length;
93 	s32 ADDR_offset;
94 	u32 CONIND_number;
95 };
96 
97 struct T_unitdata_req {
98 	s32 PRIM_type;
99 	s32 DEST_length;
100 	s32 DEST_offset;
101 	s32 OPT_length;
102 	s32 OPT_offset;
103 };
104 
105 struct T_optmgmt_req {
106 	s32 PRIM_type;
107 	s32 OPT_length;
108 	s32 OPT_offset;
109 	s32 MGMT_flags;
110 };
111 
112 struct T_bind_ack {
113 	s32 PRIM_type;
114 	s32 ADDR_length;
115 	s32 ADDR_offset;
116 	u32 CONIND_number;
117 };
118 
119 struct T_error_ack {
120 	s32 PRIM_type;
121 	s32 ERROR_prim;
122 	s32 TLI_error;
123 	s32 UNIX_error;
124 };
125 
126 struct T_ok_ack {
127 	s32 PRIM_type;
128 	s32 CORRECT_prim;
129 };
130 
131 struct T_conn_ind {
132 	s32 PRIM_type;
133 	s32 SRC_length;
134 	s32 SRC_offset;
135 	s32 OPT_length;
136 	s32 OPT_offset;
137 	s32 SEQ_number;
138 };
139 
140 struct T_conn_con {
141 	s32 PRIM_type;
142 	s32 RES_length;
143 	s32 RES_offset;
144 	s32 OPT_length;
145 	s32 OPT_offset;
146 };
147 
148 struct T_discon_ind {
149 	s32 PRIM_type;
150 	s32 DISCON_reason;
151 	s32 SEQ_number;
152 };
153 
154 struct T_unitdata_ind {
155 	s32 PRIM_type;
156 	s32 SRC_length;
157 	s32 SRC_offset;
158 	s32 OPT_length;
159 	s32 OPT_offset;
160 };
161 
162 struct T_optmgmt_ack {
163 	s32 PRIM_type;
164 	s32 OPT_length;
165 	s32 OPT_offset;
166 	s32 MGMT_flags;
167 };
168 
169 struct opthdr {
170 	s32 level;
171 	s32 name;
172 	s32 len;
173 	char value[0];
174 };
175 
176 struct T_primsg {
177 	struct T_primsg *next;
178 	unsigned char pri;
179 	unsigned char band;
180 	int length;
181 	s32 type;
182 };
183 
184 struct strbuf {
185 	s32 maxlen;
186 	s32 len;
187 	u32 buf;
188 } ;
189 
190 /* Constants used by STREAMS modules emulation code */
191 
192 typedef char sol_module;
193 
194 #define MAX_NR_STREAM_MODULES   16
195 
196 /* Private data structure assigned to sockets. */
197 
198 struct sol_socket_struct {
199         int magic;
200         int modcount;
201         sol_module module[MAX_NR_STREAM_MODULES];
202         long state;
203         int offset;
204         struct T_primsg *pfirst, *plast;
205 };
206 
207 #define SOLARIS_SOCKET_MAGIC    0xADDED
208 
209