1 #ifndef _NBBIO_H_INCLUDED_
2 #define _NBBIO_H_INCLUDED_
39 #define NBBIO_FLAG_READ (1<<0)
40 #define NBBIO_FLAG_WRITE (1<<1)
41 #define NBBIO_FLAG_EOF (1<<2)
42 #define NBBIO_FLAG_ERROR (1<<3)
43 #define NBBIO_FLAG_TIMEOUT (1<<4)
45 #define NBBIO_OP_NAME(np) \
46 (((np)->flags & NBBIO_FLAG_READ) ? "read" : \
47 ((np)->flags & NBBIO_FLAG_WRITE) ? "write" : \
50 #define NBBIO_MASK_ACTIVE \
51 (NBBIO_FLAG_READ | NBBIO_FLAG_WRITE)
53 #define NBBIO_MASK_ERROR \
54 (NBBIO_FLAG_EOF | NBBIO_FLAG_ERROR | NBBIO_FLAG_TIMEOUT)
56 #define NBBIO_BUFSIZE(np) (((np)->bufsize) + 0)
58 #define NBBIO_READ_PEND(np) ((np)->read_pend)
59 #define NBBIO_READ_BUF(np) ((np)->read_buf + 0)
61 #define NBBIO_WRITE_PEND(np) ((np)->write_pend)
62 #define NBBIO_WRITE_BUF(np) ((np)->write_buf + 0)
64 #define NBBIO_ACTIVE_FLAGS(np) ((np)->flags & NBBIO_MASK_ACTIVE)
65 #define NBBIO_ERROR_FLAGS(np) ((np)->flags & NBBIO_MASK_ERROR)
void nbbio_disable_readwrite(NBBIO *)
void nbbio_enable_write(NBBIO *, int)
void nbbio_enable_read(NBBIO *, int)
NBBIO * nbbio_create(int, ssize_t, const char *, NBBIO_ACTION, void *)
void nbbio_slumber(NBBIO *, int)
void(* NBBIO_ACTION)(int, void *)