async.h 752 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /** @file async.h
  2. * @brief Public interface for ASYNChronous I/O class.
  3. */
  4. #ifndef _faux_async_h
  5. #define _faux_async_h
  6. #include <faux/faux.h>
  7. #include <faux/sched.h>
  8. typedef struct faux_async_s faux_async_t;
  9. /*
  10. typedef enum {
  11. FAUX_ELOOP_NULL = 0,
  12. FAUX_ELOOP_SIGNAL = 1,
  13. FAUX_ELOOP_SCHED = 2,
  14. FAUX_ELOOP_FD = 3
  15. } faux_eloop_type_e;
  16. */
  17. // Callback function prototypes
  18. typedef bool_t (*faux_async_read_cb_f)(faux_async_t *async,
  19. void *data, size_t len, void *user_data);
  20. typedef bool_t (*faux_async_stall_cb_f)(faux_async_t *async,
  21. size_t len, void *user_data);
  22. C_DECL_BEGIN
  23. faux_async_t *faux_async_new(int fd);
  24. void faux_async_free(faux_async_t *async);
  25. int faux_async_fd(const faux_async_t *async);
  26. C_DECL_END
  27. #endif // _faux_async_h