protocol.h

Go to the documentation of this file.
00001 
00005 #ifndef __ENET_PROTOCOL_H__
00006 #define __ENET_PROTOCOL_H__
00007 
00008 #include "enet/types.h"
00009 
00010 enum
00011 {
00012    ENET_PROTOCOL_MINIMUM_MTU             = 576,
00013    ENET_PROTOCOL_MAXIMUM_MTU             = 4096,
00014    ENET_PROTOCOL_MAXIMUM_PACKET_COMMANDS = 32,
00015    ENET_PROTOCOL_MINIMUM_WINDOW_SIZE     = 4096,
00016    ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE     = 32768,
00017    ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT   = 1,
00018    ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT   = 255,
00019    ENET_PROTOCOL_MAXIMUM_PEER_ID         = 0x7FFF
00020 };
00021 
00022 typedef enum
00023 {
00024    ENET_PROTOCOL_COMMAND_NONE               = 0,
00025    ENET_PROTOCOL_COMMAND_ACKNOWLEDGE        = 1,
00026    ENET_PROTOCOL_COMMAND_CONNECT            = 2,
00027    ENET_PROTOCOL_COMMAND_VERIFY_CONNECT     = 3,
00028    ENET_PROTOCOL_COMMAND_DISCONNECT         = 4,
00029    ENET_PROTOCOL_COMMAND_PING               = 5,
00030    ENET_PROTOCOL_COMMAND_SEND_RELIABLE      = 6,
00031    ENET_PROTOCOL_COMMAND_SEND_UNRELIABLE    = 7,
00032    ENET_PROTOCOL_COMMAND_SEND_FRAGMENT      = 8,
00033    ENET_PROTOCOL_COMMAND_SEND_UNSEQUENCED   = 9,
00034    ENET_PROTOCOL_COMMAND_BANDWIDTH_LIMIT    = 10,
00035    ENET_PROTOCOL_COMMAND_THROTTLE_CONFIGURE = 11,
00036    ENET_PROTOCOL_COMMAND_COUNT              = 12,
00037 
00038    ENET_PROTOCOL_COMMAND_MASK               = 0x0F
00039 } ENetProtocolCommand;
00040 
00041 typedef enum
00042 {
00043    ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE = (1 << 7),
00044    ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED = (1 << 6),
00045 
00046    ENET_PROTOCOL_HEADER_FLAG_SENT_TIME = (1 << 15),
00047    ENET_PROTOCOL_HEADER_FLAG_MASK      = 0x8000
00048 } ENetProtocolFlag;
00049 
00050 typedef struct
00051 {
00052    enet_uint32 checksum;
00053    enet_uint16 peerID;
00054    enet_uint16 sentTime;
00055 } ENetProtocolHeader;
00056 
00057 typedef struct
00058 {
00059    enet_uint8 command;
00060    enet_uint8 channelID;
00061    enet_uint16 reliableSequenceNumber;
00062 } ENetProtocolCommandHeader;
00063 
00064 typedef struct
00065 {
00066    ENetProtocolCommandHeader header;
00067    enet_uint16 receivedReliableSequenceNumber;
00068    enet_uint16 receivedSentTime;
00069 } ENetProtocolAcknowledge;
00070 
00071 typedef struct
00072 {
00073    ENetProtocolCommandHeader header;
00074    enet_uint16 outgoingPeerID;
00075    enet_uint16 mtu;
00076    enet_uint32 windowSize;
00077    enet_uint32 channelCount;
00078    enet_uint32 incomingBandwidth;
00079    enet_uint32 outgoingBandwidth;
00080    enet_uint32 packetThrottleInterval;
00081    enet_uint32 packetThrottleAcceleration;
00082    enet_uint32 packetThrottleDeceleration;
00083    enet_uint32 sessionID;
00084 } ENetProtocolConnect;
00085 
00086 typedef struct
00087 {
00088    ENetProtocolCommandHeader header;
00089    enet_uint16 outgoingPeerID;
00090    enet_uint16 mtu;
00091    enet_uint32 windowSize;
00092    enet_uint32 channelCount;
00093    enet_uint32 incomingBandwidth;
00094    enet_uint32 outgoingBandwidth;
00095    enet_uint32 packetThrottleInterval;
00096    enet_uint32 packetThrottleAcceleration;
00097    enet_uint32 packetThrottleDeceleration;
00098 } ENetProtocolVerifyConnect;
00099 
00100 typedef struct
00101 {
00102    ENetProtocolCommandHeader header;
00103    enet_uint32 incomingBandwidth;
00104    enet_uint32 outgoingBandwidth;
00105 } ENetProtocolBandwidthLimit;
00106 
00107 typedef struct
00108 {
00109    ENetProtocolCommandHeader header;
00110    enet_uint32 packetThrottleInterval;
00111    enet_uint32 packetThrottleAcceleration;
00112    enet_uint32 packetThrottleDeceleration;
00113 } ENetProtocolThrottleConfigure;
00114 
00115 typedef struct
00116 {
00117    ENetProtocolCommandHeader header;
00118    enet_uint32 data;
00119 } ENetProtocolDisconnect;
00120 
00121 typedef struct
00122 {
00123    ENetProtocolCommandHeader header;
00124 } ENetProtocolPing;
00125 
00126 typedef struct
00127 {
00128    ENetProtocolCommandHeader header;
00129    enet_uint16 dataLength;
00130 } ENetProtocolSendReliable;
00131 
00132 typedef struct
00133 {
00134    ENetProtocolCommandHeader header;
00135    enet_uint16 unreliableSequenceNumber;
00136    enet_uint16 dataLength;
00137 } ENetProtocolSendUnreliable;
00138 
00139 typedef struct
00140 {
00141    ENetProtocolCommandHeader header;
00142    enet_uint16 unsequencedGroup;
00143    enet_uint16 dataLength;
00144 } ENetProtocolSendUnsequenced;
00145 
00146 typedef struct
00147 {
00148    ENetProtocolCommandHeader header;
00149    enet_uint16 startSequenceNumber;
00150    enet_uint16 dataLength;
00151    enet_uint32 fragmentCount;
00152    enet_uint32 fragmentNumber;
00153    enet_uint32 totalLength;
00154    enet_uint32 fragmentOffset;
00155 } ENetProtocolSendFragment;
00156 
00157 typedef union
00158 {
00159    ENetProtocolCommandHeader header;
00160    ENetProtocolAcknowledge acknowledge;
00161    ENetProtocolConnect connect;
00162    ENetProtocolVerifyConnect verifyConnect;
00163    ENetProtocolDisconnect disconnect;
00164    ENetProtocolPing ping;
00165    ENetProtocolSendReliable sendReliable;
00166    ENetProtocolSendUnreliable sendUnreliable;
00167    ENetProtocolSendUnsequenced sendUnsequenced;
00168    ENetProtocolSendFragment sendFragment;
00169    ENetProtocolBandwidthLimit bandwidthLimit;
00170    ENetProtocolThrottleConfigure throttleConfigure;
00171 } ENetProtocol;
00172 
00173 #endif /* __ENET_PROTOCOL_H__ */
00174 

Generated on Wed Jun 6 14:33:50 2007 for enet by  doxygen 1.5.1