diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-07-16 06:48:48 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-07-16 06:48:48 +0000 |
| commit | e4e2223cff658a7016724a625ebbd3dacb92a8f9 (patch) | |
| tree | aac49c61149d30bf11219ab8d9989915bf7bee37 /src/io.h | |
| parent | 9a79d500eb3e015f5bf579aab714916d49c1f289 (diff) | |
| download | luasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.tar.gz luasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.tar.bz2 luasocket-e4e2223cff658a7016724a625ebbd3dacb92a8f9.zip | |
Fixed a bunch of stuff. Added mike's patches.
Diffstat (limited to 'src/io.h')
| -rw-r--r-- | src/io.h | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -24,18 +24,19 @@ enum { | |||
| 24 | IO_DONE = 0, /* operation completed successfully */ | 24 | IO_DONE = 0, /* operation completed successfully */ |
| 25 | IO_TIMEOUT = -1, /* operation timed out */ | 25 | IO_TIMEOUT = -1, /* operation timed out */ |
| 26 | IO_CLOSED = -2, /* the connection has been closed */ | 26 | IO_CLOSED = -2, /* the connection has been closed */ |
| 27 | IO_CLIPPED = -3 /* maxium bytes count reached */ | 27 | IO_CLIPPED = -3, /* maxium bytes count reached */ |
| 28 | IO_UNKNOWN = -4 | ||
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| 30 | /* interface to error message function */ | 31 | /* interface to error message function */ |
| 31 | typedef const char *(*p_error) ( | 32 | typedef const char *(*p_error) ( |
| 32 | void *ctx, /* context needed by send */ | 33 | void *ctx, /* context needed by send */ |
| 33 | int err /* error code */ | 34 | int err /* error code */ |
| 34 | ); | 35 | ); |
| 35 | 36 | ||
| 36 | /* interface to send function */ | 37 | /* interface to send function */ |
| 37 | typedef int (*p_send) ( | 38 | typedef int (*p_send) ( |
| 38 | void *ctx, /* context needed by send */ | 39 | void *ctx, /* context needed by send */ |
| 39 | const char *data, /* pointer to buffer with data to send */ | 40 | const char *data, /* pointer to buffer with data to send */ |
| 40 | size_t count, /* number of bytes to send from buffer */ | 41 | size_t count, /* number of bytes to send from buffer */ |
| 41 | size_t *sent, /* number of bytes sent uppon return */ | 42 | size_t *sent, /* number of bytes sent uppon return */ |
| @@ -44,7 +45,7 @@ typedef int (*p_send) ( | |||
| 44 | 45 | ||
| 45 | /* interface to recv function */ | 46 | /* interface to recv function */ |
| 46 | typedef int (*p_recv) ( | 47 | typedef int (*p_recv) ( |
| 47 | void *ctx, /* context needed by recv */ | 48 | void *ctx, /* context needed by recv */ |
| 48 | char *data, /* pointer to buffer where data will be writen */ | 49 | char *data, /* pointer to buffer where data will be writen */ |
| 49 | size_t count, /* number of bytes to receive into buffer */ | 50 | size_t count, /* number of bytes to receive into buffer */ |
| 50 | size_t *got, /* number of bytes received uppon return */ | 51 | size_t *got, /* number of bytes received uppon return */ |
| @@ -61,6 +62,6 @@ typedef struct t_io_ { | |||
| 61 | typedef t_io *p_io; | 62 | typedef t_io *p_io; |
| 62 | 63 | ||
| 63 | void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx); | 64 | void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx); |
| 64 | const char *io_strerror(int err); | 65 | const char *io_strerror(int err); |
| 65 | 66 | ||
| 66 | #endif /* IO_H */ | 67 | #endif /* IO_H */ \ No newline at end of file |
