odyssey/sources/mm_io.h

48 lines
902 B
C
Raw Normal View History

2017-05-24 11:04:19 +00:00
#ifndef MM_IO_H
#define MM_IO_H
2017-03-21 11:48:35 +00:00
/*
* machinarium.
*
* cooperative multitasking engine.
*/
2017-05-24 11:04:19 +00:00
typedef struct mm_io mm_io_t;
2017-03-21 11:48:35 +00:00
2017-05-24 11:04:19 +00:00
struct mm_io
{
2017-05-24 12:47:05 +00:00
int fd;
mm_fd_t handle;
int attached;
2017-05-24 12:47:05 +00:00
int opt_nodelay;
int opt_keepalive;
int opt_keepalive_delay;
mm_tlsio_t tls;
mm_tls_t *tls_obj;
mm_call_t call;
2017-04-11 13:48:07 +00:00
/* connect */
2017-05-24 12:47:05 +00:00
int connected;
2017-03-21 11:48:35 +00:00
/* accept */
2017-05-24 12:47:05 +00:00
int accepted;
int accept_listen;
2017-03-21 11:48:35 +00:00
/* read */
2017-05-24 12:47:05 +00:00
char *read_buf;
int read_size;
int read_pos;
int read_eof;
mm_buf_t readahead_buf;
int readahead_size;
int readahead_pos;
int readahead_pos_read;
int readahead_status;
2017-03-21 11:48:35 +00:00
/* write */
2017-05-24 12:47:05 +00:00
char *write_buf;
int write_size;
int write_pos;
2017-03-21 11:48:35 +00:00
};
int mm_io_socket_set(mm_io_t*, int);
2017-04-11 14:39:20 +00:00
int mm_io_socket(mm_io_t*, struct sockaddr*);
2017-05-24 11:04:19 +00:00
#endif /* MM_IO_H */