Serveez is a kind of server server. It allows different protocol servers to listen on various TCP/UDP ports, on ICMP sockets and on named pipes. Servers are instantiated with a certain configuration. It is possible to run multiple different servers on the same port.
This chapter covers all questions about how to write your own Internet protocol server with this package. Most of the common tasks of such a server have got a generic solution (default routines) which could be “overridden” by your own routines. There are some examples within this package. They are showing the possibilities with this package and how to implement servers.
The ‘foo’ server does not do anything at all and is of no actual use but could be a basis for a new protocol server. We are now going to describe how this specific server works. Eventually the reader might get an impression of what is going on.
For better understanding the text below we will use the following terminology:
A server definition is a
svz_servertype_t structure which contains
server specific members like its name, different callbacks, a single default
configuration and a list of configuration items which determines what can be
A server configuration can be any kind of structure. The default server configuration must be specified within the server definition (see above). When instantiating a server (which is done via the configuration file) the configuration items specified in the server definition get processed and are put into a copy of the default configuration. Thus we get an instance.
A server instance is a copy of the server definition including the modified server configuration. A server gets instantiated by the configuration file parser. The concept of server instances has been introduced because we wanted Serveez to have the following features. A single server can have multiple instances with different behaviour due to different server configurations. A server instance can be bound to multiple port configurations. Different server instances (of the same and/or different server type) can share the same port configuration.
A port configuration in Serveez is represented by the
structure. Depending on a shared flag it contains different type of
information specifying a transport endpoint. See Define ports, for more
on this topic. It also can be a special configuration item within a server
configuration. This is necessary if a server needs for some reason a remote
transport endpoint. A server instance does not usually need to know about
the port configuration it is bound to.