Next: , Up: Writing servers   [Contents][Index]

3.2.1 Embedded servers

The core library of Serveez can be used to write standalone server modules. Serveez defines a certain interface for shared libraries which contain such server modules. If Serveez detects an unknown server type (server type which is not builtin) in its configuration file it tries to load a shared library containing this server type during startup. Prerequisites

In order to implement a server module you need an existing installation of Serveez. This can be achieved issuing the following commands:

$ ./configure --enable-shared --prefix=/usr/local
$ make
$ make install

After successful installation you are able to compile and link against the Serveez core API. The headers should be available in /usr/local/include and the library itself ( or libserveez.dll) is located in /usr/local/lib if you passed the configure script ‘--prefix=/usr/local’. Server definition

The interface mentioned in the introduction is defined via the extern declaration of the server type in the shared library of the server module. Imagine you want to implement a server type called ‘foo’. This requires the external symbol foo_server_definition in the shared library. You can achieve this inserting the following lines into your header file:

/* Either Unices.  */
extern svz_servertype_t foo_server_definition;

/* Or Windows.  */
__declspec (dllexport) extern svz_servertype_t foo_server_definition;

The data symbol foo_server_definition must be statically filled with the proper content (See Builtin servers.)