5 #ifndef __ENET_PROTOCOL_H__ 6 #define __ENET_PROTOCOL_H__ 12 ENET_PROTOCOL_MINIMUM_MTU = 576,
13 ENET_PROTOCOL_MAXIMUM_MTU = 4096,
14 ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
15 ENET_PROTOCOL_MINIMUM_WINDOW_SIZE = 4096,
16 ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE = 65536,
17 ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT = 1,
18 ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT = 255,
19 ENET_PROTOCOL_MAXIMUM_PEER_ID = 0xFFF,
20 ENET_PROTOCOL_MAXIMUM_FRAGMENT_COUNT = 1024 * 1024
23 typedef enum _ENetProtocolCommand
25 ENET_PROTOCOL_COMMAND_NONE = 0,
26 ENET_PROTOCOL_COMMAND_ACKNOWLEDGE = 1,
27 ENET_PROTOCOL_COMMAND_CONNECT = 2,
28 ENET_PROTOCOL_COMMAND_VERIFY_CONNECT = 3,
29 ENET_PROTOCOL_COMMAND_DISCONNECT = 4,
30 ENET_PROTOCOL_COMMAND_PING = 5,
31 ENET_PROTOCOL_COMMAND_SEND_RELIABLE = 6,
32 ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE = 7,
33 ENET_PROTOCOL_COMMAND_SEND_FRAGMENT = 8,
34 ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED = 9,
35 ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT = 10,
36 ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
37 ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE_FRAGMENT = 12,
38 ENET_PROTOCOL_COMMAND_COUNT = 13,
40 ENET_PROTOCOL_COMMAND_MASK = 0x0F
41 } ENetProtocolCommand;
43 typedef enum _ENetProtocolFlag
45 ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
46 ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
48 ENET_PROTOCOL_HEADER_FLAG_COMPRESSED = (1 << 14),
49 ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
50 ENET_PROTOCOL_HEADER_FLAG_MASK = ENET_PROTOCOL_HEADER_FLAG_COMPRESSED | ENET_PROTOCOL_HEADER_FLAG_SENT_TIME,
52 ENET_PROTOCOL_HEADER_SESSION_MASK = (3 << 12),
53 ENET_PROTOCOL_HEADER_SESSION_SHIFT = 12
59 #elif defined(__GNUC__) || defined(__clang__) 60 #define ENET_PACKED __attribute__ ((packed)) 75 enet_uint16 reliableSequenceNumber;
80 ENetProtocolCommandHeader header;
81 enet_uint16 receivedReliableSequenceNumber;
82 enet_uint16 receivedSentTime;
87 ENetProtocolCommandHeader header;
88 enet_uint16 outgoingPeerID;
89 enet_uint8 incomingSessionID;
90 enet_uint8 outgoingSessionID;
92 enet_uint32 windowSize;
93 enet_uint32 channelCount;
94 enet_uint32 incomingBandwidth;
95 enet_uint32 outgoingBandwidth;
96 enet_uint32 packetThrottleInterval;
97 enet_uint32 packetThrottleAcceleration;
98 enet_uint32 packetThrottleDeceleration;
99 enet_uint32 connectID;
105 ENetProtocolCommandHeader header;
106 enet_uint16 outgoingPeerID;
107 enet_uint8 incomingSessionID;
108 enet_uint8 outgoingSessionID;
110 enet_uint32 windowSize;
111 enet_uint32 channelCount;
112 enet_uint32 incomingBandwidth;
113 enet_uint32 outgoingBandwidth;
114 enet_uint32 packetThrottleInterval;
115 enet_uint32 packetThrottleAcceleration;
116 enet_uint32 packetThrottleDeceleration;
117 enet_uint32 connectID;
122 ENetProtocolCommandHeader header;
123 enet_uint32 incomingBandwidth;
124 enet_uint32 outgoingBandwidth;
129 ENetProtocolCommandHeader header;
130 enet_uint32 packetThrottleInterval;
131 enet_uint32 packetThrottleAcceleration;
132 enet_uint32 packetThrottleDeceleration;
137 ENetProtocolCommandHeader header;
143 ENetProtocolCommandHeader header;
148 ENetProtocolCommandHeader header;
149 enet_uint16 dataLength;
154 ENetProtocolCommandHeader header;
155 enet_uint16 unreliableSequenceNumber;
156 enet_uint16 dataLength;
161 ENetProtocolCommandHeader header;
162 enet_uint16 unsequencedGroup;
163 enet_uint16 dataLength;
168 ENetProtocolCommandHeader header;
169 enet_uint16 startSequenceNumber;
170 enet_uint16 dataLength;
171 enet_uint32 fragmentCount;
172 enet_uint32 fragmentNumber;
173 enet_uint32 totalLength;
174 enet_uint32 fragmentOffset;
179 ENetProtocolCommandHeader header;
180 ENetProtocolAcknowledge acknowledge;
181 ENetProtocolConnect connect;
182 ENetProtocolVerifyConnect verifyConnect;
183 ENetProtocolDisconnect disconnect;
184 ENetProtocolPing ping;
185 ENetProtocolSendReliable sendReliable;
186 ENetProtocolSendUnreliable sendUnreliable;
187 ENetProtocolSendUnsequenced sendUnsequenced;
188 ENetProtocolSendFragment sendFragment;
189 ENetProtocolBandwidthLimit bandwidthLimit;
190 ENetProtocolThrottleConfigure throttleConfigure;
Definition: protocol.h:141
Definition: protocol.h:120
Definition: protocol.h:152
Definition: protocol.h:71
Definition: protocol.h:146
Definition: protocol.h:135
Definition: protocol.h:166
Definition: protocol.h:85
Definition: protocol.h:177
Definition: protocol.h:103
Definition: protocol.h:78
Definition: protocol.h:159