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.
HostTable:create(string file1, string file2)
Create and initialize the host table. See readHostFile for details.
HostTable:addHostFile(string filename)
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.
HostTable:readHostFile(string fileNameArg)
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)
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.
HostTable:getHostByAddress(any address)
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.