Basic IPv6 support. Some inspiration from the patches by Lubos Dolezel and JF Tremblay at https://bugzilla.icculus.org/show_bug.cgi?id=2355.

This commit is contained in:
Thilo Schulz 2008-04-04 23:22:22 +00:00
parent c5980568e1
commit 5d63a38ad9
8 changed files with 926 additions and 481 deletions

View file

@ -136,7 +136,9 @@ typedef enum {
NA_BAD, // an address lookup failed
NA_LOOPBACK,
NA_BROADCAST,
NA_IP
NA_IP,
NA_IP6,
NA_UNSPEC
} netadrtype_t;
typedef enum {
@ -144,10 +146,12 @@ typedef enum {
NS_SERVER
} netsrc_t;
#define NET_ADDRSTRMAXLEN 48 // maximum length of an IPv6 address string including trailing '\0'
typedef struct {
netadrtype_t type;
byte ip[4];
byte ip6[16];
unsigned short port;
} netadr_t;
@ -165,7 +169,8 @@ qboolean NET_CompareAdr (netadr_t a, netadr_t b);
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
qboolean NET_IsLocalAddress (netadr_t adr);
const char *NET_AdrToString (netadr_t a);
qboolean NET_StringToAdr ( const char *s, netadr_t *a);
const char *NET_AdrToStringwPort (netadr_t a);
qboolean NET_StringToAdr ( const char *s, netadr_t *a, netadrtype_t family);
qboolean NET_GetLoopPacket (netsrc_t sock, netadr_t *net_from, msg_t *net_message);
void NET_Sleep(int msec);
@ -1015,7 +1020,7 @@ void Sys_SetErrorText( const char *text );
void Sys_SendPacket( int length, const void *data, netadr_t to );
qboolean Sys_GetPacket( netadr_t *net_from, msg_t *net_message );
qboolean Sys_StringToAdr( const char *s, netadr_t *a );
qboolean Sys_StringToAdr( const char *s, netadr_t *a, netadrtype_t family );
//Does NOT parse port numbers, only base addresses.
qboolean Sys_IsLANAddress (netadr_t adr);