Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

network
Class CNetServer

IJSObject
   |
   +--CJSObject, CServerSocket, CTurnManager
         |
         +--CNetServer

   in Server.h
   in Server.cpp

class CNetServer
extends CJSObject, CServerSocket, CTurnManager


Inner Classes, Typedefs, and Enums
typedef CNetServer::SessionMap
          
 
Field Summary
private static CGameAttributes::UpdateCallback AttributeUpdate
          
private CJSMap< CNetServer::SessionMap > m_JSI_Sessions
          
private int m_LastSessionID
          
private uint m_MaxObservers
          
private std::vector< CNetServerSession* > m_Observers
          
private CScriptObject m_OnChat
          
private CScriptObject m_OnClientConnect
          
private CScriptObject m_OnClientDisconnect
          
private CStrW m_Password
          
private CGame* m_pGame
          
private CGameAttributes* m_pGameAttributes
          
private int m_Port
          
private CPlayer* m_pServerPlayer
          
private CStrW m_ServerName
          
private CStrW m_ServerPlayerName
          
private ENetServerState m_ServerState
          
private CNetServer::SessionMap m_Sessions
          
private CStrW m_WelcomeMessage
          
private static CPlayer::UpdateCallback PlayerAttributeUpdate
          
private static PlayerSlotAssignmentCB PlayerSlotAssignmentCallback
          
   
Fields inherited from class CJSObject
m_NativeProperties, m_NonsharedProperties, m_ScriptProperties, m_EngineOwned, JSI_class
   
Fields inherited from class CTurnManager
RecordIterator
 
Constructor Summary
CNetServer( CGame* pGame, CGameAttributes* pGameAttribs )
          
virtual ~CNetServer()
          
 
Method Summary
protected void AddSession( CNetServerSession* pSession )
          
protected bool AllowObserver( CNetServerSession* UNUSED( pSession ) )
          
protected void AssignSessionID( CNetServerSession* pSession )
          
 void AttributeUpdate( const CStrW& name, const CStrW& newValue, void* userdata )
          
 PS_RESULT Bind( const CSocketAddress& address )
          
 void Broadcast( CNetMessage* pMsg )
          
private static CNetMessage* CreatePlayerSlotAssignmentMessage( CPlayerSlot* slot )
          
protected virtual CNetServerSession* CreateSession( CSocketInternal* pInt )
          
private void FillSetGameConfig( CSetGameConfig* pMsg )
          
private void FillSetPlayerConfig( CSetPlayerConfig* pMsg, CPlayer* pPlayer )
          
 static void GetDefaultListenAddress( CSocketAddress& address )
          
 inline const CStrW& GetServerPlayerName()
          
 inline ENetServerState GetServerState()
          
private bool JSI_Open( JSContext* UNUSED( cx ), uintN UNUSED( argc ), jsval* UNUSED( argv ) )
          
protected virtual void NewTurn()
          
protected virtual void OnAccept( const CSocketAddress& )
          
protected void OnChat( const CStrW& from, const CStrW& message )
          
protected void OnClientConnect( CNetServerSession* pSession )
          
protected void OnClientDisconnect( CNetServerSession* pSession )
          
 void PlayerAttributeUpdate( const CStrW& name, const CStrW& newValue, CPlayer* pPlayer, void* userdata )
          
 void PlayerSlotAssignmentCallback( void* userdata, CPlayerSlot* pSlot )
          
protected void QueueIncomingCommand( CNetMessage* pMsg )
          
protected virtual void QueueLocalCommand( CNetMessage* pMsg )
          
protected void RemoveSession( CNetServerSession* pSession )
          
private static void ScriptingInit()
          
 inline void SetPassword( const CStr& password )
          
 int StartGame()
          
   
Methods inherited from class CJSObject
ScriptingInit, ScriptingShutdown, GetProperty, SetProperty, HasProperty, AddProperty, AddProperty, AddProperty, AddMethod, AddProperty, AddLocalProperty, GetScript, CreateScriptObject, ReleaseScriptObject, Shutdown
   
Methods inherited from class CServerSocket
OnRead, OnWrite, OnClose, OnAccept
   
Methods inherited from class CTurnManager
ClearBatch, RotateBatches, IterateBatch, SendBatch, SendMessage, QueueMessage, SetClientPipe, SetTurnLength, GetTurnLength, Initialize, RecordBatch, RecordIterator, NewTurn, QueueLocalCommand
   
Methods inherited from class IJSObject
HasProperty, GetProperty, AddProperty, AddProperty
   
Methods inherited from class CSocketBase
Shutdown, Initialize, Close, Destroy, SetNonBlocking, SetTcpNoDelay, Read, Write, Connect, Bind, PreAccept, Accept, Reject, GetOpMask, SetOpMask, GetProtocol, IsNonBlocking, GetErrorState, GetState, GetRemoteAddress, OnRead, OnWrite, OnClose
 

Field Detail

AttributeUpdate

private static CGameAttributes::UpdateCallback AttributeUpdate;

m_JSI_Sessions

private CJSMap< CNetServer::SessionMap > m_JSI_Sessions;

m_LastSessionID

private int m_LastSessionID;

m_MaxObservers

private uint m_MaxObservers;

m_Observers

private std::vector< CNetServerSession* > m_Observers;

m_OnChat

private CScriptObject m_OnChat;

m_OnClientConnect

private CScriptObject m_OnClientConnect;

m_OnClientDisconnect

private CScriptObject m_OnClientDisconnect;

m_Password

private CStrW m_Password;

m_pGame

private CGame* m_pGame;

m_pGameAttributes

private CGameAttributes* m_pGameAttributes;

m_Port

private int m_Port;

m_pServerPlayer

private CPlayer* m_pServerPlayer;

m_ServerName

private CStrW m_ServerName;

m_ServerPlayerName

private CStrW m_ServerPlayerName;

m_ServerState

private ENetServerState m_ServerState;

m_Sessions

private CNetServer::SessionMap m_Sessions;

m_WelcomeMessage

private CStrW m_WelcomeMessage;

PlayerAttributeUpdate

private static CPlayer::UpdateCallback PlayerAttributeUpdate;

PlayerSlotAssignmentCallback

private static PlayerSlotAssignmentCB PlayerSlotAssignmentCallback;


Constructor Detail

CNetServer

public CNetServer( CGame* pGame, CGameAttributes* pGameAttribs );

~CNetServer

public virtual ~CNetServer();


Method Detail

AddSession

protected void AddSession( CNetServerSession* pSession );

AllowObserver

protected bool AllowObserver( CNetServerSession* UNUSED( pSession ) );

AssignSessionID

protected void AssignSessionID( CNetServerSession* pSession );

AttributeUpdate

 void AttributeUpdate( const CStrW& name, const CStrW& newValue, void* userdata );

Bind

public PS_RESULT Bind( const CSocketAddress& address );

Broadcast

public void Broadcast( CNetMessage* pMsg );

CreatePlayerSlotAssignmentMessage

private static CNetMessage* CreatePlayerSlotAssignmentMessage( CPlayerSlot* slot );

CreateSession

protected virtual CNetServerSession* CreateSession( CSocketInternal* pInt );

FillSetGameConfig

private void FillSetGameConfig( CSetGameConfig* pMsg );

FillSetPlayerConfig

private void FillSetPlayerConfig( CSetPlayerConfig* pMsg, CPlayer* pPlayer );

GetDefaultListenAddress

public static void GetDefaultListenAddress( CSocketAddress& address );

GetServerPlayerName

public inline const CStrW& GetServerPlayerName();

GetServerState

public inline ENetServerState GetServerState();

JSI_Open

private bool JSI_Open( JSContext* UNUSED( cx ), uintN UNUSED( argc ), jsval* UNUSED( argv ) );

NewTurn

protected virtual void NewTurn();

OnAccept

protected virtual void OnAccept( const CSocketAddress& );

OnChat

protected void OnChat( const CStrW& from, const CStrW& message );

OnClientConnect

protected void OnClientConnect( CNetServerSession* pSession );

OnClientDisconnect

protected void OnClientDisconnect( CNetServerSession* pSession );

PlayerAttributeUpdate

 void PlayerAttributeUpdate( const CStrW& name, const CStrW& newValue, CPlayer* pPlayer, void* userdata );

PlayerSlotAssignmentCallback

 void PlayerSlotAssignmentCallback( void* userdata, CPlayerSlot* pSlot );

QueueIncomingCommand

protected void QueueIncomingCommand( CNetMessage* pMsg );

QueueLocalCommand

protected virtual void QueueLocalCommand( CNetMessage* pMsg );

RemoveSession

protected void RemoveSession( CNetServerSession* pSession );

ScriptingInit

private static void ScriptingInit();

SetPassword

public inline void SetPassword( const CStr& password );

StartGame

public int StartGame();

 Overview   Project   Class   Tree   Deprecated   Index 
0 A.D.
Generated on September 04, 2007 at 18:13
CppDoc v2.4.0
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD