RFC2167 - Referral Whois (RWhois) Protocol V1.5

时间:2005-02-15 来源: 作者: 点击:
Network Working Group S. Williamson Request for Comments: 2167 M. Kosters Obsoletes: RFC1714 D. Blacka Category: Informational J. Singh K. Zeilstra Network Solutions, Inc. June 1997 Referral Whois (RWhois) Protocol V1.5 Status of this Memo This memo
  Network Working Group S. Williamson
Request for Comments: 2167 M. Kosters
Obsoletes: RFC1714 D. Blacka
Category: Informational J. Singh
K. Zeilstra
Network Solutions, Inc.
June 1997

Referral Whois (RWhois) Protocol V1.5

Status of this Memo

This memo provides information for the Internet community. This memo
does not specify an Internet standard of any kind. Distribution of
this memo is unlimited.

Abstract

This memo describes Version 1.5 of the client/server interaction of
RWhois. RWhois provides a distributed system for the discovery,
retrieval, and maintenance of directory information. This system is
primarily hierarchical by design. It allows for the deterministic
routing of a query based on hierarchical tags, referring the user
closer to the maintainer of the information. While RWhois can be
considered a generic directory services protocol, it distinguishes
itself from other protocols by providing an integrated, hierarchical
architecture and query routing mechanism.

1. Introduction

Early in the development of the ARPANET, the SRI-NIC established a
centralized Whois database that provided host and network information
about the systems connected to the network and the electronic mail
(email) addresses of the users on those systems [RFC954]. The
ARPANET experiment evolved into a global network, the Internet, with
countless people and hundreds of thousands of end systems. The sheer
size and effort needed to maintain a centralized database
necessitates an alternate, decentralized approach to storing and
retrieving this information.

The original Whois function was to be a central directory of
resources and people on ARPANET. However, it could not adequately
meet the needs of the expanded Internet. RWhois extends and enhances
the Whois concept in a hierarchical and scaleable fashion. In
accordance with this, RWhois focuses primarily on the distribution of
"network objects", or the data representing Internet resources or
people, and uses the inherently hierarchical nature of these network
objects (domain names, Internet Protocol (IP) networks, email
addresses) to more accurately discover the requested information.

RWhois synthesizes concepts from other, established Internet
protocols. The RWhois protocol and architecture derive a great deal
of structure from the Domain Name System (DNS) [RFC1034] and borrow
directory service concepts from other directory service efforts,
primarily [X.500]. The protocol is also influenced by earlier
established Internet protocols, such as the Simple Mail Transport
Protocol (SMTP) [RFC821].

This RWhois specification defines both a directory access protocol
and a directory architecture. The directory access protocol
specifically describes the syntax of the client/server interaction.
It describes how an RWhois client can search for data on an RWhois
server, or how the client can modify data on the server. It also
describes how the server is to interpret input from the client, and
how the client should interpret the results returned by the server.
The architecture portion of this document describes the conceptual
framework behind the RWhois protocol. It details the concepts upon
which the protocol is based and describes its structural elements.
The protocol implements the architecture.

This document uses language like SHOULD and SHALL that have special
meaning as specified in "Key words for use in RFCs to Indicate
Requirement Levels". [RFC2119]

2. Architecture

2.1 Overview

As a directory service, RWhois is a distributed database, where data
is split across multiple servers to keep database sizes manageable.
The architecture portion of this document details the concepts upon
which the protocol is based and describes its structural elements.
Specifically, the architecture is concerned with how the data is
split across the different servers. The basis of this splitting is
the lexically hierarchical label (or tag), which is a text string
whose position in a hierarchy can be determined from the structure of
the string itself.

All data can follow some sort of hierarchy, even if the hierarchy
seems somewhat arbitrary. For example, person names can be arranged
into hierarchical groups via geography. If all the people in
particular towns are grouped into town groups, then all of the town
groups can be grouped into state (or province) groups, and then all
of the state groups can be grouped into a country group. Then, a
particular name would belong in a town group, a state group, and a
country group. However, just given a name, it would be impossible to
determine where in the hierarchy it belongs. Therefore, a person
name is not lexically hierarchical.

However, there are certain types of data whose position in the
hierarchy can be determined by deciphering the data itself, for
example, phone numbers. A phone number is grouped according to
country code, area code, local exchange, and local extension. By
looking at a phone number, it is possible to determine to which of
all these groups the number belongs: 1-303-555-2367 is in country
code 1, area code 303, local exchange 555, and has a local extension
of 2367. Therefore, a phone number is lexically hierarchical.

On the Internet, two such types of data are widely used: domain names
and IP networks. Domain names are organized via a label-dot system,
reading from a more specific label to a more general label left to
right; for example, war.west.netsol.com is a part of west.netsol.com,
which is a part of netsol.com, which is a part of com. IP networks
are also lexically hierarchical labels using the Classless Inter-
Domain Routing (CIDR) notation, but their hierarchy is not easily
determined with simple text manipulation; for example, 198.41.0.0/22
is a part of 198.41.0.0/16, which is a part of 198.40.0.0/15.
Instead, an IP network's hierarchy is determined by converting the
network to binary notation and applying successively shorter bit
masks.

It is important to note that, while very little real data is
lexically hierarchical in nature, people often create label systems
(or namespaces) to help manage the data and provide an element of
uniqueness, for example, Social Security Numbers, ISBNs, or the Dewey
Decimal System. RWhois leverages lexically hierarchical labels,
domain names and IP networks, for its data splitting using the
concepts of authority areas and referrals. An authority area is
associated with an RWhois server and a lexically hierarchical label,
which is considered to be its name. An authority area is a piece of
the distributed database that speaks with authority about its
assigned part of the hierarchy. All data associated with a particular
lexically hierarchical tag should be located within that authority
area's database. Authority areas are further explained in Section
2.4.

RWhois directs clients toward the appropriate authority area by
generating referrals. Referrals are pointers to other servers that
are presumed to be closer to the desired data. The client uses this
referral to contact the next server and ask the same question. The
next server may respond with data, an error, or another referral (or
referrals). By following this chain of referrals, the client will
eventually reach the server with the appropriate authority area. In
the RWhois architecture, referrals are generated by identifying a
lexically hierarchical label and deciphering the label to determine
the next server. Referrals are further explained in Section 2.5.

When a number of RWhois servers containing authority areas are
brought on line and informed about each other, they form an RWhois
tree. The tree has a root authority area, which is the group that
contains all other groups. The root authority area must keep
pointers to the servers and authority areas that form the first level
of the hierarchy. The authority areas in the first level of the
hierarchy are then responsible for keeping pointers to the authority
areas below them and for keeping a pointer to the root.

2.2 Design Philosophy

The design goals for the RWhois protocol are as follows.

* It should be a directory access protocol. The server should be
able to access and update the data residing on it.
* It should facilitate query routing. An unresolved query should
be redirected to a server that is presumed to be closer to the
desired data.
* It should enable data replication. The server should be able to
duplicate its data on another server.
* The server should be lightweight and delegate more functions to
the client.

The concepts used to achieve these design goals are explained in the
remaining document.

2.3 Schema Model

As a directory service, RWhois uses various database schema to store
and represent data. Schema, in this document, has two definitions.
First, it refers to the entire structure of a database, all the
tables and fields forming a complete database. When schema is used in
this context, it is called the "database schema". Database schema
consists of attributes, classes, and objects. Schema may also refer
to a single piece of the database, a single table with fields. When
schema is used in this context, it is just called "schema" or it is
preceded by the name of the particular piece: contact schema or
domain schema, for example. In this usage, schema is equivalent to
"class", defined below.

There is no standard database schema in the RWhois architecture. Each
authority area is presumed to be able to define its own local schema.
However, an authority area that is part of a larger RWhois tree is
expected to have some part of its schema pertain to the lexically
hierarchical label upon which the RWhois tree is based. An authority
area schema may not change throughout much of an RWhois tree.

2.3.1 Attributes

An attribute is a named field and is the smallest typed unit in the
database schema. It is equivalent to a relational database's field.
An attribute is not considered to be data by itself; it is simply
used to give data a type. When a piece of data has been typed by an
attribute, it is typically referred to as a value and is represented
as an attribute-value pair. The RWhois syntax for the attribute-value
pair is to separate them with a colon, for example:

First-Name:Bill

Attributes have a number of properties, some mandated by the RWhois
protocol and some that are implementation dependent. These properties
are usually a reflection of the database system used by the server.
The following is a list of the protocol-mandated properties and their
descriptions.

Attribute This is the name of the attribute.

Description This is a natural language description of the
attribute.

Type This is a parameter that broadly indicates the use
of the attribute to the protocol. There are three
standard types: TEXT, ID, and SEE-ALSO. The default is
TEXT, which indicates that the value is a text string.
ID indicates that the attribute contains the ID of
another RWhois object. This type of attribute is used
for database normalization. SEE-ALSO indicates that
the attribute contains a pointer (a Uniform Resource
Identifier (URI)) to some other kind of external data;
for example, a World Wide Web page or FTP site.

Format This is an interpretable string that describes the
acceptance format of the value. The server (and
optionally the client) should match the value to the
format string to determine if the value is acceptable.
The format of this property is a keyword indicating the
syntax of the format string, followed by a colon,
followed by the format string itself. Currently, the
only keyword recognized is "re" for POSIX.2 extended
regular expressions.

Indexed This is a true or false flag indicating that this
attribute should be indexed (and therefore able to be
searched).

Required This is a true or false flag indicating that this
attribute must have a value in an instance of the
class.

Multi-Line This is a true or false flag indicating that this
attribute may have multiple instances in a class, but
all of the instances are to be considered as multiple
lines of the same attribute instance. This allows
normal line terminators to terminate values.

Repeatable This is a true or false flag indicating that there may
be multiple instances of this attribute in a class and
each instance is to be interpreted as a separate
instance (in contrast to Multi-Line). This flag is
mutually exclusive with Multi-Line: if Multi-Line is
true, then Repeatable must be false and vice versa.

Primary This is a true or false flag that indicates that this
attribute is a primary key. If more than one attribute
in a class is marked as primary, then these attributes
together form a single primary key. The primary key is
intended to be used to force uniqueness among class
instances. Therefore, there can be only one instance of
a primary key in a database. The Primary flag implies
that the attribute is also required.

Hierarchical This is a true or false flag that indicates that this
attribute is lexically hierarchical.

Private This is a true or false flag that indicates whether or
not this attribute is private (that is, publicly not
viewable). It defaults to false. If it is true, then
only the clients that satisfy the
authentication/encryption requirements of a guardian
(described below) are able to view the attribute-value
pair.

2.3.2 Class

A class is a collection of attributes; it is a structure, not data.
The concept is equivalent to that of a relational database table. It
is also equivalent to the second definition of schema, above.

A class also has some properties that are sometimes referred to as
its "meta" information. These properties are listed below.

Version This is a time/date stamp that is used to quickly detect
when a class definition has been changed.

Description This is a natural language description of the class.

2.3.3 Object

An object is an instance of a class. It is data with a type of
<class>.

2.3.4 Base Class

While RWhois does not have or advocate using a specific, standardized
schema, it does impose a few requirements. It requires that all
defined classes inherit attributes from a particular base class (or
base schema). The RWhois specification does not require the actual
implementation of inheritance. Instead, all classes must include the
attributes defined in the base class.

The base class has the following attributes.

Class-Name This attribute contains the name of the class to which
the object belongs. It is the type of the object
itself. It is of type TEXT and is required.

Auth-Area This attribute contains the name of the authority area
to which the object belongs. It, along with Class-
Name, definitively defines the type of the object. It
is of type TEXT and is required.

ID This attribute is a universal identifier for the
object. It is formed by choosing a string that is
unique within an authority area and appending the
authority area to it, separating the local string from
the authority area name with a period. The only
restrictions on the local string are that it must be
unique within the authority area and not contain the
period character. This attribute is hierarchical in
nature. It is always generated by the server (for
example, during a register operation). It is of type
TEXT and is required.

Updated This attribute is a time/date stamp that indicates the
time of last modification of the object. It is both
informational and a form of record locking. It
prevents two clients from modifying the same object at
the same time. It is of type TEXT and is required.

Guardian This attribute is a link to a guardian object
(described below). Its value is the ID of a guardian
object. It is of type ID and is optional. It is
repeatable, since an object may have multiple
guardians.

Private This attribute is a true or false flag that indicates
whether or not an object is private (that is, publicly
not viewable). It defaults to false. If it is true,
then only the clients that satisfy the
authentication/encryption requirements of one of the
object's guardians are able to view the object. If the
object is publicly viewable, then the Private
attribute property of each of its attributes still
applies.

TTL This attribute is the "time-to-live" of a given
object. It is included only if an object has a
different time-to-live than the default given in the
Start of Authority information. Its value is specified
in seconds. It is of type TEXT and is optional.

The RWhois specification defines two standard classes that should be
included in all implementations: the referral and guardian classes.

2.3.5 Referral Class

The referral class is defined to hold referral information (typically
for link referrals). It consists of attributes defined as part of the
base class, the protocol-specific attributes described below, and any
installation-specific attributes.

Referred-Auth-Area This attribute contains the name of the authority
area to which the referral points. It is used as
a search key during the query routing. It is of
type TEXT and is required. It is repeatable,
since referrals can point to servers hosting more
than one authority area.

Referral This attribute contains the referral itself. It
is an RWhois URL. It is of type TEXT and is
required. It is repeatable, since more than one
server can host a Referred-Auth-Area.

2.3.6 Guardian Class

The guardian class is defined to hold security information. The
fundamental concept behind the guardian class is that an object (or
another structure) is "guarded" by containing a pointer to a guardian
object [Guardian]. To modify, delete, or possibly view the guarded
object, the authentication (or encryption, or both) scheme must be
satisfied. Guardians are intended to not have rank: if an object is
guarded by more than one guardian object, satisfying any one of those
guardians is sufficient. A guardian object that does not have any
Guardian attribute linking it to other guardians guards itself. That
is, the authentication scheme in the guardian object itself must be
satisfied to modify, delete, or possibly view it.

Guardian objects are typically linked to actual database objects with
the Guardian attribute found in the base class. However, a guardian
may also be linked to an entire authority area, in which case the
guardian becomes implicitly linked to all of the objects contained
within the authority area.

The guardian class consists of the base class, the protocol-specific
attributes described below, and any installation-specific attributes.

Guard-Scheme This attribute contains a keyword indicating the
authentication methodology. Its value must be
understood by both the client and server, and its value
dictates the contents of the Guard-Info attribute. It
is of type TEXT and is required.

Guard-Info This attribute contains that data that is used by the
Guard-Scheme to verify the authentication. Its actual
format is dictated by the Guard-Scheme, for example, it
could contain a password or Pretty Good Privacy (PGP)
public key id [RFC1991]. For security reasons, it
should not be displayed, and its Private attribute
property should be set to true. It is of type TEXT and
is required.

2.4 Authority Areas

The concept of authority areas is pivotal to the RWhois architecture.
When an RWhois tree is created for a particular lexically
hierarchical namespace, the different pieces of the hierarchy are
mapped to authority areas. The most important concept behind an
authority area is the ability for a portion of the RWhois tree to
definitively control that portion of the hierarchy. This means that
an authority area is able to state whether or not a hierarchical tag
is in the whole RWhois tree. It does this either by returning the
object containing this tag, returning a referral to a sub-authority
area, or returning a response indicating that no objects were found.

This structure enables efficient routing of queries based on the
hierarchical label to the piece of the hierarchy responsible for it.
For example, in the domain name namespace as served by RWhois, the
root of the tree would be an authority area named ".", which would
delegate a "us" sub-authority area, which would delegate "va", "co",
"md", and "ca" authority areas, and so forth. When the server with
the "va.us" authority area is asked about "loudoun.va.us", it will be
able to authoritatively state that either no "loudoun.va.us" exists
or it will provide an object for or a referral to "loudoun.va.us".
Further, if the server is asked about "howard.md.us", it cannot
answer authoritatively, so it must provide a referral to its
hierarchical parent ("us" or the root).

This use of authority area strongly indicates where data should be
stored within an RWhois tree. Because RWhois uses a specific query
routing model, data needs to be placed under the proper authority
area. It is certainly possible to place a piece of data under the

wrong authority area, for example, putting an object for
"howard.md.us" under the "va.us" authority area. In such cases, the
data is considered to be misplaced and unable to be found within the
RWhois tree. However, while data should be placed under the lowest
(most specific) authority area, it is also possible that it could be
placed in a higher (least specific) authority area, for example,
putting an object for "loudoun.va.us" under the "us" authority. This
may be acceptable since, in most cases, the data would be able to be
found.

In addition to controlling a part of an RWhois hierarchy, an
authority area is considered to be autonomous. Each authority area is
treated as a separate database by the protocol. However, it is
recommended that an authority area share some core schema with the
rest of the RWhois tree for interoperability reasons. Each authority
area, however, is not bound by the database schema of its
hierarchical parent or by any of its sub-authority areas.

2.5 Query Routing

RWhois is not only a directory access protocol but it can also route
queries. Routing a query involves redirecting the query to another
server that is presumed to be closer to the desired data. To route a
query, the server first determines the location of the next server.
It then either forwards the query to that server and returns the
result to the client or returns the location of that server to the
client. The location of the server must contain its host name (or IP
address), port number, and authority area.

The location of the server to which a query is routed is called a
referral. There are two types of referrals: punt and link referrals.
A punt referral is a pointer to a server that is further up an RWhois
tree, and a link referral is a pointer to a server that is further
down the tree. For example, in Figure 1, when the server for the
"va.us" authority area routes a query up to the server for the "us"
authority area, it generates a punt referral. Alternatively, when it
routes a query down to the server for the "loudon.va.us" authority
area, it generates a link referral.

Query routing depends on whether or not the search value in a query
is lexically hierarchical. If the search value is hierarchical, the
server can generate punt or link referrals using the association of
authority areas with lexically hierarchical labels. Otherwise, the
server may send the query to a special index server that gathers the
indexing information for both hierarchical and non-hierarchical data
from the directory servers and returns referrals to these servers
[CIP]. If the server receives one or more referrals from the index
server, it should return them to the client.

It is important to note that the server may route a query whether it
could resolve the query or not. Even if a query has been resolved
locally, the server may also return referrals to the client by
sending the query to the index server. For example, if the server for
the "com" authority area receives the "domain Org-Name=IBM" query, it
may return all the domain objects for IBM within the "com" authority
area. In addition, it may also return referrals to the server for the
"nl" authority area if that server contains domain objects for IBM in
the Netherlands and has fed the corresponding indexing information to
the index server. This way the client can get back information for
both "ibm.com" and "ibm.nl" domains.

2.5.1 Query Routing Rules

An RWhois server routes a query based on certain rules. The objective
is to determine the location of a server to which to route the query.
A query may contain one or more query terms. The query routing rules
are applied on each query term until a referral is found. The rules
are listed below.

* Is the search value in the query term hierarchical? If not, go
to the next query term.
* Parse the hierarchical portion of the search value. Is it is
within one of the authority areas? If not, go to the next query
term.
* Does the found authority area have any referral objects
(instances of the referral class)? If not, return the "230 No
objects found" error to the client.
* Is the hierarchical portion of the search value within the
Referred-Auth-Area attribute of one of the referral objects? If
it is, return the value of the Referral attribute of the found
referral object as a link referral to the client.
* Are the search values of some of the query terms hierarchical
but not within any of the authority areas? If they are, return a
punt referral to the client.
* Are the search values of all the query terms non-hierarchical?
If they are, send the query to a special index server that
gathers the indexing information for both hierarchical and non-
hierarchical data from the directory servers and returns
referrals to these servers. If the server receives one or more
referrals from the index server, return them to the client.

Note that there can be more than one referral returned to the client.
These referrals may point to servers serving different authority
areas. The client may follow them in any order.

The pseudo code for the above rules is:

for each query term in the query
if the search value in the query term is hierarchical
if the search value is within one of the authority areas
if the search value is within one of the referred authority areas
the server sends link referral(s)
else
the server sends a "230 No objects found" error
endif
endif
endif
endfor

if the search values of some of the query terms are hierarchical but
not within any of the authority areas
the server sends Punt referral(s)
endif

if the search values of all the query terms are non-hierarchical
the server sends Referral(s) from an index server
endif

2.6 Data Replication

An RWhois server can replicate (duplicate) data from another RWhois
server on a per-authority area basis. Data replication makes the
RWhois service more reliable. Further, it increases throughput by
distributing queries to more than one server.

There can be two types of servers serving an authority area: a master
server and a slave server. A master server is where data is
registered for an authority area. It answers authoritatively to
queries in that authority area. There must be one and only one master
server for an authority area. A master server is also called a
primary server.

A slave server is where data is replicated from the master server for
an authority area. It also answers authoritatively to queries in that
authority area. There may be one or more slave servers for an
authority area. A slave server is also called a secondary server.
Note that a slave server must not register data for an authority
area.

It is recommended that the master and slave servers for an authority
area be geographically separate. Therefore, network unreachability at
one site will not completely shut down the RWhois service for that
authority area.

2.6.1 Data to Replicate

In RWhois, data is replicated on a per-authority area basis. The
smallest type of data a slave server can replicate is an attribute of
a class. Therefore, a slave server can replicate data for all the
classes, some classes, or some attributes of some classes.

The amount of data a slave server can replicate each time is either
all of the data or the data that has changed since the last
replication. The process of replicating all of the data is called
complete replication. The process of replicating the data that has
changed since the last replication is called incremental replication.

2.6.2 Start Of Authority Variables

Each authority area has some administrative variables, defined at the
master server, to control data replication. These variables are
called the Start Of Authority (SOA) variables. They are listed below.

Serial-Number This is the serial number of the data in an
authority area. The master server should update
this variable whenever the data in the authority
area is changed. Its value is a time/date stamp.

Refresh-Interval This is the time interval before a slave server
checks for complete replication. Its value is
specified in seconds.

Increment-IntervalThis is the time interval before a slave server
checks for incremental replication. Its value is
specified in seconds.

Retry-Interval This is the time interval before a slave server
tries again to connect to a master server that
appears to be out-of-service. Its value is
specified in seconds.

Time-To-Live This is the default time to live for the data in
an authority area at a slave server. The slave
server should not answer authoritatively to
queries for such stale data. Its value is
specified in seconds.

Admin-Contact This is the email address of an individual or a
role account responsible for the data integrity in
an authority area at the master server.

Tech-Contact This is the email address of an individual or a
role account responsible for the operation of the
master server for an authority area.

Hostmaster This is the email address of an individual or a
role account to whom email messages to update the
data in an authority area at the master server are
sent.

Primary-Server This is the location of the master server for an
authority area. Its value must contain both the
host name (or IP address) and port number of the
master server.

3. Protocol

3.1 Overview

The above sections describe the directory service architecture based
on the RWhois protocol. The remaining sections describe the syntax of
the protocol; the sequence and syntax of the information exchanged
between a server and a client. There are five types of information
that may be exchanged during a client/server session: directive,
response, query, result, and info.

3.1.1 Directive

A directive is a command that a client sends to a server to set a
control parameter for the session, get the meta-information (class
definitions and SOA information) about an authority area, or get the
data in an authority area. The first character of a directive must be
a "-". The server must support the "-rwhois" directive; all other
directives are optional. The server must indicate in the banner which
directives are implemented (see Section 3.1.9).

3.1.2 Response

A response is the information that a server returns to a client for a
directive. It is comprised of one or more lines, and the last line
always indicates the success or failure of the directive. The first
character of each response line must be a "%". If a server runs a
directive successfully, the last response line must be "%ok".
Otherwise, it must be "%error <error-code> <error-text>". A line with
the string "%ok" or "%error" in the first position must occur only
once in a server response and must always be the last line. The
server may send the "%info" response for special messages.

A client must understand the "%ok", "%error", and "%info" responses.
The client must also understand directive specific responses, if it
uses the related directives to communicate with the server. For
example, if the client sends the "-schema" directive to the server,
the client must understand the "%schema" response.

3.1.3 Query

A query is a command that a client sends to a server to access the
data in an authority area. The first character of a query must not be
a "-", since the server checks the first character of each command
from a client to determine whether it is a directive or a query.

3.1.4 Result

A result is the information that a server returns to a client for a
query. It can be either the accessed data or referrals to other
servers. It is comprised of one or more lines, and the last line
always indicates the success or failure of the query. If a server
returns either data or referrals for a query, the last result line
must be "%ok". Otherwise, it must be "%error <error-code> <error-
text>".

3.1.5 Info

An info message contains miscellaneous information that a server
sends to a client. The server may use it to send special messages,
for example a "message of the day" (MOTD), to the client. The first
info line must be "%info on", and the last info line must be "%info
off".

3.1.6 Client/Server Session

A typical RWhois client/server session has the following sequence of
messages.

* The client connects to the server.
* The server returns a banner identifying its protocol versions
and capabilities.
* The client sends one or more directives to the server.
* The server returns the response to each directive.
* The client finally sends a query to the server.
* The server returns the query results.
* The server closes the connection, unless the client has directed
it not to close the connection.

3.1.7 Examples

This section gives some common examples of the client/server
interaction. The notation in the examples uses a prefix to indicate
from where the information comes. A "C" indicates that the client
sends the data to the server. An "S" indicates that the server sends
the data to the client. The line is a comment when "#" is used. The
space after the prefix is not part of the data.

The following example illustrates a successful query.

# The client connects to the server.
# The server returns a banner identifying its protocol versions and
# capabilities.
S %rwhois V-1.5:00ffff:00 master.rwhois.net (Network Solutions V-1.5)
# The client sends a directive to limit the number of search hits
# to 20.
C -limit 20
# The server returns a successful response.
S %ok
# The client sends a query to search for rwhois.net domain.
C domain rwhois.net
# The server returns the data for rwhois.net domain.
S domain:ID:dom-1.rwhois.net
S domain:Auth-Area:rwhois.net
S domain:Class-Name:domain
S domain:Updated:19970107201111000
S domain:Domain:rwhois.net
S domain:Server;I:hst-1.rwhois.net
S domain:Server;I:hst-2.rwhois.net
S
S %ok
# The server closes the connection.

The following example illustrates the link and punt referrals.

# The client connects to the server.
# The server returns a banner identifying its protocol versions and
# capabilities.
S %rwhois V-1.5:00ffff:00 master.rwhois.net (Network Solutions V-1.5)
# The client sends a directive to hold the connection until it sends
# a directive to close the connection.
C -holdconnect on
# The server returns a successful response.
S %ok
# The client sends a query to search for a.b.rwhois.net domain.
C domain a.b.rwhois.net
# The server returns a link referral to a server serving the

# b.rwhois.net authority area.
S %referral rwhois://master.b.rwhois.net:4321/auth-area=b.rwhois.net
S %ok
# The client sends a query to search for internic.net domain.
C domain internic.net
# The server returns a punt referral to a server serving the root
# authority area.
S %referral rwhois://rs.internic.net:4321/auth-area=.
S %ok
# The client sends a directive to close the connection.
C -quit
S %ok
# The server closes the connection.

The following example illustrates a query error.

# The client connects to the server.
# The server returns a banner identifying its protocol versions and
# capabilities.
S %rwhois V-1.5:00ffff:00 master.rwhois.net (Network Solutions V-1.5)
# The client sends a query to search for c.rwhois.net domain.
C domain c.rwhois.net
# The server returns an error, since neither data nor referrals for
# c.rwhois.net domain are found within the rwhois.net authority area.
S %error 230 No objects found
# The server closes the connection.

3.1.8 Notation

The following sections use the Augmented Backus-Naur Form (ABNF)
notation to describe the syntax of the protocol. For further
information, see Section 2 of [RFC822]. The notation in the examples
uses a prefix to indicate from where the information comes. A "C"
indicates that the client sends the data to the server. An "S"
indicates that the server sends the data to the client. The line is a
comment when "#" is used. The space after the prefix is not part of
the data.

3.1.9 General ABNF definitions

Lexical Tokens

alpha = "a".."z" / "A".."Z"
digit = "0".."9"
hex-digit = digit / "a".."f" / "A".. "F"
id-char = alpha / digit / "_" / "-"
any-char = <ASCII 1..255,
except LF (linefeed) and CR (carriage return)>

dns-char = alpha / digit / "-"
email-char = <see [RFC822]>
space = " "
tab = <ASCII TAB (tab)>
lf = <ASCII LF (linefeed)>
cr = <ASCII CR (carriage return)>
crlf = cr lf

Grammar

year = 4digit
month = 2digit
day = 2digit
hour = 2digit
minute = 2digit
second = 2digit
milli-second = 3digit
host-name = dns-char *(dns-char / ".")
ip-address = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit
email = 1*email-char "@" host-name
authority-area = (dns-char / ".") *(dns-char / "." / "/")
object-id = 1*id-char "." authority-area
host-port = (host-name / ip-address) ":" 1*5digit
class-name = 1*id-char
attribute-name = 1*id-char
attribute-value = 1*any-char
time-stamp = year month day hour minute second milli-second
on-off = "on" / "off"

Note that the time-stamp must be in the Greenwich Mean Time (GMT)
time zone. Also note that since in the above any-char is 1..255
ASCII that the RWhois protocol is an 8 bit protocol.

Response

The general response for every directive and query is either "%ok" or
"%error". In addition, a "%info" response may be sent.

response = ok-response crlf / error-response crlf / info-response
ok-response = "%ok"
error-response = "%error" space error-code space error-text
error-code = 3digit
error-text = 1*any-char
info-response = "%info" space "on" crlf *(*any-char crlf) "%info"
space "off" crlf

Banner

The server must send a banner to the client when the connection is
opened. The banner contains the version(s) of the protocol the
server supports and a capability ID of encoded bit flags that
indicates which directives are implemented. If the server supports
more than one version of the protocol, the lowest-numbered version
must be specified first. The bits in extra-id are reserved for future
use. The end of the banner should contain a free-form string
indicating the name of the server implementation. A server must
support at least one version of the protocol, and may accept more
versions for compatibility reasons.

rwhois-banner = "%rwhois" space version-list space host-name
[space implementation] crlf
version-list = version *("," version)
version = version-number [":" capability-id]
/ "V-1.5" ":" capability-id
version-number = "V-" 1*digit "." 1*digit
capability-id = response-id ":" extra-id
response-id = 6hex-digit
extra-id = 2hex-digit
implementation = 1*any-char

Protocol

The entire RWhois protocol can be defined as a series of directives,
responses, queries, and results.

rwhois-protocol = client-sends / server-returns
client-sends = *(directives / rwhois-query)
server-returns = *(responses / rwhois-query-result)

3.2 Required Directives

The server must implement the following directives.

3.2.1 rwhois

Description

The "-rwhois" directive may be issued by the client at the start of
every session . It tells the server which version of the protocol the
client can handle. The server must respond with a banner containing
the protocol version and directives it implements. This banner is the
same banner that is sent by the server when the connection is opened,
except that the server must indicate only one version number. The
banner issued when opening a connection may contain more than one
version number. The directive flags are encoded into three octets,
which are described in Appendix D.

ABNF

rwhois-dir = "-rwhois" space version-number [space implementation]
crlf
rwhois-response = "%rwhois" space version space host-name
[space implementation] crlf

Errors

300 Not compatible with version
338 Invalid directive syntax

Examples

# When a connection is opened, the server issues the banner.
S %rwhois V-1.0,V-1.5:00ffff:00 rs.internic.net (NSI Server 1.5.4)
# The client sends the rwhois directive.
C -rwhois V-1.5 NSI Client 1.2.3
S %rwhois V-1.5:00ffff:00 rs.internic.net (NSI Server 1.5.4)
S %ok

3.3 Optional Directives

The server should implement the following directives.

3.3.1 class

Description

The "-class" directive can be used by the client to get the meta-
information for one or more classes in an authority area. The
response must contain the description and version number of each
specified class and may be expanded in the future with additional
attributes. When no class name is given, the server must return the
meta-information for all the classes in the authority area. Every
class record must end with an empty "%class" line.

ABNF

class-dir = "-class" space authority-area *(space class-name) crlf
class-response = *class-record response
class-record = *class-line "%class" crlf
class-line = "%class" space class-name ":" "description" ":"
1*any-char crlf
/ "%class" space class-name ":" "version" ":" time-stamp crlf
/ "%class" space class-name ":" meta-field ":" meta-value crlf
meta-field = 1*id-char
meta-value = 1*any-char

The following fields are required.

meta-field meta-value Description

description 1*any-char Class description.
Time/date stamp indicating version of class,

version time-stamp must be updated after class definition is
changed.

Errors

338 Invalid directive syntax
340 Invalid authority area
341 Invalid class
400 Directive not available
401 Not authorized for directive

Examples

C -class rwhois.net domain host
S %class domain:description:Domain information
S %class domain:version:19970103101232000
S %class

S %class host:description:Host information
S %class host:version:19970214213241000
S %class
S %ok

3.3.2 directive

Description

The "-directive" directive can be used by the client to get
information about the directives that the server supports. The
response must contain the name and description of each specified
directive and may be expanded in the future with additional
attributes. When no directive name is given, the server must return
information about all the directives. Every directive record must end
with an empty "%directive" line.

ABNF

directive-dir = "-directive" *(space directive-name) crlf
directive-name = 1*id-char
directive-response = *directive-record response
directive-record = "%directive" space "directive" ":" directive-name
crlf *directive-line "%directive" crlf
directive-line = "%directive" space "description" ":" 1*any-char crlf
/ "%directive" space attribute-name ":" attribute-value crlf

Errors

338 Invalid directive syntax
400 Directive not available
401 Not authorized for directive

Examples

Without parameters:

C -directive
S %directive directive:rwhois
S %directive description:RWhois directive
S %directive
S %directive directive:quit
S %directive description:Quit connection
S %directive
S %ok

With parameters:

C -directive quit
S %directive directive:quit
S %directive description:Quit connection
S %directive
S %ok

3.3.3 display

Description

By default, the server uses the dump format for the output of a query
result. The output format can be changed with the "-display"
directive. When no parameter is given, the server must list all the
display formats it supports. Every display record must end with an
empty "%display" line.

Currently, only the dump format is standard and must be supported by
the server. Other output formats may be added in the future. See
Section 3.4 for the definition of the dump format.

ABNF

display-dir = "-display" crlf
/ "-display" space display-name crlf
display-name = 1*id-char
display-response = *(display-record) response
display-record = "%display" space "name" ":" display-name crlf
*display-line "%display" crlf
display-line = "%display" space attribute-name ":"
attribute-value crlf

Errors

338 Invalid directive syntax
400 Directive not available
401 Not authorized for directive
436 Invalid display format

Examples

# Get the available display formats.
C -display
S %display name:dump
S %display
S %ok

# Change the active display format.
C -display dump
S %ok

3.3.4 forward

Description

The "-forward" directive instructs the server to follow all the
referrals and return the results to the client. This directive can be
used to run an RWhois server as a proxy server. The default value
must be "off". When the value is set to "on", the server must not
return referrals.

ABNF

forward-dir = "-forward" space on-off crlf
forward-response = response

Errors

338 Invalid directive syntax
400 Directive not available
401 Not authorized for directive

Examples

C -forward on
S %ok

C -forward off
S %ok

3.3.5 holdconnect

Description

Normally, the server closes the connection after each query. This
behavior is controlled by the holdconnect state, which can be changed
with the "-holdconnect" directive. When the holdconnect state is set
to "off", the server must close the connection after a query; when it
is set to "on", the server must not close the connection after a
query. By default, the holdconnect state must be set to "off" for
each connection.

ABNF

holdconnect-dir = "-holdconnect" space on-off crlf
holdconnect-response = response

Errors

338 Invalid directive syntax
400 Directive not available
401 Not authorized for directive

Examples

C -holdconnect on
S %ok

C -holdconnect off
S %ok

3.3.6 limit

Description

When returning a query result, the server should limit the number of
objects returned to the client. The "-limit" directive changes this
limit. The default and maximum limit is server-dependent. The client
can get the current limit by using the "-status" directive (see
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容