1#ifndef BASE_TYPES_H
2#define BASE_TYPES_H
3
4#include <ctime>
5
6enum class TRISTATE
7{
8 NONE,
9 SOME,
10 ALL,
11};
12
13typedef void *IOHANDLE;
14
15typedef int (*FS_LISTDIR_CALLBACK)(const char *name, int is_dir, int dir_type, void *user);
16
17typedef struct
18{
19 const char *m_pName;
20 time_t m_TimeCreated; // seconds since UNIX Epoch
21 time_t m_TimeModified; // seconds since UNIX Epoch
22} CFsFileInfo;
23
24typedef int (*FS_LISTDIR_CALLBACK_FILEINFO)(const CFsFileInfo *info, int is_dir, int dir_type, void *user);
25
26/**
27 * @ingroup Network-General
28 */
29typedef struct NETSOCKET_INTERNAL *NETSOCKET;
30
31enum
32{
33 /**
34 * The maximum bytes necessary to encode one Unicode codepoint with UTF-8.
35 */
36 UTF8_BYTE_LENGTH = 4,
37
38 IO_MAX_PATH_LENGTH = 512,
39
40 NETADDR_MAXSTRSIZE = 1 + (8 * 4 + 7) + 1 + 1 + 5 + 1, // [XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX]:XXXXX
41
42 NETTYPE_LINK_BROADCAST = 4,
43
44 NETTYPE_INVALID = 0,
45 NETTYPE_IPV4 = 1,
46 NETTYPE_IPV6 = 2,
47 NETTYPE_WEBSOCKET_IPV4 = 8,
48
49 NETTYPE_ALL = NETTYPE_IPV4 | NETTYPE_IPV6 | NETTYPE_WEBSOCKET_IPV4,
50 NETTYPE_MASK = NETTYPE_ALL | NETTYPE_LINK_BROADCAST,
51};
52
53/**
54 * @ingroup Network-General
55 */
56typedef struct NETADDR
57{
58 unsigned int type;
59 unsigned char ip[16];
60 unsigned short port;
61
62 bool operator==(const NETADDR &other) const;
63 bool operator!=(const NETADDR &other) const { return !(*this == other); }
64} NETADDR;
65#endif // BASE_TYPES_H
66