The util sub-package
This sub-package has the following code:
- PriorityQueue: This is an implementation of a priority
queue. It is used by the serv-comp package, and the models
package. This is implemented as a C++ template.
- rtp.h: This is the header file that defines the structure
of an RTP packet.
- JString, JHashtable: These are packages from http://www.mike95.com. Some
small modifications have been done (added an additional routine
to JString, and changed the return value of a routine in
JHashtable).
- LogLine: This represents a single line written out as log
by other sub-packages. You can use this for managing logs.
Each log-line has the following fields, in that order, when
written out:
- The time, in ms, since the start. This is usually the
time from the timeSyncServer (see the udp-lib sub-package).
- The service-cluster ID of the cluster-manager writing the
log (see the serv-comp
sub-package).
- The name of the function that writes the log-line.
- A string describing the log-line.
- The other fields print the different variables at the time
of logging -- see the LogLine::printValid routine for the
entire list.
- Debug: This is the debugging/logging package. You can
add log-lines to a Debug structure, store them in memory, and
finally write everything out to files.
- Control, ControlServer: "Control.*" defines the packet
structure to be used for communication between the
cluster-manager (startServComp, of the serv-comp sub-package) and the
ControlServer. The ControlServer implements the following
functionality:
- Wait for a TCP connection from all the cluster-managers.
- Send a START command to all cluster-managers -- this
ensures that all cluster-managers start their
functionality at roughly the same time.
- On receiving a Ctrl-C, sends a STOP command to all
cluster-managers. The cluster-managers then make a clean
exit, writing out all the log files (perhaps stored in
memory).
- The program then waits for a second Ctrl-C. You are
supposed to hit the second Ctrl-C after all the
cluster-managers exit. This ensures that you can re-start
the ControlServer immediately if required. If the server
exits before the clients of the TCP connections end, the
TCP connections will be in CLOSE_WAIT state for a minute,
and you have to wait until then to be able to bind to the
same ControlServer TCP port.
- Util: This has several utility routines:
- An init routine to be called before using this library
- Unix socket sugar routines
- Replacements for "sendto" and "recvfrom" when using the
emulator package. These routines handle redirection
of traffic to/from the emulator.
- Routines to handle UNIX time structures
- Hash routines
- String routines
- Routine to read in an SCID-Mapping file (see the serv-comp sub-package
documentation).
Compile-time configurations
Here are the compile-time flags/options in this sub-package:
- TUN_HOST: The host that is running the emulator
software. This is relevant when compiled with the IP_TUNNEL
option defined (see here).
- gdbg: This is the global debug flag. You can expect a
lot of print statements if you turn this on. Its a long time
since I used this flag, so I cannot tell how fast it will
scroll your screen, or the usefulness of the output.
- cfg_to_file: Turning this on makes the Debug routines
write out log-lines directly to a file, as opposed to storing
them in memory and writing them out finally.
- cfg_use_stream: Turning this on uses streams, instead of
the LogLine structure, for outputting the log-lines. In a
program under development, this option is useful to have since
you can simply write out the log-line as a print out, as opposed
to re-defining the LogLine structure for each new field you
decide to print while debugging. For best performance, turn off
the cfg_use_stream and the cfg_to_file flags.
- cfg_read_paths: This means that the client, and the
cluster-managers, would read off the physical service-level path
from the "paths.cfg" file -- the choice of service instances is
not done dynamically in this case. This option can be turned on
to have some control on which service instances are chosen
during path construction. More information on the "paths.cfg"
file is available in the serv-comp
sub-package documentation.
Command-line arguments
- The ControlServer program takes a single command-line argument
-- the SCID-Mapping file (see the serv-comp sub-package).
Bhaskaran Raman, bhaskar@cs.berkeley.edu
Last modified: Mon Jan 21 16:26:12 PST 2002