cplusplus {{ #include <vector> #include "SubSpace.h" #include "Event.h" #include "PlayerNode.h" #include <IPvXAddress.h> #include "GameState.h" #include "TreeNode.h" }}; struct IPAddress; struct SubSpace; struct Event; struct PlayerNode; struct GameState; struct TreeNode; enum Command { LOGIN = 0; LOGOUT = 1; SUBSCRIBE = 2; UNSUBSCRIBE = 3; PUBLISH = 4; CREATE = 5; REQUESTIP = 6; UPDATERESPIP =7; PUBLISHEVENTLIST = 8; PING = 9; PLAYERLIST = 10; REQUESTNODE = 11; REPLACEMENT = 12; DELAY = 13; REPLACEINT = 14; STABILIZE = 15; }; enum NodeClass { RESPONSIBLENODE = 0; BACKUPNODE = 1; INTERMEDIATENODE = 2; }; enum ServiceType { REQUEST = 0; RESPONSE = 1; CONFIRMATION = 2; FORWARD = 3; }; enum JobType { CREATENODE = 0; DELETENODE = 1; } enum Action { COMPLETE = 0; ADD = 1; REMOVE = 2; } // // Base message for all messages used by YMMOG // message YMMOGMessage { fields: double timeStamp; // simTime() when message was sended int failed; // number of failed Commands int command; // the type of command this message transmits int ServiceType; // the ServiceType this message transmits IPAddress destip; // the destination IPAddress of this message IPAddress srcip; // the source IPAddress of this message }; // // Message used to login to the game // message LoginMessage extends YMMOGMessage { fields: int id; // the id of the YMMOG node int bandwith; // the bandwith of the node that wants to login int cpu; // the cpu of the player int xpos; // the initial x-axis position int ypos; // the initial y-axis position int subSpaceSize; // number of fields in a SubSpace int gameSpaceSize; // number of SupSpaces in the game SubSpace responsibleNodes[]; // the array of nodes responsible for a SubSpace } // // Message used to logout from the game // message LogoutMessage extends YMMOGMessage { fields: int id; // the id of the YMMOG node bool successfull; // true if logout was successfull } // // Message used to create or delete a YMMOG-node // message CreateNodeMessage extends YMMOGMessage { fields: int nodeType; // the NodeClass of the new node int jobType; // delete or create a node? bool creationSuccessfull; // true if creation/deletion was successfull SubSpace subSpaceToCreate; // the SubSpace into the new node is placed } // // Message used to subscribe to a new SubSpace // message SubscribeMessage extends YMMOGMessage { fields: int playerId; // the id of the player that subscribes to an new SubSpace IPAddress playerIp; // the IPAddress of the player that subscribes to a new SubSpace int subSpaceId; // the id of the new SubSpace GameState gameState; // holds some statistics about the game } // // Message used to unsubscribe from a SubSpace // message UnSubscribeMessage extends YMMOGMessage { fields: int playerId; // the id of the player that unsubscribes IPAddress playerIp; // the IPAddress of the player that unsubscribes int subSpaceId; // the SubSpace of the player that unsubscribes } // // Message used to publish events in a SubSpace // message PublishMessage extends YMMOGMessage { fields: int playerId; int subSpaceId; // the SubSpace the event is sent to Event publishedEvent; // the event that has to be published } // // Message used to publish eventLists in a SubSpace // message PublishEventListMessage extends YMMOGMessage { fields: int timeSlot; // the timeSlot to which the eventList belongs to double sent; // simTime() when this message was sent IPAddress sender; // the IPAddress of the sender of the eventList int subSpaceId; // the SubSpace this eventList is for Event eventList[]; // the eventList that has to be published } // // Message used to ask for an IPAddress of a SubSpace // message RequestIpMessage extends YMMOGMessage { fields: int subSpaceId; // the SubSpace the requested IPAddress belongs to int nodeType; // the nodeType of the requested IPAddress (currently only RESPONSIBLENODE) IPAddress requestedIp; // the requested IPAddress } // // Message used to inform about a new responsible IPAddress for a SubSpace // message UpdateRespIpMessage extends YMMOGMessage { fields: int subSpaceId; // the SubSpace with the new responsible IPAddress int direction; IPAddress updatedIp; // the new responsible IPAddress } // // Message used to ping a node // message PingMessage extends YMMOGMessage { fields: double sent; // simTime() when PingMessage was sent } // // Message used to request and send a PlayerList for a specific SubSpace // message PlayerListMessage extends YMMOGMessage { fields: double timeStamp; // simTime() when message was sent int subSpaceId; // the SubSpace belonging to the PlayerList int action; TreeNode tree[]; // TreeNode holding the PlayerList } // // Message used to request a new node // message RequestNodeMessage extends YMMOGMessage { fields: int subSpaceId; // the SubSpace belonging to the request int nodeType; // the nodeType of the requested node } // // Message used to request a node replacement // message ReplacementMessage extends YMMOGMessage { fields: int subSpaceId; // the SubSpace belonging to the request int sendGameState; // GameState gameState; // the actual GameState } message DelayMessage extends YMMOGMessage { fields: double delay; int subSpaceId; IPAddress fromIp; } // // Message used to replace the IntermediateNode // message ReplaceIntermediateNodeMessage extends YMMOGMessage { fields: int subSpaceId; // id of the SubSpace of the replaced IntermediateNode SubSpace subSpace; // the SubSpace of the replaced IntermediateNode IPAddress toReplace; // the IPAddress of the IntermediateNode to replace IPAddress ipList[]; // the new list of IPAddresses with the replaced IntermediateNode } // // Message used to forward login information to the gameclient // message ClientLogin extends YMMOGMessage { fields: int playerId; // our playerId int xpos; // our initial x-axis position int ypos; // our initial y-axis position int gameSpaceSize; // the gameSpaceSize } // // Message used to publish ClientEvents // message ClientEvent extends YMMOGMessage { fields: Event event; // the Event to publish } // // Message used to publish ClientEvents // message ClientEventList extends YMMOGMessage { fields: Event eventList[]; // the array of Events to publish } // // Message used to verify the RESPONSIBLENODE or the BACKUPNODE of a SubSpace // message StabilizeMessage extends YMMOGMessage { fields: int subSpaceId; // the belonging SubSpaceId int nodeType; // verify RESPONSIBLENODE or BACKUPNODE? bool correct; // true if verification successfull SubSpace subSpace; // the belonging SubSpace }