VLAB Daemon

Quick Contents
VLAB Home

Overview

Communication between vlab components and launching of objects are accomplished by the vlab daemon. Each process has a separate communication channel to the daemon. The vlab daemon transparently sends messages to multiple receivers for any message sent by a component. Usually the vlab daemon is invoked automatically by other processes, and thus remains invisible to the end-user. However, the information on its operation and the format of messages are essential to implementing extensions of the Virtual Laboratory framework.

Invoking the vlab daemon

The vlab daemon may be invoked directly by the user, by typing:

    vlabd

The vlab system programs require that just one vlab daemon process must be running. The presence of a running vlab daemon is manifested by the /tmp/vlabdxxx file, where xxx is the unique 3 digit user id.

The vlab daemon can be started automatically by the browser and the object manager.

When the user exits the last one of these processes, that process will automatically kill the vlab daemon and removes the /tmp/vlabdxxx file.

Connecting to the vlab daemon

When a process wants to connect to a vlab daemon, it looks for the particular user's /tmp/vlabdxxx file and gets information from that file to establish the communication channel. The /tmp/vlabdxxx file contains the following information:

process id, port number

For example: 2758,4242

This means that the process identifier of the vlab daemon is 2758, and it is connected to port number 4242. When a component connects to the vlab daemon, it uses the port number identified in the /tmp/vlabdxxx file to establish a new socket connection between the two processes in order to free up the port identified above for future connections by other components. Thus the port number remains available for other vlab system programs to connect to: they will each repeat the same process of establishing connections and freeing up the port in turn for other connecting components. A sample set of connections to the vlab daemon by a number of vlab system components is shown in Figure 1.

Figure 1 - Sample connections to the vlab daemon

Vlab processes communicate with the vlab daemon using messages that are sent via Linux sockets. When a process starts up and makes a connection with the vlab daemon, it must send a registration message to the daemon specifying the message types it wants to receive. These types of messages will then be posted by the vlab daemon to the process. The only exception is the message type that invokes an object; this message is not posted, because the vlab daemon itself invokes the object.

Message format

Messages must use the format shown in Figure 2.

Figure 2 - Message format

where,

length: message length (4 bytes) = x+4

message id: a numeric message identifier (4 bytes)

message body: any ascii or binary message of length x bytes (it may be 0)

New messages may be anything, as long as the standard format is followed. The vlab daemon need not know anything about the details of the message body for messages that are simply to be sent to other processes.

The first thing that a process must do when establishing communication with the vlab daemon is to send it a message to register itself with the vlab daemon (see message id=26).

The message body must contain the message ids that the process is interested in, separated by commas.

Example:

A process may send the message: 29 26 12434,browser,10,12,13,14 to the vlab daemon.

This means:

length of message in bytes = 29, (25 + 4 bytes)

message id = 26 - means that the process wants to be added to the list of registered processes,

message body: process id(12434), name of process(browser), the process wants the vlab daemon to send it messages of type 10,12,13 & 14. (string length is 25 bytes)

When a process exits, it must send a message to the vlab daemon to remove itself from the list of registered processes (see message id=27).

Example:

A process may send the message: 17 27 12434,browser to the vlab daemon.

This means:
length of message in bytes = 17, (13 + 4 bytes)
message id = 27 - means that the process wants to be removed from the list of registered processes,
actual message: process id(12434), process name(browser). (string length=13 bytes)

Message types:

NOTE: This information is incomplete and not up-to-date.

Message ids (message id - message function):

browser message types:

vlab daemon message types:

Credits

E. Lowe, P. Federl - vlab daemon implementation

I. Hernadi, P. Federl - vlab daemon documentation
VLAB Home


Last updated December, 2001 by Joanne Penner