Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Types.h
Go to the documentation of this file.
1
#ifndef ULT_NETWORK_TYPES_H_INCLUDED
2
#define ULT_NETWORK_TYPES_H_INCLUDED
3
4
#ifdef _WIN32
5
6
#include <winsock2.h>
7
typedef
int
socklen_t;
8
#define IOCTL_TYPE unsigned long
9
typedef
SOCKET
ULT_SOCKET
;
10
#else
11
12
#include <unistd.h>
13
#include <sys/time.h>
14
#include <sys/types.h>
15
#include <sys/socket.h>
16
#include <netinet/in.h>
17
#include <cerrno>
18
#include <arpa/inet.h>
19
#include <netdb.h>
20
#include <sys/ioctl.h>
21
22
#define INVALID_SOCKET -1
23
#define SOCKET_ERROR -1
24
25
#define ioctlsocket ioctl
26
#define IOCTL_TYPE char
27
29
typedef
int
ULT_SOCKET
;
30
31
#endif
// #ifdef _WIN32
32
33
namespace
Ult
34
{
35
37
enum class
NetMsgType
38
{
39
ServerDisconnect
= 0,
40
ClientDisconnect
,
41
ForceDisconnect
,
42
ConnectAccepted
,
43
SendError
,
44
RespondRequire
,
45
RespondOk
46
};
47
49
enum class
NetType
50
{
51
Null
= 0,
52
Server
,
53
Client
54
};
55
57
enum class
NetResult
58
{
59
NoData
= 0,
60
DataFail
,
61
PartialData
,
62
DataSuccess
63
};
64
66
typedef
char
NetPacketValue
;
68
constexpr
size_t
MAX_PACKET_SIZE
= 256;
77
typedef
void (*
NetCallback
)(
int
u,
int
y,
char
* d,
int
s);
79
constexpr
char
NetSystemUsage
= 0;
80
81
}
// namespace Ult
82
83
#endif
// ULT_NETWORK_TYPES_H_INCLUDED
84
Ult::NetPacketValue
char NetPacketValue
Definition
Types.h:66
Ult::NetSystemUsage
constexpr char NetSystemUsage
Definition
Types.h:79
Ult::NetMsgType
NetMsgType
Definition
Types.h:38
ULT_SOCKET
int ULT_SOCKET
Definition
Types.h:29
Ult::NetCallback
void(* NetCallback)(int u, int y, char *d, int s)
Definition
Types.h:77
Ult::NetType
NetType
Definition
Types.h:50
Ult::NetResult
NetResult
Definition
Types.h:58
Ult::MAX_PACKET_SIZE
constexpr size_t MAX_PACKET_SIZE
Definition
Types.h:68
Ult::NetMsgType::RespondOk
@ RespondOk
Definition
Types.h:45
Ult::NetMsgType::ForceDisconnect
@ ForceDisconnect
Definition
Types.h:41
Ult::NetMsgType::ServerDisconnect
@ ServerDisconnect
Definition
Types.h:39
Ult::NetMsgType::RespondRequire
@ RespondRequire
Definition
Types.h:44
Ult::NetMsgType::SendError
@ SendError
Definition
Types.h:43
Ult::NetMsgType::ConnectAccepted
@ ConnectAccepted
Definition
Types.h:42
Ult::NetMsgType::ClientDisconnect
@ ClientDisconnect
Definition
Types.h:40
Ult::NetType::Client
@ Client
Definition
Types.h:53
Ult::NetType::Server
@ Server
Definition
Types.h:52
Ult::NetType::Null
@ Null
Definition
Types.h:51
Ult::NetResult::DataSuccess
@ DataSuccess
Definition
Types.h:62
Ult::NetResult::PartialData
@ PartialData
Definition
Types.h:61
Ult::NetResult::NoData
@ NoData
Definition
Types.h:59
Ult::NetResult::DataFail
@ DataFail
Definition
Types.h:60
Ult
Definition
Archive.h:13
include
Ult
Network
Types.h
Generated by
1.13.0