src/server/io.h

changeset 4
998844b5ed25
parent 1
3c066d52342d
child 8
f4d56bf9de40
equal deleted inserted replaced
3:137197831306 4:998844b5ed25
27 */ 27 */
28 28
29 #ifndef IOSTREAM_H 29 #ifndef IOSTREAM_H
30 #define IOSTREAM_H 30 #define IOSTREAM_H
31 31
32 #include "nsapi.h"
33
32 #ifdef __cplusplus 34 #ifdef __cplusplus
33 extern "C" { 35 extern "C" {
34 #endif 36 #endif
35 37
36 typedef struct io_stream IOStream; 38 typedef struct io_stream IOStream;
47 IOStream st; 49 IOStream st;
48 int fd; 50 int fd;
49 } SystemIOStream; 51 } SystemIOStream;
50 52
51 53
54 /* iovec buffer */
55 typedef struct iovec_buf{
56 struct iovec *iov;
57 int iovctn;
58 int maxiovec;
59 pool_handle_t *pool;
60 } iovec_buf_t;
61
62
63 /* system stream */
52 IOStream* stream_new_from_fd(int fd); 64 IOStream* stream_new_from_fd(int fd);
53
54 65
55 ssize_t system_write(IOStream *st, void *buf, size_t nbytes); 66 ssize_t system_write(IOStream *st, void *buf, size_t nbytes);
56 ssize_t system_read(IOStream *st, void *buf, size_t nbytes); 67 ssize_t system_read(IOStream *st, void *buf, size_t nbytes);
68
69
70 /* iovec buffer */
71 iovec_buf_t *iovec_buf_create(pool_handle_t *pool);
72 void iovec_buf_write(iovec_buf_t *io, void *buf, size_t nbyte);
73 ssize_t iovec_buf_flush(iovec_buf_t *io, int fd);
74
57 75
58 #ifdef __cplusplus 76 #ifdef __cplusplus
59 } 77 }
60 #endif 78 #endif
61 79

mercurial