# class GGZCoreServer

A GGZCoreServer object represents not only a physical server, but also the connection to it. More...

Definition | `#include <GGZCoreServer.h>`
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum GGZCoreServerEvent { connected, connectfail, negotiated, negotiatefail, loggedin, loginfail, motdloaded, roomlist, typelist, entered, enterfail, loggedout, neterror, protoerror, chatfail, statechange }
- enum GGZCoreServerLogin { normal, guest, firsttime }

#### Public Methods

- GGZCoreServer ()
- ~GGZCoreServer ()
- int addHook (const GGZCoreServerEvent event, const GGZHookFunc func)
- int addHook (const GGZCoreServerEvent event, const GGZHookFunc func, void* data)
- int removeHook (const GGZCoreServerEvent event, const GGZHookFunc func)
- int removeHook (const GGZCoreServerEvent event, const unsigned int id)
- int setHost (const char* host, const unsigned int port, const int encryption)
- int setLogin (const int type, const char* username, const char* password)
- char* host ()
- int port ()
- GGZLoginType type ()
- char* username ()
- char* password ()
- int fd ()
- GGZStateID state ()
- int encryption ()
- int countRooms ()
- int countRoomsForce ()
- GGZCoreRoom* room ()
- GGZCoreRoom* room (const unsigned int number)
- int joinRoom (const unsigned int number)
- int countGames ()
- GGZGameType* game (const unsigned int number)
- int isOnline ()
- int isLoggedIn ()
- int isInRoom ()
- int isAtTable ()
- int connect ()
- int login ()
- int motd ()
- int logout ()
- int listRooms (const int type, const char verbose)
- int listGames (const char verbose)
- int dataPending ()
- int dataRead ()
- int dataWrite ()
- int logSession (const char *filename)
- GGZServer * server ()
- void resetRoom ()
- void rescue ()

#### Public Static Methods

- static GGZCoreServer* instance ()

## Detailed Description

A GGZCoreServer object represents not only a physical server, but also the connection to it. It has also functionality for room and table handling.

enum GGZCoreServerEvent { connected, connectfail, negotiated, negotiatefail, loggedin, loginfail, motdloaded, roomlist, typelist, entered, enterfail, loggedout, neterror, protoerror, chatfail, statechange }

### GGZCoreServerEvent

Possible server events

enum GGZCoreServerLogin { normal, guest, firsttime }

### GGZCoreServerLogin

Login type

GGZCoreServer ()

### GGZCoreServer

Constructor

~GGZCoreServer ()

### ~GGZCoreServer

Destructor

int addHook (const GGZCoreServerEvent event, const GGZHookFunc func)

### addHook

Add a simple callback to the server.

int addHook (const GGZCoreServerEvent event, const GGZHookFunc func, void* data)

### addHook

Add a callback with arguments.

int removeHook (const GGZCoreServerEvent event, const GGZHookFunc func)

### removeHook

Remove a callback from the server.

int removeHook (const GGZCoreServerEvent event, const unsigned int id)

### removeHook

Overloaded: Remove a callback on its id.

int setHost (const char* host, const unsigned int port, const int encryption)

### setHost

Specify the host data.

int setLogin (const int type, const char* username, const char* password)

### setLogin

Specify the login information.

char* host ()

### host

Return the hostname of this server.

int port ()

### port

Return the port number.

GGZLoginType type ()

### type

Return the login type.

char* username ()

### username

Return the username with which the player is logged in.

char* password ()

### password

Return the player's password.

int fd ()

### fd

Return the server's specific file descriptor.

GGZStateID state ()

### state

Return the current server state.

int encryption ()

### encryption

Return the encryption status.

int countRooms ()

### countRooms

The number of available rooms.

int countRoomsForce ()

### countRoomsForce

Same as above, but result is guaranteed.

GGZCoreRoom* room ()

### room

Return the current room.

GGZCoreRoom* room (const unsigned int number)

### room

Return an explicitely given room.

int joinRoom (const unsigned int number)

### joinRoom

Join a room.

int countGames ()

### countGames

The number of available game types.

GGZGameType* game (const unsigned int number)

### game

Return a specific game.

int isOnline ()

### isOnline

Check whether player is online or not.

int isLoggedIn ()

### isLoggedIn

Check whether player is logged in.

int isInRoom ()

### isInRoom

Check whether player is in a room or not.

int isAtTable ()

### isAtTable

Check whether player is at a table.

int connect ()

### connect

Connect to a server. This method uses the information given in setHost.

int login ()

### login

Log into a server. See setLogin for information how to set the login data.

int motd ()

### motd

Invoke the message of the day.

int logout ()

### logout

Cut the connection to a server.

int listRooms (const int type, const char verbose)

### listRooms

Retrieve rooms list.

int listGames (const char verbose)

### listGames

Retrieve games list.

int dataPending ()

### dataPending

Control data flow.

int dataRead ()

### dataRead

Returns whether data is read.

int dataWrite ()

### dataWrite

Return whether data is written.

int logSession (const char *filename)

### logSession

Log an XML session to a file

GGZCoreServer* instance ()

### instance

[static]

Return a reference to itself (servers are singleton objects for now).

GGZServer * server ()

### server

Retreive the associated internal ggzcore object.

void resetRoom ()

### resetRoom

Reset the current room.

void rescue ()

### rescue

Safe shutdown during disconnection.

Generated by: josef on athlon500 on Tue Mar 19 23:18:22 2002, using kdoc 2.0a53.