Dawn of Light - Class documentation 2900
This is the Dawn of Light project
DOL.GS.GameServer Class Reference

Class encapsulates all game server functionality. More...

List of all members.

Public Member Functions

void LoadInvalidNames ()
 Loads an array of invalid names.
void SendUDP (byte[] bytes, int count, EndPoint clientEndpoint)
 Sends a UDP packet.
void SendUDP (byte[] bytes, int count, EndPoint clientEndpoint, AsyncCallback callback)
 Sends a UDP packet.
override bool Start ()
 Starts the server.
bool RecompileScripts ()
 Recomiples the scripts dll.
void Close ()
void Open ()
override void Stop ()
 Stops the server, disconnects all clients, and writes the database to disk.
override byte[] AcquirePacketBuffer ()
 Gets packet buffer from the pool.
override void ReleasePacketBuffer (byte[] buf)
 Releases previously acquired packet buffer.
void LogGMAction (string text)
 Writes a line to the gm log file.
void LogCheatAction (string text)
 Writes a line to the cheat log file.
bool InitDB ()
 Initializes the database.

Static Public Member Functions

static void CreateInstance (GameServerConfiguration config)
 Creates the gameserver instance.

Protected Member Functions

bool StartUDP ()
 Starts the udp listening.
void RecvFromCallback (IAsyncResult ar)
 UDP event handler. Called when a UDP packet is waiting to be read.
void SendToCallback (IAsyncResult ar)
 Callback function for UDP sends.
bool StartScriptComponents ()
 Initialize all script components.
virtual bool UpdateDatabase ()
 Do any required updates to the database.
bool InitComponent (bool componentInitState, string text)
 Prints out some text info on component initialisation and stops the server again if the component failed.
override BaseClient GetNewClient ()
 Creates a new client.
void SaveTimerProc (object sender)
 Function called at X interval to write the database to disk.
 GameServer ()
 Default game server constructor.
 GameServer (GameServerConfiguration config)
 Constructor with a given configuration.

Protected Attributes

const int MAX_UDPBUF = 4096
 Maximum UDP buffer size.
const int MINUTE_CONV = 60000
 Minute conversion from milliseconds.
ILog m_cheatLog
 The textwrite for log operations.
IObjectDatabase m_database
 Database instance.
ILog m_gmLog
 The textwrite for log operations.
ArrayList m_invalidNames = new ArrayList()
 Contains a list of invalid names.
IServerRules m_serverRules
 Holds instance of current server rules.
int m_startTick
 Holds the startSystemTick when server is up.
eGameServerStatus m_status
 Game server status variable.
Timer m_timer
 World save timer.
byte[] m_udpBuf
 Receive buffer for UDP.
Socket m_udpListen
 Socket that listens for UDP packets.
Socket m_udpOutSocket
 Socket that sends UDP packets.
readonly AsyncCallback m_udpReceiveCallback
 Holds udp receive callback delegate.
readonly AsyncCallback m_udpSendCallback
 Holds the async UDP send callback.

Static Protected Attributes

static GameServer m_instance
 The instance!

Properties

ILog Logger [get]
 A general logger for the server.
static GameServer Instance [get]
 Returns the instance.
virtual new GameServerConfiguration Configuration [get]
 Retrieves the server configuration.
eGameServerStatus ServerStatus [get]
 Gets the server status.
static IServerRules ServerRules [get]
 Gets the current rules used by server.
static IObjectDatabase Database [get]
 Gets the database instance.
int SaveInterval [get, set]
 Gets or sets the world save interval.
ArrayList InvalidNames [get]
 Gets an array of invalid player names.
bool IsRunning [get]
 True if the server is listening.
int TickCount [get]
 Gets the number of millisecounds elapsed since the GameServer started.
Socket UDPSocket [get]
 Gets the UDP Socket of this server instance.
byte[] UDPBuffer [get]
 Gets the UDP buffer of this server instance.
int PacketPoolSize [get]
 Gets the count of packet buffers in the pool.

Detailed Description

Class encapsulates all game server functionality.


Constructor & Destructor Documentation

DOL.GS.GameServer.GameServer ( ) [protected]

Default game server constructor.

DOL.GS.GameServer.GameServer ( GameServerConfiguration  config) [protected]

Constructor with a given configuration.

Parameters:
configA valid game server configuration

Member Function Documentation

override byte [] DOL.GS.GameServer.AcquirePacketBuffer ( )

Gets packet buffer from the pool.

Returns:
byte array that will be used as packet buffer.
static void DOL.GS.GameServer.CreateInstance ( GameServerConfiguration  config) [static]

Creates the gameserver instance.

Parameters:
config
override BaseClient DOL.GS.GameServer.GetNewClient ( ) [protected]

Creates a new client.

Returns:
An instance of a new client
bool DOL.GS.GameServer.InitComponent ( bool  componentInitState,
string  text 
) [protected]

Prints out some text info on component initialisation and stops the server again if the component failed.

Parameters:
componentInitStateThe state
textThe text to print
Returns:
false if startup should be interrupted
bool DOL.GS.GameServer.InitDB ( )

Initializes the database.

Returns:
True if the database was successfully initialized
void DOL.GS.GameServer.LoadInvalidNames ( )

Loads an array of invalid names.

void DOL.GS.GameServer.LogCheatAction ( string  text)

Writes a line to the cheat log file.

Parameters:
textthe text to log
void DOL.GS.GameServer.LogGMAction ( string  text)

Writes a line to the gm log file.

Parameters:
textthe text to log
bool DOL.GS.GameServer.RecompileScripts ( )

Recomiples the scripts dll.

Returns:
void DOL.GS.GameServer.RecvFromCallback ( IAsyncResult  ar) [protected]

UDP event handler. Called when a UDP packet is waiting to be read.

Parameters:
ar
override void DOL.GS.GameServer.ReleasePacketBuffer ( byte[]  buf)

Releases previously acquired packet buffer.

Parameters:
bufThe released buf
void DOL.GS.GameServer.SaveTimerProc ( object  sender) [protected]

Function called at X interval to write the database to disk.

Parameters:
senderObject that generated the event
void DOL.GS.GameServer.SendToCallback ( IAsyncResult  ar) [protected]

Callback function for UDP sends.

Parameters:
arAsynchronous result of this operation
void DOL.GS.GameServer.SendUDP ( byte[]  bytes,
int  count,
EndPoint  clientEndpoint 
)

Sends a UDP packet.

Parameters:
bytesPacket to be sent
countThe count of bytes to send
clientEndpointAddress of receiving client
void DOL.GS.GameServer.SendUDP ( byte[]  bytes,
int  count,
EndPoint  clientEndpoint,
AsyncCallback  callback 
)

Sends a UDP packet.

Parameters:
bytesPacket to be sent
countThe count of bytes to send
clientEndpointAddress of receiving client
callback
override bool DOL.GS.GameServer.Start ( )

Starts the server.

Returns:
True if the server was successfully started
bool DOL.GS.GameServer.StartScriptComponents ( ) [protected]

Initialize all script components.

Returns:
true if successfull, false if not
bool DOL.GS.GameServer.StartUDP ( ) [protected]

Starts the udp listening.

Returns:
true if successfull
override void DOL.GS.GameServer.Stop ( )

Stops the server, disconnects all clients, and writes the database to disk.

virtual bool DOL.GS.GameServer.UpdateDatabase ( ) [protected, virtual]

Do any required updates to the database.

Returns:
true if all went fine, false if errors

Member Data Documentation

ILog DOL.GS.GameServer.m_cheatLog [protected]

The textwrite for log operations.

IObjectDatabase DOL.GS.GameServer.m_database [protected]

Database instance.

ILog DOL.GS.GameServer.m_gmLog [protected]

The textwrite for log operations.

The instance!

ArrayList DOL.GS.GameServer.m_invalidNames = new ArrayList() [protected]

Contains a list of invalid names.

Holds instance of current server rules.

Holds the startSystemTick when server is up.

eGameServerStatus DOL.GS.GameServer.m_status [protected]

Game server status variable.

Timer DOL.GS.GameServer.m_timer [protected]

World save timer.

byte [] DOL.GS.GameServer.m_udpBuf [protected]

Receive buffer for UDP.

Socket DOL.GS.GameServer.m_udpListen [protected]

Socket that listens for UDP packets.

Socket that sends UDP packets.

readonly AsyncCallback DOL.GS.GameServer.m_udpReceiveCallback [protected]

Holds udp receive callback delegate.

readonly AsyncCallback DOL.GS.GameServer.m_udpSendCallback [protected]

Holds the async UDP send callback.

const int DOL.GS.GameServer.MAX_UDPBUF = 4096 [protected]

Maximum UDP buffer size.

const int DOL.GS.GameServer.MINUTE_CONV = 60000 [protected]

Minute conversion from milliseconds.


Property Documentation

virtual new GameServerConfiguration DOL.GS.GameServer.Configuration [get]

Retrieves the server configuration.

IObjectDatabase DOL.GS.GameServer.Database [static, get]

Gets the database instance.

GameServer DOL.GS.GameServer.Instance [static, get]

Returns the instance.

ArrayList DOL.GS.GameServer.InvalidNames [get]

Gets an array of invalid player names.

bool DOL.GS.GameServer.IsRunning [get]

True if the server is listening.

ILog DOL.GS.GameServer.Logger [get]

A general logger for the server.

int DOL.GS.GameServer.PacketPoolSize [get]

Gets the count of packet buffers in the pool.

int DOL.GS.GameServer.SaveInterval [get, set]

Gets or sets the world save interval.

IServerRules DOL.GS.GameServer.ServerRules [static, get]

Gets the current rules used by server.

eGameServerStatus DOL.GS.GameServer.ServerStatus [get]

Gets the server status.

int DOL.GS.GameServer.TickCount [get]

Gets the number of millisecounds elapsed since the GameServer started.

byte [] DOL.GS.GameServer.UDPBuffer [get, protected]

Gets the UDP buffer of this server instance.

Socket DOL.GS.GameServer.UDPSocket [get, protected]

Gets the UDP Socket of this server instance.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events