ws2_32.odin 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package sys_windows
  2. foreign import ws2_32 "system:Ws2_32.lib"
  3. @(default_calling_convention="stdcall")
  4. foreign ws2_32 {
  5. WSAStartup :: proc(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int ---
  6. WSACleanup :: proc() -> c_int ---
  7. WSAGetLastError :: proc() -> c_int ---
  8. WSADuplicateSocketW :: proc(
  9. s: SOCKET,
  10. dwProcessId: DWORD,
  11. lpProtocolInfo: LPWSAPROTOCOL_INFO,
  12. ) -> c_int ---
  13. WSASend :: proc(
  14. s: SOCKET,
  15. lpBuffers: LPWSABUF,
  16. dwBufferCount: DWORD,
  17. lpNumberOfBytesSent: LPDWORD,
  18. dwFlags: DWORD,
  19. lpOverlapped: LPWSAOVERLAPPED,
  20. lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
  21. ) -> c_int ---
  22. WSARecv :: proc(
  23. s: SOCKET,
  24. lpBuffers: LPWSABUF,
  25. dwBufferCount: DWORD,
  26. lpNumberOfBytesRecvd: LPDWORD,
  27. lpFlags: LPDWORD,
  28. lpOverlapped: LPWSAOVERLAPPED,
  29. lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE,
  30. ) -> c_int ---
  31. WSASocketW :: proc(
  32. af: c_int,
  33. kind: c_int,
  34. protocol: c_int,
  35. lpProtocolInfo: LPWSAPROTOCOL_INFO,
  36. g: GROUP,
  37. dwFlags: DWORD,
  38. ) -> SOCKET ---
  39. ioctlsocket :: proc(s: SOCKET, cmd: c_long, argp: ^c_ulong) -> c_int ---
  40. closesocket :: proc(socket: SOCKET) -> c_int ---
  41. recv :: proc(socket: SOCKET, buf: rawptr, len: c_int, flags: c_int) -> c_int ---
  42. send :: proc(socket: SOCKET, buf: rawptr, len: c_int, flags: c_int) -> c_int ---
  43. recvfrom :: proc(
  44. socket: SOCKET,
  45. buf: rawptr,
  46. len: c_int,
  47. flags: c_int,
  48. addr: ^SOCKADDR,
  49. addrlen: ^c_int,
  50. ) -> c_int ---
  51. sendto :: proc(
  52. socket: SOCKET,
  53. buf: rawptr,
  54. len: c_int,
  55. flags: c_int,
  56. addr: ^SOCKADDR,
  57. addrlen: c_int,
  58. ) -> c_int ---
  59. shutdown :: proc(socket: SOCKET, how: c_int) -> c_int ---
  60. accept :: proc(socket: SOCKET, address: ^SOCKADDR, address_len: ^c_int) -> SOCKET ---
  61. setsockopt :: proc(
  62. s: SOCKET,
  63. level: c_int,
  64. optname: c_int,
  65. optval: rawptr,
  66. optlen: c_int,
  67. ) -> c_int ---
  68. getsockname :: proc(socket: SOCKET, address: ^SOCKADDR, address_len: ^c_int) -> c_int ---
  69. getpeername :: proc(socket: SOCKET, address: ^SOCKADDR, address_len: ^c_int) -> c_int ---
  70. bind :: proc(socket: SOCKET, address: ^SOCKADDR, address_len: socklen_t) -> c_int ---
  71. listen :: proc(socket: SOCKET, backlog: c_int) -> c_int ---
  72. connect :: proc(socket: SOCKET, address: ^SOCKADDR, len: c_int) -> c_int ---
  73. getaddrinfo :: proc(
  74. node: ^c_char,
  75. service: ^c_char,
  76. hints: ^ADDRINFOA,
  77. res: ^ADDRINFOA,
  78. ) -> c_int ---
  79. freeaddrinfo :: proc(res: ^ADDRINFOA) ---
  80. select :: proc(
  81. nfds: c_int,
  82. readfds: ^fd_set,
  83. writefds: ^fd_set,
  84. exceptfds: ^fd_set,
  85. timeout: ^timeval,
  86. ) -> c_int ---
  87. getsockopt :: proc(
  88. s: SOCKET,
  89. level: c_int,
  90. optname: c_int,
  91. optval: ^c_char,
  92. optlen: ^c_int,
  93. ) -> c_int ---
  94. }