The white pages of residence listings can be thought of as a "structured set of data." If this data were stored on a computer, a lexicographer would call it a database ; a "structured set of data" is the definition of database in the Concise Oxford Dictionary. Sometimes, when you are in a hurry or don't have a telephone number, you dial a special telephone number (411 or 555-1212 in the United States) to ask an operator ("directory assistance") for the telephone number of the person you want to call. This directory assistance can be thought of as directory service. You, the caller, are a customer or client of the directory service, and the particular operator, is a server of the directory service. In the world of computer networking, the human server is replaced with a directory server of databases. Since there is a server, there has to be a client. The client-side of a directory service is typically a programming library which allows other applications to look up entries in the database.
The metaphor of a telephone directory was useful in explaining the concepts of directory service, client, and server. It turns out that the concept of names of people and their telephone numbers is also a metaphor for a similar database in computer networking. Recall from Section 1.3.2, "IP host addresses" that hosts have unique numbers or addresses, just as every telephone number in the world is unique. Just as we associate names of people with their telephone numbers, in computer networking we often want to give individual hosts a name in addition to a host address. The reasons are that it is easier to remember a name than a number, and just as people move geographically, requiring new telephone number assignments, hosts can move physically (requiring a new address assignment for the host) or conversely, the function the host was serving can move from one physical host to another (requiring a new name assignment for the host).
The hostname and address entries are stored in a hosts database that the directory server can use to respond to requests from clients. As was noted earlier, the client-side of the directory service is typically a programming library. This is the case for the hosts database. There is a subroutine, known as gethostbyname( ) that takes a string name of a host and returns the address of the host. See your system's manual page for gethostbyname for the precise calling conventions. Solaris comes with a utility called getent for looking up database entries via the command line. For example:
getent can be thought of as one of the most primitive directory service clients, but nearly every application that deals with the network will be a client that needs to access the hosts database via the directory service. A more advanced client of the hosts database is a web browser such as Netscape Navigator or Internet Explorer. Browsers will link to gethostbyname or a similar interface to find the host addresses corresponding to Universal Resource Locators (URLs, those things that start with http:// ).% getent hosts frostback 18.104.22.168 frostback
Going back to the telephone concept, sometimes we would like to know the name of the caller corresponding to a telephone number. In the United States, when you call a toll free number, the merchant receiving the call has the capability to display your phone number and can map it to your name (considering that the merchant is paying for your long distance call, some might reason that this is fair). In the computer networking world, it is sometimes useful to know the hostname of the client accessing the server. For example, suppose the server side of a web browser is a web server. Web servers often keep logs of the "hits" made to the server, for the purposes of understanding how popular a web site is, what is popular, and what hosts find it popular. The web server will always be able to find the host address of the client that made the hit. To figure out the name of the host, there is a programming interface called gethostbyaddr( ), which takes a host address, and returns the name of the host. The information can be obtained from the hosts database, via the directory service. In other words, both servers and client of different services, in this case, web services, can be clients of directory services.
|1.5. The session and presentation layers||2.2. Brief survey of common directory services|
Copyright © 2002 O'Reilly & Associates. All rights reserved.