You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
1.4 KiB
74 lines
1.4 KiB
/*** |
|
* |
|
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. |
|
* |
|
* This product contains software technology licensed from Id |
|
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
|
* All Rights Reserved. |
|
* |
|
* Use, distribution, and modification of this source code and/or resulting |
|
* object code is restricted to non-commercial enhancements to products from |
|
* Valve LLC. All other use, distribution, or modification is prohibited |
|
* without written permission from Valve LLC. |
|
* |
|
****/ |
|
|
|
#ifndef NETADR_H |
|
#define NETADR_H |
|
|
|
#include "build.h" |
|
#include STDINT_H |
|
|
|
typedef enum |
|
{ |
|
NA_UNUSED = 0, |
|
NA_LOOPBACK, |
|
NA_BROADCAST, |
|
NA_IP, |
|
NA_IPX, |
|
NA_BROADCAST_IPX, |
|
NA_IP6, |
|
NA_MULTICAST_IP6, // all nodes multicast |
|
} netadrtype_t; |
|
|
|
#define NETADR_T_SIZE 20 |
|
|
|
// Original structure: |
|
// typedef struct netadr_s |
|
// { |
|
// netadrtype_t type; |
|
// unsigned char ip[4]; |
|
// unsigned char ipx[10]; |
|
// unsigned short port; |
|
// } netadr_t; |
|
|
|
#pragma pack( push, 1 ) |
|
typedef struct netadr_s |
|
{ |
|
union |
|
{ |
|
struct |
|
{ |
|
uint32_t type; |
|
uint8_t ip[4]; // or last 4 IPv6 octets |
|
uint8_t ipx[10]; // or first 10 IPv6 octets |
|
}; |
|
struct |
|
{ |
|
#if XASH_LITTLE_ENDIAN |
|
uint16_t type6; |
|
uint8_t ip6[16]; |
|
#elif XASH_BIG_ENDIAN |
|
uint8_t ip6_0[2]; |
|
uint16_t type6; |
|
uint8_t ip6_2[14]; |
|
#endif |
|
}; |
|
}; |
|
uint16_t port; |
|
} netadr_t; |
|
#pragma pack( pop ) |
|
|
|
extern int _check_netadr_t_size[sizeof( netadr_t ) == NETADR_T_SIZE ? 1 : -1]; |
|
|
|
#endif//NETADR_H
|
|
|