511:a5a142fea2ae | 513:9a49c245a49c |
---|---|
53 | 53 |
54 #define IO_POLL_NONE 0 | 54 #define IO_POLL_NONE 0 |
55 #define IO_POLL_IN 1 | 55 #define IO_POLL_IN 1 |
56 #define IO_POLL_OUT 2 | 56 #define IO_POLL_OUT 2 |
57 | 57 |
58 #define IO_STREAM_TYPE_HTTP 0x48545450 | |
59 #define IO_STREAM_TYPE_SSL 0x53534C | |
60 | |
58 typedef struct IOStream IOStream; | 61 typedef struct IOStream IOStream; |
59 typedef struct Sysstream Sysstream; | 62 typedef struct Sysstream Sysstream; |
60 typedef struct HttpStream HttpStream; | 63 typedef struct HttpStream HttpStream; |
61 | 64 |
62 typedef ssize_t(*io_write_f)(IOStream *, const void *, size_t); | 65 typedef ssize_t(*io_write_f)(IOStream *, const void *, size_t); |
76 io_close_f close; | 79 io_close_f close; |
77 io_finish_f finish; | 80 io_finish_f finish; |
78 io_setmode_f setmode; | 81 io_setmode_f setmode; |
79 io_poll_f poll; | 82 io_poll_f poll; |
80 int io_errno; | 83 int io_errno; |
84 unsigned int type; | |
81 }; | 85 }; |
82 | 86 |
83 struct Sysstream { | 87 struct Sysstream { |
84 IOStream st; | 88 IOStream st; |
85 #ifdef XP_UNIX | 89 #ifdef XP_UNIX |
178 IOStream st; | 182 IOStream st; |
179 SSL *ssl; | 183 SSL *ssl; |
180 int error; | 184 int error; |
181 } SSLStream; | 185 } SSLStream; |
182 | 186 |
183 | 187 void io_set_max_writes(int n); |
184 | 188 |
185 /* system stream */ | 189 /* system stream */ |
186 IOStream* Sysstream_new(pool_handle_t *pool, SYS_SOCKET fd); | 190 IOStream* Sysstream_new(pool_handle_t *pool, SYS_SOCKET fd); |
187 | 191 |
188 ssize_t net_sys_write(Sysstream *st, const void *buf, size_t nbytes); | 192 ssize_t net_sys_write(Sysstream *st, const void *buf, size_t nbytes); |