Table of Contents

OIL2 Class Standard.HostTable

class Standard . HostTable {
        assoc   addressToHost;
        int32   hostFileTotal;
        set     hostFiles;
        assoc   hostToAddress;
        oid     serviceOID;
inherits from Object;


Class HostTable maintains host name to IP address mappings. This class provides the ability to import BSD host-style (e.g., /etc/host) data files to enable access to data that may not be available from a name server. The HostTable class is often used by systems requiring 100% availability as a means to prevent DNS outages from rendering the system inoperable. It is also used by system and network management-related deployments to access information about hidden hosts and routers that are part of the network infrastructure.

Related Information

NameServerDirectory, DNSresolver.



HostTable:create(string file1, string file2)

Method Description

Create and initialize the host table. See readHostFile for details.


HostTable:addHostFile(string filename)

Method Description

Dynamically includes a new BSD host-style file. This method takes one argument which is a file name corresponding to an /etc/hosts-style file.

Return Value

This method returns no value.


HostTable:readHostFile(string fileNameArg)

Method Description

This method takes as arguments a potentially empty list of file names. Each file is expected to be in BSD hosts-style format (e.g., /etc/hosts) and will be processed in the order specified. While the conventional /etc/hosts format uses IPv4 dotted-decimal addresses, IPv6 addresses are also supported by readHostFile.


HostTable:getHostByName(string hostname)

Method Description

Looks up in the host table for the IP address corresponding to a host name. This method takes one argument, a string representing the host name of the host whose IP address is desired.

Return Value

If the host name is unknown, nil is returned; otherwise, the IP address of the host is returned as an integer.


HostTable:getHostByAddress(any address)

Method Description

Looks up the name of the host corresponding to an IP address. This method takes one argument that indicates the IP address of the host. It can be specified as an integer or dotted-decimal number.

Return Value

This method returns nil if no such IP address is known; otherwise it returns a string representing the name of the host.