Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
28 { WSAEINTR,
"Interrupted function call" },
29 { WSAEBADF,
"File handle is not valid" },
30 { WSAEACCES,
"Permission denied" },
31 { WSAEFAULT,
"Bad address" },
32 { WSAEINVAL,
"Invalid argument" },
33 { WSAEMFILE,
"Too many open files" },
34 { WSAEWOULDBLOCK,
"Resource temporarily unavailable" },
35 { WSAEINPROGRESS,
"Operation now in progress" },
36 { WSAEALREADY,
"Operation already in progress" },
37 { WSAENOTSOCK,
"Socket operation on nonsocket" },
38 { WSAEDESTADDRREQ,
"Destination address required" },
39 { WSAEMSGSIZE,
"Message too long" },
40 { WSAEPROTOTYPE,
"Protocol wrong type for socket" },
41 { WSAENOPROTOOPT,
"Bad protocol option" },
42 { WSAEPROTONOSUPPORT,
"Protocol not supported" },
43 { WSAESOCKTNOSUPPORT,
"Socket type not supported" },
44 { WSAEOPNOTSUPP,
"Operation not supported" },
45 { WSAEPFNOSUPPORT,
"Protocol family not supported" },
46 { WSAEAFNOSUPPORT,
"Address family not supported by protocol family" },
47 { WSAEADDRINUSE,
"Address already in use" },
48 { WSAEADDRNOTAVAIL,
"Cannot assign requested address" },
49 { WSAENETDOWN,
"Network is down" },
50 { WSAENETUNREACH,
"Network is unreachable" },
51 { WSAENETRESET,
"Network dropped connection on reset" },
52 { WSAECONNABORTED,
"Software caused connection abort" },
53 { WSAECONNRESET,
"Connection reset by peer" },
54 { WSAENOBUFS,
"No buffer space available" },
55 { WSAEISCONN,
"Socket is already connected" },
56 { WSAENOTCONN,
"Socket is not connected" },
57 { WSAESHUTDOWN,
"Cannot send after socket shutdown" },
58 { WSAETOOMANYREFS,
"Too many references" },
59 { WSAETIMEDOUT,
"Connection timed out" },
60 { WSAECONNREFUSED,
"Connection refused" },
61 { WSAELOOP,
"Cannot translate name" },
62 { WSAENAMETOOLONG,
"Name too long" },
63 { WSAEHOSTDOWN,
"Host is down" },
64 { WSAEHOSTUNREACH,
"No route to host" },
65 { WSAENOTEMPTY,
"Directory not empty" },
66 { WSAEPROCLIM,
"Too many processes" },
67 { WSAEUSERS,
"User quota exceeded" },
68 { WSAEDQUOT,
"Disk quota exceeded" },
69 { WSAESTALE,
"Stale file handle reference" },
70 { WSAEREMOTE,
"Item is remote" },
71 { WSASYSNOTREADY,
"Network subsystem is unavailable" },
72 { WSAVERNOTSUPPORTED,
"Winsock.dll version out of range" },
73 { WSANOTINITIALISED,
"Successful WSAStartup not yet performed" },
74 { WSAEDISCON,
"Graceful shutdown in progress" },
75 { WSAENOMORE,
"No more results" },
76 { WSAECANCELLED,
"Call has been canceled" },
77 { WSAEINVALIDPROCTABLE,
"Procedure call table is invalid" },
78 { WSAEINVALIDPROVIDER,
"Service provider is invalid" },
79 { WSAEPROVIDERFAILEDINIT,
"Service provider failed to initialize" },
80 { WSASYSCALLFAILURE,
"System call failure" },
81 { WSASERVICE_NOT_FOUND,
"Service not found" },
82 { WSATYPE_NOT_FOUND,
"Class type not found" },
83 { WSA_E_NO_MORE,
"No more results" },
84 { WSA_E_CANCELLED,
"Call was canceled" },
85 { WSAEREFUSED,
"Database query was refused" },
86 { WSAHOST_NOT_FOUND,
"Host not found" },
87 { WSATRY_AGAIN,
"Nonauthoritative host not found" },
88 { WSANO_RECOVERY,
"This is a nonrecoverable error" },
89 { WSANO_DATA,
"Valid name, no data record of requested type" },
90 { -1,
"Unknown error" }
106 size_t len, netadr_t *from)
108 struct sockaddr_storage addr;
114 memset(&addr, 0,
sizeof(addr));
115 addrlen =
sizeof(addr);
116 ret = recvfrom(sock, data, len, 0,
117 (
struct sockaddr *)&addr, &addrlen);
121 if (ret != SOCKET_ERROR)
134 NET_ErrorEvent(sock, from,
net_error, 0);
146 size_t len,
const netadr_t *to)
148 struct sockaddr_storage addr;
154 ret = sendto(sock, data, len, 0,
155 (
struct sockaddr *)&addr, addrlen);
157 if (ret != SOCKET_ERROR)
167 if (
net_error == WSAEADDRNOTAVAIL && to->type == NA_BROADCAST)
182 static ssize_t
os_recv(qsocket_t sock,
void *data,
size_t len,
int flags)
184 int ret = recv(sock, data, len, flags);
186 if (ret == SOCKET_ERROR)
192 static ssize_t
os_send(qsocket_t sock,
const void *data,
size_t len,
int flags)
194 int ret = send(sock, data, len, flags);
196 if (ret == SOCKET_ERROR)
204 if (listen(sock, backlog) == SOCKET_ERROR) {
212 static neterr_t
os_accept(qsocket_t sock, qsocket_t *newsock, netadr_t *from)
214 struct sockaddr_storage addr;
218 memset(&addr, 0,
sizeof(addr));
219 addrlen =
sizeof(addr);
220 s = accept(sock, (
struct sockaddr *)&addr, &addrlen);
224 if (s == INVALID_SOCKET) {
233 static neterr_t
os_connect(qsocket_t sock,
const netadr_t *to)
235 struct sockaddr_storage addr;
240 if (connect(sock, (
struct sockaddr *)&addr, addrlen) == SOCKET_ERROR) {
255 if (ioctlsocket(sock, FIONBIO, &_val) == SOCKET_ERROR) {
267 if (setsockopt(sock,
level, name, (
char *)&_val,
sizeof(_val)) == SOCKET_ERROR) {
278 int optlen =
sizeof(_val);
280 if (getsockopt(sock,
level, name, (
char *)&_val, &optlen) == SOCKET_ERROR) {
289 static neterr_t
os_bind(qsocket_t sock,
const struct sockaddr *addr,
size_t addrlen)
291 if (bind(sock, addr, addrlen) == SOCKET_ERROR) {
301 struct sockaddr_storage addr;
304 memset(&addr, 0,
sizeof(addr));
305 addrlen =
sizeof(addr);
306 if (getsockname(sock, (
struct sockaddr *)&addr, &addrlen) == SOCKET_ERROR) {
320 static qsocket_t
os_socket(
int domain,
int type,
int protocol)
322 SOCKET s = socket(domain, type, protocol);
324 if (s == INVALID_SOCKET) {
344 Com_Error(ERR_FATAL,
"%s: no more space for fd: %Id", __func__, fd);
363 Com_Error(ERR_FATAL,
"%s: fd not found: %Id", __func__, fd);
372 static int os_select(
int nfds, fd_set *rfds, fd_set *wfds,
373 fd_set *efds,
struct timeval *
tv)
375 int ret = select(nfds, rfds, wfds, efds,
tv);
377 if (ret == SOCKET_ERROR)
388 ret = WSAStartup(MAKEWORD(1, 1), &ws);
390 Com_Error(ERR_FATAL,
"Winsock initialization failed: %s (%d)",
394 Com_DPrintf(
"Winsock initialized\n");
static neterr_t os_bind(qsocket_t sock, const struct sockaddr *addr, size_t addrlen)
static neterr_t os_getsockname(qsocket_t sock, netadr_t *name)
static void os_net_init(void)
static ssize_t os_udp_recv(qsocket_t sock, void *data, size_t len, netadr_t *from)
#define MAX_ERROR_RETRIES
static neterr_t os_setsockopt(qsocket_t sock, int level, int name, int val)
static neterr_t os_make_nonblock(qsocket_t sock, int val)
float * tv(float x, float y, float z)
static ioentry_t * os_get_io(qsocket_t fd)
static neterr_t os_getsockopt(qsocket_t sock, int level, int name, int *val)
static ioentry_t * os_add_io(qsocket_t fd)
static const char * os_error_string(int err)
void Com_Error(error_type_t type, const char *fmt,...)
static void os_closesocket(qsocket_t sock)
static qsocket_t os_socket(int domain, int type, int protocol)
static void NET_SockadrToNetadr(const struct sockaddr_storage *s, netadr_t *a)
static neterr_t os_listen(qsocket_t sock, int backlog)
static size_t NET_NetadrToSockadr(const netadr_t *a, struct sockaddr_storage *s)
static ssize_t os_udp_send(qsocket_t sock, const void *data, size_t len, const netadr_t *to)
static neterr_t os_accept(qsocket_t sock, qsocket_t *newsock, netadr_t *from)
static qsocket_t os_get_fd(ioentry_t *e)
static ioentry_t io_entries[FD_SETSIZE]
static ssize_t os_send(qsocket_t sock, const void *data, size_t len, int flags)
static ssize_t os_recv(qsocket_t sock, void *data, size_t len, int flags)
static neterr_t os_get_error(void)
static void os_net_shutdown(void)
static neterr_t os_connect(qsocket_t sock, const netadr_t *to)
static const struct @10 wsa_error_table[]
static int os_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)