Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vsnet_cmd.h File Reference
#include <iostream>

Go to the source code of this file.

Classes

class  Subcmd
 

Enumerations

enum  Cmd {
  CMD_SERVERTIME =0x00, CMD_LOGIN =0x01, CMD_LOGOUT =0x02, LOGIN_ERROR =0x03,
  LOGIN_ACCEPT =0x04, LOGIN_DATA =0x05, LOGIN_ALREADY =0x06, LOGIN_NEW =0x07,
  LOGIN_UNAVAIL =0x09, CMD_CREATECHAR =0x0A, CMD_LOCATIONS =0x0B, CMD_ADDCLIENT =0x0C,
  CMD_ENTERCLIENT =0x0D, CMD_EXITCLIENT =0x0E, CMD_ADDEDYOU =0x0F, CMD_RESPAWN =0x10,
  CMD_POSUPDATE =0x11, CMD_PING =0x12, CMD_SNAPSHOT =0x13, CMD_FIREREQUEST =0x14,
  CMD_UNFIREREQUEST =0x15, CMD_TARGET =0x16, CMD_CLOAK =0x17, CMD_SCAN =0x18,
  CMD_DAMAGE =0x19, CMD_SNAPDAMAGE =0x1A, CMD_KILL =0x1B, CMD_JUMP =0x1C,
  CMD_ASKFILE =0x1D, CMD_DOWNLOAD =0x1E, CMD_SOUNDSAMPLE =0x20, CMD_TXTMESSAGE =0x21,
  CMD_STARTNETCOMM =0x22, CMD_STOPNETCOMM =0x23, CMD_SECMESSAGE =0x24, CMD_SECSNDSAMPLE =0x25,
  CMD_DOCK =0x26, CMD_UNDOCK =0x27, CMD_SNAPCARGO =0x28, CMD_CARGOUPGRADE =0x29,
  CMD_CREDITS =0x2A, CMD_RESYNCACCOUNTS =0x2B, CMD_SAVEACCOUNTS =0x2C, CMD_NEWSUBSCRIBE =0x2D,
  CMD_CONNECT =0x2E, CMD_CHOOSESHIP =0x2F, CMD_DISCONNECT =0x30, CMD_SAVEDATA =0x31,
  CMD_MISSION =0x32, CMD_CUSTOM =0x33, CMD_SHIPDEALER =0x34, CMD_COMM =0x35
}
 Commands that are sent through the network. More...
 

Functions

std::ostream & operator<< (std::ostream &ostr, Cmd cmd)
 
const char * displayCmd (Cmd cmd)
 

Enumeration Type Documentation

enum Cmd

Commands that are sent through the network.

Enumerator
CMD_SERVERTIME 
CMD_LOGIN 
CMD_LOGOUT 
LOGIN_ERROR 
LOGIN_ACCEPT 
LOGIN_DATA 
LOGIN_ALREADY 
LOGIN_NEW 
LOGIN_UNAVAIL 
CMD_CREATECHAR 
CMD_LOCATIONS 
CMD_ADDCLIENT 
CMD_ENTERCLIENT 
CMD_EXITCLIENT 
CMD_ADDEDYOU 
CMD_RESPAWN 
CMD_POSUPDATE 
CMD_PING 
CMD_SNAPSHOT 
CMD_FIREREQUEST 
CMD_UNFIREREQUEST 
CMD_TARGET 
CMD_CLOAK 
CMD_SCAN 
CMD_DAMAGE 
CMD_SNAPDAMAGE 
CMD_KILL 
CMD_JUMP 
CMD_ASKFILE 
CMD_DOWNLOAD 
CMD_SOUNDSAMPLE 
CMD_TXTMESSAGE 
CMD_STARTNETCOMM 
CMD_STOPNETCOMM 
CMD_SECMESSAGE 
CMD_SECSNDSAMPLE 
CMD_DOCK 
CMD_UNDOCK 
CMD_SNAPCARGO 
CMD_CARGOUPGRADE 
CMD_CREDITS 
CMD_RESYNCACCOUNTS 
CMD_SAVEACCOUNTS 
CMD_NEWSUBSCRIBE 
CMD_CONNECT 
CMD_CHOOSESHIP 
CMD_DISCONNECT 
CMD_SAVEDATA 
CMD_MISSION 
CMD_CUSTOM 
CMD_SHIPDEALER 
CMD_COMM 

Definition at line 23 of file vsnet_cmd.h.

24 {
26  CMD_SERVERTIME=0x00, //Client side : Request the most up-to-date server time.
27  //Server side : Send the current game time (double).
28  CMD_LOGIN=0x01, //Client side : login request sent to server with name and passwd
29  CMD_LOGOUT =0x02, //Client side : tells the server we are logging out
30  //Server side : remove the client from the game
31  LOGIN_ERROR =0x03, //Packet sent from account server to client :
32  //a login error (mostly bad name/passwd)
33  LOGIN_ACCEPT =0x04, //Packet sent from account server to client :
34  //login accepted
35  LOGIN_DATA =0x05,
36  LOGIN_ALREADY =0x06, //Packet sent from account server to client
37  //to tell account is already being used
38  LOGIN_NEW =0x07,
39  //CMD_unused_0x08 = 0x08,
40  LOGIN_UNAVAIL=0x09, //Packet sent from game server to client :
41  //account server is unavailable -> no login
42 
43  //Character creation stuff (not used yet)
44  CMD_CREATECHAR =0x0A, //DELETEME? Could come in handy from accountserver -> client... but not so much from server...
45  CMD_LOCATIONS =0x0B,
46 
47  //Commands used to add/remove ships in systems
48  CMD_ADDCLIENT =0x0C, //Client side :
49  //request the server to be added in the game
50  //Server side : adds the client to the game
51  CMD_ENTERCLIENT=0x0D, //(Server -> Client) Indicates that a new
52  //client is entering the current zone
53  //also send the new client's data
54  //Subcommands: ZoneMgr::AddClient,AddUnit,AddMissile,AddNebula,AddAsteroid,End
55  CMD_EXITCLIENT=0x0E, //(Server -> Client) Indicates that a client
56  //is leaving the current zone
57  CMD_ADDEDYOU =0x0F, //Server -> Client
58 
60 
61  CMD_RESPAWN =0x10, //Client -> Server: Request a respawn after dying.
62 
63  //Ships movements data
64  CMD_POSUPDATE=0x11, //On client side (send): containing a ship's
65  //data sent to server for position update
66  //On client side (recv) : receive minimal update
67  //data for a ship
68  //On server side : sending minimal info
69  //(just position) in case the ship is far from
70  //the one we send other ships' data to
71  CMD_PING =0x12, //A packet sending a ping-like command just to
72  //tell to the server
73  //that the client is still alive
74  CMD_SNAPSHOT=0x13, //A packet with all the necessary ships' data
75  //in order to update
76 
77  //Weapons commands
78  CMD_FIREREQUEST =0x14, //Fire Request
79  CMD_UNFIREREQUEST=0x15, //UnFire Request
80  CMD_TARGET =0x16, //Receive a target request (server side)
81  CMD_CLOAK =0x17,
82  //or receive target info (client side)
83  CMD_SCAN =0x18, //Receive a scan request (server side)
84  //or receive target info (client side)
85  CMD_DAMAGE =0x19, //Send damages to apply
86  CMD_SNAPDAMAGE=0x1A, //A snapshot of damages
87 
88  CMD_KILL =0x1B, //Send a kill to clients
89  CMD_JUMP =0x1C, //Send a jump request
90  CMD_ASKFILE =0x1D, //Ask the server for files (char=number of
91  //files and string containing the file names)
92  CMD_DOWNLOAD =0x1E, //May be identical to CMD_ASKFILE in the end
93  //CMD_unused_0x1F = 0x1F , // This means a webcam-shot just arrived (from client to server and from server to concerned clients)
94 
95  //2* Misc. commands
96 
97  CMD_SOUNDSAMPLE =0x20, //This means a sound sample just arrived (from client to server and from server to concerned clients or from client to clients)
98  CMD_TXTMESSAGE =0x21, //This means a text message has arrived
99  CMD_STARTNETCOMM=0x22, //A client tells the server he starts a netcomm session
100  CMD_STOPNETCOMM =0x23, //A client tells the server he stops a netcomm session
101  CMD_SECMESSAGE =0x24, //This means a sound sample just arrived (from client to server and from server to concerned clients or from client to clients)
102  CMD_SECSNDSAMPLE=0x25, //This means a sound sample just arrived (from client to server and from server to concerned clients or from client to clients)
103 
104  CMD_DOCK =0x26, //Dock request or authorization from server
105  CMD_UNDOCK =0x27, //Undock request or authorization from server
106 
107  CMD_SNAPCARGO =0x28, //S->C: A full update of the up-to-date cargo inventory in all ships. Sent when logging in.
108  CMD_CARGOUPGRADE =0x29, //C->S and S->C (broadcast): buy/sell cargo or upgrade.
109  CMD_CREDITS =0x2A, //S->C: updates the number of credits. Required after a cargo/upgrade transaction.
110 
111  //Account management commands
112  CMD_RESYNCACCOUNTS=0x2B, //When connection to account server was lost
113  //and established again :
114  //send the account server a list of active
115  //client to sync and log out
116  //client that may have quit the game during
117  //loss of connection
118  CMD_SAVEACCOUNTS=0x2C, //Send a client save to account server in order
119  //to do a backup
120  CMD_NEWSUBSCRIBE=0x2D, //Account server : handle a new account creation
121  //(login/passwd) on the web
122  CMD_CONNECT=0x2E, //C->S, response S->C: Upon opening connection
123  CMD_CHOOSESHIP =0x2F, //S->C, response C->S: Server needs client to choose a ship
124  //before it can send LOGIN_ACCEPT.
125 
126  CMD_DISCONNECT =0x30, //UDP : after a problem (not clean exit) to make
127  //the client exit if still alive
128 
129  CMD_SAVEDATA =0x31,
130  CMD_MISSION =0x32,
131 
132  CMD_CUSTOM =0x33, //Used for python scripts to communicate between client and server.
133  CMD_SHIPDEALER=0x34, //C->S: Request to purchase ship, S->C: Unimplemented
134  CMD_COMM=0x35, //C->S: Send a Comm message to target, S->C: Say something to player
135 };

Function Documentation

const char* displayCmd ( Cmd  cmd)

Definition at line 29 of file vsnet_cmd.cpp.

References CASE, CMD_ADDCLIENT, CMD_ADDEDYOU, CMD_ASKFILE, CMD_CARGOUPGRADE, CMD_CHOOSESHIP, CMD_COMM, CMD_CONNECT, CMD_CREATECHAR, CMD_CREDITS, CMD_CUSTOM, CMD_DAMAGE, CMD_DISCONNECT, CMD_DOCK, CMD_DOWNLOAD, CMD_ENTERCLIENT, CMD_EXITCLIENT, CMD_FIREREQUEST, CMD_JUMP, CMD_KILL, CMD_LOCATIONS, CMD_LOGIN, CMD_LOGOUT, CMD_MISSION, CMD_NEWSUBSCRIBE, CMD_PING, CMD_POSUPDATE, CMD_RESPAWN, CMD_RESYNCACCOUNTS, CMD_SAVEACCOUNTS, CMD_SAVEDATA, CMD_SCAN, CMD_SECMESSAGE, CMD_SECSNDSAMPLE, CMD_SERVERTIME, CMD_SHIPDEALER, CMD_SNAPCARGO, CMD_SNAPDAMAGE, CMD_SNAPSHOT, CMD_SOUNDSAMPLE, CMD_STARTNETCOMM, CMD_STOPNETCOMM, CMD_TARGET, CMD_TXTMESSAGE, CMD_UNDOCK, CMD_UNFIREREQUEST, LOGIN_ACCEPT, LOGIN_ALREADY, LOGIN_DATA, LOGIN_ERROR, and LOGIN_NEW.

Referenced by operator<<().

30 {
31  switch (cmd)
32  {
33  CASE( CMD_LOGIN )
34  CASE( CMD_LOGOUT )
37  CASE( CMD_PING )
40 
43  CASE( LOGIN_ERROR )
45  CASE( LOGIN_DATA )
47  CASE( LOGIN_NEW )
48  CASE( CMD_RESPAWN )
51 
54  CASE( CMD_CREDITS )
57  CASE( CMD_TARGET )
58  CASE( CMD_SCAN )
59  CASE( CMD_DAMAGE )
61  CASE( CMD_KILL )
62  CASE( CMD_JUMP )
63  CASE( CMD_ASKFILE )
71  CASE( CMD_DOCK )
72  CASE( CMD_UNDOCK )
73 
75 
80  CASE( CMD_CONNECT )
82 
84  CASE( CMD_MISSION )
85  CASE( CMD_CUSTOM )
87  CASE( CMD_COMM )
88  //CASE( CMD_ACK )
89  default:
90  return "CMD_UNKNOWN";
91 
92  break;
93  }
94 }
std::ostream& operator<< ( std::ostream &  ostr,
Cmd  cmd 
)

Definition at line 19 of file vsnet_cmd.cpp.

References displayCmd().

20 {
21  ostr<<displayCmd( cmd );
22  return ostr;
23 }