Managing NFS and NIS, 2nd Edition - Mike Eisler [20]
Chapter 2. Introduction to Directory Services
The previous chapter gave an overview of the ISO seven-layer model, describing in some detail the lower layers. In this chapter, we will discuss a class of layer 7— application protocols known as directory services. NIS is an example of such a directory service.
Purpose of directory services
The purpose of a directory service is to map names of one form to names of another form. Often the names of the first form are alphanumeric strings, and the second form are numbers. Or the names of the first form are simple, whereas the names of second form are complex. In the days before computing, we used directories, but they were published on paper. The most obvious one, and perhaps the inspiration for network directory services, is the telephone book. A typical telephone book for a city in the United States consists of three directories:
The white pages of residence listings
The white pages of business listings
The yellow pages of business listings
The residence white page listings contains a list of names, last name first, and for each entry, the telephone number. In many cases, each entry contains the street address of the residence. Thus you can think of the residence white pages in a telephone book, as a way to direct you from a person's name to his telephone number and address. Hence, a telephone book's formal name is a telephone directory.
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 hosts database
We've so far described a lot of theory, but a concrete example of a database in directory services should crystallize the concept.
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 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