Indy 9 | Content | Index | Reference

TIdDICTServer
Hierarchy, Properties, Methods, Events, See Also, Unit: IdDICTServer
Implements a Dictionary Protocol server for dictionary databases.

    TIdDICTServer = class(TIdTCPServer)

Unit
IdDICTServer
Description
TIdDICTServer is a server implementation of the Dictionary Server Protocol as described in the Internet Standards document:

- RFC 2229 - A Dictionary Server Protocol (http://www.rfc-editor.org/rfc/rfc2229.txt)

The Dictionary Server Protocol (DICT) is a TCP transaction based query/response protocol that allows a client to access dictionary definitions from a set of natural language dictionary databases.

TIdDICTServer uses an event-based architecture that provides event handlers for the following DICT protocol commands:

- AUTH - OnCommandAuth

- CLIENT - OnCommandClient

- DEFINE - OnCommandDefine

- HELP - OnCommandHelp

- MATCH - OnCommandMatch

- OPTION - OnCommandOption

- QUIT - OnCommandQuit

- SASLAUTH - OnCommandSASLAuth

- SHOW - OnCommandShow

- STATUS - OnCommandStatus

TIdDICTServer also provides the OnCommandOther event handler to respond to unknown DICT commands, or DICT protocol extensions.

TIdDICTServer does not provide an implementation of the event handlers. The application should assign procedures to the event handlers to respond to event notifications, or the result code 500 with the error message RSCMDNotRecognized will be generated.

TIdDICTServer.DefaultPort
TIdDICTServer
Default port number for the server.

    property DefaultPort: integer;

Description
DefaultPort is a published property in TIdDICTServer that identifies the default port number for the server, as described in the Dictionary Server Protocol specification. The default value for DefaultPort is IdPORT_DICT.

TIdDICTServer.Create
TIdDICTServer
Creates the new object instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the new TIdDictServer instance. Create relies on the inherited Create constructor, and sets DefaultPort to the standard port number used by the DICT protocol (IdPORT_DICT).

SeeAso: DefaultPort, IdPORT_DICT

TIdDICTServer.OnCommandAuth
TIdDICTServer
Specifies the DICT AUTH command event handler.

    property OnCommandAuth: TIdDICTAuthEvent;

Description
OnCommandAuth specifies the TIdDICTAuthEvent event handler used to respond to the DICT AUTH command, as described in RFC 2229. The DICT AUTH command allows a client to be authenticated using a user name and an APOP-style MD5 Checksum as described in RFC 1939.

Authentication is an optional server capability. The AUTH command may be implemented by a DICT server. Applications should assign a procedure to the event handler in order to respond to the DICT command, or the server will return the default message:

          500 command not recognized

TIdDICTServer.OnCommandClient
TIdDICTServer
Specifies the DICT CLIENT command event handler.

    property OnCommandClient: TIdDICTShowEvent;

Description
OnCommandClient specifies the TIdDICTShowEvent event handler used to respond to the DICT CLIENT command, as described in RFC 2229.

The CLIENT command allows the client to provide information about itself for possible logging and statistical purposes. All clients should send this command after connecting to the server. All DICT servers must implement this command, though, the server doesn't have to do anything with the information provided by the client.

Applications should assign a procedure to the event handler in order to respond to the DICT command, or the server will return the default message:

          500 command not recognized

TIdDICTServer.OnCommandDefine
TIdDICTServer
Specifies the DICT DEFINE command event handler.

    property OnCommandDefine: TIdDICTDefineEvent;

Description
OnCommandDefine specifies the TIdDICTDefineEvent event handler used to respond to the DICT DEFINE command, as described in RFC 2229.

The DICT DEFINE command is used to perform a search for the specified word in the indicated database(s). Applications should assign a procedure to the event handler in order to respond to the DICT command, or the server will return the default message:

        500 command not recognized

TIdDICTServer.OnCommandHelp
TIdDICTServer
Specified the DICT HELP command event handler.

    property OnCommandHelp: TIdDICTGetEvent;

Description
OnCommandHelp specified the TIdDICTGetEvent event handler used to respond to the DICT HELP command, as described in RFC 2229.

The DICT HELP command provides a short summary of commands that are understood by this implementation of the DICT server. All DICT servers must implement the HELP command.

Applications should assign a procedure to the event handler in order to respond to the DICT command, or the server will return the default message:

          500 command not recognized

TIdDICTServer.OnCommandMatch
TIdDICTServer
Specifies the DICT MATCH command event handler.

    property OnCommandMatch: TIdDICTMatchEvent;

Description
OnCommandMatch specifies the TIdDICTMatchEvent event handler used to respond to the DICT MATCH command, as described in RFC 2229.

The DICT MATCH command is used to search the dictionary index and report the words found using a particular strategy. All DICT servers must implement the MATCH command, and must support the "exact" and "prefix" strategies.

The "exact" strategy performs a case-insensitive comparison. The "prefix" strategy is similar to "exact", except that it only compares the first part of the word. These strategies are easily implemented and are generally the most useful. Other strategies are server dependent.

Other strategies that might be considered are matches based on substring, suffix, regular expressions, soundex [KNUTH73], and Levenshtein [PZ85] algorithms. These last two are especially useful for correcting spelling errors. Other useful strategies perform some sort of "reverse" lookup (i.e., by searching definitions to find the word that the query suggests).

Strategy may also contain the special character ".", which indicates that the server should use the default strategy for that server. This is usually a derivative of the Levenshtein algorithm [PZ85].

Database contains the name of the database to be searched, in a form returned by SHOW DB, or one the following wildcard characters:

- "!" - Search all databases until a match is found.

- "*" - Search for all matches in the current database.

Applications should assign a procedure to the event handler in order to respond to the DICT command, or the server will return the default message:

          500 command not recognized

TIdDICTServer.OnCommandOption
TIdDICTServer
Specifies the event handler for the DICT OPTION command.

    property OnCommandOption: TIdDICTOtherEvent;

Description
TIdDICTServer uses the OnCommandOption event handler to respond to the DICT OPTION command, which informs the server that the client wishes to utilize one of the defined protocol options.

At the current time, OPTION MIME is the only recognized option. In the future, standard extensions to this protocol should be proposed which allow the client to request certain content types or encodings.

OPTION MIME requests that all text responses be prefaced by a MIME header, as described in RFC2045, and followed by a single blank line (CRLF). If a client requests this option, then the client MUST be able to parse Content-Type and Content-transfer-encoding headers, and MUST be able to ignore textual responses which have an unsupported content or encoding. A client MUST support the UTF-8 encoding described in RFC2044.

OPTION MIME is a REQUIRED server capability, and all DICT servers MUST implement this command.

TIdDICTServer.OnCommandOther
TIdDICTServer
Specifies the command event handler for unknown DICT commands.

    property OnCommandOther: TIdDICTOtherEvent;

Description
OnCommandOther specifies the event type for unrecognized DICT commands, and allows the server to respond to DICT extensions or provide default error handling by using the event handler mechanism.

TIdDICTServer.OnCommandQuit
TIdDICTServer
Specifies the event handler for the DICT QUIT command.

    property OnCommandQuit: TIdDICTGetEvent;

Description
TIdDICTServer uses the OnCommandQuit event handler to respond to the DICT QUIT command, which informs the server that the client wishes to close the connection to the DICT server.

The DICT server must implement the QUIT command.

TIdDICTServer.OnCommandSASLAuth
TIdDICTServer
Specifies the event handler for the DICT SASLAUTH command.

    property OnCommandSASLAuth: TIdDICTAuthEvent;

Description
TIdDICTAuthEvent specifies the event type for the DICT SASLAUTH command, and is used by the TIdDICTServer OnCommandSASLAuth event handler to perform user authentication.

OnCommandSASLAuth must provide, as parameters, the name of the user to be authenticated, and the BASE64-encoded initial SASL response as described in RFC 2045. All responses to the SASLAUTH server challenge should use the SASLRESP command and a BASE64-encoded parameter.

Authentication is an optional server capability. The SASLAUTH command may be implemented by a DICT server.

TIdDICTServer.OnCommandShow
TIdDICTServer
Specifies the event handler for the DICT SHOW command.

    property OnCommandShow: TIdDICTShowEvent;

Description
OnCommandShow specifies the event handler for the DICT SHOW command, and is used by the TIdDICTServer to implement the DICT command.

OnCommandShow must provide parameters that indicate the thread of execution performing the command, and the SHOW command parameters to be included in the command execution. The command options include:

- SHOW DB - Displays the list of currently accessible databases.

- SHOW DATABASES - Displays the list of currently accessible databases.

- SHOW STRAT - Displays the list of currently supported search strategies.

- SHOW STRATEGIES - Displays the list of currently supported search strategies.

- SHOW INFO database - Displays the source, copyright, and licensing information about the specified database.

- SHOW SERVER - Displays local server herald banner.

TIdDICTServer.OnCommandStatus
TIdDICTServer
Specifies the event handler for the DICT STATUS command.

    property OnCommandStatus: TIdDICTGetEvent;

Description
OnCommandStatus specifies the event handler for the DICT STATUS command, and is used by the TIdDICTServer to implement the DICT command.

The STATUS command returns server-specific timing or debugging information. This information may be useful in debugging or tuning a DICT server. All DICT servers MUST implement this command, although the text part of the response is not specified and may be omitted.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.