2024-01-12 21:08:57 +01:00
|
|
|
/*
|
|
|
|
Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NET_ADR_H
|
|
|
|
#define NET_ADR_H
|
|
|
|
|
2022-03-10 02:43:26 +01:00
|
|
|
#include STDINT_H
|
|
|
|
|
2024-01-12 21:08:57 +01:00
|
|
|
// net.h -- quake's interface to the networking layer
|
|
|
|
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
|
|
|
|
|
|
|
#define PORT_ANY -1
|
|
|
|
|
|
|
|
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Original Quake-2 structure:
|
|
|
|
typedef struct
|
2018-04-13 18:23:45 +02:00
|
|
|
{
|
2024-01-12 21:08:57 +01:00
|
|
|
netadrtype_t type;
|
|
|
|
|
|
|
|
byte ip[4];
|
|
|
|
byte ipx[10];
|
|
|
|
|
|
|
|
unsigned short port;
|
|
|
|
} netadr_t;
|
|
|
|
*/
|
2022-03-10 02:43:26 +01:00
|
|
|
|
2022-03-11 10:10:00 +01:00
|
|
|
#pragma pack( push, 1 )
|
2018-04-13 18:23:45 +02:00
|
|
|
typedef struct netadr_s
|
|
|
|
{
|
2022-03-10 02:43:26 +01:00
|
|
|
union
|
|
|
|
{
|
2024-01-12 21:08:57 +01:00
|
|
|
// IPv6 struct
|
2022-03-10 02:43:26 +01:00
|
|
|
struct
|
|
|
|
{
|
2024-01-12 21:08:57 +01:00
|
|
|
uint16_t type6;
|
|
|
|
uint8_t ip6[16];
|
2022-03-11 10:10:00 +01:00
|
|
|
};
|
|
|
|
struct
|
|
|
|
{
|
2024-01-12 21:08:57 +01:00
|
|
|
uint32_t type; // must be netadrtype_t but will break with short enums
|
|
|
|
union
|
|
|
|
{
|
|
|
|
uint8_t ip[4];
|
|
|
|
uint32_t ip4; // for easier conversions
|
|
|
|
};
|
|
|
|
uint8_t ipx[10];
|
2022-03-10 02:43:26 +01:00
|
|
|
};
|
|
|
|
};
|
2024-01-12 21:08:57 +01:00
|
|
|
uint16_t port;
|
2018-04-13 18:23:45 +02:00
|
|
|
} netadr_t;
|
2022-03-11 10:10:00 +01:00
|
|
|
#pragma pack( pop )
|
2018-04-13 18:23:45 +02:00
|
|
|
|
2024-01-12 21:08:57 +01:00
|
|
|
STATIC_ASSERT( sizeof( netadr_t ) == 20, "netadr_t isn't 20 bytes!" );
|
2022-03-10 02:43:26 +01:00
|
|
|
|
2024-01-12 21:08:57 +01:00
|
|
|
#endif // NET_ADR_H
|