overlapio.h 629 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef HV_OVERLAPPED_H_
  2. #define HV_OVERLAPPED_H_
  3. #include "iowatcher.h"
  4. #ifdef EVENT_IOCP
  5. #include "hbuf.h"
  6. #include "hsocket.h"
  7. #include <mswsock.h>
  8. #ifdef _MSC_VER
  9. #pragma comment(lib, "mswsock.lib")
  10. #endif
  11. typedef struct hoverlapped_s {
  12. OVERLAPPED ovlp;
  13. int fd;
  14. int event;
  15. WSABUF buf;
  16. int bytes;
  17. int error;
  18. hio_t* io;
  19. // for recvfrom
  20. struct sockaddr* addr;
  21. int addrlen;
  22. } hoverlapped_t;
  23. int post_acceptex(hio_t* listenio, hoverlapped_t* hovlp);
  24. int post_recv(hio_t* io, hoverlapped_t* hovlp);
  25. #endif
  26. #endif // HV_OVERLAPPED_H_