$treeview $search $mathjax
Stratagus  2.2.6
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
           Stratagus - A free fantasy real time strategy game engine

src/include/netconnect.h File Reference

#include <string>
#include "SDL.h"

Go to the source code of this file.


Classes

class  CNetworkHost
struct  _network_state_
class  CServerSetup
class  CInitMessage

netconnect.h - The network connection setup header file.

#define NetworkProtocolMajorVersion   StratagusMajorVersion
 Network protocol major version.
#define NetworkProtocolMinorVersion   StratagusMinorVersion
 Network protocol minor version (maximal 99).
#define NetworkProtocolPatchLevel   StratagusPatchLevel
 Network protocol patch level (maximal 99).
#define NetworkProtocolVersion
 Network protocol version (1,2,3) -> 10203.
#define NetworkProtocolFormatString   "%d.%d.%d"
 Network protocol printf format string.
#define NetworkProtocolFormatArgs(v)   (v) / 10000, ((v) / 100) % 100, (v) % 100
 Network protocol printf format arguments.
#define NetworkDefaultPort   6660
enum  _ic_message_subtype_ {
  ICMHello, ICMConfig, ICMEngineMismatch, ICMProtocolMismatch,
  ICMEngineConfMismatch, ICMMapUidMismatch, ICMGameFull, ICMWelcome,
  ICMWaiting, ICMMap, ICMState, ICMResync,
  ICMServerQuit, ICMGoodBye, ICMSeeYou, ICMGo,
  ICMAYT, ICMIAH
}
enum  _net_client_con_state_ {
  ccs_unused = 0, ccs_connecting, ccs_connected, ccs_mapinfo,
  ccs_badmap, ccs_synced, ccs_async, ccs_changed,
  ccs_detaching, ccs_disconnected, ccs_unreachable, ccs_usercanceled,
  ccs_nofreeslots, ccs_serverquits, ccs_goahead, ccs_started,
  ccs_incompatibleengine, ccs_incompatiblenetwork
}
typedef struct _network_state_ NetworkState
std::string NetworkArg
int NetPlayers
 Network command line argument.
char * NetworkAddr
 Network players.
int NetworkPort
 Local network address to use.
int HostsCount
 Local network port to use.
CNetworkHost Hosts [PlayerMax]
 Number of hosts.
int NetConnectRunning
 Host, port, and number of all players.
NetworkState NetStates [PlayerMax]
 Network menu: Setup mode active.
unsigned char NetLocalState
 Network menu: Server: Client Host states.
int NetLocalHostsSlot
 Network menu: Local Server/Client connect state.
int NetLocalPlayerNumber
 Network menu: Slot # in Hosts array of local client.
CServerSetup ServerSetupState
 Player number of local client.
CServerSetup LocalSetupState
 Network menu: Multiplayer Server Menu selections state.
void NetworkServerStartGame ()
 Network menu: Multiplayer Client Menu selections local state.
void NetworkGamePrepareGameSettings ()
 Server user has finally hit the start game button.
void NetworkConnectSetupGame ()
void NetworkInitClientConnect ()
 Assign Player slot, evaluate Setup state..
void NetworkExitClientConnect ()
 Setup network connect state machine for clients.
void NetworkInitServerConnect (int openslots)
 Terminate network connect state machine for clients.
void NetworkExitServerConnect ()
 Setup network connect state machine for the server.
int NetworkParseSetupEvent (const unsigned char *buf, int size)
 Terminate network connect state machine for the server.
int NetworkSetupServerAddress (const std::string &serveraddr)
 Parse a network connect event.
void NetworkProcessClientRequest ()
 Menu: Setup the server IP.
void NetworkProcessServerRequest ()
 Menu Loop: Send out client request messages.
void NetworkServerResyncClients ()
 Menu Loop: Send out server request messages.
void NetworkDetachFromServer ()
 Menu Loop: Server: Mark clients state to send stateinfo message.

Define Documentation

#define NetworkDefaultPort   6660

#define NetworkProtocolFormatArgs (  )     (v) / 10000, ((v) / 100) % 100, (v) % 100

Network protocol printf format arguments.

#define NetworkProtocolFormatString   "%d.%d.%d"

Network protocol printf format string.

#define NetworkProtocolMajorVersion   StratagusMajorVersion

Network protocol major version.

#define NetworkProtocolMinorVersion   StratagusMinorVersion

Network protocol minor version (maximal 99).

#define NetworkProtocolPatchLevel   StratagusPatchLevel

Network protocol patch level (maximal 99).

#define NetworkProtocolVersion

Value:

Network protocol version (1,2,3) -> 10203.


Typedef Documentation

typedef struct _network_state_ NetworkState

Connect state information of network systems active in current game.


Enumeration Type Documentation

Network init config message subtypes (menu state machine).

Enumerator:
ICMHello 
ICMConfig  Client Request.
ICMEngineMismatch  Setup message configure clients.
ICMProtocolMismatch  Stratagus engine version doesn't match.
ICMEngineConfMismatch  Network protocol version doesn't match.
ICMMapUidMismatch  Engine configuration isn't identical.
ICMGameFull  MAP UID doesn't match.
ICMWelcome  No player slots available.
ICMWaiting  Acknowledge for new client connections.
ICMMap  Client has received Welcome and is waiting for Map/State.
ICMState  MapInfo (and Mapinfo Ack).
ICMResync  StateInfo.
ICMServerQuit  Ack StateInfo change.
ICMGoodBye  Server has quit game.
ICMSeeYou  Client wants to leave game.
ICMGo  Client has left game.
ICMAYT  Client is ready to run.
ICMIAH  Server asks are you there.

Client answers I am here

Network Client connect states

Enumerator:
ccs_unused 
ccs_connecting  Unused.
ccs_connected  New client.
ccs_mapinfo  Has received slot info.
ccs_badmap  Has received matching map-info.
ccs_synced  Has received non-matching map-info.
ccs_async  Client is in sync with server.
ccs_changed  Server user has changed selection.
ccs_detaching  Client user has made menu selection.
ccs_disconnected  Client user wants to detach.
ccs_unreachable  Client has detached.
ccs_usercanceled  Server is unreachable.
ccs_nofreeslots  Connection canceled by user.
ccs_serverquits  Server has no more free slots.
ccs_goahead  Server quits.
ccs_started  Server wants to start game.
ccs_incompatibleengine  Server has started game.
ccs_incompatiblenetwork  Incompatible engine version.

Incompatible netowrk version


Function Documentation

void NetworkConnectSetupGame (  ) 

Assign player slots and names in a network game..

void NetworkDetachFromServer (  ) 

Menu Loop: Server: Mark clients state to send stateinfo message.

Terminate and detach Network connect state machine for the client

void NetworkExitClientConnect (  ) 

Setup network connect state machine for clients.

Terminate Network connect state machine for clients

void NetworkExitServerConnect (  ) 

Setup network connect state machine for the server.

Terminate Network connect state machine for the server

void NetworkGamePrepareGameSettings (  ) 

Server user has finally hit the start game button.

Multiplayer network game final race an player type setup.

void NetworkInitClientConnect (  ) 

Assign Player slot, evaluate Setup state..

Setup Network connect state machine for clients

void NetworkInitServerConnect ( int  openslots  ) 

Terminate network connect state machine for clients.

Setup Network connect state machine for the server

int NetworkParseSetupEvent ( const unsigned char *  buf,
int  size 
)

Terminate network connect state machine for the server.

Parse a setup event. (Command type <= MessageInitEvent)

Parameters:
buf Packet received
size size of the received packet.
Returns:
1 if packet is an InitConfig message, 0 otherwise

void NetworkProcessClientRequest (  ) 

Menu: Setup the server IP.

Client Menu Loop: Send out client request messages

void NetworkProcessServerRequest (  ) 

Menu Loop: Send out client request messages.

Server Menu Loop: Send out server request messages

void NetworkServerResyncClients (  ) 

Menu Loop: Send out server request messages.

Notify state change by menu user to connected clients

void NetworkServerStartGame (  ) 

Network menu: Multiplayer Client Menu selections local state.

Server user has finally hit the start game button

int NetworkSetupServerAddress ( const std::string &  serveraddr  ) 

Parse a network connect event.

Setup the IP-Address of the network server to connect to

Parameters:
serveraddr the serveraddress the user has entered
Returns:
True, if error; otherwise false.


Variable Documentation

CNetworkHost Hosts[PlayerMax]

Number of hosts.

Local network port to use.

Network menu: Multiplayer Server Menu selections state.

Host, port, and number of all players.

Network menu: Local Server/Client connect state.

Network menu: Slot # in Hosts array of local client.

unsigned char NetLocalState

Network menu: Server: Client Host states.

Network command line argument.

NetworkState NetStates[PlayerMax]

Network menu: Setup mode active.

char* NetworkAddr

Network players.

std::string NetworkArg

Local network address to use.

Player number of local client.

Player number of local client.

Client and server selection state for Multiplayer clients

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.