#include "winsock.h"
#include "wsipx.h"
#include "../qcommon/qcommon.h"
Go to the source code of this file.
|
char * | NET_ErrorString (void) |
|
void | NetadrToSockadr (netadr_t *a, struct sockaddr *s) |
|
void | SockadrToNetadr (struct sockaddr *s, netadr_t *a) |
|
qboolean | NET_CompareAdr (netadr_t a, netadr_t b) |
|
qboolean | NET_CompareBaseAdr (netadr_t a, netadr_t b) |
|
char * | NET_AdrToString (netadr_t a) |
|
qboolean | NET_StringToSockaddr (char *s, struct sockaddr *sadr) |
|
qboolean | NET_StringToAdr (char *s, netadr_t *a) |
|
qboolean | NET_IsLocalAddress (netadr_t adr) |
|
qboolean | NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message) |
|
void | NET_SendLoopPacket (netsrc_t sock, int length, void *data, netadr_t to) |
|
qboolean | NET_GetPacket (netsrc_t sock, netadr_t *net_from, sizebuf_t *net_message) |
|
void | NET_SendPacket (netsrc_t sock, int length, void *data, netadr_t to) |
|
int | NET_IPSocket (char *net_interface, int port) |
|
void | NET_OpenIP (void) |
|
int | NET_IPXSocket (int port) |
|
void | NET_OpenIPX (void) |
|
void | NET_Config (qboolean multiplayer) |
|
void | NET_Sleep (int msec) |
|
void | NET_Init (void) |
|
void | NET_Shutdown (void) |
|
◆ DO
Value: copy[0] = s[src]; \
copy[1] = s[src + 1]; \
sscanf (copy, "%x", &val); \
((struct sockaddr_ipx *)sadr)->dest = val
Definition at line 182 of file net_wins.c.
◆ MAX_LOOPBACK
◆ NET_AdrToString()
Definition at line 156 of file net_wins.c.
165 Com_sprintf (s,
sizeof(s),
"%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x:%i", a.
ipx[0], a.
ipx[1], a.
ipx[2], a.
ipx[3], a.
ipx[4], a.
ipx[5], a.
ipx[6], a.
ipx[7], a.
ipx[8], a.
ipx[9], ntohs(a.
port));
Referenced by CL_ConnectionlessPacket(), CL_ReadPackets(), JoinServerFunc(), M_AddToServerList(), Master_Heartbeat(), Master_Shutdown(), NET_GetPacket(), NET_SendPacket(), Netchan_Process(), Netchan_Transmit(), SV_ConnectionlessPacket(), SV_SetMaster_f(), SV_Status_f(), SVC_Ack(), SVC_DirectConnect(), and SVC_RemoteCommand().
◆ NET_CompareAdr()
◆ NET_CompareBaseAdr()
◆ NET_Config()
◆ NET_ErrorString()
char * NET_ErrorString |
( |
void |
| ) |
|
Definition at line 801 of file net_wins.c.
805 code = WSAGetLastError ();
808 case WSAEINTR:
return "WSAEINTR";
809 case WSAEBADF:
return "WSAEBADF";
810 case WSAEACCES:
return "WSAEACCES";
811 case WSAEDISCON:
return "WSAEDISCON";
812 case WSAEFAULT:
return "WSAEFAULT";
813 case WSAEINVAL:
return "WSAEINVAL";
814 case WSAEMFILE:
return "WSAEMFILE";
815 case WSAEWOULDBLOCK:
return "WSAEWOULDBLOCK";
816 case WSAEINPROGRESS:
return "WSAEINPROGRESS";
817 case WSAEALREADY:
return "WSAEALREADY";
818 case WSAENOTSOCK:
return "WSAENOTSOCK";
819 case WSAEDESTADDRREQ:
return "WSAEDESTADDRREQ";
820 case WSAEMSGSIZE:
return "WSAEMSGSIZE";
821 case WSAEPROTOTYPE:
return "WSAEPROTOTYPE";
822 case WSAENOPROTOOPT:
return "WSAENOPROTOOPT";
823 case WSAEPROTONOSUPPORT:
return "WSAEPROTONOSUPPORT";
824 case WSAESOCKTNOSUPPORT:
return "WSAESOCKTNOSUPPORT";
825 case WSAEOPNOTSUPP:
return "WSAEOPNOTSUPP";
826 case WSAEPFNOSUPPORT:
return "WSAEPFNOSUPPORT";
827 case WSAEAFNOSUPPORT:
return "WSAEAFNOSUPPORT";
828 case WSAEADDRINUSE:
return "WSAEADDRINUSE";
829 case WSAEADDRNOTAVAIL:
return "WSAEADDRNOTAVAIL";
830 case WSAENETDOWN:
return "WSAENETDOWN";
831 case WSAENETUNREACH:
return "WSAENETUNREACH";
832 case WSAENETRESET:
return "WSAENETRESET";
833 case WSAECONNABORTED:
return "WSWSAECONNABORTEDAEINTR";
834 case WSAECONNRESET:
return "WSAECONNRESET";
835 case WSAENOBUFS:
return "WSAENOBUFS";
836 case WSAEISCONN:
return "WSAEISCONN";
837 case WSAENOTCONN:
return "WSAENOTCONN";
838 case WSAESHUTDOWN:
return "WSAESHUTDOWN";
839 case WSAETOOMANYREFS:
return "WSAETOOMANYREFS";
840 case WSAETIMEDOUT:
return "WSAETIMEDOUT";
841 case WSAECONNREFUSED:
return "WSAECONNREFUSED";
842 case WSAELOOP:
return "WSAELOOP";
843 case WSAENAMETOOLONG:
return "WSAENAMETOOLONG";
844 case WSAEHOSTDOWN:
return "WSAEHOSTDOWN";
845 case WSASYSNOTREADY:
return "WSASYSNOTREADY";
846 case WSAVERNOTSUPPORTED:
return "WSAVERNOTSUPPORTED";
847 case WSANOTINITIALISED:
return "WSANOTINITIALISED";
848 case WSAHOST_NOT_FOUND:
return "WSAHOST_NOT_FOUND";
849 case WSATRY_AGAIN:
return "WSATRY_AGAIN";
850 case WSANO_RECOVERY:
return "WSANO_RECOVERY";
851 case WSANO_DATA:
return "WSANO_DATA";
852 default:
return "NO ERROR";
Referenced by NET_GetPacket(), NET_IPSocket(), NET_IPXSocket(), and NET_SendPacket().
◆ NET_GetLoopPacket()
◆ NET_GetPacket()
Definition at line 331 of file net_wins.c.
334 struct sockaddr from;
343 for (protocol = 0 ; protocol < 2 ; protocol++)
353 fromlen =
sizeof(from);
355 , 0, (
struct sockaddr *)&from, &fromlen);
361 err = WSAGetLastError();
363 if (err == WSAEWOULDBLOCK)
365 if (err == WSAEMSGSIZE) {
366 Com_Printf (
"Warning: Oversize packet from %s\n",
Referenced by CL_DumpPackets(), CL_ReadPackets(), and SV_ReadPackets().
◆ NET_Init()
Definition at line 762 of file net_wins.c.
764 WORD wVersionRequested;
767 wVersionRequested = MAKEWORD(1, 1);
Referenced by Qcommon_Init().
◆ NET_IPSocket()
int NET_IPSocket |
( |
char * |
net_interface, |
|
|
int |
port |
|
) |
| |
Definition at line 479 of file net_wins.c.
482 struct sockaddr_in address;
487 if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
489 err = WSAGetLastError();
490 if (err != WSAEAFNOSUPPORT)
496 if (ioctlsocket (newsocket, FIONBIO, &_true) == -1)
503 if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (
char *)&
i,
sizeof(
i)) == -1)
509 if (!net_interface || !net_interface[0] || !stricmp(net_interface,
"localhost"))
510 address.sin_addr.s_addr = INADDR_ANY;
515 address.sin_port = 0;
517 address.sin_port = htons((
short)port);
519 address.sin_family = AF_INET;
521 if( bind (newsocket, (
void *)&address,
sizeof(address)) == -1)
524 closesocket (newsocket);
Referenced by NET_OpenIP().
◆ NET_IPXSocket()
Definition at line 589 of file net_wins.c.
592 struct sockaddr_ipx address;
596 if ((newsocket = socket (PF_IPX, SOCK_DGRAM, NSPROTO_IPX)) == -1)
598 err = WSAGetLastError();
599 if (err != WSAEAFNOSUPPORT)
605 if (ioctlsocket (newsocket, FIONBIO, &_true) == -1)
612 if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (
char *)&_true,
sizeof(_true)) == -1)
618 address.sa_family = AF_IPX;
619 memset (address.sa_netnum, 0, 4);
620 memset (address.sa_nodenum, 0, 6);
622 address.sa_socket = 0;
624 address.sa_socket = htons((
short)port);
626 if( bind (newsocket, (
void *)&address,
sizeof(address)) == -1)
629 closesocket (newsocket);
Referenced by NET_OpenIPX().
◆ NET_IsLocalAddress()
◆ NET_OpenIP()
◆ NET_OpenIPX()
◆ NET_SendLoopPacket()
◆ NET_SendPacket()
◆ NET_Shutdown()
◆ NET_Sleep()
◆ NET_StringToAdr()
◆ NET_StringToSockaddr()
qboolean NET_StringToSockaddr |
( |
char * |
s, |
|
|
struct sockaddr * |
sadr |
|
) |
| |
Definition at line 188 of file net_wins.c.
195 memset (sadr, 0,
sizeof(*sadr));
197 if ((strlen(s) >= 23) && (s[8] ==
':') && (s[21] ==
':'))
199 ((
struct sockaddr_ipx *)sadr)->sa_family = AF_IPX;
205 DO(9, sa_nodenum[0]);
206 DO(11, sa_nodenum[1]);
207 DO(13, sa_nodenum[2]);
208 DO(15, sa_nodenum[3]);
209 DO(17, sa_nodenum[4]);
210 DO(19, sa_nodenum[5]);
211 sscanf (&s[22],
"%u", &val);
212 ((
struct sockaddr_ipx *)sadr)->sa_socket = htons((
unsigned short)val);
216 ((
struct sockaddr_in *)sadr)->sin_family = AF_INET;
218 ((
struct sockaddr_in *)sadr)->sin_port = 0;
222 for (colon = copy ; *colon ; colon++)
226 ((
struct sockaddr_in *)sadr)->sin_port = htons((
short)atoi(colon+1));
229 if (copy[0] >=
'0' && copy[0] <=
'9')
231 *(
int *)&((
struct sockaddr_in *)sadr)->sin_addr = inet_addr(copy);
235 if (! (h = gethostbyname(copy)) )
237 *(
int *)&((
struct sockaddr_in *)sadr)->sin_addr = *(
int *)h->h_addr_list[0];
Referenced by NET_IPSocket(), and NET_StringToAdr().
◆ NetadrToSockadr()
Definition at line 53 of file net_wins.c.
55 memset (s, 0,
sizeof(*s));
59 ((
struct sockaddr_in *)s)->sin_family = AF_INET;
60 ((
struct sockaddr_in *)s)->sin_port = a->
port;
61 ((
struct sockaddr_in *)s)->sin_addr.s_addr = INADDR_BROADCAST;
65 ((
struct sockaddr_in *)s)->sin_family = AF_INET;
66 ((
struct sockaddr_in *)s)->sin_addr.s_addr = *(
int *)&a->
ip;
67 ((
struct sockaddr_in *)s)->sin_port = a->
port;
71 ((
struct sockaddr_ipx *)s)->sa_family = AF_IPX;
72 memcpy(((
struct sockaddr_ipx *)s)->sa_netnum, &a->
ipx[0], 4);
73 memcpy(((
struct sockaddr_ipx *)s)->sa_nodenum, &a->
ipx[4], 6);
74 ((
struct sockaddr_ipx *)s)->sa_socket = a->
port;
78 ((
struct sockaddr_ipx *)s)->sa_family = AF_IPX;
79 memset(((
struct sockaddr_ipx *)s)->sa_netnum, 0, 4);
80 memset(((
struct sockaddr_ipx *)s)->sa_nodenum, 0xff, 6);
81 ((
struct sockaddr_ipx *)s)->sa_socket = a->
port;
Referenced by NET_SendPacket().
◆ SockadrToNetadr()
Definition at line 85 of file net_wins.c.
87 if (s->sa_family == AF_INET)
90 *(
int *)&a->
ip = ((
struct sockaddr_in *)s)->sin_addr.s_addr;
91 a->
port = ((
struct sockaddr_in *)s)->sin_port;
93 else if (s->sa_family == AF_IPX)
96 memcpy(&a->
ipx[0], ((
struct sockaddr_ipx *)s)->sa_netnum, 4);
97 memcpy(&a->
ipx[4], ((
struct sockaddr_ipx *)s)->sa_nodenum, 6);
98 a->
port = ((
struct sockaddr_ipx *)s)->sa_socket;
Referenced by NET_GetPacket(), and NET_StringToAdr().
◆ ip_sockets
◆ ipx_sockets
◆ loopbacks
◆ net_shownet
◆ noipx
◆ noudp
◆ winsockdata