mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-15 20:48:19 +00:00
05af24a052
Move a couple of trivial type definitions to `<base/types.h>` instead.
66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
#ifndef BASE_TYPES_H
|
|
#define BASE_TYPES_H
|
|
|
|
#include <ctime>
|
|
|
|
enum class TRISTATE
|
|
{
|
|
NONE,
|
|
SOME,
|
|
ALL,
|
|
};
|
|
|
|
typedef void *IOHANDLE;
|
|
|
|
typedef int (*FS_LISTDIR_CALLBACK)(const char *name, int is_dir, int dir_type, void *user);
|
|
|
|
typedef struct
|
|
{
|
|
const char *m_pName;
|
|
time_t m_TimeCreated; // seconds since UNIX Epoch
|
|
time_t m_TimeModified; // seconds since UNIX Epoch
|
|
} CFsFileInfo;
|
|
|
|
typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo *info, int is_dir, int dir_type, void *user);
|
|
|
|
/**
|
|
* @ingroup Network-General
|
|
*/
|
|
typedef struct NETSOCKET_INTERNAL *NETSOCKET;
|
|
|
|
enum
|
|
{
|
|
/**
|
|
* The maximum bytes necessary to encode one Unicode codepoint with UTF-8.
|
|
*/
|
|
UTF8_BYTE_LENGTH = 4,
|
|
|
|
IO_MAX_PATH_LENGTH = 512,
|
|
|
|
NETADDR_MAXSTRSIZE = 1 + (8 * 4 + 7) + 1 + 1 + 5 + 1, // [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:XXXXX
|
|
|
|
NETTYPE_LINK_BROADCAST = 4,
|
|
|
|
NETTYPE_INVALID = 0,
|
|
NETTYPE_IPV4 = 1,
|
|
NETTYPE_IPV6 = 2,
|
|
NETTYPE_WEBSOCKET_IPV4 = 8,
|
|
|
|
NETTYPE_ALL = NETTYPE_IPV4 | NETTYPE_IPV6 | NETTYPE_WEBSOCKET_IPV4,
|
|
NETTYPE_MASK = NETTYPE_ALL | NETTYPE_LINK_BROADCAST,
|
|
};
|
|
|
|
/**
|
|
* @ingroup Network-General
|
|
*/
|
|
typedef struct NETADDR
|
|
{
|
|
unsigned int type;
|
|
unsigned char ip[16];
|
|
unsigned short port;
|
|
|
|
bool operator==(const NETADDR &other) const;
|
|
bool operator!=(const NETADDR &other) const { return !(*this == other); }
|
|
} NETADDR;
|
|
#endif // BASE_TYPES_H
|