network.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #pragma once
  2. #include "iostatus.h"
  3. #include <util/datetime/base.h>
  4. #include <util/network/init.h>
  5. #include <util/network/iovec.h>
  6. #include <util/network/nonblock.h>
  7. #include <util/network/socket.h>
  8. class TCont;
  9. namespace NCoro {
  10. int SelectD(TCont* cont, SOCKET fds[], int what[], size_t nfds, SOCKET* outfd, TInstant deadline) noexcept;
  11. int SelectT(TCont* cont, SOCKET fds[], int what[], size_t nfds, SOCKET* outfd, TDuration timeout) noexcept;
  12. int SelectI(TCont* cont, SOCKET fds[], int what[], size_t nfds, SOCKET* outfd);
  13. int PollD(TCont* cont, SOCKET fd, int what, TInstant deadline) noexcept;
  14. int PollT(TCont* cont, SOCKET fd, int what, TDuration timeout) noexcept;
  15. int PollI(TCont* cont, SOCKET fd, int what) noexcept;
  16. TContIOStatus ReadVectorD(TCont* cont, SOCKET fd, TContIOVector* vec, TInstant deadline) noexcept;
  17. TContIOStatus ReadVectorT(TCont* cont, SOCKET fd, TContIOVector* vec, TDuration timeOut) noexcept;
  18. TContIOStatus ReadVectorI(TCont* cont, SOCKET fd, TContIOVector* vec) noexcept;
  19. TContIOStatus ReadD(TCont* cont, SOCKET fd, void* buf, size_t len, TInstant deadline) noexcept;
  20. TContIOStatus ReadT(TCont* cont, SOCKET fd, void* buf, size_t len, TDuration timeout) noexcept;
  21. TContIOStatus ReadI(TCont* cont, SOCKET fd, void* buf, size_t len) noexcept;
  22. TContIOStatus WriteVectorD(TCont* cont, SOCKET fd, TContIOVector* vec, TInstant deadline) noexcept;
  23. TContIOStatus WriteVectorT(TCont* cont, SOCKET fd, TContIOVector* vec, TDuration timeOut) noexcept;
  24. TContIOStatus WriteVectorI(TCont* cont, SOCKET fd, TContIOVector* vec) noexcept;
  25. TContIOStatus WriteD(TCont* cont, SOCKET fd, const void* buf, size_t len, TInstant deadline) noexcept;
  26. TContIOStatus WriteT(TCont* cont, SOCKET fd, const void* buf, size_t len, TDuration timeout) noexcept;
  27. TContIOStatus WriteI(TCont* cont, SOCKET fd, const void* buf, size_t len) noexcept;
  28. int ConnectD(TCont* cont, TSocketHolder& s, const struct addrinfo& ai, TInstant deadline) noexcept;
  29. int ConnectD(TCont* cont, TSocketHolder& s, const TNetworkAddress& addr, TInstant deadline) noexcept;
  30. int ConnectT(TCont* cont, TSocketHolder& s, const TNetworkAddress& addr, TDuration timeout) noexcept;
  31. int ConnectI(TCont* cont, TSocketHolder& s, const TNetworkAddress& addr) noexcept;
  32. int ConnectD(TCont* cont, SOCKET s, const struct sockaddr* name, socklen_t namelen, TInstant deadline) noexcept;
  33. int ConnectT(TCont* cont, SOCKET s, const struct sockaddr* name, socklen_t namelen, TDuration timeout) noexcept;
  34. int ConnectI(TCont* cont, SOCKET s, const struct sockaddr* name, socklen_t namelen) noexcept;
  35. int AcceptD(TCont* cont, SOCKET s, struct sockaddr* addr, socklen_t* addrlen, TInstant deadline) noexcept;
  36. int AcceptT(TCont* cont, SOCKET s, struct sockaddr* addr, socklen_t* addrlen, TDuration timeout) noexcept;
  37. int AcceptI(TCont* cont, SOCKET s, struct sockaddr* addr, socklen_t* addrlen) noexcept;
  38. SOCKET Socket(int domain, int type, int protocol) noexcept;
  39. SOCKET Socket(const struct addrinfo& ai) noexcept;
  40. }