1 /// \file 2 /// \brief All the message identifiers used by RakNet. Message identifiers comprise the first byte of any message. 3 /// 4 /// This file is part of RakNet Copyright 2003 Jenkins Software LLC 5 /// 6 /// Raknet is available under the terms of the GPLv3 license, see /usr/local/share/licenses/raknet-3.9.2_10,1/GPLv3. 7 8 9 #ifndef __MESSAGE_IDENTIFIERS_H 10 #define __MESSAGE_IDENTIFIERS_H 11 12 #if defined(RAKNET_USE_CUSTOM_PACKET_IDS) 13 #include "CustomPacketIdentifiers.h" 14 #else 15 16 enum OutOfBandIdentifiers 17 { 18 ID_NAT_ESTABLISH_UNIDIRECTIONAL, 19 ID_NAT_ESTABLISH_BIDIRECTIONAL, 20 ID_NAT_TYPE_DETECT, 21 ID_ROUTER_2_REPLY_TO_SENDER_PORT, 22 ID_ROUTER_2_REPLY_TO_SPECIFIED_PORT, 23 ID_ROUTER_2_MINI_PUNCH_REPLY, 24 ID_ROUTER_2_MINI_PUNCH_REPLY_BOUNCE 25 }; 26 27 /// You should not edit the file MessageIdentifiers.h as it is a part of RakNet static library 28 /// To define your own message id, define an enum following the code example that follows. 29 /// 30 /// \code 31 /// enum { 32 /// ID_MYPROJECT_MSG_1 = ID_USER_PACKET_ENUM, 33 /// ID_MYPROJECT_MSG_2, 34 /// ... 35 /// }; 36 /// \endcode 37 /// 38 /// \note All these enumerations should be casted to (unsigned char) before writing them to RakNet::BitStream 39 enum DefaultMessageIDTypes 40 { 41 // 42 // RESERVED TYPES - DO NOT CHANGE THESE 43 // All types from RakPeer 44 // 45 /// These types are never returned to the user. 46 /// Ping from a connected system. Update timestamps (internal use only) 47 /// 0 is reserved for UDT's connect message 48 ID_INTERNAL_PING, 49 /// Ping from an unconnected system. Reply but do not update timestamps. (internal use only) 50 ID_PING, 51 /// Ping from an unconnected system. Only reply if we have open connections. Do not update timestamps. (internal use only) 52 ID_PING_OPEN_CONNECTIONS, 53 /// Pong from a connected system. Update timestamps (internal use only) 54 ID_CONNECTED_PONG, 55 /// Asking for a new connection (internal use only) 56 ID_CONNECTION_REQUEST, 57 /// Connecting to a secured server/peer (internal use only) 58 ID_SECURED_CONNECTION_RESPONSE, 59 /// Connecting to a secured server/peer (internal use only) 60 ID_SECURED_CONNECTION_CONFIRMATION, 61 /// Packet that tells us the packet contains an integer ID to name mapping for the remote system (internal use only) 62 ID_RPC_MAPPING, 63 /// A reliable packet to detect lost connections (internal use only) 64 ID_DETECT_LOST_CONNECTIONS, 65 /// Offline message so we know when to reset and start a new connection (internal use only) 66 ID_OPEN_CONNECTION_REQUEST, 67 /// Offline message response so we know when to reset and start a new connection (internal use only) 68 ID_OPEN_CONNECTION_REPLY, 69 /// Remote procedure call (internal use only) 70 ID_RPC, 71 /// Remote procedure call reply, for RPCs that return data (internal use only) 72 ID_RPC_REPLY, 73 /// RakPeer - Same as ID_ADVERTISE_SYSTEM, but intended for internal use rather than being passed to the user. Second byte indicates type. Used currently for NAT punchthrough for receiver port advertisement. See ID_NAT_ADVERTISE_RECIPIENT_PORT 74 ID_OUT_OF_BAND_INTERNAL, 75 76 77 // 78 // USER TYPES - DO NOT CHANGE THESE 79 // 80 81 /// RakPeer - In a client/server environment, our connection request to the server has been accepted. 82 ID_CONNECTION_REQUEST_ACCEPTED, 83 /// RakPeer - Sent to the player when a connection request cannot be completed due to inability to connect. 84 ID_CONNECTION_ATTEMPT_FAILED, 85 /// RakPeer - Sent a connect request to a system we are currently connected to. 86 ID_ALREADY_CONNECTED, 87 /// RakPeer - A remote system has successfully connected. 88 ID_NEW_INCOMING_CONNECTION, 89 /// RakPeer - The system we attempted to connect to is not accepting new connections. 90 ID_NO_FREE_INCOMING_CONNECTIONS, 91 /// RakPeer - The system specified in Packet::systemAddress has disconnected from us. For the client, this would mean the server has shutdown. 92 ID_DISCONNECTION_NOTIFICATION, 93 /// RakPeer - Reliable packets cannot be delivered to the system specified in Packet::systemAddress. The connection to that system has been closed. 94 ID_CONNECTION_LOST, 95 /// RakPeer - We preset an RSA public key which does not match what the system we connected to is using. 96 ID_RSA_PUBLIC_KEY_MISMATCH, 97 /// RakPeer - We are banned from the system we attempted to connect to. 98 ID_CONNECTION_BANNED, 99 /// RakPeer - The remote system is using a password and has refused our connection because we did not set the correct password. 100 ID_INVALID_PASSWORD, 101 // RAKNET_PROTOCOL_VERSION in RakNetVersion.h does not match on the remote system what we have on our system 102 // This means the two systems cannot communicate. 103 // The 2nd byte of the message contains the value of RAKNET_PROTOCOL_VERSION for the remote system 104 ID_INCOMPATIBLE_PROTOCOL_VERSION, 105 // Means that this IP address connected recently, and can't connect again as a security measure. See RakPeer::SetLimitIPConnectionFrequency() 106 ID_IP_RECENTLY_CONNECTED, 107 /// RakPeer - A packet has been tampered with in transit. The sender is contained in Packet::systemAddress. 108 ID_MODIFIED_PACKET, 109 /// RakPeer - The four bytes following this byte represent an unsigned int which is automatically modified by the difference in system times between the sender and the recipient. Requires that you call SetOccasionalPing. 110 ID_TIMESTAMP, 111 /// RakPeer - Pong from an unconnected system. First byte is ID_PONG, second sizeof(RakNetTime) bytes is the ping, following bytes is system specific enumeration data. 112 ID_PONG, 113 /// RakPeer - Inform a remote system of our IP/Port. On the recipient, all data past ID_ADVERTISE_SYSTEM is whatever was passed to the data parameter 114 ID_ADVERTISE_SYSTEM, 115 /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has disconnected gracefully. Packet::systemAddress is modified to reflect the systemAddress of this client. 116 ID_REMOTE_DISCONNECTION_NOTIFICATION, 117 /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has been forcefully dropped. Packet::systemAddress is modified to reflect the systemAddress of this client. 118 ID_REMOTE_CONNECTION_LOST, 119 /// ConnectionGraph plugin - In a client/server environment, a client other than ourselves has connected. Packet::systemAddress is modified to reflect the systemAddress of the client that is not connected directly to us. The packet encoding is SystemAddress 1, ConnectionGraphGroupID 1, SystemAddress 2, ConnectionGraphGroupID 2 120 /// ConnectionGraph2 plugin: Bytes 1-4 = count. for (count items) contains {SystemAddress, RakNetGUID} 121 ID_REMOTE_NEW_INCOMING_CONNECTION, 122 // RakPeer - Downloading a large message. Format is ID_DOWNLOAD_PROGRESS (MessageID), partCount (unsigned int), partTotal (unsigned int), partLength (unsigned int), first part data (length <= MAX_MTU_SIZE). See the three parameters partCount, partTotal and partLength in OnFileProgress in FileListTransferCBInterface.h 123 ID_DOWNLOAD_PROGRESS, 124 125 /// FileListTransfer plugin - Setup data 126 ID_FILE_LIST_TRANSFER_HEADER, 127 /// FileListTransfer plugin - A file 128 ID_FILE_LIST_TRANSFER_FILE, 129 // Ack for reference push, to send more of the file 130 ID_FILE_LIST_REFERENCE_PUSH_ACK, 131 132 /// DirectoryDeltaTransfer plugin - Request from a remote system for a download of a directory 133 ID_DDT_DOWNLOAD_REQUEST, 134 135 /// RakNetTransport plugin - Transport provider message, used for remote console 136 ID_TRANSPORT_STRING, 137 138 /// ReplicaManager plugin - Create an object 139 ID_REPLICA_MANAGER_CONSTRUCTION, 140 /// ReplicaManager plugin - Destroy an object 141 ID_REPLICA_MANAGER_DESTRUCTION, 142 /// ReplicaManager plugin - Changed scope of an object 143 ID_REPLICA_MANAGER_SCOPE_CHANGE, 144 /// ReplicaManager plugin - Serialized data of an object 145 ID_REPLICA_MANAGER_SERIALIZE, 146 /// ReplicaManager plugin - New connection, about to send all world objects 147 ID_REPLICA_MANAGER_DOWNLOAD_STARTED, 148 /// ReplicaManager plugin - Finished downloading all serialized objects 149 ID_REPLICA_MANAGER_DOWNLOAD_COMPLETE, 150 151 /// ConnectionGraph plugin - Request the connection graph from another system 152 ID_CONNECTION_GRAPH_REQUEST, 153 /// ConnectionGraph plugin - Reply to a connection graph download request 154 ID_CONNECTION_GRAPH_REPLY, 155 /// ConnectionGraph plugin - Update edges / nodes for a system with a connection graph 156 ID_CONNECTION_GRAPH_UPDATE, 157 /// ConnectionGraph plugin - Add a new connection to a connection graph 158 ID_CONNECTION_GRAPH_NEW_CONNECTION, 159 /// ConnectionGraph plugin - Remove a connection from a connection graph - connection was abruptly lost. Two systems addresses encoded in the data packet. 160 ID_CONNECTION_GRAPH_CONNECTION_LOST, 161 /// ConnectionGraph plugin - Remove a connection from a connection graph - connection was gracefully lost. Two systems addresses encoded in the data packet. 162 ID_CONNECTION_GRAPH_DISCONNECTION_NOTIFICATION, 163 164 /// Router plugin - route a message through another system 165 ID_ROUTE_AND_MULTICAST, 166 167 /// RakVoice plugin - Open a communication channel 168 ID_RAKVOICE_OPEN_CHANNEL_REQUEST, 169 /// RakVoice plugin - Communication channel accepted 170 ID_RAKVOICE_OPEN_CHANNEL_REPLY, 171 /// RakVoice plugin - Close a communication channel 172 ID_RAKVOICE_CLOSE_CHANNEL, 173 /// RakVoice plugin - Voice data 174 ID_RAKVOICE_DATA, 175 176 /// Autopatcher plugin - Get a list of files that have changed since a certain date 177 ID_AUTOPATCHER_GET_CHANGELIST_SINCE_DATE, 178 /// Autopatcher plugin - A list of files to create 179 ID_AUTOPATCHER_CREATION_LIST, 180 /// Autopatcher plugin - A list of files to delete 181 ID_AUTOPATCHER_DELETION_LIST, 182 /// Autopatcher plugin - A list of files to get patches for 183 ID_AUTOPATCHER_GET_PATCH, 184 /// Autopatcher plugin - A list of patches for a list of files 185 ID_AUTOPATCHER_PATCH_LIST, 186 /// Autopatcher plugin - Returned to the user: An error from the database repository for the autopatcher. 187 ID_AUTOPATCHER_REPOSITORY_FATAL_ERROR, 188 /// Autopatcher plugin - Finished getting all files from the autopatcher 189 ID_AUTOPATCHER_FINISHED_INTERNAL, 190 ID_AUTOPATCHER_FINISHED, 191 /// Autopatcher plugin - Returned to the user: You must restart the application to finish patching. 192 ID_AUTOPATCHER_RESTART_APPLICATION, 193 194 /// NATPunchthrough plugin: internal 195 ID_NAT_PUNCHTHROUGH_REQUEST, 196 /// NATPunchthrough plugin: internal 197 ID_NAT_CONNECT_AT_TIME, 198 /// NATPunchthrough plugin: internal 199 ID_NAT_GET_MOST_RECENT_PORT, 200 /// NATPunchthrough plugin: internal 201 ID_NAT_CLIENT_READY, 202 203 /// NATPunchthrough plugin: Destination system is not connected to the server. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT(). 204 ID_NAT_TARGET_NOT_CONNECTED, 205 /// NATPunchthrough plugin: Destination system is not responding to the plugin messages. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT(). 206 ID_NAT_TARGET_UNRESPONSIVE, 207 /// NATPunchthrough plugin: The server lost the connection to the destination system while setting up punchthrough. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT(). 208 ID_NAT_CONNECTION_TO_TARGET_LOST, 209 /// NATPunchthrough plugin: This punchthrough is already in progress. Possibly the plugin is not installed. Bytes starting at offset 1 contains the RakNetGUID destination field of NatPunchthroughClient::OpenNAT(). 210 ID_NAT_ALREADY_IN_PROGRESS, 211 /// NATPunchthrough plugin: This message is generated on the local system, and does not come from the network. packet::guid contains the destination field of NatPunchthroughClient::OpenNAT(). Byte 1 contains 1 if you are the sender, 0 if not 212 ID_NAT_PUNCHTHROUGH_FAILED, 213 /// NATPunchthrough plugin: Punchthrough suceeded. See packet::systemAddress and packet::guid. Byte 1 contains 1 if you are the sender, 0 if not. You can now use RakPeer::Connect() or other calls to communicate with this system. 214 ID_NAT_PUNCHTHROUGH_SUCCEEDED, 215 216 /// LightweightDatabase plugin - Query 217 ID_DATABASE_QUERY_REQUEST, 218 /// LightweightDatabase plugin - Update 219 ID_DATABASE_UPDATE_ROW, 220 /// LightweightDatabase plugin - Remove 221 ID_DATABASE_REMOVE_ROW, 222 /// LightweightDatabase plugin - A serialized table. Bytes 1+ contain the table. Pass to TableSerializer::DeserializeTable 223 ID_DATABASE_QUERY_REPLY, 224 /// LightweightDatabase plugin - Specified table not found 225 ID_DATABASE_UNKNOWN_TABLE, 226 /// LightweightDatabase plugin - Incorrect password 227 ID_DATABASE_INCORRECT_PASSWORD, 228 229 /// ReadyEvent plugin - Set the ready state for a particular system 230 /// First 4 bytes after the message contains the id 231 ID_READY_EVENT_SET, 232 /// ReadyEvent plugin - Unset the ready state for a particular system 233 /// First 4 bytes after the message contains the id 234 ID_READY_EVENT_UNSET, 235 /// All systems are in state ID_READY_EVENT_SET 236 /// First 4 bytes after the message contains the id 237 ID_READY_EVENT_ALL_SET, 238 /// \internal, do not process in your game 239 /// ReadyEvent plugin - Request of ready event state - used for pulling data when newly connecting 240 ID_READY_EVENT_QUERY, 241 242 /// Lobby packets. Second byte indicates type. 243 ID_LOBBY_GENERAL, 244 245 /// Auto RPC procedure call 246 ID_AUTO_RPC_CALL, 247 248 /// Auto RPC functionName to index mapping 249 ID_AUTO_RPC_REMOTE_INDEX, 250 251 /// Auto RPC functionName to index mapping, lookup failed. Will try to auto recover 252 ID_AUTO_RPC_UNKNOWN_REMOTE_INDEX, 253 254 /// Auto RPC error code 255 /// See AutoRPC.h for codes, stored in packet->data[1] 256 ID_RPC_REMOTE_ERROR, 257 258 /// FileListTransfer transferring large files in chunks that are read only when needed, to save memory 259 ID_FILE_LIST_REFERENCE_PUSH, 260 261 /// Force the ready event to all set 262 ID_READY_EVENT_FORCE_ALL_SET, 263 264 /// Rooms function 265 ID_ROOMS_EXECUTE_FUNC, 266 ID_ROOMS_LOGON_STATUS, 267 ID_ROOMS_HANDLE_CHANGE, 268 269 /// Lobby2 message 270 ID_LOBBY2_SEND_MESSAGE, 271 ID_LOBBY2_SERVER_ERROR, 272 273 274 /// Informs user of a new host GUID. Packet::Guid contains this RakNetGuid 275 ID_FCM2_NEW_HOST, 276 /// \internal For FullyConnectedMesh2 plugin 277 ID_FCM2_REQUEST_FCMGUID, 278 /// \internal For FullyConnectedMesh2 plugin 279 ID_FCM2_RESPOND_CONNECTION_COUNT, 280 /// \internal For FullyConnectedMesh2 plugin 281 ID_FCM2_INFORM_FCMGUID, 282 283 /// UDP proxy messages. Second byte indicates type. 284 ID_UDP_PROXY_GENERAL, 285 286 /// SQLite3Plugin - execute 287 ID_SQLite3_EXEC, 288 /// SQLite3Plugin - Remote database is unknown 289 ID_SQLite3_UNKNOWN_DB, 290 291 /// Serialize construction for an object that already exists on the remote system 292 ID_REPLICA_MANAGER_3_SERIALIZE_CONSTRUCTION_EXISTING, 293 ID_REPLICA_MANAGER_3_LOCAL_CONSTRUCTION_REJECTED, 294 ID_REPLICA_MANAGER_3_LOCAL_CONSTRUCTION_ACCEPTED, 295 296 /// Sent to NatTypeDetectionServer 297 ID_NAT_TYPE_DETECTION_REQUEST, 298 299 /// Sent to NatTypeDetectionClient. Byte 1 contains the type of NAT detected. 300 ID_NAT_TYPE_DETECTION_RESULT, 301 302 /// Events happening with SQLiteClientLoggerPlugin 303 ID_SQLLITE_LOGGER, 304 305 /// Used by the router2 plugin 306 ID_ROUTER_2_INTERNAL, 307 /// No path is available or can be established to the remote system 308 /// Packet::guid contains the endpoint guid that we were trying to reach 309 ID_ROUTER_2_FORWARDING_NO_PATH, 310 /// \brief You can now call connect, ping, or other operations to the destination system. 311 /// 312 /// Connect as follows: 313 /// 314 /// RakNet::BitStream bs(packet->data, packet->length, false); 315 /// bs.IgnoreBytes(sizeof(MessageID)); 316 /// RakNetGUID endpointGuid; 317 /// bs.Read(endpointGuid); 318 /// unsigned short sourceToDestPort; 319 /// bs.Read(sourceToDestPort); 320 /// char ipAddressString[32]; 321 /// packet->systemAddress.ToString(false, ipAddressString); 322 /// rakPeerInterface->Connect(ipAddressString, sourceToDestPort, 0,0); 323 ID_ROUTER_2_FORWARDING_ESTABLISHED, 324 /// The IP address for a forwarded connection has changed 325 /// Read endpointGuid and port as per ID_ROUTER_2_FORWARDING_ESTABLISHED 326 ID_ROUTER_2_REROUTED, 327 328 /// \internal Used by the team balancer plugin 329 ID_TEAM_BALANCER_INTERNAL, 330 /// Cannot switch to the desired team because it is full. However, if someone on that team leaves, you will get ID_TEAM_BALANCER_SET_TEAM later. Byte 1 contains the team you requested to join. 331 ID_TEAM_BALANCER_REQUESTED_TEAM_CHANGE_PENDING, 332 /// Cannot switch to the desired team because all teams are locked. However, if someone on that team leaves, you will get ID_TEAM_BALANCER_SET_TEAM later. Byte 1 contains the team you requested to join. 333 ID_TEAM_BALANCER_TEAMS_LOCKED, 334 /// Team balancer plugin informing you of your team. Byte 1 contains the team you requested to join. 335 ID_TEAM_BALANCER_TEAM_ASSIGNED, 336 /// Gamebryo Lightspeed 337 ID_LIGHTSPEED_INTEGRATION, 338 339 /// Plugin based replacement for old RPC system, no boost required, but only works with C functions 340 ID_RPC_4_PLUGIN, 341 342 /// If RakPeerInterface::Send() is called where PacketReliability contains _WITH_ACK_RECEIPT, then on a later call to RakPeerInterface::Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS. The message will be 5 bytes long, and bytes 1-4 inclusive will contain a number in native order containing a number that identifies this message. This number will be returned by RakPeerInterface::Send() or RakPeerInterface::SendList(). ID_SND_RECEIPT_ACKED means that the message arrived 343 ID_SND_RECEIPT_ACKED, 344 345 /// If RakPeerInterface::Send() is called where PacketReliability contains _WITH_ACK_RECEIPT, then on a later call to RakPeerInterface::Receive() you will get ID_SND_RECEIPT_ACKED or ID_SND_RECEIPT_LOSS. The message will be 5 bytes long, and bytes 1-4 inclusive will contain a number in native order containing a number that identifies this message. This number will be returned by RakPeerInterface::Send() or RakPeerInterface::SendList(). ID_SND_RECEIPT_LOSS means that an ack for the message did not arrive (it may or may not have been delivered, probably not). On disconnect or shutdown, you will not get ID_SND_RECEIPT_LOSS for unsent messages, you should consider those messages as all lost. 346 ID_SND_RECEIPT_LOSS, 347 348 // So I can add more without changing user enumerations 349 ID_RESERVED_5, 350 ID_RESERVED_6, 351 ID_RESERVED_7, 352 ID_RESERVED_8, 353 ID_RESERVED_9, 354 355 // For the user to use. Start your first enumeration at this value. 356 ID_USER_PACKET_ENUM, 357 //------------------------------------------------------------------------------------------------------------- 358 359 }; 360 361 #endif // RAKNET_USE_CUSTOM_PACKET_IDS 362 363 #endif 364