A matter of format

Termcap: the next generation: 4.4BSD and related UNIX systems such as FreeBSD are distributed with a streamlined and improved variant of the classic termcap facility. Functions specific to terminal control have been removed, and the package has, consequently, been renamed capability database. Generalizing termcap seems logical considering that the database format and library have long since been used for purposes other than terminal handling, e.g. to describe printer capabilities (printcap). The most notable improvements over the old termcap are:

All the details are described in the getcap(3) for the cap_mkdb(1) manual pages.

A host capability database: Using the BSD capability database for hostcap seemed like a good idea for several reasons. First, why reinvent the wheel and define and implement yet another database format plus library functions when a well-known database facility is already available for free and in wide use? In addition, the text-based database format is simple and straightforward; database files can be created and modified with any ordinary text editor.

A simple example: Here is a simple host database record for a Macintosh computer named ``tzimac'':

   # Mac belonging to Technologie-Zentrum Informatik

   tzimac:\
       :arch=mac:ipaddr=134.102.218.171:org=+tzi:

Blank lines and lines beginning with # are comments; the \ character is used for continuation lines. Each record in the host database consists of the hostname and a list of colon-delimited capabilities; each capability is made up of a name and, optionally, a `=' (or some other special character depending on the capability's type) and the value.

The host capabilities ipaddr and org specify the host's IP address and the organizational entity to which the machine belongs; these capabilities are mandatory.

A complex example: Here is a more complete host database record defining a host with several network interfaces (and, consequently, several names). It uses capabilities such as the operating system version, physical location, memory size, the list of network interfaces, and a boolean capability indicating that this is a ``trusted host'' (a complete list of capabilities is presented in a moment). Note that several names can be specified delimited by `|' characters; the text following the last `|' character is a comment.

   ruin|www-rn|Server and gateway for RN:\
       :arch=sparc:os=solaris2.5:model=SPARCstation 20:\
       :room=MZH 5180:if=+ruin,+ruin-sn:display#8:memory#96:\
       :mhz#60:serial=445H1742:cpus#2:login:trusted:admin:org=+rn:

Types of capabilities: Hostcap currently recognizes three types of capabilities: string capabilities, whose values are plain strings or lists of strings separated by commas; integers; and boolean capabilities which are either present in a record (true) or absent from a record (false). Here are a few examples:

String, comma-list
:arch=sparc:user=net,cabo,grp-strait:
Integer
:memory#96:
Boolean
:trusted:

Indirect capabilities: The capability database does not define a facility for indirect capabilities whose values refer to other records in the database. For the host database, we are using the convention that a capability value that begins with the + character points to another record in the database. Records referenced by such indirect capabilities usually are not hosts but things like network interfaces or organizations:

   +ruin:ipaddr=134.102.200.36:
   +ruin-sn:ipaddr=134.102.218.1:

   +rn:\
      :group=Network research group:contact=net:

Top: hostcap overview  Prev: Life before hostcap  Next: Capabilities...