#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:
sscanf (copy, "%x", &val); \
((struct sockaddr_ipx *)sadr)->dest = val
Definition at line 187 of file net_wins.c.
◆ MAX_LOOPBACK
◆ NET_AdrToString()
Definition at line 161 of file net_wins.c.
170 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(), 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 806 of file net_wins.c.
810 code = WSAGetLastError ();
813 case WSAEINTR:
return "WSAEINTR";
814 case WSAEBADF:
return "WSAEBADF";
815 case WSAEACCES:
return "WSAEACCES";
816 case WSAEDISCON:
return "WSAEDISCON";
817 case WSAEFAULT:
return "WSAEFAULT";
818 case WSAEINVAL:
return "WSAEINVAL";
819 case WSAEMFILE:
return "WSAEMFILE";
820 case WSAEWOULDBLOCK:
return "WSAEWOULDBLOCK";
821 case WSAEINPROGRESS:
return "WSAEINPROGRESS";
822 case WSAEALREADY:
return "WSAEALREADY";
823 case WSAENOTSOCK:
return "WSAENOTSOCK";
824 case WSAEDESTADDRREQ:
return "WSAEDESTADDRREQ";
825 case WSAEMSGSIZE:
return "WSAEMSGSIZE";
826 case WSAEPROTOTYPE:
return "WSAEPROTOTYPE";
827 case WSAENOPROTOOPT:
return "WSAENOPROTOOPT";
828 case WSAEPROTONOSUPPORT:
return "WSAEPROTONOSUPPORT";
829 case WSAESOCKTNOSUPPORT:
return "WSAESOCKTNOSUPPORT";
830 case WSAEOPNOTSUPP:
return "WSAEOPNOTSUPP";
831 case WSAEPFNOSUPPORT:
return "WSAEPFNOSUPPORT";
832 case WSAEAFNOSUPPORT:
return "WSAEAFNOSUPPORT";
833 case WSAEADDRINUSE:
return "WSAEADDRINUSE";
834 case WSAEADDRNOTAVAIL:
return "WSAEADDRNOTAVAIL";
835 case WSAENETDOWN:
return "WSAENETDOWN";
836 case WSAENETUNREACH:
return "WSAENETUNREACH";
837 case WSAENETRESET:
return "WSAENETRESET";
838 case WSAECONNABORTED:
return "WSWSAECONNABORTEDAEINTR";
839 case WSAECONNRESET:
return "WSAECONNRESET";
840 case WSAENOBUFS:
return "WSAENOBUFS";
841 case WSAEISCONN:
return "WSAEISCONN";
842 case WSAENOTCONN:
return "WSAENOTCONN";
843 case WSAESHUTDOWN:
return "WSAESHUTDOWN";
844 case WSAETOOMANYREFS:
return "WSAETOOMANYREFS";
845 case WSAETIMEDOUT:
return "WSAETIMEDOUT";
846 case WSAECONNREFUSED:
return "WSAECONNREFUSED";
847 case WSAELOOP:
return "WSAELOOP";
848 case WSAENAMETOOLONG:
return "WSAENAMETOOLONG";
849 case WSAEHOSTDOWN:
return "WSAEHOSTDOWN";
850 case WSASYSNOTREADY:
return "WSASYSNOTREADY";
851 case WSAVERNOTSUPPORTED:
return "WSAVERNOTSUPPORTED";
852 case WSANOTINITIALISED:
return "WSANOTINITIALISED";
853 case WSAHOST_NOT_FOUND:
return "WSAHOST_NOT_FOUND";
854 case WSATRY_AGAIN:
return "WSATRY_AGAIN";
855 case WSANO_RECOVERY:
return "WSANO_RECOVERY";
856 case WSANO_DATA:
return "WSANO_DATA";
857 default:
return "NO ERROR";
Referenced by NET_GetPacket(), NET_IPSocket(), NET_IPXSocket(), and NET_SendPacket().
◆ NET_GetLoopPacket()
◆ NET_GetPacket()
Definition at line 336 of file net_wins.c.
339 struct sockaddr from;
348 for (protocol = 0 ; protocol < 2 ; protocol++)
358 fromlen =
sizeof(from);
360 , 0, (
struct sockaddr *)&from, &fromlen);
366 err = WSAGetLastError();
368 if (err == WSAEWOULDBLOCK)
370 if (err == WSAEMSGSIZE) {
371 Com_Printf (
"Warning: Oversize packet from %s\n",
Referenced by CL_DumpPackets(), CL_ReadPackets(), and SV_ReadPackets().
◆ NET_Init()
Definition at line 767 of file net_wins.c.
769 WORD wVersionRequested;
772 wVersionRequested = MAKEWORD(1, 1);
Referenced by Qcommon_Init().
◆ NET_IPSocket()
int NET_IPSocket |
( |
char * |
net_interface, |
|
|
int |
port |
|
) |
| |
Definition at line 484 of file net_wins.c.
487 struct sockaddr_in address;
492 if ((newsocket = socket (PF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)
494 err = WSAGetLastError();
495 if (err != WSAEAFNOSUPPORT)
501 if (ioctlsocket (newsocket, FIONBIO, &_true) == -1)
508 if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (
char *)&
i,
sizeof(
i)) == -1)
514 if (!net_interface || !net_interface[0] || !stricmp(net_interface,
"localhost"))
515 address.sin_addr.s_addr = INADDR_ANY;
520 address.sin_port = 0;
522 address.sin_port = htons((
short)port);
524 address.sin_family = AF_INET;
526 if( bind (newsocket, (
void *)&address,
sizeof(address)) == -1)
529 closesocket (newsocket);
Referenced by NET_OpenIP().
◆ NET_IPXSocket()
Definition at line 594 of file net_wins.c.
597 struct sockaddr_ipx address;
601 if ((newsocket = socket (PF_IPX, SOCK_DGRAM, NSPROTO_IPX)) == -1)
603 err = WSAGetLastError();
604 if (err != WSAEAFNOSUPPORT)
610 if (ioctlsocket (newsocket, FIONBIO, &_true) == -1)
617 if (setsockopt(newsocket, SOL_SOCKET, SO_BROADCAST, (
char *)&_true,
sizeof(_true)) == -1)
623 address.sa_family = AF_IPX;
624 memset (address.sa_netnum, 0, 4);
625 memset (address.sa_nodenum, 0, 6);
627 address.sa_socket = 0;
629 address.sa_socket = htons((
short)port);
631 if( bind (newsocket, (
void *)&address,
sizeof(address)) == -1)
634 closesocket (newsocket);
Referenced by NET_OpenIPX().
◆ NET_IsLocalAddress()
◆ NET_OpenIP()
◆ NET_OpenIPX()
◆ NET_SendLoopPacket()
◆ NET_SendPacket()
◆ NET_Shutdown()
◆ NET_Sleep()
Definition at line 731 of file net_wins.c.
733 struct timeval timeout;
752 timeout.tv_sec = msec/1000;
753 timeout.tv_usec = (msec%1000)*1000;
754 select(
i+1, &fdset,
NULL,
NULL, &timeout);
Referenced by SV_Frame().
◆ NET_StringToAdr()
◆ NET_StringToSockaddr()
qboolean NET_StringToSockaddr |
( |
char * |
s, |
|
|
struct sockaddr * |
sadr |
|
) |
| |
Definition at line 193 of file net_wins.c.
200 memset (sadr, 0,
sizeof(*sadr));
202 if ((strlen(
s) >= 23) && (
s[8] ==
':') && (
s[21] ==
':'))
204 ((
struct sockaddr_ipx *)sadr)->sa_family = AF_IPX;
210 DO(9, sa_nodenum[0]);
211 DO(11, sa_nodenum[1]);
212 DO(13, sa_nodenum[2]);
213 DO(15, sa_nodenum[3]);
214 DO(17, sa_nodenum[4]);
215 DO(19, sa_nodenum[5]);
216 sscanf (&
s[22],
"%u", &val);
217 ((
struct sockaddr_ipx *)sadr)->sa_socket = htons((
unsigned short)val);
221 ((
struct sockaddr_in *)sadr)->sin_family = AF_INET;
223 ((
struct sockaddr_in *)sadr)->sin_port = 0;
227 for (colon = copy ; *colon ; colon++)
231 ((
struct sockaddr_in *)sadr)->sin_port = htons((
short)atoi(colon+1));
234 if (copy[0] >=
'0' && copy[0] <=
'9')
236 *(
int *)&((
struct sockaddr_in *)sadr)->sin_addr = inet_addr(copy);
240 if (! (h = gethostbyname(copy)) )
242 *(
int *)&((
struct sockaddr_in *)sadr)->sin_addr = *(
int *)h->h_addr_list[0];
Referenced by NET_IPSocket(), and NET_StringToAdr().
◆ NetadrToSockadr()
Definition at line 54 of file net_wins.c.
56 memset (
s, 0,
sizeof(*
s));
60 ((
struct sockaddr_in *)
s)->sin_family = AF_INET;
61 ((
struct sockaddr_in *)
s)->sin_port = a->
port;
62 ((
struct sockaddr_in *)
s)->sin_addr.s_addr = INADDR_BROADCAST;
66 ((
struct sockaddr_in *)
s)->sin_family = AF_INET;
67 ((
struct sockaddr_in *)
s)->sin_addr.s_addr = *(
int *)&a->
ip;
68 ((
struct sockaddr_in *)
s)->sin_port = a->
port;
72 ((
struct sockaddr_ipx *)
s)->sa_family = AF_IPX;
73 memcpy(((
struct sockaddr_ipx *)
s)->sa_netnum, &a->
ipx[0], 4);
74 memcpy(((
struct sockaddr_ipx *)
s)->sa_nodenum, &a->
ipx[4], 6);
75 ((
struct sockaddr_ipx *)
s)->sa_socket = a->
port;
79 ((
struct sockaddr_ipx *)
s)->sa_family = AF_IPX;
80 memset(((
struct sockaddr_ipx *)
s)->sa_netnum, 0, 4);
81 memset(((
struct sockaddr_ipx *)
s)->sa_nodenum, 0xff, 6);
82 ((
struct sockaddr_ipx *)
s)->sa_socket = a->
port;
Referenced by NET_SendPacket().
◆ SockadrToNetadr()
Definition at line 86 of file net_wins.c.
88 if (
s->sa_family == AF_INET)
91 *(
int *)&a->
ip = ((
struct sockaddr_in *)
s)->sin_addr.s_addr;
92 a->
port = ((
struct sockaddr_in *)
s)->sin_port;
94 else if (
s->sa_family == AF_IPX)
97 memcpy(&a->
ipx[0], ((
struct sockaddr_ipx *)
s)->sa_netnum, 4);
98 memcpy(&a->
ipx[4], ((
struct sockaddr_ipx *)
s)->sa_nodenum, 6);
99 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