Main Page | Modules | Data Structures

Irmo Server


Typedefs

typedef _IrmoServer IrmoServer
 An IrmoServer object.


Functions

IrmoServerirmo_server_new (IrmoSocket *sock, char *hostname, IrmoWorld *world, IrmoInterfaceSpec *spec)
 Create a new server.

IrmoCallbackirmo_server_watch_connect (IrmoServer *server, IrmoClientCallback func, void *user_data)
 Watch new connections to a server.

void irmo_server_foreach_client (IrmoServer *server, IrmoClientCallback func, void *user_data)
void irmo_server_ref (IrmoServer *server)
 Reference a server object.

void irmo_server_unref (IrmoServer *server)
 Unreference a server object.

void irmo_server_shutdown (IrmoServer *server)
 Shutdown a server.


Detailed Description

Server objects are used to serve a particular IrmoWorld world object on an IrmoSocket socket. Clients can then connect to the server using the irmo_connect function and receive information about the world being served.

The clients themselves may also serve a world back to the server. The client world to serve is specified using the 'spec' field of the irmo_server_new constructor.


Function Documentation

void irmo_server_foreach_client IrmoServer server,
IrmoClientCallback  func,
void *  user_data
 

Iterate over all clients connected to a server

Calls a specified function for each client currently connected to the given server.

Parameters:
server The server to iterate over
func The function to call
user_data Extra data to pass to the function

IrmoServer* irmo_server_new IrmoSocket sock,
char *  hostname,
IrmoWorld world,
IrmoInterfaceSpec spec
 

Create a new server.

Create a new IrmoServer listening for connections on a particular vhost.

Parameters:
sock The socket to listen on.
hostname The vhost hostname to listen on. If NULL is passed for this parameter, this server will be the default server for the socket. If there is an existing default server, the function will fail.
world The world the server will serve.
spec An interface specification describing the interface for the client world of the connecting clients.
Returns:
A new IrmoServer or NULL if the function fails.

void irmo_server_ref IrmoServer server  ) 
 

Reference a server object.

Add a reference to a server object. When a server is created its reference count is set to 1. References can be added with irmo_server_ref and removed with irmo_server_unref. When the reference count reaches 0 the server is automatically shut down and destroyed.

Parameters:
server The server object to reference.
See also:
irmo_server_unref

void irmo_server_shutdown IrmoServer server  ) 
 

Shutdown a server.

This shuts down a server, blocking until all clients are disconnected.

Parameters:
server The server to shutdown

void irmo_server_unref IrmoServer server  ) 
 

Unreference a server object.

Parameters:
server The server object to unreference
See also:
irmo_server_ref

IrmoCallback* irmo_server_watch_connect IrmoServer server,
IrmoClientCallback  func,
void *  user_data
 

Watch new connections to a server.

Add a new watch on a server. Whenever a new client connects to the server, a callback function will be invoked.

Parameters:
server The server to watch
func The function to call
user_data Some extra data to pass to the callback function
Returns:
A IrmoCallback object representing the watch


Generated on Tue Dec 30 04:04:46 2003 for Irmo by doxygen 1.3.4