1 #ifndef __UDP_PROXY_COMMON_H 2 #define __UDP_PROXY_COMMON_H 3 4 // System flow: 5 /* 6 UDPProxyClient: End user 7 UDPProxyServer: open server, to route messages from end users that can't connect to each other using UDPForwarder class. 8 UDPProxyCoordinator: Server somewhere, connected to by RakNet, to maintain a list of UDPProxyServer 9 10 UDPProxyServer 11 On startup, log into UDPProxyCoordinator and register self 12 13 UDPProxyClient 14 Wish to open route to X 15 Send message to UDPProxyCoordinator containing X, desired timeout 16 Wait for success or failure 17 18 UDPProxyCoordinator: 19 * Get openRouteRequest 20 If no servers registered, return failure 21 Add entry to memory 22 chooseBestUDPProxyServer() (overridable, chooses at random by default) 23 Query this server to StartForwarding(). Return success or failure 24 If failure, choose another server from the remaining list. If none remaining, return failure. Else return success. 25 * Disconnect: 26 If disconnected system is pending client on openRouteRequest, delete that request 27 If disconnected system is UDPProxyServer, remove from list. For each pending client for this server, choose from remaining servers. 28 * Login: 29 Add to UDPProxyServer list, validating password if set 30 */ 31 32 // Stored in the second byte after ID_UDP_PROXY_GENERAL 33 // Otherwise MessageIdentifiers.h is too cluttered and will hit the limit on enumerations in a single byte 34 enum UDPProxyMessages 35 { 36 ID_UDP_PROXY_FORWARDING_SUCCEEDED, 37 ID_UDP_PROXY_FORWARDING_NOTIFICATION, 38 ID_UDP_PROXY_NO_SERVERS_ONLINE, 39 ID_UDP_PROXY_RECIPIENT_GUID_NOT_CONNECTED_TO_COORDINATOR, 40 ID_UDP_PROXY_ALL_SERVERS_BUSY, 41 ID_UDP_PROXY_IN_PROGRESS, 42 ID_UDP_PROXY_FORWARDING_REQUEST_FROM_CLIENT_TO_COORDINATOR, 43 ID_UDP_PROXY_PING_SERVERS_FROM_COORDINATOR_TO_CLIENT, 44 ID_UDP_PROXY_PING_SERVERS_REPLY_FROM_CLIENT_TO_COORDINATOR, 45 ID_UDP_PROXY_FORWARDING_REQUEST_FROM_COORDINATOR_TO_SERVER, 46 ID_UDP_PROXY_FORWARDING_REPLY_FROM_SERVER_TO_COORDINATOR, 47 ID_UDP_PROXY_LOGIN_REQUEST_FROM_SERVER_TO_COORDINATOR, 48 ID_UDP_PROXY_LOGIN_SUCCESS_FROM_COORDINATOR_TO_SERVER, 49 ID_UDP_PROXY_ALREADY_LOGGED_IN_FROM_COORDINATOR_TO_SERVER, 50 ID_UDP_PROXY_NO_PASSWORD_SET_FROM_COORDINATOR_TO_SERVER, 51 ID_UDP_PROXY_WRONG_PASSWORD_FROM_COORDINATOR_TO_SERVER 52 }; 53 54 55 #define UDP_FORWARDER_MAXIMUM_TIMEOUT (60000 * 10) 56 57 #endif 58