1
1
#ifndef CONNECT___NCBI_SOCKETP__H
2
2
#define CONNECT___NCBI_SOCKETP__H
4
/* $Id: ncbi_socketp.h,v 1.23 2010/10/21 20:24:31 kazimird Exp $
4
/* $Id: ncbi_socketp.h,v 1.26 2012/05/04 19:04:38 kazimird Exp $
5
5
* ===========================================================================
7
7
* PUBLIC DOMAIN NOTICE
134
138
#if 0/*defined(__GNUC__)*/
135
139
typedef ESwitch EBSwitch;
136
140
typedef EIO_Status EBIO_Status;
137
typedef ESOCK_Side EBSOCK_Side;
139
142
typedef unsigned EBSwitch;
140
143
typedef unsigned EBIO_Status;
141
typedef unsigned EBSOCK_Side;
149
eDatagram = 3/*2|1*/,
152
typedef unsigned char TSOCK_Type;
154
typedef unsigned TBSOCK_Type;
166
168
/* type, status, EOF, log, read-on-write etc bit-field indicators */
167
TSOCK_Type type; /* eTrigger */
169
TBSOCK_Type type:2; /* eTrigger */
168
170
EBSwitch log:2; /* how to log events */
169
EBSOCK_Side side:1; /* MBZ */
170
unsigned/*bool*/ keep:1; /* MBZ */
171
171
EBSwitch r_on_w:2; /* MBZ */
172
172
EBSwitch i_on_sig:2; /* eDefault */
173
174
EBIO_Status r_status:3; /* MBZ (NB: eIO_Success) */
174
175
unsigned/*bool*/ eof:1; /* MBZ */
175
176
EBIO_Status w_status:3; /* MBZ (NB: eIO_Success) */
176
177
unsigned/*bool*/ pending:1; /* MBZ */
178
unsigned reserved:8; /* MBZ */
179
unsigned reserved:16;/* MBZ */
180
181
#ifdef NCBI_OS_UNIX
181
182
int out; /* write end of the pipe */
194
205
unsigned short port; /* port on which listening (host byte order) */
196
207
/* type, status, EOF, log, read-on-write etc bit-field indicators */
197
TSOCK_Type type; /* eListening */
208
TBSOCK_Type type:2; /* eListening */
198
209
EBSwitch log:2; /* how to log events and data for this socket*/
199
EBSOCK_Side side:1; /* MBZ */
200
unsigned/*bool*/ keep:1; /* MBZ */
201
210
EBSwitch r_on_w:2; /* MBZ */
202
211
EBSwitch i_on_sig:2; /* eDefault */
203
213
EBIO_Status r_status:3; /* MBZ (NB: eIO_Success) */
204
214
unsigned/*bool*/ eof:1; /* MBZ */
205
215
EBIO_Status w_status:3; /* MBZ (NB: eIO_Success) */
206
216
unsigned/*bool*/ pending:1; /* MBZ */
218
EBSOCK_Side side:1; /* MBZ (NB: eSOCK_Server) */
219
unsigned/*bool*/ keep:1; /* whether to keep OS handle upon close */
208
220
#ifndef NCBI_OS_MSWIN
209
unsigned reserved:8; /* MBZ */
221
unsigned reserved:14;/* MBZ */
211
unsigned reserved:5; /* MBZ */
223
unsigned reserved:11;/* MBZ */
212
224
unsigned readable:1; /* =1 if known to have a pending accept */
213
225
unsigned unused:2; /* MBZ */
215
WSAEVENT event; /* event bound to I/O */
227
WSAEVENT event; /* event bound to I/O */
216
228
#endif /*!NCBI_OS_MSWIN*/
218
230
void* context; /* per-server credentials */
243
247
unsigned short myport; /* this socket's port number, host byte order*/
245
249
/* type, status, EOF, log, read-on-write etc bit-field indicators */
246
TSOCK_Type type; /* |= eSocket ({ eSocket | eDatagram }) */
250
TBSOCK_Type type:2; /* |= eSocket ({ eSocket | eDatagram }) */
247
251
EBSwitch log:2; /* how to log events and data for this socket*/
248
EBSOCK_Side side:1; /* socket side: client- or server-side */
249
unsigned/*bool*/ keep:1; /* whether to keep OS handle upon close */
250
252
EBSwitch r_on_w:2; /* enable/disable automatic read-on-write */
251
253
EBSwitch i_on_sig:2; /* enable/disable I/O restart on signals */
256
258
EBIO_Status w_status:3; /* write status: eIO_Closed if was shut down*/
257
259
unsigned/*bool*/ pending:1; /* =1 if connection is still initing */
261
EBSOCK_Side side:1; /* socket side: client- or server-side */
262
unsigned/*bool*/ keep:1; /* whether to keep OS handle upon close */
259
263
unsigned crossexec:1; /* =1 if close-on-exec must NOT be set */
260
264
unsigned connected:1; /* =1 if remote end-point is fully connected */
265
unsigned r_tv_set:1; /* =1 if read timeout is set (i.e. finite) */
266
unsigned w_tv_set:1; /* =1 if write timeout is set (i.e. finite) */
267
unsigned c_tv_set:1; /* =1 if close timeout is set (i.e. finite) */
261
268
unsigned keepalive:1; /* =1 if needs to be kept alive (if OS supp.)*/
262
269
#ifndef NCBI_OS_MSWIN
270
unsigned reserved:8; /* MBZ */
263
272
unsigned reserved:5; /* MBZ */
265
unsigned reserved:2; /* MBZ */
266
273
unsigned readable:1; /* =1 if known to be readable */
267
274
unsigned writable:1; /* =1 if known to be writeable */
268
275
unsigned closing:1; /* =1 if FD_CLOSE posted */
270
WSAEVENT event; /* event bound to I/O */
277
WSAEVENT event; /* event bound to I/O */
271
278
#endif /*!NCBI_OS_MSWIN*/
273
280
void* session; /* secure session id if secure, else 0 */
276
const struct timeval* r_timeout;/* NULL if infinite, or points to "r_tv" */
277
283
struct timeval r_tv; /* finite read timeout value */
284
struct timeval w_tv; /* finite write timeout value */
285
struct timeval c_tv; /* finite close timeout value */
278
286
STimeout r_to; /* finite read timeout value (aux., temp.) */
279
const struct timeval* w_timeout;/* NULL if infinite, or points to "w_tv" */
280
struct timeval w_tv; /* finite write timeout value */
281
287
STimeout w_to; /* finite write timeout value (aux., temp.) */
282
const struct timeval* c_timeout;/* NULL if infinite, or points to "c_tv" */
283
struct timeval c_tv; /* finite close timeout value */
284
288
STimeout c_to; /* finite close timeout value (aux., temp.) */
286
290
/* aux I/O data */