You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

31 lines
888 B

  1. #pragma once
  2. #include <stdbool.h>
  3. struct fdm;
  4. typedef bool (*fdm_handler_t)(struct fdm *fdm, int fd, int events, void *data);
  5. typedef void (*fdm_hook_t)(struct fdm *fdm, void *data);
  6. enum fdm_hook_priority {
  7. FDM_HOOK_PRIORITY_LOW,
  8. FDM_HOOK_PRIORITY_NORMAL,
  9. FDM_HOOK_PRIORITY_HIGH
  10. };
  11. struct fdm *fdm_init(void);
  12. void fdm_destroy(struct fdm *fdm);
  13. bool fdm_add(struct fdm *fdm, int fd, int events, fdm_handler_t handler, void *data);
  14. bool fdm_del(struct fdm *fdm, int fd);
  15. bool fdm_del_no_close(struct fdm *fdm, int fd);
  16. bool fdm_event_add(struct fdm *fdm, int fd, int events);
  17. bool fdm_event_del(struct fdm *fdm, int fd, int events);
  18. bool fdm_hook_add(struct fdm *fdm, fdm_hook_t hook, void *data,
  19. enum fdm_hook_priority priority);
  20. bool fdm_hook_del(struct fdm *fdm, fdm_hook_t hook, enum fdm_hook_priority priority);
  21. bool fdm_poll(struct fdm *fdm);